public static ActionListAsset AssetGUI(string label, ActionListAsset actionListAsset, string api = "", string defaultName = "")
        {
            EditorGUILayout.BeginHorizontal();
            actionListAsset = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> (label, actionListAsset, false, api);

            if (actionListAsset == null)
            {
                if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                {
                                        #if !(UNITY_WP8 || UNITY_WINRT)
                    defaultName = System.Text.RegularExpressions.Regex.Replace(defaultName, "[^\\w\\_]", "");
                                        #else
                    defaultName = "";
                                        #endif

                    if (defaultName != "")
                    {
                        actionListAsset = ActionListAssetMenu.CreateAsset(defaultName);
                    }
                    else
                    {
                        actionListAsset = ActionListAssetMenu.CreateAsset();
                    }
                }
            }

            EditorGUILayout.EndHorizontal();
            return(actionListAsset);
        }
예제 #2
0
        public override void OnInspectorGUI()
        {
            DialogueOption _target = (DialogueOption)target;

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Dialogue Option properties", EditorStyles.boldLabel);
            _target.source = (ActionListSource)EditorGUILayout.EnumPopup("Actions source:", _target.source);
            if (_target.source == ActionListSource.AssetFile)
            {
                _target.assetFile = ActionListAssetMenu.AssetGUI("ActionList asset:", _target.assetFile);
            }
            if (_target.actionListType == ActionListType.PauseGameplay)
            {
                _target.isSkippable = EditorGUILayout.Toggle("Is skippable?", _target.isSkippable);
            }
            EditorGUILayout.EndVertical();

            // Draw all GUI elements that buttons and triggers share
            DrawSharedElements();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(_target);
            }
        }
        private List <ActiveInput> ShowActiveInputsGUI(List <ActiveInput> activeInputs)
        {
            EditorGUILayout.HelpBox("Active Inputs are used to trigger ActionList assets when an input key is pressed under certain gameplay conditions.", MessageType.Info);

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

            for (int i = 0; i < activeInputs.Count; i++)
            {
                EditorGUILayout.BeginVertical(CustomStyles.thinBox);

                string defaultName = "ActiveInput_" + activeInputs[i].inputName;
                if (activeInputs[i].inputName == "")
                {
                    defaultName = "ActiveInput_" + i.ToString();
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Input #" + activeInputs[i].ID, EditorStyles.boldLabel);
                if (GUILayout.Button("-", GUILayout.Width(20f)))
                {
                    activeInputs.RemoveAt(i);
                    return(activeInputs);
                }
                EditorGUILayout.EndHorizontal();
                activeInputs[i].inputName       = EditorGUILayout.TextField("Input button:", activeInputs[i].inputName);
                activeInputs[i].enabledOnStart  = EditorGUILayout.Toggle("Enabled by default?", activeInputs[i].enabledOnStart);
                activeInputs[i].gameState       = (GameState)EditorGUILayout.EnumPopup("Available when game is:", activeInputs[i].gameState);
                activeInputs[i].actionListAsset = ActionListAssetMenu.AssetGUI("ActionList when triggered:", activeInputs[i].actionListAsset, "", defaultName);

                EditorGUILayout.EndVertical();
            }

            if (activeInputs.Count > 0)
            {
                EditorGUILayout.Space();
            }

            if (GUILayout.Button("Create new Active Input"))
            {
                if (activeInputs.Count > 0)
                {
                    List <int> idArray = new List <int>();
                    foreach (ActiveInput activeInput in activeInputs)
                    {
                        idArray.Add(activeInput.ID);
                    }
                    idArray.Sort();
                    activeInputs.Add(new ActiveInput(idArray.ToArray()));
                }
                else
                {
                    activeInputs.Add(new ActiveInput(1));
                }
            }

            EditorGUILayout.Space();

            EditorGUILayout.EndScrollView();
            return(activeInputs);
        }
예제 #4
0
        private void ArrowGUI(Arrow arrow, ActionListSource source, string label)
        {
            if (arrow != null)
            {
                ArrowPrompt _target = (ArrowPrompt)target;

                arrow.isPresent = CustomGUILayout.Toggle("Provide?", arrow.isPresent, "", "If True, the Arrow is defined and used in the ArrowPrompt");

                if (arrow.isPresent)
                {
                    arrow.texture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Icon texture:", arrow.texture, true, "", "The texture to draw on-screen");

                    EditorGUILayout.BeginHorizontal();
                    if (source == ActionListSource.InScene)
                    {
                        arrow.linkedCutscene = ActionListAssetMenu.CutsceneGUI("Linked Cutscene", arrow.linkedCutscene, _target.gameObject.name + ": " + label, "The Cutscene to run when the Arrow is triggered");
                    }
                    else if (source == ActionListSource.AssetFile)
                    {
                        arrow.linkedActionList = ActionListAssetMenu.AssetGUI("Linked ActionList:", arrow.linkedActionList, _target.gameObject.name + "_" + label, "", "The ActionList asset to run when the Arrow is triggered");
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }
        }
        private void ActionListGUI(string label, string menuTitle, string suffix, string apiPrefix, string tooltip)
        {
            actionListOnSave = ActionListAssetMenu.AssetGUI(label, actionListOnSave, menuTitle + "_" + title + "_" + suffix, apiPrefix + ".actionListOnSave", tooltip);

            if (actionListOnSave != null && actionListOnSave.useParameters && actionListOnSave.parameters.Count > 0)
            {
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.BeginHorizontal();
                parameterID = Action.ChooseParameterGUI(string.Empty, actionListOnSave.parameters, parameterID, ParameterType.Integer);

                bool found = false;
                foreach (ActionParameter _parameter in actionListOnSave.parameters)
                {
                    if (_parameter.parameterType == ParameterType.Integer)
                    {
                        found = true;
                    }
                }
                if (found)
                {
                    if (fixedOption || allowEmptySlots)
                    {
                        EditorGUILayout.LabelField("(= Save ID #)");
                    }
                    else
                    {
                        EditorGUILayout.LabelField("(= Slot index)");
                    }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
        }
        private void ShowNodeCommandGUI(Paths _target, int i)
        {
            if (_target.nodeCommands.Count > i)
            {
                if (_target.commandSource == ActionListSource.InScene)
                {
                    _target.nodeCommands[i].cutscene = ActionListAssetMenu.CutsceneGUI("Cutscene on reach:", _target.nodeCommands[i].cutscene, _target.name + "_OnReachNode_" + i.ToString(), "", "The Cutscene to run when the node is reached");

                    if (_target.nodeCommands[i].cutscene != null && _target.nodeCommands[i].cutscene.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].cutscene.parameters, _target.nodeCommands[i].parameterID);
                    }
                }
                else
                {
                    _target.nodeCommands[i].actionListAsset = ActionListAssetMenu.AssetGUI("ActionList on reach:", _target.nodeCommands[i].actionListAsset, _target.name + "_OnReachNode_" + i.ToString(), "", "The ActionList asset to run when the node is reached");

                    if (_target.nodeCommands[i].actionListAsset != null && _target.nodeCommands[i].actionListAsset.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].actionListAsset.parameters, _target.nodeCommands[i].parameterID);
                    }
                }

                if ((_target.commandSource == ActionListSource.InScene && _target.nodeCommands[i].cutscene != null) ||
                    (_target.commandSource == ActionListSource.AssetFile && _target.nodeCommands[i].actionListAsset != null))
                {
                    _target.nodeCommands[i].pausesCharacter = CustomGUILayout.Toggle("Character waits during?", _target.nodeCommands[i].pausesCharacter, string.Empty, "If True, then the character moving along the path will stop moving while the cutscene is run");
                }
            }
        }
예제 #7
0
        private void IconsGUI()
        {
            // Make sure unhandledCursorInteractions is the same length as cursorIcons
            while (unhandledCursorInteractions.Count < cursorIcons.Count)
            {
                unhandledCursorInteractions.Add(null);
            }
            while (unhandledCursorInteractions.Count > cursorIcons.Count)
            {
                unhandledCursorInteractions.RemoveAt(unhandledCursorInteractions.Count + 1);
            }

            // List icons
            foreach (CursorIcon _cursorIcon in cursorIcons)
            {
                int i = cursorIcons.IndexOf(_cursorIcon);
                GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Icon ID:", GUILayout.MaxWidth(145));
                EditorGUILayout.LabelField(_cursorIcon.id.ToString(), GUILayout.MaxWidth(120));

                GUILayout.FlexibleSpace();

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

                EditorGUILayout.EndHorizontal();

                _cursorIcon.label = CustomGUILayout.TextField("Label:", _cursorIcon.label, "AC.KickStarter.cursorManager.GetCursorIconFromID (" + i + ").label");
                if (KickStarter.settingsManager != null && KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                {
                    EditorGUILayout.LabelField("Input button:", _cursorIcon.GetButtonName());
                }
                _cursorIcon.ShowGUI(true, true, "Texture:", cursorRendering, "AC.KickStarter.cursorManager.GetCursorIconFromID (" + i + ")");

                if (settingsManager && settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                {
                    string autoName = _cursorIcon.label + "_Unhandled_Interaction";
                    unhandledCursorInteractions[i] = ActionListAssetMenu.AssetGUI("Unhandled interaction", unhandledCursorInteractions[i], "AC.KickStarter.cursorManager.unhandledCursorInteractions[" + i + "]", autoName);
                    _cursorIcon.dontCycle          = CustomGUILayout.Toggle("Leave out of Cursor cycle?", _cursorIcon.dontCycle, "AC.KickStarter.cursorManager.GetCursorIconFromID (" + i + ").dontCycle");
                }
            }

            if (GUILayout.Button("Create new icon"))
            {
                Undo.RecordObject(this, "Add icon");
                cursorIcons.Add(new CursorIcon(GetIDArray()));
            }

            passUnhandledHotspotAsParameter = CustomGUILayout.ToggleLeft("Pass Hotspot as GameObject parameter?", passUnhandledHotspotAsParameter, "AC.KickStarter.cursorManager.passUnhandledHotspotAsParameter");
            if (passUnhandledHotspotAsParameter)
            {
                EditorGUILayout.HelpBox("The Hotspot will be set as the Unhandled interaction's first parameter, which must be set to type 'GameObject'.", MessageType.Info);
            }
        }
예제 #8
0
        private void IconsGUI()
        {
            // Make sure unhandledCursorInteractions is the same length as cursorIcons
            while (unhandledCursorInteractions.Count < cursorIcons.Count)
            {
                unhandledCursorInteractions.Add(null);
            }
            while (unhandledCursorInteractions.Count > cursorIcons.Count)
            {
                unhandledCursorInteractions.RemoveAt(unhandledCursorInteractions.Count + 1);
            }

            // List icons
            foreach (CursorIcon _cursorIcon in cursorIcons)
            {
                int i = cursorIcons.IndexOf(_cursorIcon);
                GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Icon ID:", GUILayout.MaxWidth(145));
                EditorGUILayout.LabelField(_cursorIcon.id.ToString(), GUILayout.MaxWidth(120));

                if (GUILayout.Button(insertContent, EditorStyles.miniButtonLeft, buttonWidth))
                {
                    Undo.RecordObject(this, "Add icon");
                    cursorIcons.Insert(i + 1, new CursorIcon(GetIDArray()));
                    unhandledCursorInteractions.Insert(i + 1, null);
                    break;
                }
                if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(this, "Delete icon: " + _cursorIcon.label);
                    cursorIcons.Remove(_cursorIcon);
                    unhandledCursorInteractions.RemoveAt(i);
                    break;
                }
                EditorGUILayout.EndHorizontal();

                _cursorIcon.label = EditorGUILayout.TextField("Label:", _cursorIcon.label);
                if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                {
                    EditorGUILayout.LabelField("Input button:", _cursorIcon.GetButtonName());
                }
                _cursorIcon.ShowGUI(true, cursorRendering);

                if (settingsManager && settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                {
                    unhandledCursorInteractions[i] = ActionListAssetMenu.AssetGUI("Unhandled interaction", unhandledCursorInteractions[i]);
                    _cursorIcon.dontCycle          = EditorGUILayout.Toggle("Leave out of Cursor cycle?", _cursorIcon.dontCycle);
                }
            }

            if (GUILayout.Button("Create new icon"))
            {
                Undo.RecordObject(this, "Add icon");
                cursorIcons.Add(new CursorIcon(GetIDArray()));
            }
        }
예제 #9
0
        override public void SkipActionGUI(List <Action> actions, bool showGUI)
        {
            if (numSockets < 0)
            {
                numSockets = 0;
            }

            if (numSockets < endings.Count)
            {
                endings.RemoveRange(numSockets, endings.Count - numSockets);
            }
            else if (numSockets > endings.Count)
            {
                if (numSockets > endings.Capacity)
                {
                    endings.Capacity = numSockets;
                }
                for (int i = endings.Count; i < numSockets; i++)
                {
                    ActionEnd newEnd = new ActionEnd();
                    newEnd.resultAction = ResultAction.Stop;
                    endings.Add(newEnd);
                }
            }

            foreach (ActionEnd ending in endings)
            {
                if (showGUI)
                {
                    EditorGUILayout.Space();
                    int i = endings.IndexOf(ending) + 1;
                    ending.resultAction = (ResultAction)EditorGUILayout.EnumPopup(GetSocketLabel(i), (ResultAction)ending.resultAction);
                }

                if (ending.resultAction == ResultAction.RunCutscene && showGUI)
                {
                    if (isAssetFile)
                    {
                        ending.linkedAsset = ActionListAssetMenu.AssetGUI("ActionList to run:", ending.linkedAsset);
                    }
                    else
                    {
                        ending.linkedCutscene = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", ending.linkedCutscene);
                    }
                }
                else if (ending.resultAction == ResultAction.Skip)
                {
                    SkipActionGUI(ending, actions, showGUI);
                }

                /*else
                 * {
                 *      EditorGUILayout.Space ();
                 *      EditorGUILayout.Space ();
                 *      EditorGUILayout.Space ();
                 * }*/
            }
        }
예제 #10
0
        public static void PropertiesGUI(DialogueOption _target)
        {
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Dialogue Option properties", EditorStyles.boldLabel);
            _target.source = (ActionListSource)EditorGUILayout.EnumPopup("Actions source:", _target.source);
            if (_target.source == ActionListSource.AssetFile)
            {
                _target.assetFile       = ActionListAssetMenu.AssetGUI("ActionList asset:", _target.assetFile);
                _target.syncParamValues = EditorGUILayout.Toggle("Sync parameter values?", _target.syncParamValues);
            }
            if (_target.actionListType == ActionListType.PauseGameplay)
            {
                _target.isSkippable = EditorGUILayout.Toggle("Is skippable?", _target.isSkippable);
            }
            _target.tagID = ShowTagUI(_target.actions.ToArray(), _target.tagID);
            if (_target.source == ActionListSource.InScene)
            {
                _target.useParameters = EditorGUILayout.Toggle("Use parameters?", _target.useParameters);
            }
            else if (_target.source == ActionListSource.AssetFile && _target.assetFile != null && !_target.syncParamValues && _target.assetFile.useParameters)
            {
                _target.useParameters = EditorGUILayout.Toggle("Set local parameter values?", _target.useParameters);
            }
            EditorGUILayout.EndVertical();

            if (_target.useParameters)
            {
                if (_target.source == ActionListSource.InScene)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.BeginVertical("Button");

                    EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel);
                    ShowParametersGUI(_target, null, _target.parameters);

                    EditorGUILayout.EndVertical();
                }
                else if (!_target.syncParamValues && _target.source == ActionListSource.AssetFile && _target.assetFile != null && _target.assetFile.useParameters)
                {
                    bool isAsset = (PrefabUtility.GetPrefabType(_target) == PrefabType.Prefab) ? true : false;

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

                    EditorGUILayout.LabelField("Local parameter values", EditorStyles.boldLabel);
                    ShowLocalParametersGUI(_target.parameters, _target.assetFile.parameters, isAsset);

                    EditorGUILayout.EndVertical();
                }
            }
        }
예제 #11
0
        public override void ShowGUI(Menu menu)
        {
            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            showActive = EditorGUILayout.Toggle("Include active?", showActive);
            maxSlots   = EditorGUILayout.IntField("Max no. of slots:", maxSlots);
            if (source == MenuSource.AdventureCreator)
            {
                numSlots    = EditorGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots);
                slotSpacing = EditorGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f);
                orientation = (ElementOrientation)EditorGUILayout.EnumPopup("Slot orientation:", orientation);
                if (orientation == ElementOrientation.Grid)
                {
                    gridWidth = EditorGUILayout.IntSlider("Grid size:", gridWidth, 1, 10);
                }
            }

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

            actionListOnClick = ActionListAssetMenu.AssetGUI("ActionList after selecting:", actionListOnClick, "", menu.title + "_" + title + "_After_Selecting");

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)EditorGUILayout.EnumPopup("When invisible:", 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);
                }
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
예제 #12
0
 public static void PropertiesGUI(DialogueOption _target)
 {
     EditorGUILayout.BeginVertical("Button");
     EditorGUILayout.LabelField("Dialogue Option properties", EditorStyles.boldLabel);
     _target.source = (ActionListSource)EditorGUILayout.EnumPopup("Actions source:", _target.source);
     if (_target.source == ActionListSource.AssetFile)
     {
         _target.assetFile = ActionListAssetMenu.AssetGUI("ActionList asset:", _target.assetFile);
     }
     if (_target.actionListType == ActionListType.PauseGameplay)
     {
         _target.isSkippable = EditorGUILayout.Toggle("Is skippable?", _target.isSkippable);
     }
     EditorGUILayout.EndVertical();
 }
예제 #13
0
        public static ActionListAsset AssetGUI(string label, ActionListAsset actionListAsset, string api = "")
        {
            EditorGUILayout.BeginHorizontal();
            actionListAsset = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> (label, actionListAsset, false, api);

            if (actionListAsset == null)
            {
                if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                {
                    actionListAsset = ActionListAssetMenu.CreateAsset();
                }
            }

            EditorGUILayout.EndHorizontal();
            return(actionListAsset);
        }
예제 #14
0
 private void ActionListGUI()
 {
     actionList = ActionListAssetMenu.AssetGUI("ActionList to run:", actionList);
     if (actionList != null && actionList.useParameters && actionList.parameters.Count > 0)
     {
         EditorGUILayout.BeginVertical("Button");
         EditorGUILayout.BeginHorizontal();
         parameterID = Action.ChooseParameterGUI("", actionList.parameters, parameterID, ParameterType.Integer);
         if (parameterID >= 0)
         {
             parameterValue = EditorGUILayout.IntField(parameterValue);
         }
         EditorGUILayout.EndHorizontal();
         EditorGUILayout.EndVertical();
     }
 }
예제 #15
0
        private void ActionListGUI(string label, string menuTitle, string suffix)
        {
            actionListOnSave = ActionListAssetMenu.AssetGUI(label, actionListOnSave, "", menuTitle + "_" + title + "_" + suffix);

            if (actionListOnSave != null && actionListOnSave.useParameters && actionListOnSave.parameters.Count > 0)
            {
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.BeginHorizontal();
                parameterID = Action.ChooseParameterGUI("", actionListOnSave.parameters, parameterID, ParameterType.Integer);
                if (parameterID >= 0)
                {
                    EditorGUILayout.LabelField("(= Slot index)");
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
        }
예제 #16
0
파일: Action.cs 프로젝트: IJkeB/Ekster1
        protected void AfterRunningOption()
        {
            EditorGUILayout.Space();
            endAction = (ResultAction)EditorGUILayout.EnumPopup("After running:", (ResultAction)endAction);

            if (endAction == ResultAction.RunCutscene)
            {
                if (isAssetFile)
                {
                    linkedAsset = ActionListAssetMenu.AssetGUI("ActionList to run:", linkedAsset);
                }
                else
                {
                    linkedCutscene = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", linkedCutscene);
                }
            }
        }
        override public void SkipActionGUI(List <Action> actions, bool showGUI)
        {
            if (showGUI)
            {
                EditorGUILayout.Space();
                resultActionTrue = (ResultAction)EditorGUILayout.EnumPopup("If condition is met:", (ResultAction)resultActionTrue);
            }
            if (resultActionTrue == ResultAction.RunCutscene && showGUI)
            {
                if (isAssetFile)
                {
                    linkedAssetTrue = ActionListAssetMenu.AssetGUI("ActionList to run:", linkedAssetTrue);
                }
                else
                {
                    linkedCutsceneTrue = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", linkedCutsceneTrue);
                }
            }
            else if (resultActionTrue == ResultAction.Skip)
            {
                SkipActionTrueGUI(actions, showGUI);
            }

            if (showGUI)
            {
                resultActionFail = (ResultAction)EditorGUILayout.EnumPopup("If condition is not met:", (ResultAction)resultActionFail);
            }
            if (resultActionFail == ResultAction.RunCutscene && showGUI)
            {
                if (isAssetFile)
                {
                    linkedAssetFail = ActionListAssetMenu.AssetGUI("ActionList to run:", linkedAssetFail);
                }
                else
                {
                    linkedCutsceneFail = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", linkedCutsceneFail);
                }
            }
            else if (resultActionFail == ResultAction.Skip)
            {
                SkipActionFailGUI(actions, showGUI);
            }
        }
예제 #18
0
        public void ShowGUI()
        {
            string defaultName = "ActiveInput_" + Label;

            label     = CustomGUILayout.TextField("Label:", label, string.Empty, "An Editor-friendly name");
            inputName = CustomGUILayout.TextField("Input button:", inputName, string.Empty, "The name of the Input button, as defined in the Input Manager");
            inputType = (SimulateInputType)CustomGUILayout.EnumPopup("Input type:", inputType, string.Empty, "What type of input is expected");
            if (inputType == SimulateInputType.Axis)
            {
                axisThreshold = CustomGUILayout.Slider("Axis threshold:", axisThreshold, -1f, 1f, string.Empty, "The threshold value for the axis to trigger the ActionListAsset");
            }
            else if (inputType == SimulateInputType.Button)
            {
                buttonType = (ActiveInputButtonType)CustomGUILayout.EnumPopup("Responds to:", buttonType, string.Empty, "What type of button press this responds to");
            }
            enabledOnStart  = CustomGUILayout.Toggle("Enabled by default?", enabledOnStart, string.Empty, "If True, the active input is enabled when the game begins");
            gameState       = (GameState)CustomGUILayout.EnumPopup("Available when game is:", gameState, string.Empty, "What state the game must be in for the actionListAsset to run");
            actionListAsset = ActionListAssetMenu.AssetGUI("ActionList when triggered:", actionListAsset, defaultName, string.Empty, "The ActionListAsset to run when the input button is pressed");
        }
예제 #19
0
        private List <ActiveInput> ShowActiveInputsGUI(List <ActiveInput> activeInputs)
        {
            int numOptions = activeInputs.Count;

            numOptions = EditorGUILayout.IntField("Number of active inputs:", activeInputs.Count);
            if (activeInputs.Count < 0)
            {
                activeInputs = new List <ActiveInput>();
                numOptions   = 0;
            }

            if (numOptions < 0)
            {
                numOptions = 0;
            }

            if (numOptions < activeInputs.Count)
            {
                activeInputs.RemoveRange(numOptions, activeInputs.Count - numOptions);
            }
            else if (numOptions > activeInputs.Count)
            {
                if (numOptions > activeInputs.Capacity)
                {
                    activeInputs.Capacity = numOptions;
                }
                for (int i = activeInputs.Count; i < numOptions; i++)
                {
                    activeInputs.Add(new ActiveInput());
                }
            }

            for (int i = 0; i < activeInputs.Count; i++)
            {
                EditorGUILayout.LabelField("Input #" + i.ToString(), EditorStyles.boldLabel);
                activeInputs[i].inputName       = EditorGUILayout.TextField("Input button:", activeInputs[i].inputName);
                activeInputs[i].gameState       = (GameState)EditorGUILayout.EnumPopup("Available when game is:", activeInputs[i].gameState);
                activeInputs[i].actionListAsset = ActionListAssetMenu.AssetGUI("ActionList when triggered:", activeInputs[i].actionListAsset);
            }

            return(activeInputs);
        }
예제 #20
0
        public override void ShowGUI(MenuSource source)
        {
            EditorGUILayout.BeginVertical("Button");

            showActive = EditorGUILayout.Toggle("Include active?", showActive);
            maxSlots   = EditorGUILayout.IntField("Max no. of slots:", maxSlots);
            if (source == MenuSource.AdventureCreator)
            {
                numSlots    = EditorGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots);
                slotSpacing = EditorGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f);
                orientation = (ElementOrientation)EditorGUILayout.EnumPopup("Slot orientation:", orientation);
                if (orientation == ElementOrientation.Grid)
                {
                    gridWidth = EditorGUILayout.IntSlider("Grid size:", gridWidth, 1, 10);
                }
            }

            if (source == MenuSource.AdventureCreator)
            {
                anchor      = (TextAnchor)EditorGUILayout.EnumPopup("Text alignment:", anchor);
                textEffects = (TextEffects)EditorGUILayout.EnumPopup("Text effect:", textEffects);
            }

            actionListOnClick = ActionListAssetMenu.AssetGUI("ActionList after selecting:", actionListOnClick);

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");

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

            EditorGUILayout.EndVertical();

            base.ShowGUI(source);
        }
예제 #21
0
 private void ActionListGUI()
 {
     actionList = ActionListAssetMenu.AssetGUI("ActionList to run:", actionList);
     if (actionList != null && actionList.useParameters && actionList.parameters.Count > 0)
     {
         EditorGUILayout.BeginVertical("Button");
         EditorGUILayout.BeginHorizontal();
         bool hasValid = false;
         parameterID = Action.ChooseParameterGUI("", actionList.parameters, parameterID, ParameterType.Integer);
         if (parameterID >= 0)
         {
             parameterValue = EditorGUILayout.IntField(parameterValue);
             hasValid       = true;
         }
         EditorGUILayout.EndHorizontal();
         if (!hasValid)
         {
             EditorGUILayout.HelpBox("Only Integer parameters can be passed to a MenuButton's ActionList", MessageType.Info);
         }
         EditorGUILayout.EndVertical();
     }
 }
예제 #22
0
 private void ActionListGUI(string menuTitle, string apiPrefix)
 {
     actionList = ActionListAssetMenu.AssetGUI("ActionList to run:", actionList, menuTitle + "_" + title + "_OnClick", apiPrefix + ".actionList", "The ActionList asset to run when clicked");
     if (actionList && actionList.NumParameters > 0)
     {
         CustomGUILayout.BeginVertical();
         EditorGUILayout.BeginHorizontal();
         bool hasValid = false;
         parameterID = Action.ChooseParameterGUI(string.Empty, actionList.DefaultParameters, parameterID, ParameterType.Integer);
         if (parameterID >= 0)
         {
             parameterValue = EditorGUILayout.IntField(parameterValue);
             hasValid       = true;
         }
         EditorGUILayout.EndHorizontal();
         if (!hasValid)
         {
             EditorGUILayout.HelpBox("Only Integer parameters can be passed to a MenuButton's ActionList", MessageType.Info);
         }
         CustomGUILayout.EndVertical();
     }
 }
예제 #23
0
        private void ActionListGUI(string label, string menuTitle, string suffix, string apiPrefix, string tooltip)
        {
            actionListOnClick = ActionListAssetMenu.AssetGUI(label, actionListOnClick, menuTitle + "_" + title + "_" + suffix, apiPrefix + ".actionListOnClick", tooltip);

            if (actionListOnClick && actionListOnClick.NumParameters > 0)
            {
                CustomGUILayout.BeginVertical();
                EditorGUILayout.BeginHorizontal();
                parameterID = Action.ChooseParameterGUI(string.Empty, actionListOnClick.DefaultParameters, parameterID, ParameterType.Integer);
                if (parameterID >= 0)
                {
                    if (fixedOption)
                    {
                        EditorGUILayout.LabelField("(= Profile ID #)");
                    }
                    else
                    {
                        EditorGUILayout.LabelField("(= Slot index)");
                    }
                }
                EditorGUILayout.EndHorizontal();
                CustomGUILayout.EndVertical();
            }
        }
        private void ActionListGUI(string label, string menuTitle, string suffix, string apiPrefix)
        {
            actionListOnClick = ActionListAssetMenu.AssetGUI(label, actionListOnClick, apiPrefix + ".actionListOnClick", menuTitle + "_" + title + "_" + suffix);

            if (actionListOnClick != null && actionListOnClick.useParameters && actionListOnClick.parameters.Count > 0)
            {
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.BeginHorizontal();
                parameterID = Action.ChooseParameterGUI("", actionListOnClick.parameters, parameterID, ParameterType.Integer);
                if (parameterID >= 0)
                {
                    if (fixedOption)
                    {
                        EditorGUILayout.LabelField("(= Profile ID #)");
                    }
                    else
                    {
                        EditorGUILayout.LabelField("(= Slot index)");
                    }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
        }
예제 #25
0
        private void ShowNodeCommandGUI(Paths _target, int i)
        {
            if (_target.nodeCommands.Count > i)
            {
                if (_target.commandSource == ActionListSource.InScene)
                {
                    _target.nodeCommands[i].cutscene = ActionListAssetMenu.CutsceneGUI("Cutscene on reach:", _target.nodeCommands[i].cutscene, _target.name + "_OnReachNode_" + i.ToString(), "", "The Cutscene to run when the node is reached");

                    if (_target.nodeCommands[i].cutscene != null && _target.nodeCommands[i].cutscene.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].cutscene.parameters, _target.nodeCommands[i].parameterID);
                    }
                }
                else
                {
                    _target.nodeCommands[i].actionListAsset = ActionListAssetMenu.AssetGUI("ActionList on reach:", _target.nodeCommands[i].actionListAsset, _target.name + "_OnReachNode_" + i.ToString(), "", "The ActionList asset to run when the node is reached");

                    if (_target.nodeCommands[i].actionListAsset != null && _target.nodeCommands[i].actionListAsset.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].actionListAsset.parameters, _target.nodeCommands[i].parameterID);
                    }
                }
            }
        }
예제 #26
0
        private void ShowNodeCommandGUI(Paths _target, int i)
        {
            if (_target.nodeCommands.Count > i)
            {
                if (_target.commandSource == ActionListSource.InScene)
                {
                    _target.nodeCommands[i].cutscene = ActionListAssetMenu.CutsceneGUI("Cutscene on reach:", _target.nodeCommands[i].cutscene);

                    if (_target.nodeCommands[i].cutscene != null && _target.nodeCommands[i].cutscene.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].cutscene.parameters, _target.nodeCommands[i].parameterID);
                    }
                }
                else
                {
                    _target.nodeCommands[i].actionListAsset = ActionListAssetMenu.AssetGUI("ActionList on reach:", _target.nodeCommands[i].actionListAsset);

                    if (_target.nodeCommands[i].actionListAsset != null && _target.nodeCommands[i].actionListAsset.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].actionListAsset.parameters, _target.nodeCommands[i].parameterID);
                    }
                }
            }
        }
예제 #27
0
        private void ButtonGUI(Button button, string suffix, InteractionSource source, bool isForInventory = false)
        {
            bool isEnabled = !button.isDisabled;

            isEnabled         = EditorGUILayout.Toggle("Enabled:", isEnabled);
            button.isDisabled = !isEnabled;

            if (source == InteractionSource.AssetFile)
            {
                EditorGUILayout.BeginHorizontal();
                button.assetFile = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("Interaction:", button.assetFile, false, "", "The ActionList asset to run");
                if (button.assetFile == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        string defaultName = GenerateInteractionName(suffix, true);

                                                #if !(UNITY_WP8 || UNITY_WINRT)
                        defaultName = System.Text.RegularExpressions.Regex.Replace(defaultName, "[^\\w\\._]", "");
                                                #else
                        defaultName = "";
                                                #endif

                        button.assetFile = ActionListAssetMenu.CreateAsset(defaultName);
                    }
                }
                else if (GUILayout.Button("", CustomStyles.IconNodes))
                {
                    ActionListEditorWindow.Init(button.assetFile);
                }
                EditorGUILayout.EndHorizontal();

                if (button.assetFile != null && button.assetFile.useParameters && button.assetFile.parameters.Count > 0)
                {
                    EditorGUILayout.BeginHorizontal();
                    button.parameterID = Action.ChooseParameterGUI("Hotspot parameter:", button.assetFile.parameters, button.parameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this Hotspot");
                    EditorGUILayout.EndHorizontal();

                    if (isForInventory)
                    {
                        button.invParameterID = Action.ChooseParameterGUI("Inventory item parameter:", button.assetFile.parameters, button.invParameterID, ParameterType.InventoryItem, -1, "The Inventory Item parameter to automatically assign as the used item");
                    }
                }
            }
            else if (source == InteractionSource.CustomScript)
            {
                button.customScriptObject   = (GameObject)CustomGUILayout.ObjectField <GameObject> ("Object with script:", button.customScriptObject, true, "", "The GameObject with the custom script to run");
                button.customScriptFunction = CustomGUILayout.TextField("Message to send:", button.customScriptFunction, "", "The name of the function to run");

                if (isForInventory)
                {
                    EditorGUILayout.HelpBox("If the receiving function has an integer parameter, the Inventory item's ID will be passed to it.", MessageType.Info);
                }
            }
            else if (source == InteractionSource.InScene)
            {
                EditorGUILayout.BeginHorizontal();
                button.interaction = (Interaction)CustomGUILayout.ObjectField <Interaction> ("Interaction:", button.interaction, true, "", "The Interaction ActionList to run");

                if (button.interaction == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        Undo.RecordObject(_target, "Create Interaction");
                        Interaction newInteraction = SceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();

                        newInteraction.gameObject.name = GenerateInteractionName(suffix, false);
                        button.interaction             = newInteraction;
                    }
                }
                else
                {
                    if (GUILayout.Button("", CustomStyles.IconNodes))
                    {
                        ActionListEditorWindow.Init(button.interaction);
                    }
                }
                EditorGUILayout.EndHorizontal();

                if (button.interaction != null && button.interaction.source == ActionListSource.InScene && button.interaction.useParameters && button.interaction.parameters.Count > 0)
                {
                    EditorGUILayout.BeginHorizontal();
                    button.parameterID = Action.ChooseParameterGUI("Hotspot parameter:", button.interaction.parameters, button.parameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this Hotspot");
                    EditorGUILayout.EndHorizontal();

                    if (isForInventory)
                    {
                        button.invParameterID = Action.ChooseParameterGUI("Inventory item parameter:", button.interaction.parameters, button.invParameterID, ParameterType.InventoryItem, -1, "The Inventory Item parameter to automatically assign as the used item");
                    }
                }
                else if (button.interaction != null && button.interaction.source == ActionListSource.AssetFile && button.interaction.assetFile != null && button.interaction.assetFile.useParameters && button.interaction.assetFile.parameters.Count > 0)
                {
                    EditorGUILayout.BeginHorizontal();
                    button.parameterID = Action.ChooseParameterGUI("Hotspot parameter:", button.interaction.assetFile.parameters, button.parameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically assign as this Hotspot");
                    EditorGUILayout.EndHorizontal();

                    if (isForInventory)
                    {
                        button.invParameterID = Action.ChooseParameterGUI("Inventory item parameter:", button.interaction.assetFile.parameters, button.invParameterID, ParameterType.InventoryItem, -1, "The Inventory Item parameter to automatically assign as the used item");
                    }
                }
            }

            button.playerAction = (PlayerAction)CustomGUILayout.EnumPopup("Player action:", button.playerAction, "", "What the Player prefab does after clicking the Hotspot, but before the Interaction itself is run");

            if (button.playerAction == PlayerAction.WalkTo || button.playerAction == PlayerAction.WalkToMarker)
            {
                if (button.playerAction == PlayerAction.WalkToMarker && _target.walkToMarker == null)
                {
                    EditorGUILayout.HelpBox("You must assign a 'Walk-to marker' above for this option to work.", MessageType.Warning);
                }
                button.isBlocking = CustomGUILayout.Toggle("Cutscene while moving?", button.isBlocking, "", "If True, then gameplay will be blocked while the Player moves");
                button.faceAfter  = CustomGUILayout.Toggle("Face after moving?", button.faceAfter, "", "If True, then the Player will face the Hotspot after reaching the Marker");

                if (button.playerAction == PlayerAction.WalkTo)
                {
                    button.setProximity = CustomGUILayout.Toggle("Set minimum distance?", button.setProximity, "", "If True, then the Interaction will be run once the Player is within a certain distance of the Hotspot");
                    if (button.setProximity)
                    {
                        button.proximity = CustomGUILayout.FloatField("Proximity:", button.proximity, "", "The proximity the Player must be within");
                    }
                }
            }
        }
예제 #28
0
        public void ShowGUI(string apiPrefix, List <string> binList)
        {
            Upgrade();

            label    = CustomGUILayout.TextField("Name:", label, apiPrefix + ".label", "The item's Editor name");
            altLabel = CustomGUILayout.TextField("Label (if not name):", altLabel, apiPrefix + ".altLabel", "The item's in-game name, if not label");

            bool isPronoun = !canBeLowerCase;

            isPronoun      = CustomGUILayout.Toggle("Name is pronoun?", isPronoun, "!" + apiPrefix + ".canBeLowerCase", "If False, the name will be lower-cased when inside sentences.");
            canBeLowerCase = !isPronoun;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Category:", "The category that the item belongs to"), GUILayout.Width(146f));
            if (KickStarter.inventoryManager.bins.Count > 0)
            {
                int binNumber = KickStarter.inventoryManager.GetBinSlot(binID);
                binNumber = CustomGUILayout.Popup(binNumber, binList.ToArray(), apiPrefix + ".binID");
                binID     = KickStarter.inventoryManager.bins[binNumber].id;
            }
            else
            {
                binID = -1;
                EditorGUILayout.LabelField("No categories defined!", EditorStyles.miniLabel, GUILayout.Width(146f));
            }
            EditorGUILayout.EndHorizontal();

            carryOnStart = CustomGUILayout.Toggle("Carry on start?", carryOnStart, apiPrefix + ".carryOnStart", "If True, the Player carries the item when the game begins");
            if (carryOnStart && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.playerSwitching == PlayerSwitching.Allow && !AdvGame.GetReferences().settingsManager.shareInventory)
            {
                carryOnStartNotDefault = CustomGUILayout.Toggle("Non-default Player(s)?", carryOnStartNotDefault, apiPrefix + ".carryOnStartNotDefault", "If True, then a Player prefab that is not the default carries the item when the game begins");
                if (carryOnStartNotDefault)
                {
                    carryOnStartIDs = ChoosePlayerGUI(carryOnStartIDs, apiPrefix + ".carryOnStartID");
                }
            }

            canCarryMultiple = CustomGUILayout.Toggle("Can carry multiple?", canCarryMultiple, apiPrefix + ".canCarryMultiple", "If True, then multiple instances of the item can be carried at once");

            if (carryOnStart && canCarryMultiple)
            {
                count = CustomGUILayout.IntField("Quantity on start:", count, apiPrefix + ".count", "The number of instances that the player is carrying when the game begins");
            }
            else
            {
                count = 1;
            }

            if (canCarryMultiple)
            {
                if (maxCount == 0)
                {
                    maxCount = 999;
                }
                maxCount = CustomGUILayout.IntField("Slot capacity:", maxCount, apiPrefix + ".maxCount", "The number of instances of the item that can occupy a single inventory slot");
                if (maxCount < 1)
                {
                    maxCount = 1;
                }

                if (maxCount > 1)
                {
                    itemStackingMode = (ItemStackingMode)CustomGUILayout.EnumPopup("Selection mode:", itemStackingMode, apiPrefix + ".itemStackingMode", "How to select items when multiple are in a given slot");
                }
            }

            overrideUseSyntax = CustomGUILayout.Toggle("Override 'Use' syntax?", overrideUseSyntax, apiPrefix + ".overrideUseSyntax", "If True, then the item has its own 'Use X on Y' syntax when selected");
            if (overrideUseSyntax)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Use syntax:", GUILayout.Width(100f));
                hotspotPrefix1.label = EditorGUILayout.TextField(hotspotPrefix1.label, GUILayout.MaxWidth(80f));
                EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f));
                hotspotPrefix2.label = EditorGUILayout.TextField(hotspotPrefix2.label, GUILayout.MaxWidth(80f));
                EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f));
                EditorGUILayout.EndHorizontal();
            }

            linkedPrefab = (GameObject)CustomGUILayout.ObjectField <GameObject> ("Linked prefab:", linkedPrefab, false, apiPrefix + ".linkedPrefab", "A GameObject that can be associated with the item, for the creation of e.g. 3D inventory items (through scripting only)");
            if (linkedPrefab != null)
            {
                EditorGUILayout.HelpBox("This reference is accessible through scripting, or via Inventory parameter in the 'Object: Add or remove' Action.", MessageType.Info);
            }

            CustomGUILayout.DrawUILine();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Main graphic:", "The item's main graphic"), GUILayout.Width(145));
            tex = (Texture)CustomGUILayout.ObjectField <Texture> (tex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".tex");
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Active graphic:", "The item's 'highlighted' graphic"), GUILayout.Width(145));
            activeTex = (Texture)CustomGUILayout.ObjectField <Texture> (activeTex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".activeTex");
            EditorGUILayout.EndHorizontal();

            if (AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.selectInventoryDisplay == SelectInventoryDisplay.ShowSelectedGraphic)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("Selected graphic:", "The item's 'selected' graphic"), GUILayout.Width(145));
                selectedTex = (Texture)CustomGUILayout.ObjectField <Texture> (selectedTex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".selectedTex");
                EditorGUILayout.EndHorizontal();
            }
            if (AdvGame.GetReferences().cursorManager != null)
            {
                CursorManager cursorManager = AdvGame.GetReferences().cursorManager;
                if (cursorManager.inventoryHandling == InventoryHandling.ChangeCursor || cursorManager.inventoryHandling == InventoryHandling.ChangeCursorAndHotspotLabel)
                {
                    cursorIcon.ShowGUI(true, true, "Cursor (optional):", cursorManager.cursorRendering, apiPrefix + ".cursorIcon", "A Cursor that, if assigned, will be used in place of the 'tex' Texture when the item is selected on the cursor");
                    CustomGUILayout.DrawUILine();
                }
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Standard interactions", CustomStyles.subHeader);
            if (KickStarter.settingsManager && KickStarter.settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple && KickStarter.cursorManager)
            {
                List <string> iconList = new List <string> ();
                foreach (CursorIcon icon in KickStarter.cursorManager.cursorIcons)
                {
                    iconList.Add(icon.id.ToString() + ": " + icon.label);
                }

                if (KickStarter.cursorManager.cursorIcons.Count > 0)
                {
                    foreach (InvInteraction interaction in interactions)
                    {
                        EditorGUILayout.BeginHorizontal();
                        int invNumber = GetIconSlot(interaction.icon.id);
                        invNumber        = EditorGUILayout.Popup(invNumber, iconList.ToArray());
                        interaction.icon = KickStarter.cursorManager.cursorIcons[invNumber];

                        int    i        = interactions.IndexOf(interaction);
                        string autoName = label + "_" + interaction.icon.label;
                        interaction.actionList = ActionListAssetMenu.AssetGUI("", interaction.actionList, autoName, apiPrefix + ".interactions[" + i + "].actionList", "The ActionList to run when the interaction is triggered");

                        if (GUILayout.Button(string.Empty, CustomStyles.IconCog))
                        {
                            SideInteractionMenu(interactions.IndexOf(interaction));
                        }

                        EditorGUILayout.EndHorizontal();
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No interaction icons defined - please use the Cursor Manager", MessageType.Warning);
                }
                if (GUILayout.Button("Add interaction"))
                {
                    Undo.RecordObject(KickStarter.inventoryManager, "Add new interaction");
                    interactions.Add(new InvInteraction(KickStarter.cursorManager.cursorIcons[0]));
                }
            }
            else
            {
                string autoName = label + "_Use";
                useActionList = ActionListAssetMenu.AssetGUI("Use:", useActionList, autoName, apiPrefix + ".useActionList", "The ActionList asset to run when using the item is used");
                if (KickStarter.cursorManager && KickStarter.cursorManager.allowInteractionCursorForInventory && KickStarter.cursorManager.cursorIcons.Count > 0)
                {
                    int useCursor_int = KickStarter.cursorManager.GetIntFromID(useIconID) + 1;
                    if (useIconID == -1)
                    {
                        useCursor_int = 0;
                    }
                    useCursor_int = CustomGUILayout.Popup("Use cursor icon:", useCursor_int, KickStarter.cursorManager.GetLabelsArray(true), apiPrefix + ".useIconID", "The Cursor to show when hovering over the item");

                    if (useCursor_int == 0)
                    {
                        useIconID = -1;
                    }
                    else if (KickStarter.cursorManager.cursorIcons.Count > (useCursor_int - 1))
                    {
                        useIconID = KickStarter.cursorManager.cursorIcons[useCursor_int - 1].id;
                    }
                }
                else
                {
                    useIconID = 0;
                }
                autoName       = label + "_Examine";
                lookActionList = ActionListAssetMenu.AssetGUI("Examine:", lookActionList, autoName, apiPrefix + ".lookActionList", "The ActionListAsset to run when the item is examined");
            }

            if (KickStarter.settingsManager && KickStarter.settingsManager.CanSelectItems(false))
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Unhandled interactions", CustomStyles.subHeader);
                string autoName = label + "_Unhandled_Hotspot";
                unhandledActionList        = ActionListAssetMenu.AssetGUI("Unhandled use on Hotspot:", unhandledActionList, autoName, apiPrefix + ".unhandledActionList", "The ActionList asset to run when using the item on a Hotspot is unhandled");
                autoName                   = label + "_Unhandled_Combine";
                unhandledCombineActionList = ActionListAssetMenu.AssetGUI("Unhandled combine:", unhandledCombineActionList, autoName, apiPrefix + ".unhandledCombineActionList", "The ActionListAsset to run when using the item on another InvItem is unhandled");
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Combine interactions", CustomStyles.subHeader);
            for (int i = 0; i < combineActionList.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                int invNumber = KickStarter.inventoryManager.GetArraySlot(combineID[i]);
                invNumber    = EditorGUILayout.Popup(invNumber, KickStarter.inventoryManager.GetLabelList());
                combineID[i] = KickStarter.inventoryManager.items[invNumber].id;

                string autoName = label + "_Combine_" + KickStarter.inventoryManager.GetLabelList()[invNumber];
                combineActionList[i] = ActionListAssetMenu.AssetGUI(string.Empty, combineActionList[i], autoName, apiPrefix + ".combineActionList[" + i + "]", "A List of all 'Combine' InvInteraction objects associated with the item");

                if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(KickStarter.inventoryManager, "Delete combine event");
                    combineActionList.RemoveAt(i);
                    combineID.RemoveAt(i);
                    break;
                }
                EditorGUILayout.EndHorizontal();
            }
            if (GUILayout.Button("Add combine event"))
            {
                Undo.RecordObject(KickStarter.inventoryManager, "Add new combine event");
                combineActionList.Add(null);
                combineID.Add(0);
            }

            // List all "reverse" inventory combinations
            string reverseCombinations = string.Empty;

            foreach (InvItem otherItem in KickStarter.inventoryManager.items)
            {
                if (otherItem != this)
                {
                    if (otherItem.combineID.Contains(id))
                    {
                        reverseCombinations += "- " + otherItem.label + "\n";
                        continue;
                    }
                }
            }
            if (reverseCombinations.Length > 0)
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox("The following inventory items have combine interactions that reference this item:\n" + reverseCombinations, MessageType.Info);
            }

            if (KickStarter.inventoryManager.invVars.Count > 0)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Properties", CustomStyles.subHeader);

                RebuildProperties();

                // UI for setting property values
                if (vars.Count > 0)
                {
                    foreach (InvVar invVar in vars)
                    {
                        invVar.ShowGUI(apiPrefix + ".GetProperty (" + invVar.id + ")");
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No properties have been defined that this inventory item can use.", MessageType.Info);
                }
            }
        }
예제 #29
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);
        }
예제 #30
0
        override public void SkipActionGUI(List <Action> actions, bool showGUI)
        {
            if (numSockets < 0)
            {
                numSockets = 0;
            }

            if (numSockets < endings.Count)
            {
                endings.RemoveRange(numSockets, endings.Count - numSockets);
            }
            else if (numSockets > endings.Count)
            {
                if (numSockets > endings.Capacity)
                {
                    endings.Capacity = numSockets;
                }
                for (int i = endings.Count; i < numSockets; i++)
                {
                    ActionEnd newEnd = new ActionEnd();
                    endings.Add(newEnd);
                }
            }

            foreach (ActionEnd ending in endings)
            {
                if (showGUI)
                {
                    EditorGUILayout.Space();
                    int i = endings.IndexOf(ending) + 1;
                    ending.resultAction = (ResultAction)EditorGUILayout.EnumPopup("Output " + i.ToString() + ":", (ResultAction)ending.resultAction);
                }

                if (ending.resultAction == ResultAction.RunCutscene && showGUI)
                {
                    if (isAssetFile)
                    {
                        ending.linkedAsset = ActionListAssetMenu.AssetGUI("ActionList to run:", ending.linkedAsset);
                    }
                    else
                    {
                        ending.linkedCutscene = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", ending.linkedCutscene);
                    }
                }
                else if (ending.resultAction == ResultAction.Skip)
                {
                    SkipActionGUI(ending, actions, showGUI);
                }
            }

            bool       shownError    = false;
            List <int> outputIndices = new List <int>();

            foreach (ActionEnd ending in endings)
            {
                if (ending.resultAction == ResultAction.Skip)
                {
                    if (outputIndices.Contains(ending.skipAction))
                    {
                        if (!shownError)
                        {
                            EditorGUILayout.HelpBox("Two or more output sockets connect to the same subsequent Action - this may cause unexpected behaviour and should be changed.", MessageType.Warning);
                        }
                        shownError = true;
                    }
                    else
                    {
                        outputIndices.Add(ending.skipAction);
                    }
                }
            }
        }