diff --git a/Assets/Cryville/Crtr/InputProxy.cs b/Assets/Cryville/Crtr/InputProxy.cs index e07d7c5..5297f34 100644 --- a/Assets/Cryville/Crtr/InputProxy.cs +++ b/Assets/Cryville/Crtr/InputProxy.cs @@ -4,6 +4,7 @@ using Cryville.Common.Unity.Input; using System; using System.Collections.Generic; using UnityEngine; +using Logger = Cryville.Common.Logger; namespace Cryville.Crtr { public class InputProxy { @@ -102,13 +103,19 @@ namespace Cryville.Crtr { #endregion #region Handling - public void Activate() { foreach (var src in _sproxies.Keys) src.Handler.Activate(); } + public void Activate() { + _activeCounts.Clear(); + foreach (var p in _tproxies.Values) _activeCounts.Add(p.Source.Value, 0); + _vect.Clear(); _vecs.Clear(); + foreach (var src in _sproxies.Keys) src.Handler.Activate(); + } public void Deactivate() { foreach (var src in _sproxies.Keys) src.Handler.Deactivate(); } readonly object _lock = new object(); static readonly int _var_value = IdentifierManager.SharedInstance.Request("value"); static readonly PropOp.Arbitrary _arbop = new PropOp.Arbitrary(); readonly byte[] _vecbuf = new byte[3 * sizeof(float) + sizeof(int)]; + readonly Dictionary _activeCounts = new Dictionary(); // TODO used for force tick readonly Dictionary _vect = new Dictionary(); readonly Dictionary _vecs = new Dictionary(); static readonly byte[] _nullvalue = new byte[0]; @@ -152,11 +159,19 @@ namespace Cryville.Crtr { PropSrc.Arbitrary fv, tv = _etor.ContextCascadeLookup(_var_value); if (!_vecs.TryGetValue(pid, out fv)) fv = new PropSrc.Arbitrary(PdtInternalType.Null, new byte[0]); if (fv.Type != PdtInternalType.Null || tv.Type != PdtInternalType.Null) { + if (fv.Type == PdtInternalType.Null) { + _activeCounts[id.Source]++; + Logger.Log("main", 0, "Input/Proxy", "active {0} # {1} (+)", id.Source, _activeCounts[id.Source]); + } _etor.ContextCascadeInsert(); _etor.ContextCascadeUpdate(_var_fv, fv); _etor.ContextCascadeUpdate(_var_tv, tv); _judge.Feed(target, ft, tt); _etor.ContextCascadeDiscard(); + if (tv.Type == PdtInternalType.Null) { + _activeCounts[id.Source]--; + Logger.Log("main", 0, "Input/Proxy", "active {0} # {1} (-)", id.Source, _activeCounts[id.Source]); + } } _judge.Cleanup(target, ft, tt); _vecs[pid] = tv;