public ScopeEvents(BaseScope scope) { this.scope = scope; signals = new List <SignalEvent>(100); events = new List <ScopeEvent>(10); }
public static void AddOutgoingSignal(BaseScope scope, Type outgoingScopeType, NetworkReader reader) { // read useless data reader.ReadInt32(); int signalType = reader.ReadInt32(); MethodInfo method = outgoingScopeType.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public).FirstOrDefault(m => m.Name.GetHashCode() == signalType); if (method == null) { Debug.Log("Could not find method with sigType " + signalType); } ScopeEvents ev = GetOrCreateScopeEvent(scope); SignalEvent sigEvent = ev.AddSignalEvent(method, reader, false); reader.SeekZero(); if (OnSignalEvent != null) { OnSignalEvent(scope, sigEvent); } }
public ScopeEvent(Type eventType, BaseScope scope1, BaseScope scope2) { type = eventType; this.scope1 = scope1; this.scope2 = scope2; receiveTime = DateTime.Now; }
public static void AddScopeEvent(BaseScope scope, BaseScope otherScope, ScopeEvent.Type scopeEv) { ScopeEvents ev = GetOrCreateScopeEvent(scope); ScopeEvent scopeEvent = ev.AddScopeEvent(scopeEv, scope, otherScope); if (OnScopeEvent != null) { OnScopeEvent(scope, otherScope, scopeEvent); } }
public Log(BaseScope scope, ScopeDebugger.SignalEvent sigEv) { name = sigEv.method.Name; parameters = sigEv.parameters; if (sigEv.isOutgoing) { color = Color.green; } else { color = Color.cyan; } }
public Log(BaseScope scope, BaseScope otherScope, ScopeDebugger.ScopeEvent scopeEv) { name = scopeEv.type.ToString() + " Scope"; color = Color.white; if (scopeEv.type == ScopeDebugger.ScopeEvent.Type.Switch) { parameters = new string[] { scope.GetType().Name, otherScope.GetType().Name } } ; else { parameters = new string[] { scope.GetType().Name } }; } }
public static void AddIncomingSignal(BaseScope scope, NetworkReader reader) { int signalType = reader.ReadInt32(); MethodInfo method = scope.GetType().GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public).FirstOrDefault(m => m.Name.GetHashCode() == signalType); ScopeEvents ev = GetOrCreateScopeEvent(scope); SignalEvent sigEvent = ev.AddSignalEvent(method, reader, false); reader.SeekZero(); if (OnSignalEvent != null) { OnSignalEvent(scope, sigEvent); } }
private static ScopeEvents GetOrCreateScopeEvent(BaseScope scope) { if (scopeEventsList == null) { scopeEventsList = new List <ScopeEvents>(); } // find event int scopeEventIndex = scopeEventsList.FindIndex(s => s.scope == scope); // create and add if not found if (scopeEventIndex == -1) { ScopeEvents ev = new ScopeEvents(scope); scopeEventsList.Add(ev); return(ev); } return(scopeEventsList[scopeEventIndex]); }
public ScopeEvent AddScopeEvent(ScopeEvent.Type eventType, BaseScope scope1, BaseScope scope2) { events.Add(new ScopeEvent(eventType, scope1, scope2)); return(events[events.Count - 1]); }
void ScopeDebugger_OnScopeEvent(BaseScope scope, BaseScope otherScope, ScopeDebugger.ScopeEvent scopeEvent) { logs.Add(new Log(scope, otherScope, scopeEvent)); Repaint(); }
void ScopeDebugger_OnSignalEvent(BaseScope scope, ScopeDebugger.SignalEvent signalEvent) { logs.Add(new Log(scope, signalEvent)); Repaint(); }