Пример #1
0
        protected void CreateUIEvent(UnityEngine.UI.Button uiButton, AC.Menu _menu, UIPointerState uiPointerState = UIPointerState.PointerClick, int _slotIndex = 0, bool liveState = true)
        {
            if (uiPointerState == UIPointerState.PointerClick)
            {
                uiButton.onClick.AddListener(() => {
                    ProcessClickUI(_menu, _slotIndex, liveState ? KickStarter.playerInput.GetMouseState() : MouseState.SingleClick);
                });
            }
            else
            {
                EventTrigger eventTrigger = uiButton.gameObject.GetComponent <EventTrigger>();
                if (eventTrigger == null)
                {
                    eventTrigger = uiButton.gameObject.AddComponent <EventTrigger>();
                }
                EventTrigger.Entry entry = new EventTrigger.Entry();

                if (uiPointerState == UIPointerState.PointerDown)
                {
                    entry.eventID = EventTriggerType.PointerDown;
                }
                else if (uiPointerState == UIPointerState.PointerEnter)
                {
                    entry.eventID = EventTriggerType.PointerEnter;
                }

                entry.callback.AddListener((eventData) => {
                    ProcessClickUI(_menu, _slotIndex, liveState ? KickStarter.playerInput.GetMouseState() : MouseState.SingleClick);
                });

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

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            if (source == MenuSource.AdventureCreator)
            {
                GetCursorGUI();
                displayType = (AC_DisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType");

                if (displayType != AC_DisplayType.TextOnly)
                {
                    overrideTexture = CustomGUILayout.Toggle("Override icon texture?", overrideTexture, apiPrefix + ".overrideTexture");
                }
            }
            else
            {
                uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source);
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle");
                uiPointerState        = (UIPointerState)CustomGUILayout.EnumPopup("Responds to:", uiPointerState, apiPrefix + ".uiPointerState");
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                displayType = (AC_DisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType");
                GetCursorGUI();
            }
            alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton");
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Пример #3
0
        protected void CreateUIEvent(UnityEngine.UI.Button uiButton, AC.Menu _menu, UIPointerState uiPointerState = UIPointerState.PointerClick)
        {
            if (uiPointerState == UIPointerState.PointerClick)
            {
                uiButton.onClick.AddListener(() => {
                    ProcessClickUI(_menu, 0, KickStarter.playerInput.GetMouseState());
                });
            }
            else
            {
                EventTrigger eventTrigger = uiButton.gameObject.GetComponent <EventTrigger>();
                if (eventTrigger == null)
                {
                    eventTrigger = uiButton.gameObject.AddComponent <EventTrigger>();
                }

                EventTrigger.Entry entry = new EventTrigger.Entry();
                entry.eventID = EventTriggerType.PointerDown;
                entry.callback.AddListener((eventData) => {
                    ProcessClickUI(_menu, 0, KickStarter.playerInput.GetMouseState());
                });

                                #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0
                eventTrigger.delegates.Add(entry);
                                #else
                eventTrigger.triggers.Add(entry);
                                #endif
            }
        }
Пример #4
0
        void Update()
        {
            RightState = CheckPointer(IsOverRight, RightState, RightHandPointer);
            LeftState  = CheckPointer(IsOverLeft, LeftState, LeftHandPointer);

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

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

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

                if (displayType != AC_DisplayType.TextOnly)
                {
                    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
            {
                uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source, "The Unity UI Button this is linked to");
                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");
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                displayType = (AC_DisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How interactions are displayed");
                GetCursorGUI();
            }
            alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton", "The name of the input button that triggers the element when pressed");
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Пример #6
0
        /**
         * <summary>Copies the values from another MenuButton instance.</summary>
         * <param name = "_element">The MenuButton to copy values from</param>
         */
        public void CopyButton(MenuButton _element)
        {
            uiButton              = _element.uiButton;
            uiPointerState        = _element.uiPointerState;
            uiText                = _element.uiText;
            label                 = _element.label;
            hotspotLabel          = _element.hotspotLabel;
            hotspotLabelID        = _element.hotspotLabelID;
            anchor                = _element.anchor;
            textEffects           = _element.textEffects;
            outlineSize           = _element.outlineSize;
            buttonClickType       = _element.buttonClickType;
            simulateInput         = _element.simulateInput;
            simulateValue         = _element.simulateValue;
            doFade                = _element.doFade;
            switchMenuTitle       = _element.switchMenuTitle;
            inventoryBoxTitle     = _element.inventoryBoxTitle;
            shiftInventory        = _element.shiftInventory;
            loopJournal           = _element.loopJournal;
            actionList            = _element.actionList;
            inputAxis             = _element.inputAxis;
            clickTexture          = _element.clickTexture;
            clickAlpha            = _element.clickAlpha;
            shiftAmount           = _element.shiftAmount;
            onlyShowWhenEffective = _element.onlyShowWhenEffective;
            allowContinuousClick  = _element.allowContinuousClick;
            parameterID           = _element.parameterID;
            parameterValue        = _element.parameterValue;
            uiSelectableHideStyle = _element.uiSelectableHideStyle;

            base.Copy(_element);
        }
        /**
         * <summary>Initialises the linked Unity UI GameObjects.</summary>
         * <param name = "_menu">The element's parent Menu</param>
         */
        public override void LoadUnityUI(AC.Menu _menu, Canvas canvas)
        {
            uiMenu = _menu;

            int i = 0;

            foreach (UISlot uiSlot in uiSlots)
            {
                uiSlot.LinkUIElements(canvas, linkUIGraphic);
                if (uiSlot != null && uiSlot.uiButton != null)
                {
                    int j = i;

                    if (inventoryBoxType == AC_InventoryBoxType.Default || inventoryBoxType == AC_InventoryBoxType.CustomScript)
                    {
                        if (KickStarter.settingsManager != null &&
                            KickStarter.settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive &&
                            KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple)
                        {
                        }
                        else
                        {
                            uiPointerState = UIPointerState.PointerClick;
                        }
                    }

                    CreateUIEvent(uiSlot.uiButton, _menu, uiPointerState, j, false);

                    uiSlot.AddClickHandler(_menu, this, j);
                }
                i++;
            }
        }
Пример #8
0
        /**
         * Initialises the element when it is created within MenuManager.
         */
        public override void Declare()
        {
            uiButton        = null;
            uiPointerState  = UIPointerState.PointerClick;
            uiText          = null;
            label           = "Button";
            hotspotLabel    = "";
            hotspotLabelID  = -1;
            isVisible       = true;
            isClickable     = true;
            textEffects     = TextEffects.None;
            outlineSize     = 2f;
            buttonClickType = AC_ButtonClickType.RunActionList;
            simulateInput   = SimulateInputType.Button;
            simulateValue   = 1f;
            numSlots        = 1;
            anchor          = TextAnchor.MiddleCenter;
            SetSize(new Vector2(10f, 5f));
            doFade                = false;
            switchMenuTitle       = "";
            inventoryBoxTitle     = "";
            shiftInventory        = AC_ShiftInventory.ShiftLeft;
            loopJournal           = false;
            actionList            = null;
            inputAxis             = "";
            clickTexture          = null;
            clickAlpha            = 0f;
            shiftAmount           = 1;
            onlyShowWhenEffective = false;
            allowContinuousClick  = false;
            parameterID           = -1;
            parameterValue        = 0;

            base.Declare();
        }
Пример #9
0
        private void CopyInteraction(MenuInteraction _element, bool ignoreUnityUI)
        {
            if (ignoreUnityUI)
            {
                uiButton = null;
            }
            else
            {
                uiButton = _element.uiButton;
            }

            uiPointerState = _element.uiPointerState;
            uiText         = null;

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

            base.Copy(_element);
        }
Пример #10
0
        //EMPTY
        #region PUBLIC_METHODS
        #endregion

        #region PRIVATE_METHODS
        /// <summary>
        /// Check if the pointer is touching the UI
        /// </summary>
        /// <param name="isOver">If the Raycast is over something</param>
        /// <param name="pointerState">The current state of the pointer</param>
        /// <param name="pointer">The linerenderer to which the material is attached</param>
        /// <returns>The new state of the pointer</returns>
        private UIPointerState CheckPointer(BoolVariable isOver, UIPointerState pointerState, LineRenderer pointer)
        {
            if (isOver.Value && pointerState != UIPointerState.Selectable)
            {
                pointer.material = MatSelectable;
                return(UIPointerState.Selectable);
            }
            else if (!isOver.Value && pointerState != UIPointerState.On)
            {
                pointer.material = MatOn;
                return(UIPointerState.On);
            }
            return(pointerState);
        }
        private void CopyInteraction(MenuInteraction _element)
        {
            uiButton        = _element.uiButton;
            uiPointerState  = _element.uiPointerState;
            uiText          = null;
            displayType     = _element.displayType;
            anchor          = _element.anchor;
            textEffects     = _element.textEffects;
            outlineSize     = _element.outlineSize;
            iconID          = _element.iconID;
            overrideTexture = _element.overrideTexture;
            activeTexture   = _element.activeTexture;

            base.Copy(_element);
        }
Пример #12
0
        public override void ShowGUI(Menu menu)
        {
            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            if (source == MenuSource.AdventureCreator)
            {
                displayType = (AC_DisplayType)EditorGUILayout.EnumPopup("Display type:", displayType);
                GetCursorGUI();

                if (displayType != AC_DisplayType.IconOnly)
                {
                    anchor      = (TextAnchor)EditorGUILayout.EnumPopup("Text alignment:", anchor);
                    textEffects = (TextEffects)EditorGUILayout.EnumPopup("Text effect:", textEffects);
                    if (textEffects != TextEffects.None)
                    {
                        outlineSize = EditorGUILayout.Slider("Effect size:", outlineSize, 1f, 5f);
                    }
                }

                if (displayType != AC_DisplayType.TextOnly)
                {
                    overrideTexture = EditorGUILayout.Toggle("Override icon texture?", overrideTexture);
                    if (overrideTexture)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField("Active texture:", GUILayout.Width(145f));
                        activeTexture = (Texture2D)EditorGUILayout.ObjectField(activeTexture, typeof(Texture2D), false, GUILayout.Width(70f), GUILayout.Height(30f));
                        EditorGUILayout.EndHorizontal();
                    }
                }
            }
            else
            {
                uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source);
                uiSelectableHideStyle = (UISelectableHideStyle)EditorGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle);
                uiPointerState        = (UIPointerState)EditorGUILayout.EnumPopup("Responds to:", uiPointerState);
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                displayType = (AC_DisplayType)EditorGUILayout.EnumPopup("Display type:", displayType);
                GetCursorGUI();
            }
            alternativeInputButton = EditorGUILayout.TextField("Alternative input button:", alternativeInputButton);
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
        /**
         * Initialises the element when it is created within MenuManager.
         */
        public override void Declare()
        {
            uiButton       = null;
            uiPointerState = UIPointerState.PointerClick;
            uiText         = null;
            isVisible      = true;
            isClickable    = true;
            numSlots       = 1;
            anchor         = TextAnchor.MiddleCenter;
            SetSize(new Vector2(5f, 5f));
            iconID          = -1;
            textEffects     = TextEffects.None;
            outlineSize     = 2f;
            overrideTexture = false;
            activeTexture   = null;

            base.Declare();
        }
        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();
        }
Пример #15
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;
            }
        }
        /**
         * Initialises the element when it is created within MenuManager.
         */
        public override void Declare()
        {
            uiSlots        = null;
            uiPointerState = UIPointerState.PointerClick;

            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;
        }
Пример #17
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();
        }
        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");

                if (maxSlots == 1)
                {
                    alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton");
                }
            }

            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);

                // Don't show if Single and Default or Custom Script
                if (inventoryBoxType == AC_InventoryBoxType.Default || inventoryBoxType == AC_InventoryBoxType.CustomScript)
                {
                    if (KickStarter.settingsManager != null &&
                        KickStarter.settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive &&
                        KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple)
                    {
                        uiPointerState = (UIPointerState)CustomGUILayout.EnumPopup("Responds to:", uiPointerState, apiPrefix + ".uiPointerState");
                    }
                }
                else
                {
                    uiPointerState = (UIPointerState)CustomGUILayout.EnumPopup("Responds to:", uiPointerState, apiPrefix + ".uiPointerState");
                }
            }
            EditorGUILayout.EndVertical();

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

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

            CustomGUILayout.BeginVertical();
            MenuSource source = menu.menuSource;

            if (source != MenuSource.AdventureCreator)
            {
                uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source, "The Unity UI Button this is linked to");
                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");
                CustomGUILayout.EndVertical();
                CustomGUILayout.BeginVertical();
            }

            label           = CustomGUILayout.TextField("Button text:", label, apiPrefix + ".label", "The text that's displayed on-screen");
            buttonClickType = (AC_ButtonClickType)CustomGUILayout.EnumPopup("Click type:", buttonClickType, apiPrefix + ".buttonClickType", "The type of reaction that occurs when clicked");

            if (buttonClickType == AC_ButtonClickType.TurnOffMenu)
            {
                doFade = CustomGUILayout.Toggle("Do transition?", doFade, apiPrefix + ".doFade", "If True, then the menu will transition as it turns off");
            }
            else if (buttonClickType == AC_ButtonClickType.Crossfade)
            {
                switchMenuTitle = CustomGUILayout.TextField("Menu to switch to:", switchMenuTitle, apiPrefix + ".switchMenutitle", "The name of the menu to crossfade to");
            }
            else if (buttonClickType == AC_ButtonClickType.OffsetElementSlot)
            {
                inventoryBoxTitle     = CustomGUILayout.TextField("Element to affect:", inventoryBoxTitle, apiPrefix + ".inventoryBoxTitle", "The name of the element (in the same menu) with slots to shift");
                shiftInventory        = (AC_ShiftInventory)CustomGUILayout.EnumPopup("Offset type:", shiftInventory, apiPrefix + ".shiftInventory", "The direction to shift slots");
                shiftAmount           = CustomGUILayout.IntField("Offset amount:", shiftAmount, apiPrefix + ".shiftAmount", "The amount to shift slots by");
                onlyShowWhenEffective = CustomGUILayout.Toggle("Only show when effective?", onlyShowWhenEffective, apiPrefix + ".onlyShowWhenEffective", "If True, then the button will only be visible if the slots it affects can actually be shifted");
            }
            else if (buttonClickType == AC_ButtonClickType.OffsetJournal)
            {
                inventoryBoxTitle     = CustomGUILayout.TextField("Journal to affect:", inventoryBoxTitle, apiPrefix + ".inventoryBoxTitle", "The name of the Journal element (in the same menu)");
                shiftInventory        = (AC_ShiftInventory)CustomGUILayout.EnumPopup("Offset type:", shiftInventory, apiPrefix + ".shiftInventory", "The direction to shift pages in");
                loopJournal           = CustomGUILayout.Toggle("Cycle pages?", loopJournal, apiPrefix + ".loopJournal", "If True, then shifting past the last Journal page will open the first");
                shiftAmount           = CustomGUILayout.IntField("Offset amount:", shiftAmount, apiPrefix + ".shiftAmount", "The number of pages to shift by");
                onlyShowWhenEffective = CustomGUILayout.Toggle("Only show when effective?", onlyShowWhenEffective, apiPrefix + ".onlyShowWhenEffective", "If True, then the button will only be visible if the Journal it affects can actually be shifted");
            }
            else if (buttonClickType == AC_ButtonClickType.RunActionList)
            {
                ActionListGUI(menu.title, apiPrefix);
            }
            else if (buttonClickType == AC_ButtonClickType.CustomScript)
            {
                allowContinuousClick = CustomGUILayout.Toggle("Accept held-down clicks?", allowContinuousClick, apiPrefix + ".allowContinuousClick", "If True, then the button will respond to the mouse button being held down");
                ShowClipHelp();
            }
            else if (buttonClickType == AC_ButtonClickType.SimulateInput)
            {
                simulateInput = (SimulateInputType)CustomGUILayout.EnumPopup("Simulate:", simulateInput, apiPrefix + ".simulateInput", "The type of Input to simulate when clicked");
                inputAxis     = CustomGUILayout.TextField("Input axis:", inputAxis, apiPrefix + ".inputAxis", "The name of the Input axis to simulate when clicked");
                if (simulateInput == SimulateInputType.Axis)
                {
                    simulateValue = CustomGUILayout.FloatField("Input value:", simulateValue, apiPrefix + ".simulateValue", "The value of the Input axis to simulate when clicked");
                }
            }

            hotspotLabel           = CustomGUILayout.TextField("Hotspot label override:", hotspotLabel, apiPrefix + ".hotspotLabel", "The text that appears in the Hotspot label buffer when the mouse hovers over");
            alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton", "The name of the input button that triggers the element when pressed");
            ChangeCursorGUI(menu);
            CustomGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Пример #20
0
        public override void ShowGUI(Menu menu)
        {
            EditorGUILayout.BeginVertical("Button");
            MenuSource source = menu.menuSource;

            if (source != MenuSource.AdventureCreator)
            {
                uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source);
                uiSelectableHideStyle = (UISelectableHideStyle)EditorGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle);
                uiPointerState        = (UIPointerState)EditorGUILayout.EnumPopup("Responds to:", uiPointerState);
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

            label = EditorGUILayout.TextField("Button text:", label);

            if (source == MenuSource.AdventureCreator)
            {
                anchor      = (TextAnchor)EditorGUILayout.EnumPopup("Text alignment:", anchor);
                textEffects = (TextEffects)EditorGUILayout.EnumPopup("Text effect:", textEffects);
                if (textEffects != TextEffects.None)
                {
                    outlineSize = EditorGUILayout.Slider("Effect size:", outlineSize, 1f, 5f);
                }
            }

            hotspotLabel = EditorGUILayout.TextField("Hotspot label override:", hotspotLabel);

            if (source == MenuSource.AdventureCreator)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Click texture:", GUILayout.Width(145f));
                clickTexture = (Texture2D)EditorGUILayout.ObjectField(clickTexture, typeof(Texture2D), false, GUILayout.Width(70f), GUILayout.Height(30f));
                EditorGUILayout.EndHorizontal();
            }

            buttonClickType = (AC_ButtonClickType)EditorGUILayout.EnumPopup("Click type:", buttonClickType);

            if (buttonClickType == AC_ButtonClickType.TurnOffMenu)
            {
                doFade = EditorGUILayout.Toggle("Do transition?", doFade);
            }
            else if (buttonClickType == AC_ButtonClickType.Crossfade)
            {
                switchMenuTitle = EditorGUILayout.TextField("Menu to switch to:", switchMenuTitle);
            }
            else if (buttonClickType == AC_ButtonClickType.OffsetElementSlot)
            {
                inventoryBoxTitle     = EditorGUILayout.TextField("Element to affect:", inventoryBoxTitle);
                shiftInventory        = (AC_ShiftInventory)EditorGUILayout.EnumPopup("Offset type:", shiftInventory);
                shiftAmount           = EditorGUILayout.IntField("Offset amount:", shiftAmount);
                onlyShowWhenEffective = EditorGUILayout.Toggle("Only show when effective?", onlyShowWhenEffective);
            }
            else if (buttonClickType == AC_ButtonClickType.OffsetJournal)
            {
                inventoryBoxTitle     = EditorGUILayout.TextField("Journal to affect:", inventoryBoxTitle);
                shiftInventory        = (AC_ShiftInventory)EditorGUILayout.EnumPopup("Offset type:", shiftInventory);
                loopJournal           = EditorGUILayout.Toggle("Cycle pages?", loopJournal);
                shiftAmount           = EditorGUILayout.IntField("Offset amount:", shiftAmount);
                onlyShowWhenEffective = EditorGUILayout.Toggle("Only show when effective?", onlyShowWhenEffective);
            }
            else if (buttonClickType == AC_ButtonClickType.RunActionList)
            {
                ActionListGUI(menu.title);
            }
            else if (buttonClickType == AC_ButtonClickType.CustomScript)
            {
                allowContinuousClick = EditorGUILayout.Toggle("Accept held-down clicks?", allowContinuousClick);
                ShowClipHelp();
            }
            else if (buttonClickType == AC_ButtonClickType.SimulateInput)
            {
                simulateInput = (SimulateInputType)EditorGUILayout.EnumPopup("Simulate:", simulateInput);
                inputAxis     = EditorGUILayout.TextField("Input axis:", inputAxis);
                if (simulateInput == SimulateInputType.Axis)
                {
                    simulateValue = EditorGUILayout.FloatField("Input value:", simulateValue);
                }
            }

            alternativeInputButton = EditorGUILayout.TextField("Alternative input button:", alternativeInputButton);
            ChangeCursorGUI(menu);
            EditorGUILayout.EndVertical();

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

            EditorGUILayout.BeginVertical("Button");
            MenuSource source = menu.menuSource;

            if (source != MenuSource.AdventureCreator)
            {
                uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source);
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle");
                uiPointerState        = (UIPointerState)CustomGUILayout.EnumPopup("Responds to:", uiPointerState, apiPrefix + ".uiPointerState");
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

            label           = CustomGUILayout.TextField("Button text:", label, apiPrefix + ".label");
            buttonClickType = (AC_ButtonClickType)CustomGUILayout.EnumPopup("Click type:", buttonClickType, apiPrefix + ".buttonClickType");

            if (buttonClickType == AC_ButtonClickType.TurnOffMenu)
            {
                doFade = CustomGUILayout.Toggle("Do transition?", doFade, apiPrefix + ".doFade");
            }
            else if (buttonClickType == AC_ButtonClickType.Crossfade)
            {
                switchMenuTitle = CustomGUILayout.TextField("Menu to switch to:", switchMenuTitle, apiPrefix + ".switchMenutitle");
            }
            else if (buttonClickType == AC_ButtonClickType.OffsetElementSlot)
            {
                inventoryBoxTitle     = CustomGUILayout.TextField("Element to affect:", inventoryBoxTitle, apiPrefix + ".inventoryBoxTitle");
                shiftInventory        = (AC_ShiftInventory)CustomGUILayout.EnumPopup("Offset type:", shiftInventory, apiPrefix + ".shiftInventory");
                shiftAmount           = CustomGUILayout.IntField("Offset amount:", shiftAmount, apiPrefix + ".shiftAmount");
                onlyShowWhenEffective = CustomGUILayout.Toggle("Only show when effective?", onlyShowWhenEffective, apiPrefix + ".onlyShowWhenEffective");
            }
            else if (buttonClickType == AC_ButtonClickType.OffsetJournal)
            {
                inventoryBoxTitle     = CustomGUILayout.TextField("Journal to affect:", inventoryBoxTitle, apiPrefix + ".inventoryBoxTitle");
                shiftInventory        = (AC_ShiftInventory)CustomGUILayout.EnumPopup("Offset type:", shiftInventory, apiPrefix + ".shiftInventory");
                loopJournal           = CustomGUILayout.Toggle("Cycle pages?", loopJournal, apiPrefix + ".loopJournal");
                shiftAmount           = CustomGUILayout.IntField("Offset amount:", shiftAmount, apiPrefix + ".shiftAmount");
                onlyShowWhenEffective = CustomGUILayout.Toggle("Only show when effective?", onlyShowWhenEffective, apiPrefix + ".onlyShowWhenEffective");
            }
            else if (buttonClickType == AC_ButtonClickType.RunActionList)
            {
                ActionListGUI(menu.title, apiPrefix);
            }
            else if (buttonClickType == AC_ButtonClickType.CustomScript)
            {
                allowContinuousClick = CustomGUILayout.Toggle("Accept held-down clicks?", allowContinuousClick, apiPrefix + ".allowContinuousClick");
                ShowClipHelp();
            }
            else if (buttonClickType == AC_ButtonClickType.SimulateInput)
            {
                simulateInput = (SimulateInputType)CustomGUILayout.EnumPopup("Simulate:", simulateInput, apiPrefix + ".simulateInput");
                inputAxis     = CustomGUILayout.TextField("Input axis:", inputAxis, apiPrefix + ".inputAxis");
                if (simulateInput == SimulateInputType.Axis)
                {
                    simulateValue = CustomGUILayout.FloatField("Input value:", simulateValue, apiPrefix + ".simulateValue");
                }
            }

            hotspotLabel           = CustomGUILayout.TextField("Hotspot label override:", hotspotLabel, apiPrefix + ".hotspotLabel");
            alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton");
            ChangeCursorGUI(menu);
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }