Exemplo n.º 1
0
        private void DoTimelineBar(Skill fsm, Rect area)
        {
            if (!Application.get_isPlaying())
            {
                return;
            }
            if (fsm == null)
            {
                return;
            }
            SkillLog myLog = fsm.get_MyLog();

            if (myLog == null || myLog.get_Entries() == null)
            {
                return;
            }
            GUI.BeginGroup(area);
            float      startTime = 0f;
            SkillState fsmState  = null;

            for (int i = 0; i < myLog.get_Entries().get_Count(); i++)
            {
                SkillLogEntry fsmLogEntry = myLog.get_Entries().get_Item(i);
                if (fsmLogEntry.get_LogType() == 5)
                {
                    if (fsmLogEntry.get_Time() > this.timelineControl.VisibleRangeStart)
                    {
                        this.DrawTimelineBar(startTime, fsmLogEntry.get_Time(), fsmState);
                    }
                    fsmState = null;
                }
                if (fsmLogEntry.get_LogType() == 6)
                {
                    if (fsmLogEntry.get_Time() > this.timelineControl.VisibleRangeEnd)
                    {
                        GUI.EndGroup();
                        return;
                    }
                    fsmState  = fsmLogEntry.get_State();
                    startTime = fsmLogEntry.get_Time();
                }
                SkillLogType arg_AE_0 = fsmLogEntry.get_LogType();
                SkillLogType arg_B8_0 = fsmLogEntry.get_LogType();
            }
            if (fsmState != null)
            {
                this.DrawTimelineBar(startTime, SkillTime.get_RealtimeSinceStartup(), fsmState);
            }
            GUI.EndGroup();
        }
Exemplo n.º 2
0
        private static SkillLogEntry FindPrevLogEntry(SkillLogEntry fromEntry, SkillLogType logType = 6)
        {
            if (fromEntry == null)
            {
                return(null);
            }
            SkillLog log = fromEntry.get_Log();

            if (log == null || log.get_Entries() == null)
            {
                return(null);
            }
            SkillLogEntry result = null;

            using (List <SkillLogEntry> .Enumerator enumerator = log.get_Entries().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    SkillLogEntry current = enumerator.get_Current();
                    if (current == fromEntry)
                    {
                        break;
                    }
                    if (current.get_LogType() == logType)
                    {
                        result = current;
                    }
                }
            }
            return(result);
        }
Exemplo n.º 3
0
 private static void RestoreNearestVariables(SkillLogEntry logEntry)
 {
     if (logEntry == null)
     {
         return;
     }
     if (logEntry.get_LogType() == 6 || logEntry.get_LogType() == 5)
     {
         DebugFlow.RestoreVariables(logEntry);
         return;
     }
     if (logEntry.get_Event() == SkillEvent.get_Finished())
     {
         SkillLogEntry fsmLogEntry = DebugFlow.FindNextLogEntry(logEntry, new SkillLogType[]
         {
             5
         });
         if (fsmLogEntry != null)
         {
             DebugFlow.RestoreVariables(fsmLogEntry);
             return;
         }
     }
     else
     {
         if (DebugFlow.SelectedLogEntryIndex == 0)
         {
             SkillLogEntry fsmLogEntry2 = DebugFlow.FindNextLogEntry(logEntry, new SkillLogType[]
             {
                 6
             });
             if (fsmLogEntry2 != null)
             {
                 DebugFlow.RestoreVariables(fsmLogEntry2);
                 return;
             }
         }
         else
         {
             SkillLogEntry fsmLogEntry3 = DebugFlow.FindPrevLogEntry(logEntry, 6);
             if (fsmLogEntry3 != null)
             {
                 DebugFlow.RestoreVariables(fsmLogEntry3);
             }
         }
     }
 }
Exemplo n.º 4
0
        private static SkillLogEntry FindMostRecentLogEntry(SkillLog fsmLog, int fromFrame)
        {
            if (fsmLog == null || fsmLog.get_Entries() == null)
            {
                return(null);
            }
            SkillLogEntry result = null;

            using (List <SkillLogEntry> .Enumerator enumerator = fsmLog.get_Entries().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    SkillLogEntry current = enumerator.get_Current();
                    if (current.get_LogType() == 6 || current.get_LogType() == 8 || current.get_LogType() == 7)
                    {
                        result = current;
                    }
                }
            }
            return(result);
        }
Exemplo n.º 5
0
        private float CalculateEntryHeight(SkillLogEntry entry)
        {
            if (!this.EntryIsVisible(entry))
            {
                return(0f);
            }
            float num = 20f;

            if (entry.get_LogType() == 6)
            {
                num += 2f;
            }
            return(num + 20f * (float)this.ExtraRows(entry));
        }
Exemplo n.º 6
0
        private static SkillLogEntry FindClosestLogEntry(SkillLog fsmLog, float time)
        {
            SkillLogEntry result = null;

            using (List <SkillLogEntry> .Enumerator enumerator = fsmLog.get_Entries().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    SkillLogEntry current = enumerator.get_Current();
                    if (current.get_Time() > time)
                    {
                        break;
                    }
                    if (current.get_LogType() == 6)
                    {
                        result = current;
                    }
                }
            }
            return(result);
        }
Exemplo n.º 7
0
        private static SkillLogEntry FindNextLogEntry(SkillLogEntry fromEntry, params SkillLogType[] logTypes)
        {
            SkillLog log = fromEntry.get_Log();

            if (log == null)
            {
                return(null);
            }
            int num = DebugFlow.SelectedLog.get_Entries().IndexOf(fromEntry);

            for (int i = num + 1; i < log.get_Entries().get_Count(); i++)
            {
                SkillLogEntry fsmLogEntry = log.get_Entries().get_Item(i);
                for (int j = 0; j < logTypes.Length; j++)
                {
                    SkillLogType fsmLogType = logTypes[j];
                    if (fsmLogEntry.get_LogType() == fsmLogType)
                    {
                        return(fsmLogEntry);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 8
0
 private bool ShowEventTarget(SkillLogEntry entry)
 {
     return(entry.get_LogType() == 8 && entry.get_EventTarget().target != null);
 }
Exemplo n.º 9
0
 private bool ShowSentBy(SkillLogEntry entry)
 {
     return(entry.get_LogType() == 3 && FsmEditorSettings.LogShowSentBy && entry.get_SentByState() != null && entry.get_SentByState() != entry.get_State());
 }
Exemplo n.º 10
0
 private bool EntryIsVisible(SkillLogEntry entry)
 {
     return(!string.IsNullOrEmpty(entry.get_Text()) && (entry.get_LogType() != 5 || FsmEditorSettings.LogShowExit));
 }
Exemplo n.º 11
0
        private void DoLogLine(SkillLogEntry entry, int index)
        {
            if (!this.EntryIsVisible(entry))
            {
                return;
            }
            if (entry.get_LogType() == 6)
            {
                this.currentState = entry.get_State();
                SkillEditorGUILayout.Divider(new GUILayoutOption[0]);
            }
            if (this.selectedEntry != null && index > this.selectedEntryIndex)
            {
                GUI.set_color(new Color(1f, 1f, 1f, 0.3f));
            }
            if (entry.get_LogType() == 9 || entry.get_LogType() == 10)
            {
                GUI.set_backgroundColor(SkillEditorStyles.DefaultBackgroundColor);
            }
            else
            {
                GUI.set_backgroundColor((this.currentState != null) ? PlayMakerPrefs.get_Colors()[this.currentState.get_ColorIndex()] : Color.get_grey());
            }
            GUILayout.BeginVertical(SkillEditorStyles.LogBackground, new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            Color backgroundColor = GUI.get_backgroundColor();

            GUI.set_backgroundColor(Color.get_white());
            GUIStyle gUIStyle = SkillEditorStyles.GetLogTypeStyles()[entry.get_LogType()];

            GUILayout.Label("", gUIStyle, new GUILayoutOption[]
            {
                GUILayout.MaxWidth(20f)
            });
            GUI.set_backgroundColor(backgroundColor);
            gUIStyle = SkillEditorStyles.LogLine;
            if (GUILayout.Button(FsmEditorSettings.LogShowTimecode ? entry.get_TextWithTimecode() : entry.get_Text(), gUIStyle, new GUILayoutOption[0]))
            {
                this.SelectLogEntry(entry);
            }
            GUILayout.EndHorizontal();
            if (this.ShowSentBy(entry))
            {
                if (string.IsNullOrEmpty(entry.get_Text2()))
                {
                    entry.set_Text2(Strings.get_FsmLog_Label_Sent_By() + Labels.GetFullStateLabel(entry.get_SentByState()));
                    if (entry.get_Action() != null)
                    {
                        entry.set_Text2(entry.get_Text2() + " : " + Labels.GetActionLabel(entry.get_Action()));
                    }
                }
                if (GUILayout.Button(entry.get_Text2(), SkillEditorStyles.LogLine2, new GUILayoutOption[0]))
                {
                    SkillLogger.OnClickSentBy(entry);
                }
                EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), 4);
            }
            else
            {
                if (this.ShowEventTarget(entry))
                {
                    if (string.IsNullOrEmpty(entry.get_Text2()))
                    {
                        entry.set_Text2(Strings.get_FsmLog_Label_Target() + SkillLogger.GetEventTargetLabel(entry));
                    }
                    if (GUILayout.Button(entry.get_Text2(), SkillEditorStyles.LogLine2, new GUILayoutOption[0]))
                    {
                        this.OnClickEventTarget(entry);
                        GUIUtility.ExitGUI();
                        return;
                    }
                    EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), 4);
                }
                else
                {
                    if (this.ShowHitGameObject(entry))
                    {
                        if (string.IsNullOrEmpty(entry.get_Text2()))
                        {
                            entry.set_Text2("WITH: " + entry.get_GameObjectName());
                            entry.set_GameObjectIcon(EditorHacks.GetIconForObject(entry.get_GameObject()));
                        }
                        if (entry.get_GameObject() != null)
                        {
                            if (GUILayout.Button(entry.get_Text2(), SkillEditorStyles.LogLine2, new GUILayoutOption[0]))
                            {
                                Selection.set_activeGameObject(entry.get_GameObject());
                                GUIUtility.ExitGUI();
                                return;
                            }
                            Rect lastRect = GUILayoutUtility.GetLastRect();
                            EditorGUIUtility.AddCursorRect(lastRect, 4);
                            if (entry.get_GameObjectIcon() != null)
                            {
                                lastRect.Set(lastRect.get_xMin(), lastRect.get_yMin() + 2f, 27f, lastRect.get_height() - 2f);
                                GUI.Label(lastRect, entry.get_GameObjectIcon());
                            }
                        }
                        else
                        {
                            GUILayout.Label(entry.get_Text2() + " (Destroyed)", SkillEditorStyles.LogLine2, new GUILayoutOption[0]);
                        }
                    }
                }
            }
            GUILayout.EndVertical();
            if (entry == this.selectedEntry)
            {
                this.beforeSelected = this.prevEntry;
                GUI.set_backgroundColor(Color.get_white());
                GUILayout.Box(GUIContent.none, SkillEditorStyles.LogLineTimeline, new GUILayoutOption[0]);
            }
            if (this.prevEntry == this.selectedEntry)
            {
                this.afterSelected = entry;
            }
            this.prevEntry = entry;
            this.numEntriesDrawn++;
        }