UniRx 에셋 추가
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#if UNITY_METRO
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace UniRx
|
||||
{
|
||||
public static class Thread
|
||||
{
|
||||
public static void Sleep(TimeSpan wait)
|
||||
{
|
||||
new System.Threading.ManualResetEvent(false).WaitOne(wait);
|
||||
}
|
||||
|
||||
public static void Sleep(int ms)
|
||||
{
|
||||
new System.Threading.ManualResetEvent(false).WaitOne(ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf1175d5dd9b5904d898eb4c9dd7e0c5
|
||||
timeCreated: 1455373901
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,100 @@
|
||||
#if UNITY_METRO
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
#if NETFX_CORE
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
|
||||
namespace UniRx
|
||||
{
|
||||
public static partial class Scheduler
|
||||
{
|
||||
public static readonly IScheduler ThreadPool = new ThreadPoolScheduler();
|
||||
|
||||
class ThreadPoolScheduler : IScheduler
|
||||
{
|
||||
public DateTimeOffset Now
|
||||
{
|
||||
get { return Scheduler.Now; }
|
||||
}
|
||||
|
||||
public IDisposable Schedule(Action action)
|
||||
{
|
||||
var d = new BooleanDisposable();
|
||||
#if NETFX_CORE
|
||||
|
||||
Task.Run(()=>
|
||||
{
|
||||
if (!d.IsDisposed)
|
||||
{
|
||||
action();
|
||||
}
|
||||
});
|
||||
|
||||
#else
|
||||
Action act = () =>
|
||||
{
|
||||
if (!d.IsDisposed)
|
||||
{
|
||||
action();
|
||||
}
|
||||
};
|
||||
|
||||
act.BeginInvoke(ar => act.EndInvoke(ar), null);
|
||||
|
||||
#endif
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
public IDisposable Schedule(TimeSpan dueTime, Action action)
|
||||
{
|
||||
var wait = Scheduler.Normalize(dueTime);
|
||||
|
||||
var d = new BooleanDisposable();
|
||||
|
||||
#if NETFX_CORE
|
||||
|
||||
Task.Run(()=>
|
||||
{
|
||||
if (!d.IsDisposed)
|
||||
{
|
||||
if (wait.Ticks > 0)
|
||||
{
|
||||
Thread.Sleep(wait);
|
||||
}
|
||||
action();
|
||||
}
|
||||
});
|
||||
|
||||
#else
|
||||
|
||||
Action act = () =>
|
||||
{
|
||||
if (!d.IsDisposed)
|
||||
{
|
||||
if (wait.Ticks > 0)
|
||||
{
|
||||
Thread.Sleep(wait);
|
||||
}
|
||||
action();
|
||||
}
|
||||
};
|
||||
|
||||
act.BeginInvoke(ar => act.EndInvoke(ar), null);
|
||||
|
||||
#endif
|
||||
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c36c9256c17bbb40854ef9b9e4d51c7
|
||||
timeCreated: 1455373898
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user