Beispiel #1
0
        private void DrawTicks(Rect area)
        {
            float num  = this.majorTickUnits * this.timeScale;
            float num2 = this.majorTickUnits * Mathf.Floor(this.offset / this.majorTickUnits);
            float num3 = this.TimeToScreenPosition(num2);
            float num4 = this.offset * this.timeScale + area.get_width();

            while (num3 < num4)
            {
                this.tickLabelRect.set_x(num3);
                GUI.Label(this.tickLabelRect, this.FormatTime(num2), EditorStyles.get_miniLabel());
                this.line.DrawVerticalLine(0.75f, num3, 7f, this.toolbarHeight);
                this.line.DrawVerticalLine(0.25f, num3, this.toolbarHeight, area.get_height());
                if (this.minorTickUnits > 0f)
                {
                    float num5 = this.majorTickUnits / this.minorTickUnits;
                    float num6 = num / num5;
                    float num7 = num3 + num6;
                    int   num8 = 0;
                    while ((float)num8 < num5 - 1f)
                    {
                        this.line.DrawVerticalLine(0.5f, num7, 14f, this.toolbarHeight);
                        this.line.DrawVerticalLine(0.15f, num7, this.toolbarHeight, area.get_height());
                        num7 += num6;
                        num8++;
                    }
                }
                num3 += num;
                num2 += this.majorTickUnits;
            }
        }
Beispiel #2
0
 public override void DoGUI()
 {
     SkillEditorStyles.Init();
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     SkillEditorGUILayout.PlaymakerHeader(this);
     GUILayout.Label(FsmEditorSettings.ProductCopyright, EditorStyles.get_miniLabel(), new GUILayoutOption[0]);
     GUILayout.Label((!EditorApp.IsSourceCodeVersion) ? string.Format(Strings.get_AboutPlaymaker_Version_Info(), VersionInfo.GetAssemblyInformationalVersion()) : "Source Code Version", new GUILayoutOption[0]);
     if (VersionInfo.PlayMakerVersionInfo != "")
     {
         EditorGUILayout.HelpBox(VersionInfo.PlayMakerVersionInfo, 0);
     }
     EditorGUILayout.HelpBox(string.Format(Strings.get_AboutPlaymaker_Special_Thanks(), "Erin Ko, Kemal Amarasingham, Bruce Blumberg, Steve Gargolinski, Lee Hepler, Bart Simon, Lucas Meijer, Joachim Ante, Jaydee Alley, James Murchison, XiaoHang Zheng, Andrzej Łukasik, Vanessa Wesley, Marek Ledvina, Bob Berkebile, Jean Fabre, MaDDoX, gamesonytablet, Marc 'Dreamora' Schaerer, Eugenio 'Ryo567' Martínez, Steven 'Nightreaver' Barthen, Damiangto, VisionaiR3D, 黄峻, Nilton Felicio, Andre Dantas Lima, Ramprasad Madhavan, and the PlayMaker Community!\r\n"), 0);
     if (GUILayout.Button(Strings.get_AboutPlaymaker_Release_Notes(), new GUILayoutOption[0]))
     {
         EditorCommands.OpenWikiPage(WikiPages.ReleaseNotes);
     }
     if (GUILayout.Button(Strings.get_AboutPlaymaker_Hutong_Games_Link(), new GUILayoutOption[0]))
     {
         Application.OpenURL("http://hutonggames.com/");
     }
     GUILayout.Space(5f);
     GUILayout.EndVertical();
     if (!AboutPlaymaker.heightHasBeenSet && Event.get_current().get_type() == 7)
     {
         this.SetWindowHeightToFitContents();
     }
 }
        public static void OnGUI()
        {
            EditorGUI.BeginChangeCheck();
            Skill fsm = SkillEditor.SelectedFsm;

            if (fsm == null)
            {
                GUILayout.FlexibleSpace();
                return;
            }
            if (!FsmInspector.isInitialized)
            {
                FsmInspector.isInitialized = true;
                FsmInspector.Init();
            }
            FsmInspector.scrollViewPosition = GUILayout.BeginScrollView(FsmInspector.scrollViewPosition, new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            fsm.set_Name(EditorGUILayout.TextField(fsm.get_Name(), new GUILayoutOption[0]));
            if (EditorGUI.EndChangeCheck())
            {
                Labels.Update(fsm);
            }
            if (fsm.get_Owner() != null)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                SkillTemplate fsmTemplate = (SkillTemplate)EditorGUILayout.ObjectField(FsmInspector.SelectedTemplate, typeof(SkillTemplate), false, new GUILayoutOption[0]);
                if (fsmTemplate != FsmInspector.SelectedTemplate)
                {
                    FsmInspector.SelectTemplate(fsmTemplate);
                }
                if (GUILayout.Button(SkillEditorContent.BrowseTemplateButton, new GUILayoutOption[]
                {
                    GUILayout.MaxWidth(30f),
                    GUILayout.Height(16f)
                }))
                {
                    Templates.DoSelectTemplateMenu(FsmInspector.SelectedTemplate, new GenericMenu.MenuFunction(FsmInspector.ClearTemplate), new GenericMenu.MenuFunction2(FsmInspector.SelectTemplate));
                }
                GUILayout.EndHorizontal();
            }
            EditorGUI.BeginDisabledGroup(!Application.get_isPlaying() && SkillEditor.SelectedFsmUsesTemplate);
            if (fsm.get_Template() != null)
            {
                fsm = fsm.get_Template().fsm;
            }
            fsm.set_Description(SkillEditorGUILayout.TextAreaWithHint(fsm.get_Description(), Strings.get_Label_Description___(), new GUILayoutOption[]
            {
                GUILayout.MinHeight(80f)
            }));
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            fsm.set_DocUrl(SkillEditorGUILayout.TextFieldWithHint(fsm.get_DocUrl(), Strings.get_Tooltip_Documentation_Url(), new GUILayoutOption[0]));
            EditorGUI.BeginDisabledGroup(!string.IsNullOrEmpty(fsm.get_DocUrl()));
            if (SkillEditorGUILayout.HelpButton("Online Help"))
            {
                Application.OpenURL(fsm.get_DocUrl());
            }
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndHorizontal();
            EditorGUI.BeginDisabledGroup(!Application.get_isPlaying() && SkillEditor.SelectedFsmUsesTemplate);
            fsm.set_MaxLoopCountOverride(EditorGUILayout.IntField(SkillEditorContent.MaxLoopOverrideLabel, fsm.get_MaxLoopCountOverride(), new GUILayoutOption[0]));
            fsm.RestartOnEnable = GUILayout.Toggle(fsm.RestartOnEnable, SkillEditorContent.ResetOnDisableLabel, new GUILayoutOption[0]);
            EditorGUI.EndDisabledGroup();
            EditorGUI.EndDisabledGroup();
            fsm = SkillEditor.SelectedFsm;
            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
            GUILayout.Label(SkillEditorContent.FsmControlsLabel, EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
            if (fsm.ExposedEvents.get_Count() + FsmInspector.fsmVariables.get_Count() == 0)
            {
                SkillEditorGUILayout.DisabledLabel(Strings.get_Label_None_In_Table());
            }
            else
            {
                SkillEditorGUILayout.LabelWidth(100f);
                int num = 0;
                for (int i = 0; i < FsmInspector.fsmVariables.get_Count(); i++)
                {
                    SkillVariable fsmVariable = FsmInspector.fsmVariables.get_Item(i);
                    if (fsmVariable.ShowInInspector)
                    {
                        int categoryID = fsmVariable.CategoryID;
                        if (categoryID > 0 && categoryID != num)
                        {
                            num = categoryID;
                            GUILayout.Label(SkillEditor.SelectedFsm.get_Variables().get_Categories()[categoryID], EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
                            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
                        }
                        fsmVariable.DoInspectorGUI(SkillEditorContent.TempContent(fsmVariable.Name, fsmVariable.Name + ((!string.IsNullOrEmpty(fsmVariable.Tooltip)) ? (":\n" + fsmVariable.Tooltip) : "")), false);
                    }
                }
                using (List <SkillEvent> .Enumerator enumerator = fsm.ExposedEvents.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        SkillEvent current = enumerator.get_Current();
                        if (GUILayout.Button(current.get_Name(), new GUILayoutOption[0]))
                        {
                            fsm.Event(current);
                        }
                    }
                }
                if (GUI.get_changed())
                {
                    SkillEditor.RepaintAll();
                }
            }
            if (FsmEditorSettings.ShowHints)
            {
                GUILayout.Box(Strings.get_Hint_Expose_Events_and_Variables(), SkillEditorStyles.HintBox, new GUILayoutOption[0]);
            }
            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
            GUILayout.Label(SkillEditorContent.NetworkSyncLabel, EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
            int num2 = 0;

            SkillBool[] boolVariables = fsm.get_Variables().get_BoolVariables();
            for (int j = 0; j < boolVariables.Length; j++)
            {
                SkillBool fsmBool = boolVariables[j];
                if (fsmBool.get_NetworkSync())
                {
                    GUILayout.Label(fsmBool.get_Name(), new GUILayoutOption[0]);
                    num2++;
                }
            }
            SkillFloat[] floatVariables = fsm.get_Variables().get_FloatVariables();
            for (int k = 0; k < floatVariables.Length; k++)
            {
                SkillFloat fsmFloat = floatVariables[k];
                if (fsmFloat.get_NetworkSync())
                {
                    GUILayout.Label(fsmFloat.get_Name(), new GUILayoutOption[0]);
                    num2++;
                }
            }
            SkillInt[] intVariables = fsm.get_Variables().get_IntVariables();
            for (int l = 0; l < intVariables.Length; l++)
            {
                SkillInt fsmInt = intVariables[l];
                if (fsmInt.get_NetworkSync())
                {
                    GUILayout.Label(fsmInt.get_Name(), new GUILayoutOption[0]);
                    num2++;
                }
            }
            SkillQuaternion[] quaternionVariables = fsm.get_Variables().get_QuaternionVariables();
            for (int m = 0; m < quaternionVariables.Length; m++)
            {
                SkillQuaternion fsmQuaternion = quaternionVariables[m];
                if (fsmQuaternion.get_NetworkSync())
                {
                    GUILayout.Label(fsmQuaternion.get_Name(), new GUILayoutOption[0]);
                    num2++;
                }
            }
            SkillVector3[] vector3Variables = fsm.get_Variables().get_Vector3Variables();
            for (int n = 0; n < vector3Variables.Length; n++)
            {
                SkillVector3 fsmVector = vector3Variables[n];
                if (fsmVector.get_NetworkSync())
                {
                    GUILayout.Label(fsmVector.get_Name(), new GUILayoutOption[0]);
                    num2++;
                }
            }
            if (num2 == 0)
            {
                SkillEditorGUILayout.DisabledLabel(Strings.get_Label_None_In_Table());
            }
            if (FsmEditorSettings.ShowHints)
            {
                GUILayout.Box(Strings.get_Hint_Network_Sync_Variables(), SkillEditorStyles.HintBox, new GUILayoutOption[0]);
            }
            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
            GUILayout.Label("Debug", EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
            fsm.set_ShowStateLabel(GUILayout.Toggle(fsm.get_ShowStateLabel(), SkillEditorContent.ShowStateLabelsLabel, new GUILayoutOption[0]));
            fsm.EnableBreakpoints = GUILayout.Toggle(fsm.EnableBreakpoints, SkillEditorContent.EnableBreakpointsLabel, new GUILayoutOption[0]);
            fsm.EnableDebugFlow   = GUILayout.Toggle(fsm.EnableDebugFlow, SkillEditorContent.EnableDebugFlowLabel, new GUILayoutOption[0]);
            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
            GUILayout.Label("Experimental", EditorStyles.get_boldLabel(), new GUILayoutOption[0]);
            EditorGUILayout.HelpBox(Strings.get_Help_Experimental_Warning(), 0);
            fsm.set_KeepDelayedEventsOnStateExit(GUILayout.Toggle(fsm.get_KeepDelayedEventsOnStateExit(), SkillEditorContent.KeepDelayedEvents, new GUILayoutOption[0]));
            fsm.set_ManualUpdate(GUILayout.Toggle(fsm.get_ManualUpdate(), SkillEditorContent.ManualUpdate, new GUILayoutOption[0]));
            GUILayout.EndScrollView();
            EventType arg_641_0 = Event.get_current().get_type();

            if (EditorGUI.EndChangeCheck())
            {
                SkillEditor.SetFsmDirty(false, false);
            }
            if (Event.get_current().get_type() == null)
            {
                GUIUtility.set_keyboardControl(0);
            }
            SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
            EditorGUI.BeginDisabledGroup(true);
            GUILayout.Label("Data Version: " + fsm.get_DataVersion(), EditorStyles.get_miniLabel(), new GUILayoutOption[0]);
            EditorGUI.EndDisabledGroup();
            SkillEditorGUILayout.LockFsmGUI(fsm);
        }