Пример #1
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.NumParameters > 0)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].actionListAsset.DefaultParameters, _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");
                }
            }
        }
Пример #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);
            }
        }
Пример #3
0
        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 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.NumParameters > 0)
            {
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.BeginHorizontal();
                parameterID = Action.ChooseParameterGUI(string.Empty, actionListOnSave.DefaultParameters, parameterID, ParameterType.Integer);

                bool found = false;
                foreach (ActionParameter _parameter in actionListOnSave.DefaultParameters)
                {
                    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();
            }
        }
Пример #5
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();
                }
            }
        }
Пример #6
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);

                bool found = false;
                foreach (ActionParameter _parameter in actionListOnSave.parameters)
                {
                    if (_parameter.parameterType == ParameterType.Integer)
                    {
                        found = true;
                    }
                }
                if (found)
                {
                    if (fixedOption)
                    {
                        EditorGUILayout.LabelField("(= Save ID #)");
                    }
                    else
                    {
                        EditorGUILayout.LabelField("(= Slot index)");
                    }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
        }
Пример #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));

                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()));
            }
        }
Пример #8
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 ();
                 * }*/
            }
        }
Пример #9
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);
            }
        }
Пример #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
 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();
     }
 }
Пример #14
0
        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);
                }
            }
        }
Пример #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();
            }
        }
        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);
            }
        }
Пример #17
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");
        }
Пример #18
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);
        }
Пример #19
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);
        }
Пример #20
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();
     }
 }
Пример #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 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);
                    }
                }
            }
        }
Пример #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);

                    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);
                    }
                }
            }
        }
Пример #26
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);
        }
Пример #27
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);
                }
            }
        }
Пример #28
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);
                    }
                }
            }
        }
        private void ShowActiveInputsGUI()
        {
            EditorGUILayout.HelpBox("Active Inputs are used to trigger ActionList assets when an input key is pressed under certain gameplay conditions.", MessageType.Info);

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showActiveInputsList = CustomGUILayout.ToggleHeader(showActiveInputsList, "Active inputs");
            if (showActiveInputsList)
            {
                scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Height(Mathf.Min(settingsManager.activeInputs.Count * 21, 185f) + 5));
                foreach (ActiveInput activeInput in settingsManager.activeInputs)
                {
                    EditorGUILayout.BeginHorizontal();

                    if (GUILayout.Toggle(activeInput.isEditing, activeInput.ID + ": " + activeInput.Label, "Button"))
                    {
                        if (selectedActiveInput != activeInput)
                        {
                            DeactivateAllInputs();
                            ActivateInput(activeInput);
                        }
                    }

                    if (GUILayout.Button("", CustomStyles.IconCog))
                    {
                        SideMenu(activeInput);
                    }

                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.EndScrollView();

                EditorGUILayout.Space();
                if (GUILayout.Button("Create new Active Input"))
                {
                    Undo.RecordObject(this, "Create new Active Input");

                    if (settingsManager.activeInputs.Count > 0)
                    {
                        List <int> idArray = new List <int>();
                        foreach (ActiveInput activeInput in settingsManager.activeInputs)
                        {
                            idArray.Add(activeInput.ID);
                        }
                        idArray.Sort();

                        ActiveInput newActiveInput = new ActiveInput(idArray.ToArray());
                        settingsManager.activeInputs.Add(newActiveInput);

                        DeactivateAllInputs();
                        ActivateInput(newActiveInput);
                    }
                    else
                    {
                        ActiveInput newActiveInput = new ActiveInput(1);
                        settingsManager.activeInputs.Add(newActiveInput);
                    }
                }
                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.Space();

            if (selectedActiveInput != null && settingsManager.activeInputs.Contains(selectedActiveInput))
            {
                EditorGUILayout.BeginVertical(CustomStyles.thinBox);

                showSelectedActiveInput = CustomGUILayout.ToggleHeader(showSelectedActiveInput, "Input #" + selectedActiveInput.ID + ": " + selectedActiveInput.label);
                if (showSelectedActiveInput)
                {
                    string defaultName = "ActiveInput_" + selectedActiveInput.Label;

                    selectedActiveInput.label     = CustomGUILayout.TextField("Label:", selectedActiveInput.label, "", "An Editor-friendly name");
                    selectedActiveInput.inputName = CustomGUILayout.TextField("Input button:", selectedActiveInput.inputName, "", "The name of the Input button, as defined in the Input Manager");
                    selectedActiveInput.inputType = (SimulateInputType)CustomGUILayout.EnumPopup("Input type:", selectedActiveInput.inputType, "", "What type of input is expected");
                    if (selectedActiveInput.inputType == SimulateInputType.Axis)
                    {
                        selectedActiveInput.axisThreshold = CustomGUILayout.Slider("Axis threshold:", selectedActiveInput.axisThreshold, -1f, 1f, "", "The threshold value for the axis to trigger the ActionListAsset");
                    }
                    selectedActiveInput.enabledOnStart  = CustomGUILayout.Toggle("Enabled by default?", selectedActiveInput.enabledOnStart, "", "If True, the active input is enabled when the game begins");
                    selectedActiveInput.gameState       = (GameState)CustomGUILayout.EnumPopup("Available when game is:", selectedActiveInput.gameState, "", "What state the game must be in for the actionListAsset to run");
                    selectedActiveInput.actionListAsset = ActionListAssetMenu.AssetGUI("ActionList when triggered:", selectedActiveInput.actionListAsset, defaultName, "", "The ActionListAsset to run when the input button is pressed");
                }
                EditorGUILayout.EndVertical();
            }
        }
Пример #30
0
        public override void OnInspectorGUI()
        {
            Paths _target = (Paths)target;

            if (_target.GetComponent <AC.Char>())
            {
                return;
            }

            int numNodes = _target.nodes.Count;

            if (numNodes < 1)
            {
                numNodes      = 1;
                _target.nodes = ResizeList(_target.nodes, numNodes);
            }

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Path properties", EditorStyles.boldLabel);
            _target.nodePause = EditorGUILayout.FloatField("Wait time (s):", _target.nodePause);
            _target.pathSpeed = (PathSpeed)EditorGUILayout.EnumPopup("Walk or run:", (PathSpeed)_target.pathSpeed);
            _target.pathType  = (AC_PathType)EditorGUILayout.EnumPopup("Path type:", (AC_PathType)_target.pathType);
            if (_target.pathType == AC_PathType.Loop)
            {
                _target.teleportToStart = EditorGUILayout.Toggle("Teleports when looping?", _target.teleportToStart);
            }
            _target.affectY       = EditorGUILayout.Toggle("Override gravity?", _target.affectY);
            _target.commandSource = (ActionListSource)EditorGUILayout.EnumPopup("Node commands source:", _target.commandSource);
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            // List nodes
            ResetCommandList(_target);
            for (int i = 1; i < _target.nodes.Count; i++)
            {
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.BeginHorizontal();
                _target.nodes[i] = EditorGUILayout.Vector3Field("Node " + i + ": ", _target.nodes[i]);

                if (GUILayout.Button(insertContent, EditorStyles.miniButtonLeft, buttonWidth))
                {
                    Undo.RecordObject(_target, "Add path node");
                    Vector3 newNodePosition;
                    newNodePosition = _target.nodes[i] + new Vector3(1.0f, 0f, 0f);
                    _target.nodes.Insert(i + 1, newNodePosition);
                    _target.nodeCommands.Insert(i + 1, new NodeCommand());
                    numNodes += 1;
                    ResetCommandList(_target);
                }
                if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(_target, "Delete path node");
                    _target.nodes.RemoveAt(i);
                    _target.nodeCommands.RemoveAt(i);
                    numNodes -= 1;
                    ResetCommandList(_target);
                }
                EditorGUILayout.EndHorizontal();
                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);
                        }
                    }
                }
                EditorGUILayout.EndVertical();
            }

            if (numNodes == 1 && GUILayout.Button("Add node"))
            {
                Undo.RecordObject(_target, "Add path node");
                numNodes += 1;
            }

            _target.nodes[0] = _target.transform.position;
            _target.nodes    = ResizeList(_target.nodes, numNodes);

            UnityVersionHandler.CustomSetDirty(_target);
        }