예제 #1
0
            public ScopeEvents(BaseScope scope)
            {
                this.scope = scope;

                signals = new List <SignalEvent>(100);
                events  = new List <ScopeEvent>(10);
            }
예제 #2
0
        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);
            }
        }
예제 #3
0
            public ScopeEvent(Type eventType, BaseScope scope1, BaseScope scope2)
            {
                type = eventType;

                this.scope1 = scope1;
                this.scope2 = scope2;

                receiveTime = DateTime.Now;
            }
예제 #4
0
        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);
            }
        }
예제 #5
0
            public Log(BaseScope scope, ScopeDebugger.SignalEvent sigEv)
            {
                name       = sigEv.method.Name;
                parameters = sigEv.parameters;

                if (sigEv.isOutgoing)
                {
                    color = Color.green;
                }
                else
                {
                    color = Color.cyan;
                }
            }
예제 #6
0
            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 }
                };
            }
        }
예제 #7
0
        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);
            }
        }
예제 #8
0
        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]);
        }
예제 #9
0
 public ScopeEvent AddScopeEvent(ScopeEvent.Type eventType, BaseScope scope1, BaseScope scope2)
 {
     events.Add(new ScopeEvent(eventType, scope1, scope2));
     return(events[events.Count - 1]);
 }
예제 #10
0
        void ScopeDebugger_OnScopeEvent(BaseScope scope, BaseScope otherScope, ScopeDebugger.ScopeEvent scopeEvent)
        {
            logs.Add(new Log(scope, otherScope, scopeEvent));

            Repaint();
        }
예제 #11
0
        void ScopeDebugger_OnSignalEvent(BaseScope scope, ScopeDebugger.SignalEvent signalEvent)
        {
            logs.Add(new Log(scope, signalEvent));

            Repaint();
        }