Implement InputProxy.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
using Cryville.Common;
|
||||
using Cryville.Common.Plist;
|
||||
using Cryville.Common.Unity.Input;
|
||||
using Cryville.Crtr.Event;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
@@ -65,6 +66,8 @@ namespace Cryville.Crtr {
|
||||
public static Dictionary<string, MotionRegistry> motionRegistry = new Dictionary<string, MotionRegistry>();
|
||||
|
||||
public static PdtEvaluator etor;
|
||||
|
||||
InputProxy inputProxy;
|
||||
|
||||
~ChartPlayer() {
|
||||
Dispose();
|
||||
@@ -381,7 +384,23 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
Logger.Log("main", 0, "Load/Prehandle", "Initializing states");
|
||||
cbus.BroadcastInit();
|
||||
Game.InputManager.Activate();
|
||||
|
||||
inputProxy = new InputProxy(pruleset, judge);
|
||||
foreach (var i in Game.InputManager._handlers) {
|
||||
/*if (i is UnityKeyHandler<UnityKeyboardReceiver>) {
|
||||
inputProxy.Set(new InputProxyEntry { Source = new InputSource { Handler = i, Type = (int)KeyCode.Z }, Target = "track0" });
|
||||
inputProxy.Set(new InputProxyEntry { Source = new InputSource { Handler = i, Type = (int)KeyCode.X }, Target = "track1" });
|
||||
inputProxy.Set(new InputProxyEntry { Source = new InputSource { Handler = i, Type = (int)KeyCode.Comma }, Target = "track2" });
|
||||
inputProxy.Set(new InputProxyEntry { Source = new InputSource { Handler = i, Type = (int)KeyCode.Period }, Target = "track3" });
|
||||
break;
|
||||
}*/
|
||||
if (i is UnityMouseHandler) {
|
||||
inputProxy.Set(new InputProxyEntry { Source = new InputSource { Handler = i, Type = 0 }, Target = "screen_x" });
|
||||
break;
|
||||
}
|
||||
}
|
||||
inputProxy.Activate();
|
||||
|
||||
if (logEnabled) ToggleLogs();
|
||||
Logger.Log("main", 0, "Load/Prehandle", "Cleaning up");
|
||||
GC.Collect();
|
||||
@@ -390,7 +409,7 @@ namespace Cryville.Crtr {
|
||||
Logger.Log("main", 1, "Load/Prehandle", "Prehandling done ({0}ms)", timer.Elapsed.TotalMilliseconds);
|
||||
Game.AudioSequencer.Playing = true;
|
||||
Thread.Sleep((int)(Game.AudioClient.BufferPosition - Game.AudioClient.Position));
|
||||
Game.InputManager.SyncTime(cbus.Time);
|
||||
// TODO SyncTime(cbus.Time);
|
||||
started = true;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
@@ -408,7 +427,7 @@ namespace Cryville.Crtr {
|
||||
if (bbus != null) bbus.Dispose();
|
||||
if (tbus != null) tbus.Dispose();
|
||||
if (nbus != null) nbus.Dispose();
|
||||
// Game.InputManager.Deactivate();
|
||||
inputProxy.Deactivate();
|
||||
foreach (var t in texs) Texture.Destroy(t.Value);
|
||||
Logger.Log("main", 1, "Game", "Stopped");
|
||||
}
|
||||
|
Reference in New Issue
Block a user