Example #1
0
        private void SetToolMode(ToolMode rToolMode, bool rUserInitiated = false)
        {
            if (rToolMode == ToolMode.Basic)
            {
                // Ensure that the Basic mode profiles have been loaded
                LoadBasicModeProfiles(false);
            }

            // If the user clicked an editor tab and changed the mode:
            if (rUserInitiated && mToolMode != rToolMode)
            {
                // Advanced to Basic
                if (rToolMode == ToolMode.Basic)
                {
                    // Store the path of the current active profile (if it is a user-created one) so that it can be reloaded
                    if (ActiveProfile != null && ActiveProfile.Priority == CharacterWizardProfile.PriorityStatus.User)
                    {
                        ActiveProfile.StorePath(PrefsKey.ActiveProfile);
                    }
                }
                // Basic to Advanced
                else if (rToolMode == ToolMode.Advanced)
                {
                    //if (ActiveProfile != null)
                    //{
                    //    // If a profile was selected in Basic mode, create a new copy of it in the user's folder
                    //    UseCopyOfCurrentProfile();
                    //}
                    //else
                    //{
                    //    // Use the last selected profile
                    //    UseStoredProfile();
                    //}
                }

                // Save the new tool mode when user-initiated
                EditorPrefs.SetInt(PrefsKey.Mode, (int)rToolMode);
            }
            // Called from OnEnable()
            else if (!rUserInitiated)
            {
                // When starting in Advanced, load the last stored profile
                if (rToolMode == ToolMode.Advanced)
                {
                    UseStoredProfile();
                }
            }


            mToolMode = rToolMode;
        }