public static void SelectLogEntry(SkillLogEntry logEntry, bool updateTime = true) { if (logEntry != null) { DebugFlow.SelectedLog = logEntry.get_Log(); DebugFlow.SelectedLogEntry = logEntry; DebugFlow.DebugState = logEntry.get_State(); DebugFlow.SelectedLogEntryIndex = logEntry.GetIndex(); if (updateTime) { DebugFlow.CurrentDebugTime = logEntry.get_Time(); DebugFlow.CurrentDebugFrame = logEntry.get_FrameCount(); } SkillEditor.SelectState(logEntry.get_State(), true); if (logEntry.get_Action() != null) { SkillEditor.SelectAction(logEntry.get_Action(), true); } if (FsmEditorSettings.EnableDebugFlow && DebugFlow.SelectedLog.get_Fsm().EnableDebugFlow&& DebugFlow.SelectedLogEntryIndex < DebugFlow.lastEnterIndex) { DebugFlow.RestoreNearestVariables(logEntry); } if (DebugFlow.LogEntrySelected != null) { DebugFlow.LogEntrySelected(logEntry); } SkillEditor.Repaint(true); } }
public override void Initialize() { this.isToolWindow = true; SkillLogger.instance = this; this.InitWindowTitle(); base.set_minSize(new Vector2(200f, 200f)); DebugFlow.SyncFsmLog(SkillEditor.SelectedFsm); }
public static void SelectNextTransition() { DebugFlow.SelectLogEntry(DebugFlow.FindNextLogEntry(DebugFlow.SelectedLogEntry, new SkillLogType[] { 6, 7 }), true); }
private void SetDebugTime(float time) { if (FsmEditorSettings.LogPauseOnSelect && !EditorApplication.get_isPaused()) { EditorApplication.set_isPaused(true); } this.timelineControl.FrameTime(time, 0f); DebugFlow.SetDebugTime(time); base.Repaint(); }
private void SelectFsm(Skill fsm) { if (fsm != SkillEditor.SelectedFsm) { SkillEditor.SelectFsm(fsm); if (EditorApplication.get_isPaused()) { DebugFlow.Refresh(); } } }
private void SelectLogEntry(SkillLogEntry entry) { if (entry == null) { return; } if (FsmEditorSettings.LogPauseOnSelect && !EditorApplication.get_isPaused()) { EditorApplication.set_isPaused(true); } DebugFlow.SelectLogEntry(entry, true); this.autoScroll = true; }
public static void SyncFsmLog(Skill fsm) { if (fsm == null) { return; } DebugFlow.SelectedLog = fsm.get_MyLog(); if (DebugFlow.Active && DebugFlow.SelectedLog != null && DebugFlow.SelectedLog.get_Entries() != null) { DebugFlow.SelectMostRecentLogEntry(DebugFlow.CurrentDebugFrame); DebugFlow.lastEnter = DebugFlow.SelectedLogEntry; DebugFlow.lastEnterIndex = DebugFlow.SelectedLog.get_Entries().IndexOf(DebugFlow.lastEnter); } }
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); } } } }
public static void Start(Skill fsm) { DebugFlow.UpdateTime(); DebugFlow.Active = true; DebugFlow.SyncFsmLog(fsm); DebugFlow.StartedDebugFrame = Time.get_frameCount(); DebugFlow.variablesCache.Clear(); using (List <Skill> .Enumerator enumerator = SkillEditor.FsmList.GetEnumerator()) { while (enumerator.MoveNext()) { Skill current = enumerator.get_Current(); if (current.EnableDebugFlow) { DebugFlow.variablesCache.Add(current, new SkillVariables(current.get_Variables())); } } } DebugFlow.globalVariablesCache = new SkillVariables(SkillVariables.get_GlobalVariables()); }
private static void DoDebugFlowControls() { if (GameStateTracker.CurrentState == GameState.Stopped) { GUILayout.FlexibleSpace(); return; } if (DebugFlow.Active) { GUI.set_contentColor(Color.get_yellow()); GUILayout.Label(Labels.FormatTime(DebugFlow.CurrentDebugTime), EditorStyles.get_toolbarButton(), new GUILayoutOption[0]); GUI.set_contentColor(Color.get_white()); GUILayout.Space(10f); if (GUILayout.Button(SkillEditorContent.DebugToolbarPrev, EditorStyles.get_toolbarButton(), new GUILayoutOption[0])) { DebugFlow.SelectPrevTransition(); } if (GUILayout.Button(SkillEditorContent.DebugToolbarNext, EditorStyles.get_toolbarButton(), new GUILayoutOption[0])) { DebugFlow.SelectNextTransition(); } GUILayout.FlexibleSpace(); if (GUILayout.Button(Strings.get_DebugToolbar_Button_Open_Log(), EditorStyles.get_toolbarButton(), new GUILayoutOption[0])) { SkillEditor.OpenFsmLogWindow(); GUIUtility.ExitGUI(); return; } } else { GUILayout.FlexibleSpace(); if (GUILayout.Button(Strings.get_DebugToolbar_Button_Open_Log(), EditorStyles.get_toolbarButton(), new GUILayoutOption[0])) { SkillEditor.OpenFsmLogWindow(); GUIUtility.ExitGUI(); } } }
public void Step() { switch (this.StepMode) { case FsmDebugger.FsmStepMode.StepFrame: EditorApplication.set_isPaused(false); EditorApplication.Step(); Skill.set_StepToStateChange(false); break; case FsmDebugger.FsmStepMode.StepToStateChange: EditorApplication.set_isPaused(false); Skill.set_StepToStateChange(true); Skill.set_StepFsm(SkillEditor.SelectedFsm); break; case FsmDebugger.FsmStepMode.StepToAnyStateChange: EditorApplication.set_isPaused(false); Skill.set_StepToStateChange(true); Skill.set_StepFsm(null); break; } DebugFlow.UpdateTime(); }
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); }
private static SkillLogEntry FindMostRecentLogEntry(int fromFrame) { return(DebugFlow.FindMostRecentLogEntry(DebugFlow.SelectedLog, fromFrame)); }
public static void SelectPrevTransition() { DebugFlow.SelectLogEntry(DebugFlow.FindPrevLogEntry(DebugFlow.SelectedLogEntry, 6), true); }
private static void SelectMostRecentLogEntry(int fromFrame) { DebugFlow.SelectLogEntry(DebugFlow.FindMostRecentLogEntry(fromFrame), false); }
public static SkillLogEntry GetLastTransition() { return(DebugFlow.FindPrevLogEntry(DebugFlow.SelectedLogEntry, 4)); }
public static void Refresh() { DebugFlow.SetDebugTime(DebugFlow.CurrentDebugTime); }