/**
         * Initialises the element when it is created within MenuManager.
         */
        public override void Declare()
        {
            uiSlots = null;

            isVisible   = true;
            isClickable = true;
            numSlots    = 1;
            maxSlots    = 5;
            showActive  = true;

            SetSize(new Vector2(20f, 5f));
            anchor = TextAnchor.MiddleCenter;

            actionListOnClick = null;
            textEffects       = TextEffects.None;
            outlineSize       = 2f;
            uiHideStyle       = UIHideStyle.DisableObject;

            fixedOption   = false;
            optionToShow  = 0;
            autoHandle    = true;
            parameterID   = -1;
            linkUIGraphic = LinkUIGraphic.ImageComponent;

            base.Declare();
        }
Exemple #2
0
        private void CopyInventoryBox(MenuInventoryBox _element, bool ignoreUnityUI)
        {
            if (ignoreUnityUI)
            {
                uiSlots = null;
            }
            else
            {
                uiSlots = _element.uiSlots;
            }

            isClickable                = _element.isClickable;
            textEffects                = _element.textEffects;
            outlineSize                = _element.outlineSize;
            inventoryBoxType           = _element.inventoryBoxType;
            numSlots                   = _element.numSlots;
            maxSlots                   = _element.maxSlots;
            limitToCategory            = _element.limitToCategory;
            limitToDefinedInteractions = _element.limitToDefinedInteractions;
            categoryID                 = _element.categoryID;
            selectItemsAfterTaking     = _element.selectItemsAfterTaking;
            displayType                = _element.displayType;
            uiHideStyle                = _element.uiHideStyle;
            categoryIDs                = _element.categoryIDs;
            linkUIGraphic              = _element.linkUIGraphic;

            UpdateLimitCategory();

            items = GetItemList();

            base.Copy(_element);

            Upgrade();
        }
Exemple #3
0
        /**
         * Initialises the element when it is created within MenuManager.
         */
        public override void Declare()
        {
            uiSlots = null;

            isVisible    = true;
            isClickable  = true;
            fixedOption  = false;
            displayType  = ConversationDisplayType.TextOnly;
            testIcon     = null;
            optionToShow = 1;
            numSlots     = 0;
            SetSize(new Vector2(20f, 5f));
            maxSlots                           = 10;
            anchor                             = TextAnchor.MiddleLeft;
            textEffects                        = TextEffects.None;
            outlineSize                        = 2f;
            markAlreadyChosen                  = false;
            alreadyChosenFontColour            = Color.white;
            alreadyChosenFontHighlightedColour = Color.white;
            showIndexNumbers                   = false;
            uiHideStyle                        = UIHideStyle.DisableObject;
            linkUIGraphic                      = LinkUIGraphic.ImageComponent;
            resetOffsetWhenRestart             = true;

            base.Declare();
        }
Exemple #4
0
        private void CopyCrafting(MenuCrafting _element, bool ignoreUnityUI)
        {
            if (ignoreUnityUI)
            {
                uiSlots = null;
            }
            else
            {
                uiSlots = new UISlot[_element.uiSlots.Length];
                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i] = new UISlot(_element.uiSlots[i]);
                }
            }

            isClickable  = _element.isClickable;
            textEffects  = _element.textEffects;
            outlineSize  = _element.outlineSize;
            numSlots     = _element.numSlots;
            craftingType = _element.craftingType;
            displayType  = _element.displayType;
            uiHideStyle  = _element.uiHideStyle;
            actionListOnWrongIngredients = _element.actionListOnWrongIngredients;
            linkUIGraphic             = _element.linkUIGraphic;
            autoCreate                = _element.autoCreate;
            inventoryItemCountDisplay = _element.inventoryItemCountDisplay;

            PopulateList(MenuSource.AdventureCreator);

            base.Copy(_element);
        }
Exemple #5
0
        private void CopySavesList(MenuSavesList _element, bool ignoreUnityUI)
        {
            if (ignoreUnityUI)
            {
                uiSlots = null;
            }
            else
            {
                uiSlots = _element.uiSlots;
            }

            newSaveText        = _element.newSaveText;
            textEffects        = _element.textEffects;
            outlineSize        = _element.outlineSize;
            anchor             = _element.anchor;
            saveListType       = _element.saveListType;
            maxSlots           = _element.maxSlots;
            actionListOnSave   = _element.actionListOnSave;
            displayType        = _element.displayType;
            blankSlotTexture   = _element.blankSlotTexture;
            fixedOption        = _element.fixedOption;
            optionToShow       = _element.optionToShow;
            importProductName  = _element.importProductName;
            importSaveFilename = _element.importSaveFilename;
            checkImportBool    = _element.checkImportBool;
            checkImportVar     = _element.checkImportVar;
            parameterID        = _element.parameterID;
            showNewSaveOption  = _element.showNewSaveOption;
            autoHandle         = _element.autoHandle;
            uiHideStyle        = _element.uiHideStyle;
            linkUIGraphic      = _element.linkUIGraphic;

            base.Copy(_element);
        }
Exemple #6
0
        private void CopyCrafting(MenuCrafting _element, bool ignoreUnityUI)
        {
            if (ignoreUnityUI)
            {
                uiSlots = null;
            }
            else
            {
                uiSlots = _element.uiSlots;
            }

            isClickable  = _element.isClickable;
            textEffects  = _element.textEffects;
            outlineSize  = _element.outlineSize;
            numSlots     = _element.numSlots;
            craftingType = _element.craftingType;
            displayType  = _element.displayType;
            uiHideStyle  = _element.uiHideStyle;
            actionListOnWrongIngredients = _element.actionListOnWrongIngredients;
            linkUIGraphic = _element.linkUIGraphic;

            PopulateList(MenuSource.AdventureCreator);

            base.Copy(_element);
        }
Exemple #7
0
        private void CopyDialogList(MenuDialogList _element, bool ignoreUnityUI)
        {
            if (ignoreUnityUI)
            {
                uiSlots = null;
            }
            else
            {
                uiSlots = _element.uiSlots;
            }

            textEffects                        = _element.textEffects;
            outlineSize                        = _element.outlineSize;
            displayType                        = _element.displayType;
            testIcon                           = _element.testIcon;
            anchor                             = _element.anchor;
            labels                             = _element.labels;
            fixedOption                        = _element.fixedOption;
            optionToShow                       = _element.optionToShow;
            maxSlots                           = _element.maxSlots;
            markAlreadyChosen                  = _element.markAlreadyChosen;
            alreadyChosenFontColour            = _element.alreadyChosenFontColour;
            alreadyChosenFontHighlightedColour = _element.alreadyChosenFontHighlightedColour;
            showIndexNumbers                   = _element.showIndexNumbers;
            uiHideStyle                        = _element.uiHideStyle;
            linkUIGraphic                      = _element.linkUIGraphic;
            resetOffsetWhenRestart             = _element.resetOffsetWhenRestart;

            base.Copy(_element);
        }
        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);
        }
Exemple #9
0
        /**
         * <summary>Links the UI GameObjects to the class, based on the supplied uiButtonID.</summary>
         * <param name = "canvas">The Canvas that contains the UI GameObjects</param>
         * <param name = "linkUIGraphic">What Image component the Element's Graphics should be linked to (ImageComponent, ButtonTargetGraphic)</param>
         * <param name = "emptySlotTexture">If set, the texture to use when a slot is considered empty</param>
         */
        public void LinkUIElements(Canvas canvas, LinkUIGraphic linkUIGraphic, Texture2D emptySlotTexture = null)
        {
            if (canvas != null)
            {
                uiButton = Serializer.GetGameObjectComponent <UnityEngine.UI.Button> (uiButtonID, canvas.gameObject);
            }
            else
            {
                uiButton = null;
            }

            if (uiButton)
            {
                                #if TextMeshProIsPresent
                uiText = uiButton.GetComponentInChildren <TMPro.TextMeshProUGUI>();
                                #else
                uiText = uiButton.GetComponentInChildren <Text>();
                                #endif
                uiRawImage = uiButton.GetComponentInChildren <RawImage>();

                if (linkUIGraphic == LinkUIGraphic.ImageComponent)
                {
                    uiImage = uiButton.GetComponentInChildren <Image>();
                }
                else if (linkUIGraphic == LinkUIGraphic.ButtonTargetGraphic)
                {
                    if (uiButton.targetGraphic != null)
                    {
                        if (uiButton.targetGraphic is Image)
                        {
                            uiImage = uiButton.targetGraphic as Image;
                        }
                        else
                        {
                            ACDebug.LogWarning("Cannot assign UI Image for " + uiButton.name + "'s target graphic as " + uiButton.targetGraphic + " is not an Image component.", canvas);
                        }
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot assign UI Image for " + uiButton.name + "'s target graphic because it has none.", canvas);
                    }
                }

                originalColour = uiButton.colors.normalColor;
            }

            if (emptySlotTexture != null)
            {
                emptySprite = Sprite.Create(emptySlotTexture, new Rect(0f, 0f, emptySlotTexture.width, emptySlotTexture.height), new Vector2(0.5f, 0.5f), 100f, 0, SpriteMeshType.FullRect);
            }
        }
Exemple #10
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuInteraction)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            GetCursorGUI(apiPrefix, source);
            displayType = (AC_DisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How interactions are displayed");

            if (fixedIcon)
            {
                alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton", "The name of the input button that triggers the element when pressed");
            }

            if (source == MenuSource.AdventureCreator)
            {
                if (displayType != AC_DisplayType.TextOnly && fixedIcon)
                {
                    overrideTexture = CustomGUILayout.Toggle("Override icon texture?", overrideTexture, apiPrefix + ".overrideTexture", "If True, the element's texture can be set independently of the associated interaction icon set within the Cursor Manager");
                }
            }
            else
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");

                if (fixedIcon)
                {
                    uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source, "The Unity UI Button this is linked to");
                }
                else
                {
                    uiSlots = ResizeUISlots(uiSlots, maxSlots);
                    for (int i = 0; i < uiSlots.Length; i++)
                    {
                        uiSlots[i].LinkedUiGUI(i, source);
                    }
                }

                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle", "The method by which this element is hidden from view when made invisible");
                uiPointerState        = (UIPointerState)CustomGUILayout.EnumPopup("Responds to:", uiPointerState, apiPrefix + ".uiPointerState", "What pointer state registers as a 'click' for Unity UI Menus");
                linkUIGraphic         = (LinkUIGraphic)CustomGUILayout.EnumPopup("Link graphics to:", linkUIGraphic, "", "What Image component the element's graphics should be linked to");
            }
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Exemple #11
0
 /**
  * Initialises the element when it is created within MenuManager.
  */
 public override void Declare()
 {
     uiSlots     = null;
     isVisible   = true;
     isClickable = true;
     numSlots    = 4;
     SetSize(new Vector2(6f, 10f));
     textEffects  = TextEffects.None;
     outlineSize  = 2f;
     craftingType = CraftingElementType.Ingredients;
     displayType  = ConversationDisplayType.IconOnly;
     uiHideStyle  = UIHideStyle.DisableObject;
     actionListOnWrongIngredients = null;
     linkUIGraphic = LinkUIGraphic.ImageComponent;
     items         = new List <InvItem>();
 }
Exemple #12
0
        /**
         * <summary>Links the UI GameObjects to the class, based on the supplied uiButtonID.</summary>
         * <param name = "canvas">The Canvas that contains the UI GameObjects</param>
         * <param name = "linkUIGraphic">What Image component the Element's Graphics should be linked to (ImageComponent, ButtonTargetGraphic)</param>
         */
        public void LinkUIElements(Canvas canvas, LinkUIGraphic linkUIGraphic)
        {
            if (canvas != null)
            {
                uiButton = Serializer.GetGameObjectComponent <UnityEngine.UI.Button> (uiButtonID, canvas.gameObject);
            }
            else
            {
                uiButton = null;
            }

            if (uiButton)
            {
                if (uiButton.GetComponentInChildren <Text>())
                {
                    uiText = uiButton.GetComponentInChildren <Text>();
                }
                if (uiButton.GetComponentInChildren <RawImage>())
                {
                    uiRawImage = uiButton.GetComponentInChildren <RawImage>();
                }
                if (linkUIGraphic == LinkUIGraphic.ImageComponent && uiButton.GetComponentInChildren <Image>())
                {
                    uiImage = uiButton.GetComponentInChildren <Image>();
                }
                else if (linkUIGraphic == LinkUIGraphic.ButtonTargetGraphic)
                {
                    if (uiButton.targetGraphic != null)
                    {
                        if (uiButton.targetGraphic is Image)
                        {
                            uiImage = uiButton.targetGraphic as Image;
                        }
                        else
                        {
                            ACDebug.LogWarning("Cannot assign UI Image for " + uiButton.name + "'s target graphic as " + uiButton.targetGraphic + " is not an Image component.", canvas);
                        }
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot assign UI Image for " + uiButton.name + "'s target graphic because it has none.", canvas);
                    }
                }

                originalColour = uiButton.colors.normalColor;
            }
        }
        private void CopyInventoryBox(MenuInventoryBox _element, bool ignoreUnityUI)
        {
            if (ignoreUnityUI)
            {
                uiSlots = null;
            }
            else
            {
                uiSlots = _element.uiSlots;
            }
            uiPointerState = _element.uiPointerState;

            isClickable                = _element.isClickable;
            textEffects                = _element.textEffects;
            outlineSize                = _element.outlineSize;
            inventoryBoxType           = _element.inventoryBoxType;
            numSlots                   = _element.numSlots;
            maxSlots                   = _element.maxSlots;
            limitToCategory            = _element.limitToCategory;
            limitToDefinedInteractions = _element.limitToDefinedInteractions;
            categoryID                 = _element.categoryID;
            selectItemsAfterTaking     = _element.selectItemsAfterTaking;
            displayType                = _element.displayType;
            uiHideStyle                = _element.uiHideStyle;
            categoryIDs                = _element.categoryIDs;
            linkUIGraphic              = _element.linkUIGraphic;

            UpdateLimitCategory();

            items = GetItemList();

            base.Copy(_element);

            if (Application.isPlaying)
            {
                if (!(inventoryBoxType == AC_InventoryBoxType.HotspotBased && maxSlots == 1))
                {
                    alternativeInputButton = "";
                }
            }

            Upgrade();
        }
Exemple #14
0
 /**
  * Initialises the element when it is created within MenuManager.
  */
 public override void Declare()
 {
     uiSlots     = null;
     isVisible   = true;
     isClickable = true;
     numSlots    = 4;
     SetSize(new Vector2(6f, 10f));
     textEffects  = TextEffects.None;
     outlineSize  = 2f;
     craftingType = CraftingElementType.Ingredients;
     displayType  = ConversationDisplayType.IconOnly;
     uiHideStyle  = UIHideStyle.DisableObject;
     actionListOnWrongIngredients = null;
     linkUIGraphic             = LinkUIGraphic.ImageComponent;
     invInstances              = new List <InvInstance>();
     autoCreate                = true;
     inventoryItemCountDisplay = InventoryItemCountDisplay.OnlyIfMultiple;
     containerSelectMode       = ContainerSelectMode.MoveToInventoryAndSelect;
 }
Exemple #15
0
        private void CopySavesList(MenuSavesList _element, bool ignoreUnityUI)
        {
            if (ignoreUnityUI)
            {
                uiSlots = null;
            }
            else
            {
                uiSlots = new UISlot[_element.uiSlots.Length];
                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i] = new UISlot(_element.uiSlots[i]);
                }
            }

            newSaveText         = _element.newSaveText;
            emptySlotText       = _element.emptySlotText;
            emptySlotTextLineID = _element.emptySlotTextLineID;
            textEffects         = _element.textEffects;
            outlineSize         = _element.outlineSize;
            anchor             = _element.anchor;
            saveListType       = _element.saveListType;
            maxSlots           = _element.maxSlots;
            actionListOnSave   = _element.actionListOnSave;
            displayType        = _element.displayType;
            blankSlotTexture   = _element.blankSlotTexture;
            allowEmptySlots    = _element.allowEmptySlots;
            fixedOption        = _element.fixedOption;
            optionToShow       = _element.optionToShow;
            hideIfNotValid     = _element.hideIfNotValid;
            importProductName  = _element.importProductName;
            importSaveFilename = _element.importSaveFilename;
            checkImportBool    = _element.checkImportBool;
            checkImportVar     = _element.checkImportVar;
            parameterID        = _element.parameterID;
            showNewSaveOption  = _element.showNewSaveOption;
            autoHandle         = _element.autoHandle;
            uiHideStyle        = _element.uiHideStyle;
            linkUIGraphic      = _element.linkUIGraphic;

            base.Copy(_element);
        }
Exemple #16
0
        /**
         * Initialises the element when it is created within MenuManager.
         */
        public override void Declare()
        {
            uiSlots = null;

            newSaveText         = "New save";
            emptySlotText       = string.Empty;
            emptySlotTextLineID = -1;
            isVisible           = true;
            isClickable         = true;
            numSlots            = 1;
            maxSlots            = 5;

            SetSize(new Vector2(20f, 5f));
            anchor       = TextAnchor.MiddleCenter;
            saveListType = AC_SaveListType.Save;

            actionListOnSave = null;
            newSaveSlot      = false;
            textEffects      = TextEffects.None;
            outlineSize      = 2f;
            displayType      = SaveDisplayType.LabelOnly;
            blankSlotTexture = null;

            allowEmptySlots = false;
            fixedOption     = false;
            optionToShow    = 1;
            hideIfNotValid  = false;

            importProductName  = "";
            importSaveFilename = "";
            checkImportBool    = false;
            checkImportVar     = 0;

            showNewSaveOption = true;
            autoHandle        = true;

            parameterID   = -1;
            uiHideStyle   = UIHideStyle.DisableObject;
            linkUIGraphic = LinkUIGraphic.ImageComponent;

            base.Declare();
        }
Exemple #17
0
        private void CopyInteraction(MenuInteraction _element, bool ignoreUnityUI)
        {
            if (ignoreUnityUI)
            {
                uiButton = null;
                uiSlots  = null;
            }
            else
            {
                uiButton = _element.uiButton;

                uiSlots = new UISlot[_element.uiSlots.Length];
                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i] = new UISlot(_element.uiSlots[i]);
                }
            }

            uiPointerState = _element.uiPointerState;
            uiText         = null;
            uiImage        = null;

            maxSlots              = _element.maxSlots;
            displayType           = _element.displayType;
            anchor                = _element.anchor;
            textEffects           = _element.textEffects;
            outlineSize           = _element.outlineSize;
            iconID                = _element.iconID;
            overrideTexture       = _element.overrideTexture;
            activeTexture         = _element.activeTexture;
            uiSelectableHideStyle = _element.uiSelectableHideStyle;
            linkUIGraphic         = _element.linkUIGraphic;
            fixedIcon             = _element.fixedIcon;

            base.Copy(_element);

            if (!fixedIcon)
            {
                alternativeInputButton = string.Empty;
            }
        }
Exemple #18
0
        /**
         * Initialises the element when it is created within MenuManager.
         */
        public override void Declare()
        {
            uiSlots = null;

            isVisible        = true;
            isClickable      = true;
            inventoryBoxType = AC_InventoryBoxType.Default;
            numSlots         = 0;
            SetSize(new Vector2(6f, 10f));
            maxSlots                   = 10;
            limitToCategory            = false;
            limitToDefinedInteractions = true;
            selectItemsAfterTaking     = true;
            categoryID                 = -1;
            displayType                = ConversationDisplayType.IconOnly;
            textEffects                = TextEffects.None;
            outlineSize                = 2f;
            uiHideStyle                = UIHideStyle.DisableObject;
            items         = new List <InvItem>();
            categoryIDs   = new List <int>();
            linkUIGraphic = LinkUIGraphic.ImageComponent;
        }
Exemple #19
0
        /**
         * Initialises the element when it is created within MenuManager.
         */
        public override void Declare()
        {
            uiButton       = null;
            uiSlots        = null;
            uiPointerState = UIPointerState.PointerClick;
            uiImage        = null;
            uiText         = null;
            isVisible      = true;
            isClickable    = true;
            numSlots       = 1;
            maxSlots       = 5;
            anchor         = TextAnchor.MiddleCenter;
            SetSize(new Vector2(5f, 5f));
            iconID                = -1;
            textEffects           = TextEffects.None;
            outlineSize           = 2f;
            overrideTexture       = false;
            activeTexture         = null;
            uiSelectableHideStyle = UISelectableHideStyle.DisableObject;
            fixedIcon             = true;
            linkUIGraphic         = LinkUIGraphic.ImageComponent;

            base.Declare();
        }
Exemple #20
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);
        }
Exemple #21
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);
        }
Exemple #23
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);
        }
        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);
        }
        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);
        }
Exemple #26
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);
        }
Exemple #27
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);
        }
Exemple #28
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);
        }