예제 #1
0
 private void RemoveEntry(FsmLogEntry entry)
 {
     if (entries != null)
     {
         entries.Remove(entry);
     }
 }
예제 #2
0
        public void LogStart(FsmState startState)
        {
            FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.Start);

            fsmLogEntry.State = startState;
            AddEntry(fsmLogEntry);
        }
예제 #3
0
        public void LogAction(FsmLogType logType, string text, bool sendToUnityLog = false)
        {
            if (FsmExecutionStack.ExecutingAction == null)
            {
                switch (logType)
                {
                case FsmLogType.Info:
                    Debug.Log(text);
                    break;

                case FsmLogType.Warning:
                    Debug.LogWarning(text);
                    break;

                case FsmLogType.Error:
                    Debug.LogError(text);
                    break;

                default:
                    Debug.Log(text);
                    break;
                }
            }
            else
            {
                FsmLogEntry fsmLogEntry = NewFsmLogEntry(logType);
                fsmLogEntry.State  = FsmExecutionStack.ExecutingState;
                fsmLogEntry.Action = FsmExecutionStack.ExecutingAction;
                fsmLogEntry.Text   = FsmUtility.StripNamespace(FsmExecutionStack.ExecutingAction.ToString()) + " : " + text;
                AddEntry(fsmLogEntry, sendToUnityLog);
            }
        }
예제 #4
0
        public void Log(FsmLogType logType, string text)
        {
            FsmLogEntry fsmLogEntry = NewFsmLogEntry(logType);

            fsmLogEntry.State = FsmExecutionStack.ExecutingState;
            fsmLogEntry.Text  = text;
            AddEntry(fsmLogEntry);
        }
예제 #5
0
        public void LogBreak()
        {
            FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.Break);

            fsmLogEntry.State = FsmExecutionStack.ExecutingState;
            Debug.Log("BREAK: " + FormatUnityLogString("Breakpoint"));
            AddEntry(fsmLogEntry);
        }
예제 #6
0
        public void LogTransition(FsmState fromState, FsmTransition transition)
        {
            FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.Transition);

            fsmLogEntry.State      = fromState;
            fsmLogEntry.Transition = transition;
            AddEntry(fsmLogEntry);
        }
예제 #7
0
        public void LogEvent(FsmEvent fsmEvent, FsmState state)
        {
            FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.Event);

            fsmLogEntry.State       = state;
            fsmLogEntry.SentByState = Fsm.EventData.SentByState;
            fsmLogEntry.Action      = Fsm.EventData.SentByAction;
            fsmLogEntry.Event       = fsmEvent;
            AddEntry(fsmLogEntry);
        }
예제 #8
0
 static FsmLog()
 {
     MaxSize        = 10000;
     Logs           = new List <FsmLog>();
     LoggingEnabled = !Application.isEditor;
     logEntryPool   = new FsmLogEntry[MaxSize];
     for (int i = 0; i < logEntryPool.Length; i++)
     {
         logEntryPool[i] = new FsmLogEntry();
     }
 }
예제 #9
0
 public void LogSendEvent(FsmState state, FsmEvent fsmEvent, FsmEventTarget eventTarget)
 {
     if (state != null && fsmEvent != null && !fsmEvent.IsSystemEvent)
     {
         FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.SendEvent);
         fsmLogEntry.State       = state;
         fsmLogEntry.Event       = fsmEvent;
         fsmLogEntry.EventTarget = new FsmEventTarget(eventTarget);
         AddEntry(fsmLogEntry);
     }
 }
예제 #10
0
 public void LogEnterState(FsmState state)
 {
     if (state != null)
     {
         FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.EnterState);
         fsmLogEntry.State = state;
         if (EnableDebugFlow && state.Fsm.EnableDebugFlow)
         {
             fsmLogEntry.FsmVariablesCopy    = new FsmVariables(state.Fsm.Variables);
             fsmLogEntry.GlobalVariablesCopy = new FsmVariables(FsmVariables.GlobalVariables);
         }
         AddEntry(fsmLogEntry);
     }
 }
예제 #11
0
 public void LogExitState(FsmState state)
 {
     if (state != null)
     {
         FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.ExitState);
         fsmLogEntry.State     = state;
         fsmLogEntry.StateTime = FsmTime.RealtimeSinceStartup - state.RealStartTime;
         if (EnableDebugFlow && state.Fsm.EnableDebugFlow && !PlayMakerFSM.ApplicationIsQuitting)
         {
             fsmLogEntry.FsmVariablesCopy    = new FsmVariables(state.Fsm.Variables);
             fsmLogEntry.GlobalVariablesCopy = new FsmVariables(FsmVariables.GlobalVariables);
         }
         AddEntry(fsmLogEntry);
     }
 }
예제 #12
0
        private FsmLogEntry NewFsmLogEntry(FsmLogType logType)
        {
            FsmLogEntry fsmLogEntry = logEntryPool[nextLogEntryPoolIndex];

            if (fsmLogEntry.Log != null)
            {
                fsmLogEntry.Log.RemoveEntry(fsmLogEntry);
                fsmLogEntry.Reset();
            }
            fsmLogEntry.Log     = this;
            fsmLogEntry.LogType = logType;
            nextLogEntryPoolIndex++;
            if (nextLogEntryPoolIndex >= logEntryPool.Length)
            {
                nextLogEntryPoolIndex = 0;
            }
            return(fsmLogEntry);
        }
예제 #13
0
        private void AddEntry(FsmLogEntry entry, bool sendToUnityLog = false)
        {
            entry.Log        = this;
            entry.Time       = FsmTime.RealtimeSinceStartup;
            entry.FrameCount = Time.frameCount;
            if (IsCollisionEvent(entry.Event))
            {
                entry.GameObject     = entry.Fsm.CollisionGO;
                entry.GameObjectName = entry.Fsm.CollisionName;
            }
            if (IsTriggerEvent(entry.Event))
            {
                entry.GameObject     = entry.Fsm.TriggerGO;
                entry.GameObjectName = entry.Fsm.TriggerName;
            }
            if (IsCollision2DEvent(entry.Event))
            {
                entry.GameObject     = entry.Fsm.Collision2dGO;
                entry.GameObjectName = entry.Fsm.Collision2dName;
            }
            if (IsTrigger2DEvent(entry.Event))
            {
                entry.GameObject     = entry.Fsm.Trigger2dGO;
                entry.GameObjectName = entry.Fsm.Trigger2dName;
            }
            entries.Add(entry);
            switch (entry.LogType)
            {
            case FsmLogType.Error:
                Debug.LogError(FormatUnityLogString(entry.Text));
                return;

            case FsmLogType.Warning:
                Debug.LogWarning(FormatUnityLogString(entry.Text));
                return;
            }
            if ((MirrorDebugLog || sendToUnityLog) && entry.LogType != FsmLogType.Transition)
            {
                Debug.Log(FormatUnityLogString(entry.Text));
            }
        }
예제 #14
0
        public void LogStop()
        {
            FsmLogEntry entry = NewFsmLogEntry(FsmLogType.Stop);

            AddEntry(entry);
        }