コード例 #1
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;
            autoCreate                = _element.autoCreate;
            inventoryItemCountDisplay = _element.inventoryItemCountDisplay;

            PopulateList(MenuSource.AdventureCreator);

            base.Copy(_element);
        }
コード例 #2
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;
            containerSelectMode       = _element.containerSelectMode;

            PopulateList();

            base.Copy(_element);
        }
コード例 #3
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>();
     autoCreate                = true;
     inventoryItemCountDisplay = InventoryItemCountDisplay.OnlyIfMultiple;
 }
コード例 #4
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);
        }