예제 #1
0
    protected override void OnGUI()
    {
        if (shouldRefresh)
        {
            Repaint();
        }

        FsmEditorStyles.Init();

        FsmEditorGUILayout.ToolWindowLargeTitle(this, "Photon Setup Wizard");
        GUILayout.Space(_topSpace);
        EditorGUIUtility.LookLikeControls(200);


        // check pun version support
        if (!PlayMakerPhotonEditorUtility.IsPunVersionSupported())
        {
            GUI.color = PlayMakerPhotonEditorUtility.lightOrange;
            GUILayout.Label("WARNING: Photon Network version is newer: " + PhotonNetwork.versionPUN + ". We only support version " + PlayMakerPhotonEditorUtility.supportedPUNVersion + ".\n It is recommended to only use the Photon Network assets provided with PlayMaker, as compatibility issue may be found otherwise.", "box", GUILayout.ExpandWidth(true));
            GUI.color = Color.white;
        }

        bool hasPro = UnityEditorInternal.InternalEditorUtility.HasAdvancedLicenseOnBuildTarget(EditorUserBuildSettings.activeBuildTarget);

        if (!hasPro)
        {
            GUI.color = PlayMakerPhotonEditorUtility.lightOrange;
            GUILayout.Label("WARNING: Photon requires " + EditorUserBuildSettings.activeBuildTarget + " Pro to make an " + EditorUserBuildSettings.activeBuildTarget + " build.", "box", GUILayout.ExpandWidth(true));
            GUI.color = Color.white;
        }

        // custom layout (other parts can be overridden as well)
        //  GUILayout.Label("My Custom Editor");
        base.OnGUI();
    }
예제 #2
0
        private void DoTopicsList()
        {
            GUILayout.Space(5f);

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);

            if (Event.current.type == EventType.Layout)
            {
                guidedTour.UpdateTopicTree();
            }

            var windows = guidedTour.GetWindows();

            foreach (var window in windows)
            {
                FsmEditorGUILayout.LightDivider();
                var topics = guidedTour.GetTopics(window);
                foreach (var topic in topics)
                {
                    DoTopicGUI(topic);
                }
            }

            FsmEditorGUILayout.LightDivider();

            EditorGUILayout.EndScrollView();

            DoAutoScroll();
        }
예제 #3
0
        public override void DoGUI()
        {
            FsmEditorStyles.Init();
            FsmEditorGUILayout.ToolWindowLargeTitle(this, "Update Tools");

            OnGUI_ToolBar();
        }
예제 #4
0
        protected void DoTopicGUI(GuidedTour.Topic topic)
        {
            if (!guidedTour.IsVisible(topic))
            {
                return;
            }

            var isRepaint = Event.current.type == EventType.Repaint;

            // setup selected styles
            var isSelected = guidedTour.IsHighlighted(topic);
            var rowStyle   = isSelected ? FsmEditorStyles.ActionItemSelected : FsmEditorStyles.ActionItem;
            var labelStyle = isSelected ? FsmEditorStyles.ActionLabelSelected : FsmEditorStyles.ActionLabel;

            GUILayout.BeginHorizontal(rowStyle);

            GUILayout.Space(topic.Indent * 10f);

            if (!string.IsNullOrEmpty(topic.HelpUrl))
            {
                if (FsmEditorGUILayout.HelpButton())
                {
                    Application.OpenURL(topic.HelpUrl);
                }
            }
            else
            {
                GUILayout.Space(18f);
            }

            if (GUILayout.Button(topic.Label, labelStyle))
            {
                autoScroll = true;
                guidedTour.HighlightTopic(topic);
                FsmEditor.RepaintAll();
                GUIUtility.ExitGUI();
            }

            GUILayout.Space(20); // reserve space for scrollbar
            GUILayout.EndHorizontal();

            // Store selectedRect for auto scroll

            if (isRepaint)
            {
                if (isSelected)
                {
                    selectedRect         = GUILayoutUtility.GetLastRect();
                    selectedRect.y      -= scrollPosition.y + 20;
                    selectedRect.height += 20; // pad to scroll a little further
                }

                if (topic.IsNew(NewVersion))
                {
                    var rect = GUILayoutUtility.GetLastRect();
                    GUI.Label(rect, NewTag, FsmEditorStyles.NewTag);
                }
            }
        }
        public void OnGUI()
        {
            FsmEditorStyles.Init();

            FsmEditorGUILayout.ToolWindowLargeTitle(this, "Upgrade Guide");

            // Hack fix needed in 1.7.8 (fixed in 1.8.0)
            GUILayout.Space(20);

            scrollPosition = GUILayout.BeginScrollView(scrollPosition);

            EditorGUILayout.HelpBox("Always BACKUP projects before updating!", MessageType.Error);

            GUILayout.Label("Version 1.7.8", EditorStyles.boldLabel);

#if (UNITY_5_0 || UNITY_5)
            EditorGUILayout.HelpBox("Update PlayMaker for Unity 5 compatibility!" +
                                    "\nUpdate in the Unity 5 Asset store, or " +
                                    "download from the Hutong Games store.", MessageType.Error);
#else
            EditorGUILayout.HelpBox("This is a maintainance release for Unity 5 compatibility. " +
                                    "\nFor full Unity 5 compatibility please update PlayMaker in the Unity 5 Asset Store and re-import. " +
                                    "", MessageType.Info);
#endif

            GUILayout.Label("Unity 5 Upgrade Notes", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Unity 5 removed component property shortcuts from GameObject. " +
                                    "\n\nThe Unity auto update process replaces these properties with GetComponent calls. " +
                                    "In many cases this is fine, but some third party actions and addons might need manual updating! " +
                                    "Please post on the PlayMaker forums and contact the original authors for help." +
                                    "\n\nIf you used these GameObject properties in Get Property or Set Property actions " +
                                    "they are no longer valid, and you need to instead point to the Component directly. " +
                                    "E.g., Drag the Component (NOT the GameObject) into the Target Object field." +
                                    "\n", MessageType.Warning);

            GUILayout.Label("Unity 4.6 Upgrade Notes", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Find support for the new Unity GUI online in our Addons page.", MessageType.Info);
            EditorGUILayout.HelpBox("PlayMakerGUI is only needed if you use OnGUI Actions. " +
                                    "If you don't use OnGUI actions un-check Auto-Add PlayMakerGUI in PlayMaker Preferences.", MessageType.Info);


            GUILayout.EndScrollView();

            GUILayout.FlexibleSpace();

            EditorGUI.BeginChangeCheck();
            var dontShowAgain = GUILayout.Toggle(!showOnLoad, "Don't Show Again Until Next Update");
            if (EditorGUI.EndChangeCheck())
            {
                showOnLoad = !dontShowAgain;
                EditorPrefs.SetBool("Playmaker.ShowUpgradeGuide", showOnLoad);
            }

            if (GUILayout.Button("Online Release Notes"))
            {
                Application.OpenURL(urlReleaseNotes);
            }
        }
        public override void DoGUI()
        {
            FsmEditorStyles.Init();
            FsmEditorGUILayout.ToolWindowLargeTitle(this, "Guided Tour");
            EditorGUIUtility.labelWidth = 200;

            //EditorGUILayout.HelpBox("NOTE: This is a BETA feature, please give feedback on the Playmaker Forums. Thanks!", MessageType.Info);

            DoGuidedTourGUI();
        }
예제 #7
0
        public override bool OnGUI()
        {
            // If you need to reference the action directly:
            var action       = target as BaseDelegateAction;
            var delegateInfo = action.delegateInterface != null?TypeCache.GetIFsmActionDelegateInfoByFullName(action.delegateInterface.Value) : null;

            isDirty = false;

            //
            // TODO: Show errors when these values don't exist anymore
            //

            // Interface choice
            EditorGUILayout.BeginHorizontal();
            {
                FsmEditorGUILayout.PrefixLabel("Delegate");

                var buttonRect    = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.popup);
                var interfaceName = delegateInfo != null ? delegateInfo.type.Name : "";

                if (GUI.Button(buttonRect, interfaceName, EditorStyles.popup))
                {
                    GetDelegateMenu(delegateInfo != null ? delegateInfo.choiceIndex : 0).DropDown(buttonRect);
                    delegateInfo = DelegateInfo;
                }
            }
            EditorGUILayout.EndHorizontal();

            FsmEditorGUILayout.ReadonlyTextField(action.delegateInterface != null ? action.delegateInterface.Value : "");

            //FsmEditorGUILayout.LightDivider();

            // Method choice
            EditorGUILayout.BeginHorizontal();
            {
                var enabledBefore = GUI.enabled;
                GUI.enabled = GUI.enabled && delegateInfo != null;

                FsmEditorGUILayout.PrefixLabel("Method");

                var buttonRect = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.popup);

                if (GUI.Button(buttonRect, GetMethodName(), EditorStyles.popup))
                {
                    GetMethodMenu().DropDown(buttonRect);
                }

                GUI.enabled = enabledBefore;
            }
            EditorGUILayout.EndHorizontal();

            FsmEditorGUILayout.ReadonlyTextField(action.methodSignature != null ? action.methodSignature.Value : "");

            return(GUI.changed || isDirty);
        }
예제 #8
0
        public override void DoGUI()
        {
            FsmEditorStyles.Init();

            GUILayout.BeginVertical();

            FsmEditorGUILayout.PlaymakerHeader(this);

            GUILayout.Space(10);
            GUILayout.Label("© Hutong Games LLC. All Rights Reserved.", EditorStyles.miniLabel);

            GUILayout.Label("Version 1.7.8.4");
            if (VersionInfo.PlayMakerVersionInfo != "")
            {
                EditorGUILayout.HelpBox(VersionInfo.PlayMakerVersionInfo, MessageType.None);
            }

#if (UNITY_5_0 || UNITY_5)
            if (showUpdateWarning)
            {
                EditorGUILayout.HelpBox("Update PlayMaker for Unity 5!" +
                                        "\nUpdate in the Unity 5 Asset store, or " +
                                        "download from the Hutong Games store.", MessageType.Error);
            }
#endif

            EditorGUILayout.HelpBox(string.Format(Strings.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"),
                                    MessageType.None);

            if (GUILayout.Button(Strings.AboutPlaymaker_Release_Notes))
            {
                EditorCommands.OpenWikiPage(WikiPages.ReleaseNotes);
            }

            if (GUILayout.Button(Strings.AboutPlaymaker_Hutong_Games_Link))
            {
                Application.OpenURL("http://www.hutonggames.com/");
            }

            GUILayout.Space(5);

            GUILayout.EndVertical();

            if (!heightHasBeenSet && Event.current.type == EventType.repaint)
            {
                SetWindowHeightToFitContents();
            }
        }
예제 #9
0
        public void OnGUI()
        {
            FsmEditorStyles.Init();

            FsmEditorGUILayout.ToolWindowLargeTitle(this, "Upgrade Guide");

            // Hack fix needed in 1.7.8 (fixed in 1.8.0)
            GUILayout.Space(20);

            scrollPosition = GUILayout.BeginScrollView(scrollPosition);

            EditorGUILayout.HelpBox("Always BACKUP projects before updating!", MessageType.Error);

            GUILayout.Label("Version 1.7.8", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("This is a maintainance release for Unity 5 compatibility. " +
                                    "\nNew features and bug fixes coming soon in 1.8.0", MessageType.Info);
            EditorGUILayout.HelpBox("The Playmaker About Window still says 1.7.7 since the dlls were not recompiled for this version.", MessageType.Info);

            GUILayout.Label("Unity 5 Upgrade Notes", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Unity 5 removed component property shortcuts from GameObject. " +
                                    "\n\nThe Unity auto update process replaces these properties with GetComponent calls. " +
                                    "In many cases this is fine, but some third party actions and addons might need manual updating! " +
                                    "Please post on the PlayMaker forums and contact the original authors for help." +
                                    "\n\nIf you used these GameObject properties in Get Property or Set Property actions " +
                                    "they will be gone, and you need to reset them to point to the component directly. " +
                                    "E.g., Drag the component into the property field instead of the GameObject." +
                                    "\n", MessageType.Warning);

            GUILayout.Label("Unity 4.6 Upgrade Notes", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Find support for the new Unity GUI online in our Addons page.", MessageType.Info);
            EditorGUILayout.HelpBox("PlayMakerGUI is only needed if you use OnGUI Actions. " +
                                    "If you don't use OnGUI actions un-check Auto-Add PlayMakerGUI in PlayMaker Preferences.", MessageType.Info);


            GUILayout.EndScrollView();

            GUILayout.FlexibleSpace();

            EditorGUI.BeginChangeCheck();
            var dontShowAgain = GUILayout.Toggle(!showOnLoad, "Don't Show Again Until Next Update");

            if (EditorGUI.EndChangeCheck())
            {
                showOnLoad = !dontShowAgain;
                EditorPrefs.SetBool("Playmaker.ShowUpgradeGuide", showOnLoad);
            }

            if (GUILayout.Button("Online Release Notes"))
            {
                Application.OpenURL(urlReleaseNotes);
            }
        }
        public void OnGUI()
        {
            FsmEditorStyles.Init();


            FsmEditorGUILayout.ToolWindowLargeTitle(this, "Event Proxy Creator");

            GUILayout.Label(" ");
            GUILayout.Label("This Proxy lets you create a Component with a public method.\n" +
                            "That method will send a PlayMaker event.\n" +
                            "Use this when you expect Unity or third party assets to fire messages\n" +
                            "and you want to catch that message as a PlayMaker Event");
            OnGUI_DoEnumDefinitionForm();
        }
예제 #11
0
    protected override void OnGUI()
    {
        if (shouldRefresh)
        {
            Repaint();
        }

        FsmEditorStyles.Init();

        FsmEditorGUILayout.ToolWindowLargeTitle(this, "Photon Setup Wizard");
        GUILayout.Space(_topSpace);
#if UNITY_3_5
        EditorGUIUtility.LookLikeControls(200);
#endif

        // check pun version support
        if (!PlayMakerPhotonEditorUtility.IsPunVersionSupported())
        {
            GUI.color = PlayMakerPhotonEditorUtility.lightOrange;
            GUILayout.Label("WARNING: Photon Network version is newer: " + PhotonNetwork.versionPUN + ". We only support version " + PlayMakerPhotonEditorUtility.supportedPUNVersion + ".\n It is recommended to only use the Photon Network assets provided with PlayMaker, as compatibility issue may be found otherwise.", "box", GUILayout.ExpandWidth(true));
            GUI.color = Color.white;
        }



                #if PLAYMAKER_1_9_OR_NEWER
        if (!FsmEditorSettings.UseLegacyNetworking || !FsmEditorSettings.ShowNetworkSync)
        {
            FsmEditorSettings.UseLegacyNetworking = true;
            FsmEditorSettings.ShowNetworkSync     = true;
        }

        // doesn't work, we need to check with PLAYMAKER_LEGACY_NETWORK compile flag
        //EditorStartupPrefs.UseLegacyNetworking = GUILayout.Toggle(EditorStartupPrefs.UseLegacyNetworking,"enabled");

//			#if !PLAYMAKER_LEGACY_NETWORK
//			GUI.color =  PlayMakerPhotonEditorUtility.lightOrange;
//			GUILayout.Label("WARNING: PlayMaker needs to have its network UI system enabled","box",GUILayout.ExpandWidth(true));
//			GUI.color = Color.white;
//
//			if (GUILayout.Button(new GUIContent("Enable PlayMaker Network UI", "Displays the network sync property for Fsm Variables")))
//			{
//				PlayMakerEditorUtils.MountScriptingDefineSymbolToAllTargets("PLAYMAKER_LEGACY_NETWORK");
//			}
//
//			#endif
                #endif

        base.OnGUI();
    }
예제 #12
0
        public override bool OnGUI()
        {
            var action = (target as InternalAction);

            if (action._event == null)
            {
                action._event = new FsmString();
            }

            var eventChanged = EditEventField("Event", action.Fsm, action._event);

            FsmEditorGUILayout.LightDivider();

            return(base.OnGUI() || eventChanged);
        }
예제 #13
0
        void DrawEvents(string fieldKey, string fieldName, Dictionary <string, FsmEvent> currentValueMapping, Dictionary <string, FsmEvent> newValueMapping, bool draw)
        {
            FsmEvent ev;

            if (!currentValueMapping.TryGetValue(fieldKey, out ev))
            {
                ev = null;
            }

            if (draw)
            {
                ev = FsmEditorGUILayout.EventPopup(new GUIContent(fieldName), target.Fsm.Events.ToList(), ev);
            }
            newValueMapping.Add(fieldKey, ev);
        }
        void OnGUI_HorizontalResizeScrollView()
        {
            if (currentScrollViewHeight < 0)
            {
                currentScrollViewHeight = 100;

                cursorChangeRect = new Rect(0, currentScrollViewHeight, this.position.width, 5f);
            }
            cursorChangeRect.height = 5f;

            FsmEditorGUILayout.Divider();

            GUI.Box(cursorChangeRect, "", "label");

            FsmEditorGUILayout.Divider();

            GUILayout.Space(5);

            if (resize)
            {
                EditorGUIUtility.AddCursorRect(this.position, MouseCursor.ResizeVertical);

                currentScrollViewHeight = Mathf.Max(65, Event.current.mousePosition.y);

                if (Event.current.type == EventType.MouseUp)
                {
                    resize = false;
                }
            }
            else
            {
                EditorGUIUtility.AddCursorRect(cursorChangeRect, MouseCursor.ResizeVertical);
#if UNITY_5_3_OR_NEWER
                if (Event.current.type == EventType.MouseDown && cursorChangeRect.Contains(Event.current.mousePosition))
                {
#else
                if (Event.current.type == EventType.mouseDown && cursorChangeRect.Contains(Event.current.mousePosition))
                {
#endif
                    resize = true;
                    currentScrollViewHeight = Event.current.mousePosition.y;
                }
            }

            cursorChangeRect.Set(cursorChangeRect.x, currentScrollViewHeight, this.position.width, cursorChangeRect.height);
        }

        bool enumListFoldOut;
예제 #15
0
        public override bool OnGUI()
        {
            var tweenFade = target as PlayMaker.Actions.TweenFade;

            EditorGUI.BeginChangeCheck();

            EditField("gameObject");

            FsmEditorGUILayout.ReadonlyTextField("Fade Type: " + tweenFade.type);

            EditField("tweenDirection", "Fade");
            EditField("value");

            DoEasingUI();

            return(EditorGUI.EndChangeCheck());
        }
예제 #16
0
    public static bool EditFsmXpathQueryField(Fsm fsm, FsmXpathQuery target)
    {
        bool edited = false;

        target._foldout = FsmEditorGUILayout.BoldFoldout(target._foldout, new GUIContent("xPath Query"));

        if (target.xPathQuery == null)
        {
            target.xPathQuery = new FsmString();
        }

        if (target._foldout)
        {
                        #if PLAYMAKER_1_8_OR_NEWER
            PlayMakerInspectorUtils.SetActionEditorVariableSelectionContext(target, target.GetType().GetField("xPathQuery"));
                        #endif


            target.xPathQuery = VariableEditor.FsmStringField(new GUIContent("xPath Query"), fsm, target.xPathQuery, null);
        }

        if (string.IsNullOrEmpty(target.xPathQuery.Value))
        {
        }
        else
        {
            if (target.xPathVariables == null || target.xPathVariables.Length == 0)
            {
                if (!target._foldout)
                {
                    EditorGUILayout.LabelField("xPath Query", target.xPathQuery.Value);
                }
            }
            else
            {
                EditorGUILayout.LabelField("xPath Query parsed", target.ParseXpathQuery(fsm));
            }
        }
        if (target._foldout)
        {
            edited = edited || EditFsmXpathQueryVariablesProperties(fsm, target);
        }


        return(edited);
    }
예제 #17
0
        void OnGUI_ToolBar()
        {
            FsmEditorGUILayout.Divider();

            GUILayout.Space(5);
            if (!ActionInProgress)
            {
                if (GUILayout.Button("Re-Save All Fsm In Builds"))
                {
                    DoResaveAllFsmsInBuild();
                }
            }
            else
            {
                OnGUI_DoToolFeedback();
            }
        }
        void OnGUI_DoEnumDefinitionForm()
        {
            // NAME
            GUILayout.Label("Class Name");
            ClassName = GUILayout.TextField(ClassName);

            // Method Name
            GUILayout.Label("Method/Message Name");
            ClassName = GUILayout.TextField(ClassName);

            FsmEditorGUILayout.Divider();

            if (GUILayout.Button("Create"))             // Label "Save Changes" when we detected that we are editing an existing enum
            {
                //enumCreator.CreateEnum(currentEnum);
            }
        }
예제 #19
0
    public override void OnInspectorGUI()
    {
        FsmEditorStyles.Init();

        serializedObject.Update();

        EditorGUI.BeginChangeCheck();

        GUILayout.Label("Category - used in Template Browser and menus");
        EditorGUILayout.PropertyField(categoryProperty, GUIContent.none);

        if (multiline == null)
        {
            multiline = new GUIStyle(EditorStyles.textField)
            {
                wordWrap = true
            };
        }
        descriptionProperty.stringValue = EditorGUILayout.TextArea(descriptionProperty.stringValue, multiline, GUILayout.MinHeight(60));
        FsmEditorGUILayout.DrawHintText(descriptionProperty.stringValue, "Description");

        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
            FsmTemplateSelector.Refresh();
        }
        GUILayout.BeginHorizontal();

        //GUILayout.FlexibleSpace();

        if (GUILayout.Button(findInBrowser))
        {
            FsmTemplateSelector.FindTemplateInBrowser((FsmTemplate)target);
        }

        if (GUILayout.Button(editButton))
        {
            FsmEditorWindow.OpenWindow((FsmTemplate)target);
        }

        GUILayout.EndHorizontal();

        EditorGUILayout.HelpBox(Strings.Hint_Exporting_Templates, MessageType.None);
    }
        // Help panel for selected topic
        private void DoBottomPanel()
        {
            GUILayout.BeginVertical(FsmEditorStyles.BottomBarBG);

            FsmEditorGUILayout.Divider();

            GUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins, GUILayout.Height(helpHeight));

            helpScrollPosition = EditorGUILayout.BeginScrollView(helpScrollPosition);

            if (guidedTour.SelectedTopic != null)
            {
                var topic = guidedTour.SelectedTopic;

                GUILayout.BeginHorizontal();
                GUILayout.Label(topic.Label.text, EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                if (!string.IsNullOrEmpty(topic.HelpUrl))
                {
                    if (FsmEditorGUILayout.HelpButton())
                    {
                        Application.OpenURL(topic.HelpUrl);
                    }
                }

                GUILayout.EndHorizontal();

                if (!string.IsNullOrEmpty(topic.Label.tooltip))
                {
                    EditorGUILayout.Space();
                    GUILayout.Label(topic.Label.tooltip, helpStyle);
                }

                EditorGUILayout.Space();
                topic.HelpText.DoGUILayout(position.width);
            }

            EditorGUILayout.EndScrollView();
            GUILayout.Space(5);
            GUILayout.EndVertical();

            GUILayout.EndVertical();
        }
예제 #21
0
        public void OnGUI()
        {
            FsmEditorStyles.Init();

            // set style ot use rich text.
            if (labelStyle == null)
            {
                labelStyle          = GUI.skin.GetStyle("Label");
                labelStyle.richText = true;
            }

            // unfocus invisible field
            GUI.SetNextControlName(_unfocusControlName);
            GUI.TextField(new Rect(0, -100, 100, 20), "");

            FsmEditorGUILayout.ToolWindowLargeTitle(this, "Enum Creator");

            OnGUI_HorizontalSplitView();
        }
예제 #22
0
        public override bool OnGUI()
        {
            EditorGUI.BeginChangeCheck();

            EditField("target");

            var tweenColor = (PlayMaker.Actions.TweenColor)target;

            switch (tweenColor.target)
            {
            case PlayMaker.Actions.TweenColor.Target.GameObject:
                EditField("gameObject");
                FsmEditorGUILayout.ReadonlyTextField("Type: " + tweenColor.type);
                break;

            case PlayMaker.Actions.TweenColor.Target.Variable:
                EditField("variable");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            EditField("fromOption");
            DoTargetValueGUI(tweenAction.fromOption, "fromValue");
            if (tweenAction.fromOption == TargetValueOptions.Offset)
            {
                EditField("fromOffsetBlendMode", "Blend Mode");
            }

            EditField("toOption");
            DoTargetValueGUI(tweenAction.toOption, "toValue");
            if (tweenAction.fromOption == TargetValueOptions.Offset)
            {
                EditField("toOffsetBlendMode", "Blend Mode");
            }

            DoEasingUI();

            return(EditorGUI.EndChangeCheck());
        }
예제 #23
0
    public static bool EditFsmXpathQueryField(Fsm fsm, FsmXpathQuery target)
    {
        bool edited = false;

        target._foldout = FsmEditorGUILayout.BoldFoldout(target._foldout, new GUIContent("xPath Query"));

        if (target.xPathQuery == null)
        {
            target.xPathQuery = new FsmString();
        }

        if (target._foldout)
        {
            target.xPathQuery = VariableEditor.FsmStringField(new GUIContent("xPath Query"), fsm, target.xPathQuery, null);
        }

        if (string.IsNullOrEmpty(target.xPathQuery.Value))
        {
        }
        else
        {
            if (target.xPathVariables == null || target.xPathVariables.Length == 0)
            {
                if (!target._foldout)
                {
                    EditorGUILayout.LabelField("xPath Query", target.xPathQuery.Value);
                }
            }
            else
            {
                EditorGUILayout.LabelField("xPath Query parsed", target.ParseXpathQuery(fsm));
            }
        }
        if (target._foldout)
        {
            edited = edited || EditFsmXpathQueryVariablesProperties(fsm, target);
        }


        return(edited);
    }
예제 #24
0
        public bool EditEventField(string label, Fsm fsm, FsmString _event)
        {
            editFieldChanged = false;
            currentEditField = _event;

            EditorGUILayout.BeginHorizontal();
            {
                FsmEditorGUILayout.PrefixLabel(label);

                var buttonRect       = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.popup);
                var currentEventName = _event != null ? _event.Value : "";

                if (GUI.Button(buttonRect, currentEventName, EditorStyles.popup))
                {
                    FsmEditorGUILayout.GenerateEventSelectionMenu(
                        fsm, FindEvent(currentEventName), OnSelect, OnNew).DropDown(buttonRect);
                }
            }

            EditorGUILayout.EndHorizontal();

            return(editFieldChanged);
        }
예제 #25
0
        public void OnGUI()
        {
            wantsMouseMove = true;
            if (Event.current.type == EventType.MouseMove)
            {
                Repaint();
            }


            if (isCompiling != EditorApplication.isCompiling)
            {
                isCompiling = EditorApplication.isCompiling;
            }

            FsmEditorStyles.Init();

            // set style ot use rich text.
            if (labelStyle == null)
            {
                labelStyle          = GUI.skin.GetStyle("Label");
                labelStyle.richText = true;
            }

            FsmEditorGUILayout.ToolWindowLargeTitle(this, "Event Proxy Creator");

            // for the banner odd bug on height
            GUILayout.Space(15);

            GUILayout.Label("This wizard lets you create a Component with a public method.\n" +
                            "When this method is called, it will send a PlayMaker event.\n" +
                            "You can define this PlayMaker event in the component Inspector.\n" +
                            "\nUse this when you expect Unity or third parties to fire messages\n" +
                            "and you want to catch that message as a PlayMaker Event");

            FsmEditorGUILayout.Divider();

            OnGUI_DoDefinitionForm();

            FsmEditorGUILayout.Divider();


            OnGUI_DoProxyList();

            GUILayout.Space(5);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();

            if (isCompiling)
            {
                GUILayout.Label("Unity is compiling, please wait");
            }
            else
            {
                GUILayout.Label(" ");
            }
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }
예제 #26
0
        void OnGUI_DoEnumDefinitionForm()
        {
            Color _orig = Color.clear;

            ReBuildPreview = false;

            if (currentEnumFileDetails != null)
            {
                GUILayout.Label("You are editing an existing enum");
                FsmEditorGUILayout.Divider();
            }

            // FOLDER
            _orig = GUI.color;
            if (!currentEnum.FolderPathValidation.success)
            {
                GUI.color = new Color(255, 165, 0);
            }
            GUILayout.Label("Project Folder: <color=#ffa500><b>" + currentEnum.FolderPathValidation.message + "</b></color>");
            currentEnum.FolderPath = GUILayout.TextField(currentEnum.FolderPath);
            GUI.color = _orig;

            // NAMESPACE
            _orig = GUI.color;
            if (!currentEnum.NameSpaceValidation.success)
            {
                GUI.color = Color.red;
            }
            GUILayout.Label("NameSpace: <color=#B20000><b>" + currentEnum.NameSpaceValidation.message + "</b></color>");
            string _nameSpace = GUILayout.TextField(currentEnum.NameSpace);

            GUI.color = _orig;
            if (!string.Equals(_nameSpace, currentEnum.NameSpace))
            {
                currentEnum.NameSpace = _nameSpace;
                ReBuildPreview        = true;
            }

            // NAME
            _orig = GUI.color;
            if (!currentEnum.NameValidation.success)
            {
                GUI.color = Color.red;
            }
            GUILayout.Label("Enum Name: <color=#B20000><b>" + currentEnum.NameValidation.message + "</b></color>");
            string _name = GUILayout.TextField(currentEnum.Name);

            GUI.color = _orig;
            if (!string.Equals(_name, currentEnum.Name))
            {
                currentEnum.Name = _name;
                ReBuildPreview   = true;
            }

            // ENTRIES

            enumEntriesScrollPos = GUILayout.BeginScrollView(enumEntriesScrollPos);
            int count = currentEnum.entries.Count;

            List <string> _origEntries = new List <string>(currentEnum.entries);

            ReorderableListGUI.Title("Enum Entries:  <color=#B20000><b>" + currentEnum.EntriesValidation.message + "</b></color>");
            ReorderableListGUI.ListField(currentEnum.entries, DrawListItem);

            if (currentEnum.entries.Count != count || _origEntries != currentEnum.entries)
            {
                ReBuildPreview = true;
            }

            GUILayout.EndScrollView();

            FsmEditorGUILayout.Divider();


            //if (Event.current.type != EventType.Layout)
            //{
            if (!currentEnum.DefinitionValidation.success)
            {
                GUILayout.Label("<color=#B20000><b>" + currentEnum.DefinitionValidation.message + "</b></color>");
            }
            //}
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Clear"))
            {
                StartEditingNewEnum();
            }

            if (currentEnumFileDetails != null)
            {
                if (GUILayout.Button("Revert"))
                {
                    StartEditingExistingEnum(_sourceDetails);
                }
            }


            if (currentEnum.DefinitionValidation.success)
            {
                if (GUILayout.Button("Create"))                 // Label "Save Changes" when we detected that we are editing an existing enum
                {
                    enumCreator.CreateEnum(currentEnum);
                }
            }
            else
            {
                Color _color = GUI.color;

                _color.a  = 0.5f;
                GUI.color = _color;
                GUILayout.Label("Create", "Button");
                _color.a  = 1f;
                GUI.color = _color;
            }

            GUILayout.EndHorizontal();


            FsmEditorGUILayout.Divider();

            GUILayout.FlexibleSpace();

            bool newSourcePreviewFoldout = EditorGUILayout.Foldout(sourcePreviewFoldout, "Code Source Preview:");

            if (newSourcePreviewFoldout != sourcePreviewFoldout)
            {
                sourcePreviewFoldout = newSourcePreviewFoldout;
                EditorPrefs.SetBool(__CodeSourceFoldOutPrefKey__, sourcePreviewFoldout);
            }

            if (sourcePreviewFoldout)
            {
                sourcePreviewScrollPos = GUILayout.BeginScrollView(sourcePreviewScrollPos);
                GUILayout.TextArea(currentEnum.EnumLiteralPreview);
                GUILayout.EndScrollView();
            }

            /*
             * if ( ReBuildPreview || string.IsNullOrEmpty(currentEnum.ScriptLiteral) )
             * {
             *      currentEnum.ValidateDefinition();
             *
             *      enumCreator.BuildScriptLiteral(currentEnum);
             *      Repaint();
             * }
             */
        }
예제 #27
0
    protected void OnBuildPlayMakerMainWizard()
    {
        //	GUILayout.Space(_topSpace);


        // JFF : modified the look, but need more checks then just "notSet", not sure if we need to go that far tho.
        // settings
        GUILayout.BeginHorizontal();
        GUILayout.Label("Settings", EditorStyles.boldLabel, GUILayout.Width(100));

        bool isNotSet = PhotonNetwork.PhotonServerSettings.HostType == ServerSettings.HostingOption.NotSet;

        if (!EditorApplication.isPlaying)
        {
            if (isNotSet)
            {
                GUI.color = PlayMakerPhotonEditorUtility.lightOrange;
                if (GUILayout.Button(new GUIContent("Setup", "Setup wizard for setting up your own server or the cloud.")))
                {
                    userHasSeenWizardIntro = true;

                    PhotonEditor.ShowRegistrationWizard();
                    //base.photonSetupState = PhotonEditor.PhotonSetupStates.RegisterForPhotonCloud;
                    //base.isSetupWizard = false;
                    //InitPhotonSetupWindow();
                }
                GUI.color = Color.white;



                //	EditorUtility.DisplayDialog("Warning", "You have not yet run the Photon setup wizard! Your game won't be able to connect. See Windows -> Photon Unity Networking.", "Ok");
            }
            else
            {
                if (GUILayout.Button(new GUIContent("Setup", "Setup wizard for setting up your own server or the cloud.")))
                {
                    PhotonEditor.ShowRegistrationWizard();
                    //base.photonSetupState = PhotonEditor.PhotonSetupStates.RegisterForPhotonCloud;
                    //base.isSetupWizard = false;
                    //InitPhotonSetupWindow();
                }
                GUI.color = Color.green;
                GUILayout.Label("Photon server is set up properly.", "box", GUILayout.ExpandWidth(true));
                GUI.color = Color.white;
            }

            if (FsmEditorGUILayout.HelpButton("Photon must be set up before working on a multi user scene"))
            {
                EditorUtility.OpenWithDefaultApp(PhotonSetupHelpUrl);
            }
        }
        else
        {
            GUILayout.Label("Game is playing. To edit Photon Settings, stop playing", "box", GUILayout.ExpandWidth(true));
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(12);

        if (!EditorApplication.isPlaying)
        {
            if (!isNotSet)
            {
                BuildSceneWizard();
            }
            else
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("", EditorStyles.boldLabel, GUILayout.Width(100));
                GUILayout.Label("You need to first set up Photon if you want to build a multi user scene", "box", GUILayout.ExpandWidth(true));
                GUILayout.EndHorizontal();
            }
        }
        GUILayout.FlexibleSpace();
        BuildDocSection();
    }
예제 #28
0
    void BuildSceneWizard()
    {
        // JFF : Adds the playmaker proxy, and only display that button if the scene doesn't have it already.
        // mabe make it in red or a lot clearer
        GUILayout.BeginHorizontal();
        GUILayout.Label("Scene", EditorStyles.boldLabel, GUILayout.Width(100));

        if (!PlayMakerPhotonEditorUtility.IsSceneSetup())
        {
            GUI.color = PlayMakerPhotonEditorUtility.lightOrange;
            if (GUILayout.Button(new GUIContent("Add Photon System to the scene", "Required for Photon and PlayMaker to work together")))
            {
                PlayMakerPhotonEditorUtility.DoCreateRpcProxy();
            }
            GUI.color = Color.white;
            if (FsmEditorGUILayout.HelpButton("Required for scenes that will use Photon"))
            {
                EditorUtility.OpenWithDefaultApp(PhotonGOPhotonProxyHelpUrl);
            }
        }
        else
        {
            GUI.color = Color.green;
            GUILayout.Label("The scene is set up properly.", "box", GUILayout.ExpandWidth(true));
        }
        GUI.color = Color.white;
        GUILayout.EndHorizontal();

        if (!PlayMakerPhotonEditorUtility.IsSceneSetup())
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("", EditorStyles.boldLabel, GUILayout.Width(100));
            GUILayout.Label("You need to first add the Photon System Proxy Prefab if you want this scene to work for multi users and PlayMaker", "box", GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();
        }
        GUILayout.Space(22);


        // JFF : Adds a photon view to the selected gameObject, will automatically add the gameObject proxy if required.
        if (Selection.activeGameObject)
        {
            // check that it is not the photon proxy
            PlayMakerPhotonProxy prox = Selection.activeGameObject.GetComponent <PlayMakerPhotonProxy>();

            if (prox != null)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Photon Proxy", EditorStyles.boldLabel, GUILayout.Width(100));
                GUILayout.Label("This GameObject must not be edited. It is the bridge between Photon and PlayMaker", "box", GUILayout.ExpandWidth(true));


                if (FsmEditorGUILayout.HelpButton("Photon Proxy must not be edited"))
                {
                    EditorUtility.OpenWithDefaultApp(PhotonGOPhotonProxyHelpUrl);
                }

                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Component", EditorStyles.boldLabel, GUILayout.Width(100));

                //object[] objects = Selection.GetFiltered(typeof(PlayMakerFSM),SelectionMode.Unfiltered);

                //PlayMakerFSM fsm = objects[0] as PlayMakerFSM;
                GUILayout.BeginVertical();
                GUILayout.BeginHorizontal();
                if (GUILayout.Button(new GUIContent("Add network-ready FSM to  '" + Selection.activeGameObject.name + "'", "Required for Fsm that will use Photon")))
                {
                    PlayMakerPhotonEditorUtility.DoCreateFsmWithPhotonView();
                }

                if (FsmEditorGUILayout.HelpButton("Required on GameObject that will use Photon network engine"))
                {
                    EditorUtility.OpenWithDefaultApp(PhotonGOFsmSetupHelpUrl);
                }

                GUILayout.EndHorizontal();

                GUILayout.Space(12);

                GUILayout.BeginHorizontal();
                if (GUILayout.Button(new GUIContent("Add Photon View to '" + Selection.activeGameObject.name + "'", "Required on GameObject that will use Photon")))
                {
                    PlayMakerPhotonEditorUtility.DoAddPhotonView();
                }

                if (FsmEditorGUILayout.HelpButton("Required on GameObject that will be instantiated over the Photon network"))
                {
                    EditorUtility.OpenWithDefaultApp(PhotonGOPhotonViewSetupHelpUrl);
                }

                GUILayout.EndHorizontal();
                GUILayout.EndVertical();

                GUILayout.EndHorizontal();
            }


            GUILayout.Space(22);
        }
    }
예제 #29
0
    public override void OnInspectorGUI()
    {
        LinkerData _target = target as LinkerData;

        FsmEditorStyles.Init();

        //GUILayout.Box("Hello",FsmEditorStyles.LargeTitleWithLogo,GUILayout.Height(42f));
        GUI.Box(new Rect(0f, 0f, Screen.width, 42f), "Linker Wizard", FsmEditorStyles.LargeTitleWithLogo);


        GUILayout.Label("1: Make sure you installed them actions");

        if (GUILayout.Button("Install Actions"))
        {
            Debug.Log("importing package " + Application.dataPath + "/" + ActionsPackagePath);

            AssetDatabase.ImportPackage(Application.dataPath + "/" + ActionsPackagePath, true);
        }


        GUILayout.Label("2: Check 'debug' for tracking all reflections");

        EditorGUI.indentLevel++;
        bool _debug = EditorGUILayout.Toggle("Debug", _target.debug);

        EditorGUI.indentLevel--;
        if (_debug != _target.debug)
        {
            _target.debug = _debug;
            EditorUtility.SetDirty(_target);
        }

        GUILayout.Label("3: Run your scenes from start to finish");
        GUILayout.Label("   Check the preview below for usages as they come ");

        if (_target.linkerEntries.Count > 0)
        {
            GUILayout.Label("4: Update Linker xml file");
            if (GUILayout.Button("Update Linker content"))
            {
                UpdateLinkerContent(_target);
                GUIUtility.ExitGUI();
            }
            if (_target.LinkContentUpdateDone)
            {
                GUILayout.Label("5: You can now publish and test on device");
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Ping link.xml"))
                {
                    EditorGUIUtility.PingObject(_target.Asset);
                }
                if (GUILayout.Button("Select link.xml"))
                {
                    Selection.activeObject = _target.Asset;
                    EditorGUIUtility.PingObject(_target.Asset);
                }
                GUILayout.EndHorizontal();
            }
        }


        GUILayout.BeginHorizontal(GUILayout.Height(25));
        GUILayout.BeginVertical();
        GUILayout.FlexibleSpace();
        FsmEditorGUILayout.Divider();
        GUILayout.FlexibleSpace();
        GUILayout.EndVertical();
        GUILayout.Label("preview", GUILayout.ExpandWidth(false));
        GUILayout.BeginVertical();
        GUILayout.FlexibleSpace();
        FsmEditorGUILayout.Divider();
        GUILayout.FlexibleSpace();
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();


        foreach (KeyValuePair <string, List <string> > entry in _target.linkerEntries)
        {
            GUILayout.Label(entry.Key);
            foreach (string _item in entry.Value)
            {
                GUILayout.Label("    " + _item);
            }
        }
    }
예제 #30
0
        void OnGUI_DoDefinitionForm()
        {
            Color _orig = Color.clear;

            ReBuildPreview = false;

            /*
             * if (currentFileDetails!=null)
             * {
             *      GUILayout.Label("You are editing an existing enum");
             *      FsmEditorGUILayout.Divider();
             * }
             */
            // FOLDER
            _orig = GUI.color;
            if (!currentDefinition.FolderPathValidation.success)
            {
                GUI.color = new Color(255, 165, 0);
            }
            GUILayout.Label("Project Folder: <color=#ffa500><b>" + currentDefinition.FolderPathValidation.message + "</b></color>");
            currentDefinition.FolderPath = GUILayout.TextField(currentDefinition.FolderPath);
            GUI.color = _orig;

            // NAMESPACE
            _orig = GUI.color;
            if (!currentDefinition.NameSpaceValidation.success)
            {
                GUI.color = Color.red;
            }
            GUILayout.Label("NameSpace: <color=#B20000><b>" + currentDefinition.NameSpaceValidation.message + "</b></color>");
            string _nameSpace = GUILayout.TextField(currentDefinition.NameSpace);

            GUI.color = _orig;
            if (!string.Equals(_nameSpace, currentDefinition.NameSpace))
            {
                currentDefinition.NameSpace = _nameSpace;
                ReBuildPreview = true;
            }

            // Method Name
            _orig = GUI.color;
            if (!currentDefinition.PublicMethodValidation.success)
            {
                GUI.color = Color.red;
            }
            GUILayout.Label("Public Method/Message Name: <color=#B20000><b>" + currentDefinition.PublicMethodValidation.message + "</b></color>");
            string _methodName = GUILayout.TextField(currentDefinition.PublicMethodName);

            GUI.color = _orig;
            if (!string.Equals(_methodName, currentDefinition.PublicMethodName))
            {
                currentDefinition.Name             = _methodName + "Proxy";
                currentDefinition.PublicMethodName = _methodName;
                ReBuildPreview = true;
            }

            GUILayout.Label("FileName being generated: " + currentDefinition.Name + ".cs");

            FsmEditorGUILayout.Divider();

            if (!currentDefinition.DefinitionValidation.success)
            {
                GUILayout.Label("<color=#B20000><b>" + currentDefinition.DefinitionValidation.message + "</b></color>");
            }

            if (currentDefinition.DefinitionValidation.success)
            {
                //if (_currentFileDetails!=null) GUILayout.Label(_currentFileDetails.projectPath);
                // check if this is the item we are currently editing
                string _label      = "Create";
                bool   _isUpdating = _currentFileDetails != null && (currentDefinition.FolderPath + currentDefinition.Name + ".cs").Equals(_currentFileDetails.projectPath);
                if (_isUpdating)
                {
                    _label    = "Save Modification";
                    GUI.color = Color.yellow;
                }

                if (GUILayout.Button(_label))                 // Label "Save Changes" when we detected that we are editing an existing enum
                {
                    eventProxyCreator.CreateProxy(currentDefinition);
                    _list = EventProxyFileFinder.FindFiles();
                }
                GUI.color = Color.white;

                if (_isUpdating)
                {
                    GUILayout.Label("If this component is already in use, this may break your logic.");
                }
            }
            else
            {
                Color _color = GUI.color;

                _color.a  = 0.5f;
                GUI.color = _color;
                GUILayout.Label("Fix form before saving", "Button");
                _color.a  = 1f;
                GUI.color = _color;
            }


            if (ReBuildPreview)
            {
                currentDefinition.ValidateDefinition();

                //enumCreator.BuildScriptLiteral(currentEnum);
                Repaint();
            }
        }