private void OnDisable() { if (instance == this) { instance = null; } }
private static void InitInstance() { if (instance == null) { instance = (PlayMakerGUI)UnityEngine.Object.FindObjectOfType(typeof(PlayMakerGUI)); } }
void Awake() { DontDestroyOnLoad(this); // Register itself RegisterSystem(this, "General", null, true); // Those should not be changed... _gameSystems[this].isDebuggingEnabled = true; _gameSystems[this].showLog = true; // Create and register log subsystem _log = new LogSystem(); RegisterSystem(_log, "LogSystem", this, true); // Log(this, "Log open!", LogType.Log); // Register GLRendering subsystem GLRenderingUtils render = new GLRenderingUtils(); RegisterSystem(render, "RenderingUtils", this, true, false); _gameSystems[render].isDebuggingEnabled = true; _gameSystems[render].showLog = true; PlayMakerGUI playMakerGUI = (PlayMakerGUI)FindObjectOfType(typeof(PlayMakerGUI)); if (playMakerGUI != null) { RegisterSystem(new PlayMakerDebuggable(playMakerGUI), "PlayMaker", null, true, true); } }
private void OnDisable() { if (PlayMakerGUI.instance == this) { PlayMakerGUI.instance = null; } }
void OnEnable() { guiComponent = (PlayMakerGUI)target; guiComponent.drawStateLabels = EditorPrefs.GetBool(EditorPrefStrings.ShowStateLabelsInGameView); CheckForDuplicateComponents(); }
void OnEnable() { guiComponent = target as PlayMakerGUI; guiComponent.drawStateLabels = EditorPrefs.GetBool("PlayMaker.ShowStateLabelsInGameView"); CheckForDuplicateComponents(); }
void OnEnable() { guiComponent = (PlayMakerGUI) target; guiComponent.drawStateLabels = EditorPrefs.GetBool(EditorPrefStrings.ShowStateLabelsInGameView); CheckForDuplicateComponents(); }
private void Awake() { if (PlayMakerGUI.instance == null) { PlayMakerGUI.instance = this; return; } Debug.LogWarning("There should only be one PlayMakerGUI per scene!"); }
private void Awake() { if (instance == null) { instance = this; } else { Debug.LogWarning("There should only be one PlayMakerGUI per scene!"); } }
public void OnEnable() { guiComponent = target as PlayMakerGUI; if (guiComponent != null) // can happen on rebuild? { guiComponent.drawStateLabels = EditorPrefs.GetBool(EditorPrefStrings.ShowStateLabelsInGameView); guiComponent.enableStateLabelsInBuilds = EditorPrefs.GetBool(EditorPrefStrings.ShowStateLabelsInBuild); } CheckForDuplicateComponents(); }
private void OnGUI() { base.set_useGUILayout(this.enableGUILayout); if (PlayMakerGUI.GUISkin != null) { GUI.set_skin(PlayMakerGUI.GUISkin); } GUI.set_color(PlayMakerGUI.GUIColor); GUI.set_backgroundColor(PlayMakerGUI.GUIBackgroundColor); GUI.set_contentColor(PlayMakerGUI.GUIContentColor); if (this.previewOnGUI && !Application.get_isPlaying()) { PlayMakerGUI.DoEditGUI(); return; } PlayMakerGUI.fsmList.Clear(); PlayMakerGUI.fsmList.AddRange(PlayMakerFSM.FsmList); for (int i = 0; i < PlayMakerGUI.fsmList.get_Count(); i++) { PlayMakerFSM playMakerFSM = PlayMakerGUI.fsmList.get_Item(i); if (!(playMakerFSM == null) && playMakerFSM.Active && playMakerFSM.Fsm.ActiveState != null && !playMakerFSM.Fsm.HandleOnGUI) { this.CallOnGUI(playMakerFSM.Fsm); for (int j = 0; j < playMakerFSM.Fsm.SubFsmList.get_Count(); j++) { Skill fsm = playMakerFSM.Fsm.SubFsmList.get_Item(j); this.CallOnGUI(fsm); } } } if (Application.get_isPlaying() && Event.get_current().get_type() == 7) { Matrix4x4 matrix = GUI.get_matrix(); GUI.set_matrix(Matrix4x4.get_identity()); if (PlayMakerGUI.MouseCursor != null) { Rect rect = new Rect(Input.get_mousePosition().x - (float)PlayMakerGUI.MouseCursor.get_width() * 0.5f, (float)Screen.get_height() - Input.get_mousePosition().y - (float)PlayMakerGUI.MouseCursor.get_height() * 0.5f, (float)PlayMakerGUI.MouseCursor.get_width(), (float)PlayMakerGUI.MouseCursor.get_height()); GUI.DrawTexture(rect, PlayMakerGUI.MouseCursor); } if (this.drawStateLabels && PlayMakerGUI.EnableStateLabels) { this.DrawStateLabels(); } GUI.set_matrix(matrix); PlayMakerGUI.GUIMatrix = Matrix4x4.get_identity(); if (this.controlMouseCursor) { Cursor.set_lockState(PlayMakerGUI.LockCursor ? 1 : 0); Cursor.set_visible(!PlayMakerGUI.HideCursor); } } }
public PlayMakerDebuggable(PlayMakerGUI playMakerGUI) { _gui = playMakerGUI; }
private void DrawStateLabel(PlayMakerFSM fsm) { if (PlayMakerGUI.stateLabelStyle == null || Math.Abs(this.initLabelScale - this.labelScale) > 0.1f) { this.InitLabelStyle(); } if (Camera.get_main() == null) { return; } if (fsm.get_gameObject() == Camera.get_main()) { return; } if (fsm.get_gameObject() == PlayMakerGUI.labelGameObject) { PlayMakerGUI.fsmLabelIndex += 1f; } else { PlayMakerGUI.fsmLabelIndex = 0f; PlayMakerGUI.labelGameObject = fsm.get_gameObject(); } string text = PlayMakerGUI.GenerateStateLabel(fsm); if (string.IsNullOrEmpty(text)) { return; } Vector2 vector = default(Vector2); PlayMakerGUI.labelContent.set_text(text); Vector2 vector2 = PlayMakerGUI.stateLabelStyle.CalcSize(PlayMakerGUI.labelContent); vector2.x = Mathf.Clamp(vector2.x, 10f * this.labelScale, 200f * this.labelScale); if (this.GUITextureStateLabels && fsm.GuiTexture != null) { vector.x = fsm.get_gameObject().get_transform().get_position().x *(float)Screen.get_width() + fsm.GuiTexture.get_pixelInset().get_x(); vector.y = fsm.get_gameObject().get_transform().get_position().y *(float)Screen.get_height() + fsm.GuiTexture.get_pixelInset().get_y(); } else { if (this.GUITextStateLabels && fsm.GuiText != null) { vector.x = fsm.get_gameObject().get_transform().get_position().x *(float)Screen.get_width(); vector.y = fsm.get_gameObject().get_transform().get_position().y *(float)Screen.get_height(); } else { if (this.filterLabelsWithDistance) { float num = Vector3.Distance(Camera.get_main().get_transform().get_position(), fsm.get_transform().get_position()); if (num > this.maxLabelDistance) { return; } } if (Camera.get_main().get_transform().InverseTransformPoint(fsm.get_transform().get_position()).z <= 0f) { return; } vector = Camera.get_main().WorldToScreenPoint(fsm.get_transform().get_position()); vector.x -= vector2.x * 0.5f; } } vector.y = (float)Screen.get_height() - vector.y - PlayMakerGUI.fsmLabelIndex * 15f * this.labelScale; Color backgroundColor = GUI.get_backgroundColor(); Color color = GUI.get_color(); int num2 = 0; if (fsm.Fsm.ActiveState != null) { num2 = fsm.Fsm.ActiveState.ColorIndex; } Color color2 = PlayMakerPrefs.Colors[num2]; GUI.set_backgroundColor(new Color(color2.r, color2.g, color2.b, 0.5f)); GUI.set_contentColor(Color.get_white()); GUI.Label(new Rect(vector.x, vector.y, vector2.x, vector2.y), text, PlayMakerGUI.stateLabelStyle); GUI.set_backgroundColor(backgroundColor); GUI.set_color(color); }
void OnEnable() { guiComponent = target as PlayMakerGUI; CheckForDuplicateComponents(); }
void OnEnable() { guiComponent = target as PlayMakerGUI; }
public void OnApplicationQuit() { instance = null; }
public void OnApplicationQuit() { PlayMakerGUI.instance = null; }