Пример #1
0
        private void GetCursorGUI(string apiPrefix, MenuSource source)
        {
            fixedIcon = CustomGUILayout.Toggle("For fixed icon?", fixedIcon, apiPrefix + ".fixedIcon", "If True, the element will always be associated with the same single icon. If False, the element will represent all available icons.");

            if (fixedIcon)
            {
                numSlots = 1;

                if (AdvGame.GetReferences().cursorManager&& AdvGame.GetReferences().cursorManager.cursorIcons.Count > 0)
                {
                    int iconInt = AdvGame.GetReferences().cursorManager.GetIntFromID(iconID);
                    iconInt = EditorGUILayout.Popup("Cursor:", iconInt, AdvGame.GetReferences().cursorManager.GetLabelsArray());
                    iconID  = AdvGame.GetReferences().cursorManager.cursorIcons [iconInt].id;
                }
                else
                {
                    iconID = -1;
                }
            }
            else
            {
                maxSlots = CustomGUILayout.IntField("Maximum # of icons:", maxSlots, apiPrefix + ".maxSlots", "The maximum number of icons that can be shown at once");
                if (KickStarter.cursorManager != null && maxSlots > KickStarter.cursorManager.cursorIcons.Count)
                {
                    maxSlots = KickStarter.cursorManager.cursorIcons.Count;
                }

                if (source == MenuSource.AdventureCreator)
                {
                    numSlots    = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 30f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }
        }
Пример #2
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            inventoryBoxType = (AC_InventoryBoxType)CustomGUILayout.EnumPopup("Inventory box type:", inventoryBoxType, apiPrefix + ".inventoryBoxType");
            if (inventoryBoxType == AC_InventoryBoxType.Default || inventoryBoxType == AC_InventoryBoxType.CustomScript)
            {
                maxSlots    = CustomGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30, apiPrefix + ".maxSlots");
                isClickable = true;
            }
            else if (inventoryBoxType == AC_InventoryBoxType.DisplaySelected)
            {
                isClickable = false;
                maxSlots    = 1;
            }
            else if (inventoryBoxType == AC_InventoryBoxType.DisplayLastSelected)
            {
                isClickable = true;
                maxSlots    = 1;
            }
            else if (inventoryBoxType == AC_InventoryBoxType.Container)
            {
                isClickable            = true;
                maxSlots               = CustomGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30, apiPrefix + ".maxSlots");
                selectItemsAfterTaking = CustomGUILayout.Toggle("Select item after taking?", selectItemsAfterTaking, apiPrefix + ".selectItemsAfterTaking");
            }
            else
            {
                isClickable = true;
                if (source == MenuSource.AdventureCreator)
                {
                    numSlots = CustomGUILayout.IntField("Test slots:", numSlots, apiPrefix + ".numSlots");
                }
                maxSlots = CustomGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30, apiPrefix + ".maxSlots");
            }

            if (inventoryBoxType == AC_InventoryBoxType.HotspotBased)
            {
                limitToDefinedInteractions = CustomGUILayout.ToggleLeft("Only show items referenced in Interactions?", limitToDefinedInteractions, apiPrefix + ".limitToDefinedInteractions");
            }

            displayType = (ConversationDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType");
            if (displayType == ConversationDisplayType.IconAndText && source == MenuSource.AdventureCreator)
            {
                EditorGUILayout.HelpBox("'Icon And Text' mode is only available for Unity UI-based Menus.", MessageType.Warning);
            }

            if (inventoryBoxType != AC_InventoryBoxType.DisplaySelected && inventoryBoxType != AC_InventoryBoxType.DisplayLastSelected && source == MenuSource.AdventureCreator)
            {
                slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f, apiPrefix + ".slotSpacing");
                orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                if (orientation == ElementOrientation.Grid)
                {
                    gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                }
            }

            if (inventoryBoxType == AC_InventoryBoxType.CustomScript)
            {
                ShowClipHelp();
            }

            uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When slot is empty:", uiHideStyle, apiPrefix + ".uiHideStyle");

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                uiSlots = ResizeUISlots(uiSlots, maxSlots);

                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i].LinkedUiGUI(i, source);
                }

                linkUIGraphic = (LinkUIGraphic)EditorGUILayout.EnumPopup("Link graphics to:", linkUIGraphic);
            }
            EditorGUILayout.EndVertical();

            if (CanBeLimitedByCategory())
            {
                ShowCategoriesUI(apiPrefix);
            }

            base.ShowGUI(menu);
        }
Пример #3
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuCrafting)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            craftingType = (CraftingElementType)CustomGUILayout.EnumPopup("Crafting element type:", craftingType, apiPrefix + ".craftingType");

            if (craftingType == CraftingElementType.Ingredients)
            {
                numSlots = CustomGUILayout.IntSlider("Number of slots:", numSlots, 1, 12);
                if (source == MenuSource.AdventureCreator)
                {
                    slotSpacing = EditorGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f);
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }
            else
            {
                numSlots = 1;
                actionListOnWrongIngredients = ActionListAssetMenu.AssetGUI("ActionList on fail:", actionListOnWrongIngredients, apiPrefix + ".actionListOnWrongIngredients", "ActionList_On_Fail_Recipe");
                if (actionListOnWrongIngredients != null)
                {
                    EditorGUILayout.HelpBox("This ActionList will only be run if the result is calculated manually via the 'Inventory: Crafting' Action.", MessageType.Info);
                }
            }

            displayType = (ConversationDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType");
            if (displayType == ConversationDisplayType.IconAndText && source == MenuSource.AdventureCreator)
            {
                EditorGUILayout.HelpBox("'Icon And Text' mode is only available for Unity UI-based Menus.", MessageType.Warning);
            }

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                uiSlots = ResizeUISlots(uiSlots, numSlots);

                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i].LinkedUiGUI(i, source);
                }

                linkUIGraphic = (LinkUIGraphic)EditorGUILayout.EnumPopup("Link graphics to:", linkUIGraphic);
            }

            isClickable = true;
            EditorGUILayout.EndVertical();

            PopulateList(source);
            base.ShowGUI(menu);
        }
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuSavesList)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            saveListType = (AC_SaveListType)CustomGUILayout.EnumPopup("List type:", saveListType, apiPrefix + ".savesListType", "How this list behaves");
            if (saveListType == AC_SaveListType.Save)
            {
                if (fixedOption || !allowEmptySlots)
                {
                    showNewSaveOption = CustomGUILayout.Toggle("Show 'New save' option?", showNewSaveOption, apiPrefix + ".showNewSaveOption", "If True, a slot that represents a 'new save' space can be displayed if appropriate");
                }

                if ((!fixedOption && allowEmptySlots) || showNewSaveOption)
                {
                    newSaveText = CustomGUILayout.TextField("'New save' text:", newSaveText, apiPrefix + ".newSaveText", "The display text when a slot represents a 'new save' space");
                }
                autoHandle = CustomGUILayout.Toggle("Save when click on?", autoHandle, apiPrefix + ".autoHandle");
                if (autoHandle)
                {
                    ActionListGUI("ActionList after saving:", menu.title, "AfterSaving", apiPrefix, "An ActionList asset that runs after the game is saved");
                }
                else
                {
                    ActionListGUI("ActionList when click:", menu.title, "OnClick", apiPrefix, "An ActionList asset that runs after the user clicks on a save file");
                }
            }
            else if (saveListType == AC_SaveListType.Load)
            {
                autoHandle = CustomGUILayout.Toggle("Load when click on?", autoHandle, apiPrefix + ".autoHandle");
                if (autoHandle)
                {
                    ActionListGUI("ActionList after loading:", menu.title, "AfterLoading", apiPrefix, "An ActionList asset that runs after the game is loaded");
                }
                else
                {
                    ActionListGUI("ActionList when click:", menu.title, "OnClick", apiPrefix, "An ActionList asset that runs after the user clicks on a save file");
                }
            }
            else if (saveListType == AC_SaveListType.Import)
            {
                autoHandle = true;
                                #if UNITY_STANDALONE
                importProductName  = CustomGUILayout.TextField("Import product name:", importProductName, apiPrefix + ".importProductName", "The name of the project to import files from");
                importSaveFilename = CustomGUILayout.TextField("Import save filename:", importSaveFilename, apiPrefix + ".importSaveFilename", "The filename syntax of import files");
                ActionListGUI("ActionList after import:", menu.title, "After_Import", apiPrefix, "An ActionList asset that runs after a save file is imported");
                checkImportBool = CustomGUILayout.Toggle("Require Bool to be true?", checkImportBool, apiPrefix + ".checkImportBool", "If True, then a specific Boolean global variable must = True for an import file to be listed");
                if (checkImportBool)
                {
                    if (KickStarter.variablesManager != null)
                    {
                        ShowVarGUI(KickStarter.variablesManager.vars);
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("A Variables Manager is required.", MessageType.Warning);
                    }
                }
                                #else
                EditorGUILayout.HelpBox("This feature is only available for standalone platforms (PC, Mac, Linux)", MessageType.Warning);
                                #endif
            }

            displayType = (SaveDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How save files are displayed");

            fixedOption = CustomGUILayout.Toggle("Fixed Save ID only?", fixedOption, apiPrefix + ".fixedOption", "If True, then only one save slot will be shown");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntField("ID to display:", optionToShow, apiPrefix + ".optionToShow", "The index number of the save slot to show");

                if (saveListType == AC_SaveListType.Load)
                {
                    hideIfNotValid = CustomGUILayout.Toggle("Hide if no save file found?", hideIfNotValid, apiPrefix + ".hideIfNotValid", "If True, then the element will be hidden if the slot ID it represents is not filled with a valid save");
                }
            }
            else
            {
                maxSlots        = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots", "The maximum number of slots that can be displayed at once");
                allowEmptySlots = CustomGUILayout.Toggle("Allow empty slots?", allowEmptySlots, apiPrefix + ".allowEmptySlots", "If True, then all slots will be shown even if they are not already assigned a save file.");

                if (source == MenuSource.AdventureCreator)
                {
                    if (allowEmptySlots)
                    {
                        numSlots = maxSlots;
                    }
                    else
                    {
                        numSlots = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    }
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 30f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle", "The method by which this element (or slots within it) are hidden from view when made invisible");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                if (fixedOption)
                {
                    uiSlots = ResizeUISlots(uiSlots, 1);
                }
                else
                {
                    uiSlots = ResizeUISlots(uiSlots, maxSlots);
                }

                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i].LinkedUiGUI(i, source);
                }

                linkUIGraphic = (LinkUIGraphic)CustomGUILayout.EnumPopup("Link graphics to:", linkUIGraphic, "", "What Image component the element's graphics should be linked to");
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Пример #5
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuDialogList)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");
            fixedOption = CustomGUILayout.Toggle("Fixed option number?", fixedOption, apiPrefix + ".fixedOption");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntSlider("Option to display:", optionToShow, 1, 10, apiPrefix + ".optionToShow");
            }
            else
            {
                maxSlots = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots");
                resetOffsetWhenRestart = CustomGUILayout.ToggleLeft("Always reset offset when turn on?", resetOffsetWhenRestart, apiPrefix + ".resetOffsetWhenRestart");

                if (source == MenuSource.AdventureCreator)
                {
                    numSlots    = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }

            displayType = (ConversationDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType");
            if (displayType == ConversationDisplayType.IconAndText && source == MenuSource.AdventureCreator)
            {
                EditorGUILayout.HelpBox("'Icon And Text' mode is only available for Unity UI-based Menus.", MessageType.Warning);
            }

            markAlreadyChosen = CustomGUILayout.Toggle("Mark options already used?", markAlreadyChosen, apiPrefix + ".markAlreadyChosen");
            if (markAlreadyChosen)
            {
                alreadyChosenFontColour            = (Color)CustomGUILayout.ColorField("'Already chosen' colour:", alreadyChosenFontColour, apiPrefix + ".alreadyChosenFontColour");
                alreadyChosenFontHighlightedColour = (Color)CustomGUILayout.ColorField("'Already chosen' highlighted colour:", alreadyChosenFontHighlightedColour, apiPrefix + ".alreadyChosenFontHighlightedColour");
            }

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                if (fixedOption)
                {
                    uiSlots = ResizeUISlots(uiSlots, 1);
                }
                else
                {
                    uiSlots = ResizeUISlots(uiSlots, maxSlots);
                }

                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i].LinkedUiGUI(i, source);
                }

                linkUIGraphic = (LinkUIGraphic)EditorGUILayout.EnumPopup("Link graphics to:", linkUIGraphic);
            }

            if (displayType == ConversationDisplayType.TextOnly || displayType == ConversationDisplayType.IconAndText)
            {
                showIndexNumbers = CustomGUILayout.Toggle("Prefix with index numbers?", showIndexNumbers, apiPrefix + ".showIndexNumbers");
            }

            ChangeCursorGUI(menu);
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Пример #6
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuJournal)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            journalType = (JournalType)CustomGUILayout.EnumPopup("Journal type:", journalType, apiPrefix + ".journalType", "What type of journal this is");
            if (journalType == JournalType.DisplayExistingJournal || journalType == JournalType.DisplayActiveDocument)
            {
                if (journalType == JournalType.DisplayExistingJournal)
                {
                    EditorGUILayout.HelpBox("This Journal will share pages from another Journal element in the same Menu.", MessageType.Info);
                    otherJournalTitle = CustomGUILayout.TextField("Existing element name:", otherJournalTitle, apiPrefix + ".otherJournalTitle", "The name of the Journal element within the same Menu that is used as reference");
                    pageOffset        = CustomGUILayout.IntField("Page offset #:", pageOffset, apiPrefix + ".pageOffset", "The difference in page index between this and the reference Journal");
                }

                if (pages == null || pages.Count != 1)
                {
                    pages.Clear();
                    pages.Add(new JournalPage());
                }

                showPage = 1;

                if (source == MenuSource.AdventureCreator)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Placeholder text:", GUILayout.Width(146f));
                    pages[0].text = CustomGUILayout.TextArea(pages[0].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[0].text");
                    EditorGUILayout.EndHorizontal();
                }
            }
            else if (journalType == JournalType.NewJournal)
            {
                if (pages == null)
                {
                    pages = new List <JournalPage>();
                    pages.Clear();
                    pages.Add(new JournalPage());
                }
                numPages = pages.Count;

                for (int i = 0; i < pages.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();

                    if (pages[i].lineID >= 0)
                    {
                        CustomGUILayout.LabelField("Page #" + (i + 1).ToString() + ", Text ID #" + pages[i].lineID + ":", apiPrefix + ".pages[" + i.ToString() + "].text");
                    }
                    else
                    {
                        CustomGUILayout.LabelField("Page #" + (i + 1).ToString() + ":", apiPrefix + ".pages[" + i.ToString() + "].text");
                    }

                    if (GUILayout.Button("", CustomStyles.IconCog))
                    {
                        sideMenu = i;
                        SideMenu();
                    }
                    EditorGUILayout.EndHorizontal();

                    pages[i].text = CustomGUILayout.TextArea(pages[i].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[" + i.ToString() + "].text");
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }

                if (GUILayout.Button("Create new page", EditorStyles.miniButton))
                {
                    Undo.RecordObject(this, "Create journal page");
                    pages.Add(new JournalPage());
                }

                numPages = pages.Count;

                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");

                if (numPages > 1)
                {
                    showPage      = CustomGUILayout.IntSlider("Preview page #:", showPage, 1, numPages, apiPrefix + ".showPage", "The index number of the current page being shown ");
                    startFromPage = CustomGUILayout.Toggle("Start from this page?", startFromPage, apiPrefix + ".startFromPage", "If True, then the page index above will be the first open when the game begins");
                }
                else if (numPages == 1)
                {
                    showPage = 1;
                }
                else
                {
                    showPage = 0;
                }
            }

            if (source == MenuSource.AdventureCreator)
            {
                anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor", "The text alignment");
                textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects", "The special FX applied to the text");
                if (textEffects != TextEffects.None)
                {
                    outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize", "The outline thickness");
                }
            }
            else
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");

                                #if TextMeshProIsPresent
                uiText = LinkedUiGUI <TMPro.TextMeshProUGUI> (uiText, "Linked Text:", source);
                                #else
                uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                                #endif
            }

            if (journalType == JournalType.NewJournal)
            {
                actionListOnAddPage = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on add page:", actionListOnAddPage, false, apiPrefix + ".actionListOnAddPage", "An ActionList to run whenever a new page is added");
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Пример #7
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            journalType = (JournalType)CustomGUILayout.EnumPopup("Journal type:", journalType, apiPrefix + ".journalType");
            if (journalType == JournalType.DisplayExistingJournal)
            {
                EditorGUILayout.HelpBox("This Journal will share pages from another Journal element in the same Menu.", MessageType.Info);
                otherJournalTitle = CustomGUILayout.TextField("Existing element name:", otherJournalTitle, apiPrefix + ".otherJournalTitle");
                pageOffset        = CustomGUILayout.IntField("Page offset #:", pageOffset, apiPrefix + ".pageOffset");

                if (pages == null || pages.Count != 1)
                {
                    pages.Clear();
                    pages.Add(new JournalPage());
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Placeholder text:", GUILayout.Width(146f));
                pages[0].text = CustomGUILayout.TextArea(pages[0].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[0].text");
                showPage      = 1;
                EditorGUILayout.EndHorizontal();

                if (source == MenuSource.AdventureCreator)
                {
                    anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor");
                    textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects");
                    if (textEffects != TextEffects.None)
                    {
                        outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize");
                    }
                }
                else
                {
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical("Button");
                    uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                }
            }
            else
            {
                if (pages == null || pages.Count == 0)
                {
                    pages.Clear();
                    pages.Add(new JournalPage());
                }
                numPages = pages.Count;

                for (int i = 0; i < pages.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();

                    if (pages[i].lineID >= 0)
                    {
                        EditorGUILayout.LabelField("Page #" + (i + 1).ToString() + ", Text ID #" + pages[i].lineID + ":");
                    }
                    else
                    {
                        EditorGUILayout.LabelField("Page #" + (i + 1).ToString() + ":");
                    }

                    if (GUILayout.Button(Resource.CogIcon, GUILayout.Width(20f), GUILayout.Height(15f)))
                    {
                        sideMenu = i;
                        SideMenu();
                    }
                    EditorGUILayout.EndHorizontal();

                    pages[i].text = CustomGUILayout.TextArea(pages[i].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[" + i.ToString() + "].text");
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }

                if (GUILayout.Button("Create new page", EditorStyles.miniButton))
                {
                    Undo.RecordObject(this, "Create journal page");
                    pages.Add(new JournalPage());
                }

                numPages = pages.Count;

                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");

                if (numPages > 1)
                {
                    showPage      = CustomGUILayout.IntSlider("Preview page #:", showPage, 1, numPages, apiPrefix + ".showPage");
                    startFromPage = CustomGUILayout.Toggle("Start from this page?", startFromPage, apiPrefix + ".startFromPage");
                }
                else
                {
                    showPage = 1;
                }

                if (source == MenuSource.AdventureCreator)
                {
                    anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor");
                    textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects");
                }
                else
                {
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical("Button");
                    uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                }

                actionListOnAddPage = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on add page:", actionListOnAddPage, false, apiPrefix + ".actionListOnAddPage");
            }
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuProfilesList)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            fixedOption = CustomGUILayout.Toggle("Fixed Profile ID only?", fixedOption, apiPrefix + ".fixedOption");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntField("ID to display:", optionToShow, apiPrefix + ".optionToShow");
            }
            else
            {
                showActive = CustomGUILayout.Toggle("Include active?", showActive, apiPrefix + ".showActive");
                maxSlots   = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots");

                if (source == MenuSource.AdventureCreator)
                {
                    numSlots    = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }

            autoHandle = CustomGUILayout.Toggle("Switch profile when click?", autoHandle, apiPrefix + ".autoHandle");

            if (autoHandle)
            {
                ActionListGUI("ActionList after selecting:", menu.title, "After_Selecting", apiPrefix);
            }
            else
            {
                ActionListGUI("ActionList when click:", menu.title, "When_Click", apiPrefix);
            }

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                uiSlots = ResizeUISlots(uiSlots, maxSlots);
                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i].LinkedUiGUI(i, source);
                }

                linkUIGraphic = (LinkUIGraphic)EditorGUILayout.EnumPopup("Link graphics to:", linkUIGraphic);
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Пример #9
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuDialogList)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");
            fixedOption = CustomGUILayout.Toggle("Fixed option number?", fixedOption, apiPrefix + ".fixedOption", "If True, then only one dialogue option will be shown");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntSlider("Option to display:", optionToShow, 1, 10, apiPrefix + ".optionToShow", "The index number of the dialogue option to show");
            }
            else
            {
                maxSlots = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots", "The maximum number of dialogue options that can be shown at once");
                resetOffsetWhenRestart = CustomGUILayout.Toggle("Reset offset when turn on?", resetOffsetWhenRestart, apiPrefix + ".resetOffsetWhenRestart", "If True, then the offset value will be reset when the parent menu is turned on for the same Conversation that it last displayed");

                if (source == MenuSource.AdventureCreator)
                {
                    numSlots    = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 30f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }

            displayType = (ConversationDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How the Conversation's dialogue options are displayed");
            if (displayType == ConversationDisplayType.IconAndText && source == MenuSource.AdventureCreator)
            {
                EditorGUILayout.HelpBox("'Icon And Text' mode is only available for Unity UI-based Menus.", MessageType.Warning);
            }

            markAlreadyChosen = CustomGUILayout.Toggle("Mark options already used?", markAlreadyChosen, apiPrefix + ".markAlreadyChosen", "If True, then options that have already been clicked can be displayed in a different colour");
            if (markAlreadyChosen)
            {
                alreadyChosenFontColour            = (Color)CustomGUILayout.ColorField("'Already chosen' colour:", alreadyChosenFontColour, apiPrefix + ".alreadyChosenFontColour", "The font colour for options already chosen");
                alreadyChosenFontHighlightedColour = (Color)CustomGUILayout.ColorField("'Already chosen' highlighted colour:", alreadyChosenFontHighlightedColour, apiPrefix + ".alreadyChosenFontHighlightedColour", "The font colour when the option is highlighted but has already been chosen");
            }

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle", "The method by which this element (or slots within it) are hidden from view when made invisible");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                if (fixedOption)
                {
                    uiSlots = ResizeUISlots(uiSlots, 1);
                }
                else
                {
                    uiSlots = ResizeUISlots(uiSlots, maxSlots);
                }

                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i].LinkedUiGUI(i, source);
                }

                linkUIGraphic = (LinkUIGraphic)CustomGUILayout.EnumPopup("Link graphics to:", linkUIGraphic, "", "What Image component the element's graphics should be linked to");
            }

            if (displayType == ConversationDisplayType.TextOnly || displayType == ConversationDisplayType.IconAndText)
            {
                showIndexNumbers = CustomGUILayout.Toggle("Prefix with index numbers?", showIndexNumbers, apiPrefix + ".showIndexNumbers", "If True, then each option's index number will be prefixed to the label");
            }

            ChangeCursorGUI(menu);
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Пример #10
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuCrafting)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            craftingType = (CraftingElementType)CustomGUILayout.EnumPopup("Crafting element type:", craftingType, apiPrefix + ".craftingType", "What part of the crafting process this element is used for");

            if (craftingType == CraftingElementType.Ingredients)
            {
                numSlots = CustomGUILayout.IntSlider("Number of slots:", numSlots, 1, 12);
                if (source == MenuSource.AdventureCreator && numSlots > 1)
                {
                    slotSpacing = EditorGUILayout.Slider(new GUIContent("Slot spacing:", "The distance between slots"), slotSpacing, 0f, 20f);
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation", "The slot orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }
            else
            {
                autoCreate = CustomGUILayout.Toggle("Result is automatic?", autoCreate, apiPrefix + ".autoCreate", "If True, then the output ingredient will appear automatically when the correct ingredients are used. If False, then the player will have to run the 'Inventory: Crafting' Action as an additional step.");

                numSlots = 1;
                actionListOnWrongIngredients = ActionListAssetMenu.AssetGUI("ActionList on fail:", actionListOnWrongIngredients, menu.title + "_OnFailRecipe", apiPrefix + ".actionListOnWrongIngredients", "Ahe ActionList asset to run if a crafting attempt is made but no succesful recipe is possible. This only works if crafting is performed manually via the Inventory: Crafting Action.");
                if (actionListOnWrongIngredients != null)
                {
                    EditorGUILayout.HelpBox("This ActionList will only be run if the result is calculated manually via the 'Inventory: Crafting' Action.", MessageType.Info);
                }
            }

            displayType = (ConversationDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How items are displayed");
            if (displayType == ConversationDisplayType.IconAndText && source == MenuSource.AdventureCreator)
            {
                EditorGUILayout.HelpBox("'Icon And Text' mode is only available for Unity UI-based Menus.", MessageType.Warning);
            }

            inventoryItemCountDisplay = (InventoryItemCountDisplay)CustomGUILayout.EnumPopup("Display item amounts:", inventoryItemCountDisplay, apiPrefix + ".inventoryItemCountDisplay", "How item counts are drawn");

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle", "The method by which this element (or slots within it) are hidden from view when made invisible");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                uiSlots = ResizeUISlots(uiSlots, numSlots);

                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i].LinkedUiGUI(i, source);
                }

                linkUIGraphic = (LinkUIGraphic)CustomGUILayout.EnumPopup("Link graphics to:", linkUIGraphic, "", "What Image component the element's graphics should be linked to");
            }

            isClickable = true;
            EditorGUILayout.EndVertical();

            PopulateList(source);
            base.ShowGUI(menu);
        }
Пример #11
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuProfilesList)";

            MenuSource source = menu.menuSource;

            CustomGUILayout.BeginVertical();

            fixedOption = CustomGUILayout.Toggle("Fixed Profile ID only?", fixedOption, apiPrefix + ".fixedOption", "If True, then only one profile slot will be shown");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntField("ID to display:", optionToShow, apiPrefix + ".optionToShow", "The index number of the profile to show");
            }
            else
            {
                showActive = CustomGUILayout.Toggle("Include active?", showActive, apiPrefix + ".showActive", "If True, then the current active profile will also be listed");
                maxSlots   = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots", "The maximum number of profiles that can be displayed at once");
                if (maxSlots < 0)
                {
                    maxSlots = 0;
                }

                if (source == MenuSource.AdventureCreator)
                {
                    if (maxSlots > 1)
                    {
                        numSlots    = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                        slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 30f, apiPrefix + ".slotSpacing");
                        orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                        if (orientation == ElementOrientation.Grid)
                        {
                            gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                        }
                    }
                    else
                    {
                        numSlots = Mathf.Max(0, maxSlots);
                    }
                }
            }

            autoHandle = CustomGUILayout.Toggle("Switch profile when click?", autoHandle, apiPrefix + ".autoHandle", "If True, then the profile will be switched to once its slot is clicked on");

            if (autoHandle)
            {
                ActionListGUI("ActionList after selecting:", menu.title, "After_Selecting", apiPrefix, "The ActionList asset to run once a profile has been switched to");
            }
            else
            {
                ActionListGUI("ActionList when click:", menu.title, "When_Click", apiPrefix, "The ActionList asset to run once a profile has been clicked on");
            }

            if (source != MenuSource.AdventureCreator)
            {
                CustomGUILayout.EndVertical();
                CustomGUILayout.BeginVertical();
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle", "The method by which this element (or slots within it) are hidden from view when made invisible");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                uiSlots = ResizeUISlots(uiSlots, maxSlots);
                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i].LinkedUiGUI(i, source);
                }

                linkUIGraphic = (LinkUIGraphic)CustomGUILayout.EnumPopup("Link graphics to:", linkUIGraphic, "", "What Image component the element's graphics should be linked to");
            }

            CustomGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Пример #12
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            saveListType = (AC_SaveListType)CustomGUILayout.EnumPopup("List type:", saveListType, apiPrefix + ".savesListType");
            if (saveListType == AC_SaveListType.Save)
            {
                showNewSaveOption = CustomGUILayout.Toggle("Show 'New save' option?", showNewSaveOption, apiPrefix + ".showNewSaveOption");
                if (showNewSaveOption)
                {
                    newSaveText = CustomGUILayout.TextField("'New save' text:", newSaveText, apiPrefix + ".newSaveText");
                }
                autoHandle = CustomGUILayout.Toggle("Save when click on?", autoHandle, apiPrefix + ".autoHandle");
                if (autoHandle)
                {
                    ActionListGUI("ActionList after saving:", menu.title, "After_Saving");
                }
                else
                {
                    ActionListGUI("ActionList when click:", menu.title, "When_Click");
                }
            }
            else if (saveListType == AC_SaveListType.Load)
            {
                autoHandle = CustomGUILayout.Toggle("Load when click on?", autoHandle, apiPrefix + ".autoHandle");
                if (autoHandle)
                {
                    ActionListGUI("ActionList after loading:", menu.title, "After_Loading");
                }
                else
                {
                    ActionListGUI("ActionList when click:", menu.title, "When_Click");
                }
            }
            else if (saveListType == AC_SaveListType.Import)
            {
                autoHandle = true;
                                #if UNITY_STANDALONE
                importProductName  = CustomGUILayout.TextField("Import product name:", importProductName, apiPrefix + ".importProductName");
                importSaveFilename = CustomGUILayout.TextField("Import save filename:", importSaveFilename, apiPrefix + ".importSaveFilename");
                ActionListGUI("ActionList after import:", menu.title, "After_Import");
                checkImportBool = CustomGUILayout.Toggle("Require Bool to be true?", checkImportBool, apiPrefix + ".checkImportBool");
                if (checkImportBool)
                {
                    if (KickStarter.variablesManager != null)
                    {
                        ShowVarGUI(KickStarter.variablesManager.vars);
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("A Variables Manager is required.", MessageType.Warning);
                    }
                    //checkImportVar = CustomGUILayout.IntField ("Global Variable ID:", checkImportVar, apiPrefix + "checkImportVar");
                }
                                #else
                EditorGUILayout.HelpBox("This feature is only available for standalone platforms (PC, Mac, Linux)", MessageType.Warning);
                                #endif
            }

            displayType = (SaveDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType");

            fixedOption = CustomGUILayout.Toggle("Fixed Save ID only?", fixedOption, apiPrefix + ".fixedOption");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntField("ID to display:", optionToShow, apiPrefix + ".optionToShow");
            }
            else
            {
                maxSlots = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots");

                if (source == MenuSource.AdventureCreator)
                {
                    numSlots    = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                if (fixedOption)
                {
                    uiSlots = ResizeUISlots(uiSlots, 1);
                }
                else
                {
                    uiSlots = ResizeUISlots(uiSlots, maxSlots);
                }

                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i].LinkedUiGUI(i, source);
                }

                linkUIGraphic = (LinkUIGraphic)EditorGUILayout.EnumPopup("Link graphics to:", linkUIGraphic);
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }