private void CopyProfilesList(MenuProfilesList _element, bool ignoreUnityUI)
        {
            if (ignoreUnityUI)
            {
                uiSlots = null;
            }
            else
            {
                uiSlots = _element.uiSlots;
            }

            textEffects       = _element.textEffects;
            outlineSize       = _element.outlineSize;
            anchor            = _element.anchor;
            maxSlots          = _element.maxSlots;
            actionListOnClick = _element.actionListOnClick;
            showActive        = _element.showActive;
            uiHideStyle       = _element.uiHideStyle;
            autoHandle        = _element.autoHandle;
            parameterID       = _element.parameterID;
            fixedOption       = _element.fixedOption;
            optionToShow      = _element.optionToShow;
            linkUIGraphic     = _element.linkUIGraphic;

            base.Copy(_element);
        }
예제 #2
0
        public override MenuElement DuplicateSelf()
        {
            MenuProfilesList newElement = CreateInstance <MenuProfilesList>();

            newElement.Declare();
            newElement.CopyProfilesList(this);
            return(newElement);
        }
        public override MenuElement DuplicateSelf(bool fromEditor, bool ignoreUnityUI)
        {
            MenuProfilesList newElement = CreateInstance <MenuProfilesList>();

            newElement.Declare();
            newElement.CopyProfilesList(this, ignoreUnityUI);
            return(newElement);
        }
예제 #4
0
        public void CopyProfilesList(MenuProfilesList _element)
        {
            uiSlots = _element.uiSlots;

            textEffects       = _element.textEffects;
            anchor            = _element.anchor;
            maxSlots          = _element.maxSlots;
            actionListOnClick = _element.actionListOnClick;
            showActive        = _element.showActive;

            base.Copy(_element);
        }
예제 #5
0
        public void CopyProfilesList(MenuProfilesList _element)
        {
            uiSlots = _element.uiSlots;

            textEffects = _element.textEffects;
            anchor = _element.anchor;
            maxSlots = _element.maxSlots;
            actionListOnClick = _element.actionListOnClick;
            showActive = _element.showActive;

            base.Copy (_element);
        }
예제 #6
0
        private void CopyProfilesList(MenuProfilesList _element)
        {
            uiSlots = _element.uiSlots;

            textEffects       = _element.textEffects;
            outlineSize       = _element.outlineSize;
            anchor            = _element.anchor;
            maxSlots          = _element.maxSlots;
            actionListOnClick = _element.actionListOnClick;
            showActive        = _element.showActive;
            uiHideStyle       = _element.uiHideStyle;

            base.Copy(_element);
        }
예제 #7
0
        private void CopyProfilesList(MenuProfilesList _element)
        {
            uiSlots = _element.uiSlots;

            textEffects       = _element.textEffects;
            outlineSize       = _element.outlineSize;
            anchor            = _element.anchor;
            maxSlots          = _element.maxSlots;
            actionListOnClick = _element.actionListOnClick;
            showActive        = _element.showActive;
            uiHideStyle       = _element.uiHideStyle;
            autoHandle        = _element.autoHandle;
            parameterID       = _element.parameterID;
            fixedOption       = _element.fixedOption;
            optionToShow      = _element.optionToShow;

            base.Copy(_element);
        }
예제 #8
0
        private void SearchForInstances(bool justLocal, ActionType actionType)
        {
            if (searchedAssets != null)
            {
                searchedAssets.Clear();
            }

            if (justLocal)
            {
                SearchSceneForType("", actionType);
                return;
            }

            string[] sceneFiles = AdvGame.GetSceneFiles();

            // First look for lines that already have an assigned lineID
            foreach (string sceneFile in sceneFiles)
            {
                SearchSceneForType(sceneFile, actionType);
            }

            // Settings
            if (KickStarter.settingsManager)
            {
                SearchAssetForType(KickStarter.settingsManager.actionListOnStart, actionType);
                if (KickStarter.settingsManager.activeInputs != null)
                {
                    foreach (ActiveInput activeInput in KickStarter.settingsManager.activeInputs)
                    {
                        SearchAssetForType(activeInput.actionListAsset, actionType);
                    }
                }
            }

            // Inventory
            if (KickStarter.inventoryManager)
            {
                SearchAssetForType(KickStarter.inventoryManager.unhandledCombine, actionType);
                SearchAssetForType(KickStarter.inventoryManager.unhandledHotspot, actionType);
                SearchAssetForType(KickStarter.inventoryManager.unhandledGive, actionType);

                // Item-specific events
                if (KickStarter.inventoryManager.items.Count > 0)
                {
                    foreach (InvItem item in (KickStarter.inventoryManager.items))
                    {
                        SearchAssetForType(item.useActionList, actionType);
                        SearchAssetForType(item.lookActionList, actionType);
                        SearchAssetForType(item.unhandledActionList, actionType);
                        SearchAssetForType(item.unhandledCombineActionList, actionType);

                        foreach (ActionListAsset actionList in item.combineActionList)
                        {
                            SearchAssetForType(actionList, actionType);
                        }

                        foreach (InvInteraction interaction in item.interactions)
                        {
                            if (interaction.actionList != null)
                            {
                                SearchAssetForType(interaction.actionList, actionType);
                            }
                        }
                    }
                }

                foreach (Recipe recipe in KickStarter.inventoryManager.recipes)
                {
                    SearchAssetForType(recipe.invActionList, actionType);
                    SearchAssetForType(recipe.actionListOnCreate, actionType);
                }
            }

            // Cursor
            if (KickStarter.cursorManager)
            {
                // Prefixes
                foreach (ActionListAsset actionListAsset in KickStarter.cursorManager.unhandledCursorInteractions)
                {
                    SearchAssetForType(actionListAsset, actionType);
                }
            }

            // Menus
            if (KickStarter.menuManager)
            {
                // Gather elements
                if (KickStarter.menuManager.menus.Count > 0)
                {
                    foreach (AC.Menu menu in KickStarter.menuManager.menus)
                    {
                        SearchAssetForType(menu.actionListOnTurnOff, actionType);
                        SearchAssetForType(menu.actionListOnTurnOn, actionType);

                        foreach (MenuElement element in menu.elements)
                        {
                            if (element is MenuButton)
                            {
                                MenuButton button = (MenuButton)element;
                                if (button.buttonClickType == AC_ButtonClickType.RunActionList)
                                {
                                    SearchAssetForType(button.actionList, actionType);
                                }
                            }
                            else if (element is MenuSavesList)
                            {
                                MenuSavesList button = (MenuSavesList)element;
                                SearchAssetForType(button.actionListOnSave, actionType);
                            }
                            else if (element is MenuCycle)
                            {
                                MenuCycle cycle = (MenuCycle)element;
                                SearchAssetForType(cycle.actionListOnClick, actionType);
                            }
                            else if (element is MenuJournal)
                            {
                                MenuJournal journal = (MenuJournal)element;
                                SearchAssetForType(journal.actionListOnAddPage, actionType);
                            }
                            else if (element is MenuSlider)
                            {
                                MenuSlider slider = (MenuSlider)element;
                                SearchAssetForType(slider.actionListOnChange, actionType);
                            }
                            else if (element is MenuToggle)
                            {
                                MenuToggle toggle = (MenuToggle)element;
                                SearchAssetForType(toggle.actionListOnClick, actionType);
                            }
                            else if (element is MenuProfilesList)
                            {
                                MenuProfilesList profilesList = (MenuProfilesList)element;
                                SearchAssetForType(profilesList.actionListOnClick, actionType);
                            }
                        }
                    }
                }
            }

            searchedAssets.Clear();
        }
예제 #9
0
        public override ActionEnd End(List <Action> actions)
        {
            switch (saveCheck)
            {
            case SaveCheck.NumberOfSaveGames:
                return(ProcessResult(CheckCondition(KickStarter.saveSystem.GetNumSaves(includeAutoSaves)), actions));

            case SaveCheck.NumberOfProfiles:
                return(ProcessResult(CheckCondition(KickStarter.options.GetNumProfiles()), actions));

            case SaveCheck.IsSlotEmpty:
                return(ProcessResult(!SaveSystem.DoesSaveExist(intValue, intValue, !checkByElementIndex), actions));

            case SaveCheck.DoesProfileExist:
                if (checkByElementIndex)
                {
                    int  i             = Mathf.Max(0, intValue);
                    bool includeActive = true;
                    if (menuName != "" && elementName != "")
                    {
                        MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName);
                        if (menuElement != null && menuElement is MenuProfilesList)
                        {
                            MenuProfilesList menuProfilesList = (MenuProfilesList)menuElement;

                            if (menuProfilesList.fixedOption)
                            {
                                LogWarning("Cannot refer to ProfilesList " + elementName + " in Menu " + menuName + ", as it lists a fixed profile ID only!");
                                return(ProcessResult(false, actions));
                            }

                            i            += menuProfilesList.GetOffset();
                            includeActive = menuProfilesList.showActive;
                        }
                        else
                        {
                            LogWarning("Cannot find ProfilesList element '" + elementName + "' in Menu '" + menuName + "'.");
                        }
                    }
                    else
                    {
                        LogWarning("No ProfilesList element referenced when trying to delete profile slot " + i.ToString());
                    }

                    return(ProcessResult(KickStarter.options.DoesProfileExist(i, includeActive), actions));
                }
                else
                {
                    // intValue is the profile ID
                    return(ProcessResult(Options.DoesProfileIDExist(intValue), actions));
                }

            case SaveCheck.DoesProfileNameExist:
                bool result = false;

                GVar gVar = GlobalVariables.GetVariable(profileVarID);
                if (gVar != null)
                {
                    string profileName = gVar.TextValue;
                    result = KickStarter.options.DoesProfileExist(profileName);
                }
                else
                {
                    LogWarning("Could not check for profile name - no variable found.");
                }

                return(ProcessResult(result, actions));

            case SaveCheck.IsSavingPossible:
                return(ProcessResult(!PlayerMenus.IsSavingLocked(this), actions));

            default:
                break;
            }

            return(GenerateStopActionEnd());
        }
        override public float Run()
        {
            if (!KickStarter.settingsManager.useProfiles)
            {
                ACDebug.LogWarning("Save game profiles are not enabled - please set in Settings Manager to use this Action.");
                return(0f);
            }

            string newProfileLabel = "";

            if ((manageProfileType == ManageProfileType.CreateProfile && useCustomLabel) || manageProfileType == ManageProfileType.RenameProfile)
            {
                GVar gVar = GlobalVariables.GetVariable(varID);
                if (gVar != null)
                {
                    newProfileLabel = gVar.textVal;
                }
                else
                {
                    ACDebug.LogWarning("Could not " + manageProfileType.ToString() + " - no variable found.");
                    return(0f);
                }
            }

            if (manageProfileType == ManageProfileType.CreateProfile)
            {
                KickStarter.options.CreateProfile(newProfileLabel);
            }
            else if (manageProfileType == ManageProfileType.DeleteProfile ||
                     manageProfileType == ManageProfileType.RenameProfile ||
                     manageProfileType == ManageProfileType.SwitchActiveProfile)
            {
                if (deleteProfileType == DeleteProfileType.ActiveProfile)
                {
                    if (manageProfileType == ManageProfileType.DeleteProfile)
                    {
                        KickStarter.saveSystem.DeleteProfile();
                    }
                    else if (manageProfileType == ManageProfileType.RenameProfile)
                    {
                        KickStarter.options.RenameProfile(newProfileLabel);
                    }
                    return(0f);
                }
                else if (deleteProfileType == DeleteProfileType.SetProfileID)
                {
                    int profileID = Mathf.Max(0, profileIndex);

                    if (manageProfileType == ManageProfileType.DeleteProfile)
                    {
                        KickStarter.saveSystem.DeleteProfileID(profileID);
                    }
                    else if (manageProfileType == ManageProfileType.RenameProfile)
                    {
                        KickStarter.options.RenameProfileID(newProfileLabel, profileID);
                    }
                    else if (manageProfileType == ManageProfileType.SwitchActiveProfile)
                    {
                        Options.SwitchProfileID(profileID);
                    }
                }
                else if (deleteProfileType == DeleteProfileType.SetSlotIndex ||
                         deleteProfileType == DeleteProfileType.SlotIndexFromVariable)
                {
                    int i = Mathf.Max(0, profileIndex);

                    if (deleteProfileType == DeleteProfileType.SlotIndexFromVariable)
                    {
                        GVar gVar = GlobalVariables.GetVariable(slotVarID);
                        if (gVar != null)
                        {
                            i = gVar.val;
                        }
                        else
                        {
                            ACDebug.LogWarning("Could not " + manageProfileType.ToString() + " - no variable found.");
                            return(0f);
                        }
                    }

                    bool includeActive = true;
                    if (menuName != "" && elementName != "")
                    {
                        MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName);
                        if (menuElement != null && menuElement is MenuProfilesList)
                        {
                            MenuProfilesList menuProfilesList = (MenuProfilesList)menuElement;

                            if (menuProfilesList.fixedOption)
                            {
                                ACDebug.LogWarning("Cannot refer to ProfilesLst " + elementName + " in Menu " + menuName + ", as it lists a fixed profile ID only!");
                                return(0f);
                            }

                            i            += menuProfilesList.GetOffset();
                            includeActive = menuProfilesList.showActive;
                        }
                        else
                        {
                            ACDebug.LogWarning("Cannot find ProfilesList element '" + elementName + "' in Menu '" + menuName + "'.");
                        }
                    }
                    else
                    {
                        ACDebug.LogWarning("No ProfilesList element referenced when trying to delete profile slot " + i.ToString());
                    }

                    if (manageProfileType == ManageProfileType.DeleteProfile)
                    {
                        KickStarter.saveSystem.DeleteProfile(i, includeActive);
                    }
                    else if (manageProfileType == ManageProfileType.RenameProfile)
                    {
                        KickStarter.options.RenameProfile(newProfileLabel, i, includeActive);
                    }
                    else if (manageProfileType == ManageProfileType.SwitchActiveProfile)
                    {
                        KickStarter.options.SwitchProfile(i, includeActive);
                    }
                }
            }

            return(0f);
        }
예제 #11
0
        override public ActionEnd End(List <AC.Action> actions)
        {
            int actualNumber = 0;

            if (saveCheck == SaveCheck.NumberOfSaveGames)
            {
                actualNumber = KickStarter.saveSystem.GetNumSaves(includeAutoSaves);
            }
            else if (saveCheck == SaveCheck.NumberOfProfiles)
            {
                actualNumber = KickStarter.options.GetNumProfiles();
            }
            else if (saveCheck == SaveCheck.IsSlotEmpty)
            {
                return(ProcessResult(!SaveSystem.DoesSaveExist(intValue, intValue, !checkByElementIndex), actions));
            }
            else if (saveCheck == SaveCheck.DoesProfileExist)
            {
                if (checkByElementIndex)
                {
                    int  i             = Mathf.Max(0, intValue);
                    bool includeActive = true;
                    if (menuName != "" && elementName != "")
                    {
                        MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName);
                        if (menuElement != null && menuElement is MenuProfilesList)
                        {
                            MenuProfilesList menuProfilesList = (MenuProfilesList)menuElement;

                            if (menuProfilesList.fixedOption)
                            {
                                ACDebug.LogWarning("Cannot refer to ProfilesLst " + elementName + " in Menu " + menuName + ", as it lists a fixed profile ID only!");
                                return(ProcessResult(false, actions));
                            }

                            i            += menuProfilesList.GetOffset();
                            includeActive = menuProfilesList.showActive;
                        }
                        else
                        {
                            ACDebug.LogWarning("Cannot find ProfilesList element '" + elementName + "' in Menu '" + menuName + "'.");
                        }
                    }
                    else
                    {
                        ACDebug.LogWarning("No ProfilesList element referenced when trying to delete profile slot " + i.ToString());
                    }

                    bool result = KickStarter.options.DoesProfileExist(i, includeActive);
                    return(ProcessResult(result, actions));
                }
                else
                {
                    // intValue is the profile ID
                    bool result = Options.DoesProfileIDExist(intValue);
                    return(ProcessResult(result, actions));
                }
            }
            else if (saveCheck == SaveCheck.IsSavingPossible)
            {
                return(ProcessResult(!PlayerMenus.IsSavingLocked(this), actions));
            }

            return(ProcessResult(CheckCondition(actualNumber), actions));
        }