Esempio n. 1
0
 private void OnDisable()
 {
     if (SkillLogger.instance == this)
     {
         SkillLogger.instance = null;
     }
 }
Esempio n. 2
0
 public override void Initialize()
 {
     this.isToolWindow    = true;
     SkillLogger.instance = this;
     this.InitWindowTitle();
     base.set_minSize(new Vector2(200f, 200f));
     DebugFlow.SyncFsmLog(SkillEditor.SelectedFsm);
 }
Esempio n. 3
0
        private void DoMainToolbar()
        {
            GUILayout.BeginHorizontal(EditorStyles.get_toolbar(), new GUILayoutOption[0]);
            string fullFsmLabel = Labels.GetFullFsmLabel(SkillEditor.SelectedFsm);

            if (GUILayout.Button(fullFsmLabel, EditorStyles.get_toolbarDropDown(), new GUILayoutOption[0]))
            {
                SkillEditorGUILayout.GenerateFsmSelectionMenu(false, false).ShowAsContext();
            }
            if (SkillEditorGUILayout.ToolbarSettingsButton())
            {
                SkillLogger.GenerateSettingsMenu().ShowAsContext();
            }
            GUILayout.Space(-5f);
            GUILayout.EndHorizontal();
        }
Esempio n. 4
0
 public override void DoGUI()
 {
     this.DoMainToolbar();
     if (FsmEditorSettings.ShowHints)
     {
         GUILayout.Box(Strings.get_Hint_FsmLog(), SkillEditorStyles.HintBox, new GUILayoutOption[0]);
     }
     if (!FsmEditorSettings.EnableLogging)
     {
         SkillLogger.DoDisabledGUI();
         return;
     }
     GUI.set_enabled(SkillLogger.selectedLog != null);
     this.HandleKeyboardInput();
     this.DoLogView();
     this.DoBottomToolbar();
 }
Esempio n. 5
0
 private void Update()
 {
     if (SkillLogger.selectedLog == null || SkillLogger.selectedLog.get_Entries() == null)
     {
         return;
     }
     if (SkillLogger.selectedLog.get_Resized())
     {
         SkillLogger.ResetView();
         SkillLogger.selectedLog.set_Resized(false);
     }
     this.HandleWindowResize();
     this.UpdateLayout();
     if (this.updateVisibility)
     {
         this.UpdateVisibility();
         base.Repaint();
     }
 }
Esempio n. 6
0
 public static void SetDebugTime(float time)
 {
     DebugFlow.CurrentDebugTime = time;
     using (List <Skill> .Enumerator enumerator = SkillEditor.FsmList.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             Skill current = enumerator.get_Current();
             if (current != null)
             {
                 SkillLogEntry logEntry = DebugFlow.FindClosestLogEntry(current.get_MyLog(), time);
                 if (SkillEditor.SelectedFsm == current)
                 {
                     DebugFlow.SelectLogEntry(logEntry, false);
                 }
                 else
                 {
                     DebugFlow.RestoreNearestVariables(logEntry);
                 }
             }
         }
     }
     SkillLogger.SetDebugFlowTime(time);
 }
Esempio n. 7
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++;
        }