Ejemplo n.º 1
0
        public Menu()
        {
            this.Set(flexDirection: FlexDirection.Row, justifyContent: Justify.SpaceAround, height: 25f, _class: "darkBackground");

            stateWithButton.Add(MenuStates.Sdk, new Button());
            stateWithButton.Add(MenuStates.Settings, new Button());
            stateWithButton.Add(MenuStates.Data, new Button());
            stateWithButton.Add(MenuStates.Tools, new Button());
            stateWithButton.Add(MenuStates.Packages, new Button());
            stateWithButton.Add(MenuStates.Help, new Button());
            stateWithButton.Add(MenuStates.Logout, new Button());

            foreach (var sWB in stateWithButton)
            {
                var btn   = sWB.Value;
                var state = sWB.Key;

                btn.clickable.clicked += () => OnMenuButton(state);
                btn.text = state.ToString().ToUpperInvariant();

                Add(btn);
            }
            var savedState = (MenuStates)PlayFabEditorPrefsSO.Instance.curMainMenuIdx;

            OnMenuButton(savedState);

            PlayFabEditor.EdExStateUpdate += PlayFabEditor_EdExStateUpdate;

            void OnMenuButton(MenuStates state)
            {
                foreach (var sWB in stateWithButton)
                {
                    var curBtn = sWB.Value;
                    curBtn.RemoveFromClassList("blueColor");
                }
                stateWithButton[state].AddToClassList("blueColor");
                PlayFabEditor.RaiseStateUpdate(PlayFabEditor.EdExStates.OnMenuItemClicked, state.ToString());

                PlayFabEditorPrefsSO.Instance.curMainMenuIdx = (int)state;

                if (state == MenuStates.Logout)
                {
                    PlayFabEditorAuthenticate.Logout();
                }
            }

            void PlayFabEditor_EdExStateUpdate(PlayFabEditor.EdExStates state, string status, string misc)
            {
                if (state == PlayFabEditor.EdExStates.OnLogin)
                {
                    OnMenuButton(MenuStates.Sdk);
                }

                if (state == PlayFabEditor.EdExStates.GoToSettings)
                {
                    OnMenuButton(MenuStates.Settings);
                }
            }
        }
Ejemplo n.º 2
0
        public static void OnLogoutClicked()
        {
            _menuState = MenuStates.Logout;
            PlayFabEditor.RaiseStateUpdate(PlayFabEditor.EdExStates.OnMenuItemClicked, MenuStates.Logout.ToString());
            PlayFabEditorAuthenticate.Logout();

            _menuState = MenuStates.Sdks;
            PlayFabEditorDataService.EditorView.currentMainMenu = (int)_menuState;
        }
        public static void OnLogoutClicked()
        {
            _menuState = MenuStates.Logout;
            PlayFabEditor.RaiseStateUpdate(PlayFabEditor.EdExStates.OnMenuItemClicked, MenuStates.Logout.ToString());
            PlayFabEditorAuthenticate.Logout();

            _menuState = MenuStates.Sdks;
            PlayFabEditorPrefsSO.Instance.curMainMenuIdx = (int)_menuState;
        }
        private void OnGuiNotAuthenticated()
        {
            GUI.skin    = PlayFabEditorHelper.uiStyle;
            GUI.enabled = blockingRequests.Count == 0 && !EditorApplication.isCompiling;
            using (new UnityVertical())
            {
                PlayFabEditorAuthenticate.DrawAuthPanels();

                using (new UnityVertical(PlayFabEditorHelper.uiStyle.GetStyle("gpStyleGray1"), GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)))
                {
                    GUILayout.FlexibleSpace();
                }
            }

            Repaint();
        }
        private void Update()
        {
            if (window == null)
            {
                OnEnable();
            }

            if (PlayFabEditorAuthenticate.IsAuthenticated())
            {
                menu.Set(display: DisplayStyle.Flex);
                mainIMGUI.onGUIHandler = OnGuiAuthenticated;
            }
            else
            {
                menu.Set(display: DisplayStyle.None);
                mainIMGUI.onGUIHandler = OnGuiNotAuthenticated;
            }

            PruneBlockingRequests();
        }
Ejemplo n.º 6
0
        private void OnGuiInternal()
        {
            GUI.skin = PlayFabEditorHelper.uiStyle;

            using (new UnityVertical())
            {
                //Run all updaters prior to drawing;
                PlayFabEditorHeader.DrawHeader();

                GUI.enabled = blockingRequests.Count == 0 && !EditorApplication.isCompiling;

                if (PlayFabEditorAuthenticate.IsAuthenticated())
                {
                    PlayFabEditorMenu.DrawMenu();

                    switch (PlayFabEditorMenu._menuState)
                    {
                    case PlayFabEditorMenu.MenuStates.Sdks:
                        PlayFabEditorSDKTools.DrawSdkPanel();
                        break;

                    case PlayFabEditorMenu.MenuStates.Settings:
                        PlayFabEditorSettings.DrawSettingsPanel();
                        break;

                    case PlayFabEditorMenu.MenuStates.Help:
                        PlayFabEditorHelpMenu.DrawHelpPanel();
                        break;

                    case PlayFabEditorMenu.MenuStates.Data:
                        PlayFabEditorDataMenu.DrawDataPanel();
                        break;

                    case PlayFabEditorMenu.MenuStates.Tools:
                        PlayFabEditorToolsMenu.DrawToolsPanel();
                        break;

                    case PlayFabEditorMenu.MenuStates.Packages:
                        PlayFabEditorPackages.DrawPackagesMenu();
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    PlayFabEditorAuthenticate.DrawAuthPanels();
                }

                using (new UnityVertical(PlayFabEditorHelper.uiStyle.GetStyle("gpStyleGray1"), GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)))
                {
                    GUILayout.FlexibleSpace();
                }

                // help tag at the bottom of the help menu.
                if (PlayFabEditorMenu._menuState == PlayFabEditorMenu.MenuStates.Help)
                {
                    DisplayHelpMenu();
                }
            }

            PruneBlockingRequests();

            Repaint();
        }