Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
ready for 5.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Sep 30, 2016
1 parent 2c54ca0 commit c1d136b
Show file tree
Hide file tree
Showing 18 changed files with 1,072 additions and 302 deletions.
306 changes: 306 additions & 0 deletions Assembly-CSharp-firstpass-vs.csproj

Large diffs are not rendered by default.

306 changes: 306 additions & 0 deletions Assembly-CSharp-firstpass.csproj

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions Assembly-CSharp-vs.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C46B99A5-0F0F-2FEE-50C8-DAE79AA3F247}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace></RootNamespace>
<AssemblyName>Assembly-CSharp</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<BaseDirectory>Assets</BaseDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_5_0_0;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Temp\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.XML" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="UnityEngine">
<HintPath>D:/UnityDir/5.0.0f4/Editor/Data/Managed/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEditor">
<HintPath>D:/UnityDir/5.0.0f4/Editor/Data/Managed/UnityEditor.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\ObjectTest\AsyncTestScene.cs" />
<Compile Include="Assets\ObjectTest\Clicker.cs" />
<Compile Include="Assets\ObjectTest\CountOnly.cs" />
<Compile Include="Assets\ObjectTest\DispatcherCullingTest.cs" />
<Compile Include="Assets\ObjectTest\EditorBehaviourTest.cs" />
<Compile Include="Assets\ObjectTest\GameObjectDisplacer.cs" />
<Compile Include="Assets\ObjectTest\IntervalTest.cs" />
<Compile Include="Assets\ObjectTest\LoadLevelTest.cs" />
<Compile Include="Assets\ObjectTest\MyStateMachine.cs" />
<Compile Include="Assets\ObjectTest\PostBuildProcessor.cs" />
<Compile Include="Assets\ObjectTest\RotateGameObject.cs" />
<Compile Include="Assets\ObjectTest\Sandbox2.cs" />
<Compile Include="Assets\ObjectTest\SimpleMultiline.cs" />
<Compile Include="Assets\ObjectTest\UniRxTestSandbox.cs" />
<Compile Include="Assets\ObjectTest\WorkerThreadTest.cs" />
<Compile Include="Assets\ObjectTest\YieldTest.cs" />
<Compile Include="Assets\UnitTests\SceneItems\Result.cs" />
<Compile Include="Assets\UnitTests\SceneItems\UnitTestScene.cs" />
<Compile Include="Assets\UnitTests\Tools\ChainingAssertion.Unity.cs" />
<Compile Include="Assets\UnitTests\Tools\Container.cs" />
<Compile Include="Assets\UnitTests\Tools\Shim.cs" />
<Compile Include="Assets\UnitTests\Tools\TestUtil.cs" />
<Compile Include="Assets\UnitTests\UnitTests.cs" />
<None Include="Assets\Plugins\UniRx\ReadMe.txt" />
<Reference Include="UnityEngine.UI">
<HintPath>D:/UnityDir/5.0.0f4/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="Assembly-CSharp-firstpass-vs.csproj">
<Project>{FC6D064E-28ED-A578-0D72-8E424343BF9A}</Project> <Name>Assembly-CSharp-firstpass-vs</Name> </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->

</Project>
2 changes: 1 addition & 1 deletion Assets/AssetStoreTools.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Assets/AssetStoreTools/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions Assets/AssetStoreTools/Editor/AssetStoreTools.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Assets/AssetStoreTools/Editor/AssetStoreToolsExtra.dll
Binary file not shown.
10 changes: 1 addition & 9 deletions Assets/AssetStoreTools/Editor/AssetStoreToolsExtra.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Assets/ObjectTest/AsyncTestScene.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#if (ENABLE_MONO_BLEEDING_EDGE_EDITOR || ENABLE_MONO_BLEEDING_EDGE_STANDALONE)

using System;
using UniRx.Triggers;
using System.Collections;
using System.Threading.Tasks;
using UniRx;
Expand Down Expand Up @@ -90,7 +91,7 @@ async Task CoroutineBridge2()
{
Debug.Log("start ienumerator await");

var www = await CustomCoroutine();
await CustomCoroutine();

Debug.Log("end ienumerator await");
}
Expand Down
121 changes: 118 additions & 3 deletions Assets/Plugins/UniRx/ReadMe.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
UniRx - Reactive Extensions for Unity / ver 5.4.1
UniRx - Reactive Extensions for Unity / Ver 5.5.0
===
Created by Yoshifumi Kawai(neuecc)

Expand All @@ -12,6 +12,8 @@ UniRx is available on the Unity Asset Store (FREE) - http://u3d.as/content/neuec

Presentation - http://www.slideshare.net/neuecc/unirx-reactive-extensions-for-unityen

Blog for update info - https://medium.com/@neuecc

Support thread on the Unity Forums: Ask me any question - http://forum.unity3d.com/threads/248535-UniRx-Reactive-Extensions-for-Unity

Release Notes, see [UniRx/releases](https://github.com/neuecc/UniRx/releases)
Expand Down Expand Up @@ -952,7 +954,76 @@ eventTrigger.OnBeginDragAsObservable()
> Note:
> PresenterBase works enough, but too complex.
> You can use simple `Initialize` method and call parent to child, it works for most scenario.
> So I don't recommend using `PresenterBase`, sorry.
> So I don't recommend using `PresenterBase`, sorry.

ReactiveCommand, AsyncReactiveCommand
----
ReactiveCommand abstraction of button command with boolean interactable.

```csharp
public class Player
{
public ReactiveProperty<int> Hp;
public ReactiveCommand Resurrect;

public Player()
{
Hp = new ReactiveProperty<int>(1000);

// If dead, can not execute.
Resurrect = Hp.Select(x => x <= 0).ToReactiveCommand();
// Execute when clicked
Resurrect.Subscribe(_ =>
{
Hp.Value = 1000;
});
}
}

public class Presenter : MonoBehaviour
{
public Button resurrectButton;

Player player;

void Start()
{
player = new Player();

// If Hp <= 0, can't press button.
player.Resurrect.BindTo(resurrectButton);
}
}
```

AsyncReactiveCommand is a variation of ReactiveCommand that `CanExecute`(in many cases bind to button's interactable) is changed to false until asynchronous execution was finished.

```csharp
public class Presenter : MonoBehaviour
{
public UnityEngine.UI.Button button;

void Start()
{
var command = new AsyncReactiveCommand();

command.Subscribe(_ =>
{
// heavy, heavy, heavy method....
return Observable.Timer(TimeSpan.FromSeconds(3)).AsUnitObservable();
});

// after clicked, button shows disable for 3 seconds
command.BindTo(button);

// Note:shortcut extension, bind aync onclick directly
button.BindToOnClick(_ =>
{
return Observable.Timer(TimeSpan.FromSeconds(3)).AsUnitObservable();
});
}
}
```

`AsyncReactiveCommand` has three constructor.

Expand Down Expand Up @@ -1116,6 +1187,49 @@ Windows Store/Phone App (NETFX_CORE)
Some interfaces, such as `UniRx.IObservable<T>` and `System.IObservable<T>`, cause conflicts when submitting to the Windows Store App.
Therefore, when using NETFX_CORE, please refrain from using such constructs as `UniRx.IObservable<T>` and refer to the UniRx components by their short name, without adding the namespace. This solves the conflicts.

async/await Support
---
for the [Upgraded Mono/.Net in Editor on 5.5.0b4](https://forum.unity3d.com/threads/upgraded-mono-net-in-editor-on-5-5-0b4.433541/), Unity supports .NET 4.6 and C# 6 languages. UniRx provides `UniRxSynchronizationContext` for back to MainThread in Task multithreading.

```csharp
async Task UniRxSynchronizationContextSolves()
{
Debug.Log("start delay");

// UniRxSynchronizationContext is automatically used.
await Task.Delay(TimeSpan.FromMilliseconds(300));

Debug.Log("from another thread, but you can touch transform position.");
Debug.Log(this.transform.position);
}
```

UniRx also supports directly await Coroutine support type instad of yield return.

```csharp
async Task CoroutineBridge()
{
Debug.Log("start www await");

var www = await new WWW("https://unity3d.com");

Debug.Log(www.text);
}
```

Ofcourse, IObservable is awaitable.

```csharp
async Task AwaitOnClick()
{
Debug.Log("start mousedown await");

await this.OnMouseDownAsObservable().FirstOrDefault();

Debug.Log("end mousedown await");
}
```

DLL Separation
---
If you want to pre-build UniRx, you can build own dll. clone project and open `UniRx.sln`, you can see `UniRx`, it is fullset separated project of UniRx. You should define compile symbol like `UNITY;UNITY_5_4_OR_NEWER;UNITY_5_4_0;UNITY_5_4;UNITY_5;` + `UNITY_EDITOR`, `UNITY_IPHONE` or other platform symbol. We can not provides pre-build binary to release page, asset store because compile symbol is different each other.
Expand Down Expand Up @@ -1189,7 +1303,8 @@ Grani is a top social game developer in Japan.
He is awarding Microsoft MVP for Visual C# since 2011.
He is known as the creator of [linq.js](http://linqjs.codeplex.com/)(LINQ to Objects for JavaScript)

Blog: http://neue.cc/ (Japanese)
Blog: https://medium.com/@neuecc (English)
Blog: http://neue.cc/ (Japanese)
Twitter: https://twitter.com/neuecc (Japanese)

License
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,41 @@

namespace UniRx
{
public class CoroutineAsyncBridge : INotifyCompletion
{
Action continuation;
public bool IsCompleted { get; private set; }

CoroutineAsyncBridge()
{
IsCompleted = false;
}

public static CoroutineAsyncBridge Start<T>(T awaitTarget)
{
var bridge = new CoroutineAsyncBridge();
MainThreadDispatcher.StartCoroutine(bridge.Run(awaitTarget));
return bridge;
}

IEnumerator Run<T>(T target)
{
yield return target;
IsCompleted = true;
continuation();
}

public void OnCompleted(Action continuation)
{
this.continuation = continuation;
}

public void GetResult()
{
if (!IsCompleted) throw new InvalidOperationException("coroutine not yet completed");
}
}

public class CoroutineAsyncBridge<T> : INotifyCompletion
{
readonly T result;
Expand Down Expand Up @@ -56,19 +91,19 @@ public static CoroutineAsyncBridge<WWW> GetAwaiter(this WWW www)
return CoroutineAsyncBridge<WWW>.Start(www);
}

public static CoroutineAsyncBridge<Coroutine> GetAwaiter(this Coroutine coroutine)
public static CoroutineAsyncBridge GetAwaiter(this Coroutine coroutine)
{
return CoroutineAsyncBridge<Coroutine>.Start(coroutine);
return CoroutineAsyncBridge.Start(coroutine);
}

public static CoroutineAsyncBridge<AsyncOperation> GetAwaiter(this AsyncOperation asyncOperation)
{
return CoroutineAsyncBridge<AsyncOperation>.Start(asyncOperation);
}

public static CoroutineAsyncBridge<IEnumerator> GetAwaiter(this IEnumerator coroutine)
public static CoroutineAsyncBridge GetAwaiter(this IEnumerator coroutine)
{
return CoroutineAsyncBridge<IEnumerator>.Start(coroutine);
return CoroutineAsyncBridge.Start(coroutine);
}
}
}
Expand Down
Loading

0 comments on commit c1d136b

Please sign in to comment.