Permalink
Browse files

ready for 5.5.0

  • Loading branch information...
1 parent 2c54ca0 commit c1d136b136e43c738dc1cac3199c503c9bb80b05 @neuecc committed Sep 30, 2016
Oops, something went wrong.
Oops, something went wrong.
@@ -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>
@@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 8951e7b9687d74949af2854b82e3601c
folderAsset: yes
-timeCreated: 1425282656
+timeCreated: 1475197920
licenseType: Pro
DefaultImporter:
userData:
@@ -1,5 +1,9 @@
fileFormatVersion: 2
guid: 47c3c77b488bde14eac761a5144660ed
folderAsset: yes
+timeCreated: 1475197920
+licenseType: Pro
DefaultImporter:
userData:
+ assetBundleName:
+ assetBundleVariant:
@@ -7,16 +7,8 @@ PluginImporter:
isPreloaded: 0
platformData:
Any:
- enabled: 0
- settings: {}
- Editor:
enabled: 1
- settings:
- DefaultValueInitialized: true
- WindowsStoreApps:
- enabled: 0
- settings:
- CPU: AnyCPU
+ settings: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -7,16 +7,8 @@ PluginImporter:
isPreloaded: 0
platformData:
Any:
- enabled: 0
- settings: {}
- Editor:
enabled: 1
- settings:
- DefaultValueInitialized: true
- WindowsStoreApps:
- enabled: 0
- settings:
- CPU: AnyCPU
+ settings: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -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;
@@ -90,7 +91,7 @@ void Awake()
{
Debug.Log("start ienumerator await");
- var www = await CustomCoroutine();
+ await CustomCoroutine();
Debug.Log("end ienumerator await");
}
@@ -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)
@@ -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)
@@ -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.
@@ -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.
@@ -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
@@ -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;
@@ -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);
}
}
}
Oops, something went wrong.

0 comments on commit c1d136b

Please sign in to comment.