override public void ShowGUI(List <ActionParameter> parameters)
        {
            invAction = (InvAction)EditorGUILayout.EnumPopup("Method:", invAction);

            string _label = "Object to instantiate:";

            if (invAction == InvAction.Remove)
            {
                _label = "Object to delete:";
            }

            parameterID = Action.ChooseParameterGUI(_label, parameters, parameterID, ParameterType.GameObject);
            if (parameterID >= 0)
            {
                constantID = 0;
                gameObject = null;
            }
            else
            {
                gameObject = (GameObject)EditorGUILayout.ObjectField(_label, gameObject, typeof(GameObject), true);

                constantID = FieldToID(gameObject, constantID);
                gameObject = IDToField(gameObject, constantID, false);
            }

            if (invAction == InvAction.Add)
            {
                positionRelativeTo = (PositionRelativeTo)EditorGUILayout.EnumPopup("Position relative to:", positionRelativeTo);

                if (positionRelativeTo == PositionRelativeTo.RelativeToGameObject)
                {
                    relativeGameObjectParameterID = Action.ChooseParameterGUI("Relative GameObject:", parameters, relativeGameObjectParameterID, ParameterType.GameObject);
                    if (relativeGameObjectParameterID >= 0)
                    {
                        relativeGameObjectID = 0;
                        relativeGameObject   = null;
                    }
                    else
                    {
                        relativeGameObject = (GameObject)EditorGUILayout.ObjectField("Relative GameObject:", relativeGameObject, typeof(GameObject), true);

                        relativeGameObjectID = FieldToID(relativeGameObject, relativeGameObjectID);
                        relativeGameObject   = IDToField(relativeGameObject, relativeGameObjectID, false);
                    }
                }
                else if (positionRelativeTo == PositionRelativeTo.EnteredValue)
                {
                    relativeVectorParameterID = Action.ChooseParameterGUI("Value:", parameters, relativeVectorParameterID, ParameterType.Vector3);
                    if (relativeVectorParameterID < 0)
                    {
                        relativeVector = EditorGUILayout.Vector3Field("Value:", relativeVector);
                    }
                }
                else if (positionRelativeTo == PositionRelativeTo.VectorVariable)
                {
                    if (isAssetFile)
                    {
                        variableLocation = VariableLocation.Global;
                    }
                    else
                    {
                        variableLocation = (VariableLocation)EditorGUILayout.EnumPopup("Source:", variableLocation);
                    }

                    if (variableLocation == VariableLocation.Global)
                    {
                        vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.GlobalVariable);
                        if (vectorVarParameterID < 0)
                        {
                            vectorVarID = AdvGame.GlobalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3);
                        }
                    }
                    else if (variableLocation == VariableLocation.Local)
                    {
                        vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.LocalVariable);
                        if (vectorVarParameterID < 0)
                        {
                            vectorVarID = AdvGame.LocalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3);
                        }
                    }
                }
            }
            else if (invAction == InvAction.Replace)
            {
                EditorGUILayout.Space();
                replaceParameterID = Action.ChooseParameterGUI("Object to delete:", parameters, replaceParameterID, ParameterType.GameObject);
                if (replaceParameterID >= 0)
                {
                    replaceConstantID = 0;
                    replaceGameObject = null;
                }
                else
                {
                    replaceGameObject = (GameObject)EditorGUILayout.ObjectField("Object to delete:", replaceGameObject, typeof(GameObject), true);

                    replaceConstantID = FieldToID(replaceGameObject, replaceConstantID);
                    replaceGameObject = IDToField(replaceGameObject, replaceConstantID, false);
                }
            }

            AfterRunningOption();
        }
        private void SetParamGUI(List <ActionParameter> parameters, List <ActionParameter> ownParameters = null, bool forceConstantIDs = false)
        {
            if (parameters == null || parameters.Count == 0)
            {
                parameterLabel = "";
                return;
            }

            _parameter = GetParameterWithID(parameters, parameterID);

            if (_parameter == null)
            {
                parameterLabel = "";
                return;
            }

            parameterLabel = _parameter.label;

            setParamMethod = (SetParamMethod)EditorGUILayout.EnumPopup("New value is:", setParamMethod);

            if (setParamMethod == SetParamMethod.EnteredHere)
            {
                if (ownParameters != null && ownParameters.Count > 0)
                {
                    ownParamID = Action.ChooseParameterGUI("Set as:", ownParameters, ownParamID, _parameter.parameterType);
                    if (ownParamID >= 0)
                    {
                        return;
                    }
                }

                if (_parameter.parameterType == ParameterType.Boolean)
                {
                    bool boolValue = (intValue == 1) ? true : false;
                    boolValue = EditorGUILayout.Toggle("Set as:", boolValue);
                    intValue  = (boolValue) ? 1 : 0;
                }
                else if (_parameter.parameterType == ParameterType.Integer)
                {
                    intValue = EditorGUILayout.IntField("Set as:", intValue);
                }
                else if (_parameter.parameterType == ParameterType.Float)
                {
                    floatValue = EditorGUILayout.FloatField("Set as:", floatValue);
                }
                else if (_parameter.parameterType == ParameterType.String)
                {
                    stringValue = EditorGUILayout.TextField("Set as:", stringValue);
                }
                else if (_parameter.parameterType == ParameterType.GameObject)
                {
                    gameobjectValue = (GameObject)EditorGUILayout.ObjectField("Set to:", gameobjectValue, typeof(GameObject), true);

                    gameObjectConstantID = FieldToID(gameobjectValue, gameObjectConstantID, forceConstantIDs);
                    gameobjectValue      = IDToField(gameobjectValue, gameObjectConstantID, false, forceConstantIDs);
                }
                else if (_parameter.parameterType == ParameterType.GlobalVariable)
                {
                    if (AdvGame.GetReferences().variablesManager == null || AdvGame.GetReferences().variablesManager.vars == null || AdvGame.GetReferences().variablesManager.vars.Count == 0)
                    {
                        EditorGUILayout.HelpBox("No Global variables exist!", MessageType.Info);
                    }
                    else
                    {
                        intValue = ShowVarSelectorGUI(AdvGame.GetReferences().variablesManager.vars, intValue);
                    }
                }
                else if (_parameter.parameterType == ParameterType.UnityObject)
                {
                    unityObjectValue = (Object)EditorGUILayout.ObjectField("Set to:", unityObjectValue, typeof(Object), true);
                }
                else if (_parameter.parameterType == ParameterType.InventoryItem)
                {
                    intValue = ShowInvSelectorGUI(intValue);
                }
                else if (_parameter.parameterType == ParameterType.LocalVariable)
                {
                    if (isAssetFile)
                    {
                        EditorGUILayout.HelpBox("Cannot access local variables from an asset file.", MessageType.Warning);
                    }
                    else if (KickStarter.localVariables == null || KickStarter.localVariables.localVars == null || KickStarter.localVariables.localVars.Count == 0)
                    {
                        EditorGUILayout.HelpBox("No Local variables exist!", MessageType.Info);
                    }
                    else
                    {
                        intValue = ShowVarSelectorGUI(KickStarter.localVariables.localVars, intValue);
                    }
                }
                else if (_parameter.parameterType == ParameterType.Vector3)
                {
                    vector3Value = EditorGUILayout.Vector3Field("Set as:", vector3Value);
                }
            }
            else if (setParamMethod == SetParamMethod.Random)
            {
                if (_parameter.parameterType == ParameterType.Boolean)
                {
                }
                else if (_parameter.parameterType == ParameterType.Integer)
                {
                    intValue    = EditorGUILayout.IntField("Minimum:", intValue);
                    intValueMax = EditorGUILayout.IntField("Maximum:", intValueMax);
                    if (intValueMax < intValue)
                    {
                        intValueMax = intValue;
                    }
                }
                else if (_parameter.parameterType == ParameterType.Float)
                {
                    floatValue    = EditorGUILayout.FloatField("Minimum:", floatValue);
                    floatValueMax = EditorGUILayout.FloatField("Maximum:", floatValueMax);
                    if (floatValueMax < floatValue)
                    {
                        floatValueMax = floatValue;
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("Parameters of type '" + _parameter.parameterType + "' cannot be set randomly.", MessageType.Warning);
                }
            }
            else if (setParamMethod == SetParamMethod.CopiedFromGlobalVariable)
            {
                if (AdvGame.GetReferences() != null && AdvGame.GetReferences().variablesManager != null && AdvGame.GetReferences().variablesManager.vars != null && AdvGame.GetReferences().variablesManager.vars.Count > 0)
                {
                    if (_parameter.parameterType == ParameterType.Vector3)
                    {
                        globalVariableID = AdvGame.GlobalVariableGUI("Vector3 variable:", globalVariableID, VariableType.Vector3);
                    }
                    else if (_parameter.parameterType == ParameterType.GameObject || _parameter.parameterType == ParameterType.GlobalVariable || _parameter.parameterType == ParameterType.InventoryItem || _parameter.parameterType == ParameterType.LocalVariable || _parameter.parameterType == ParameterType.UnityObject)
                    {
                        EditorGUILayout.HelpBox("Parameters of type '" + _parameter.parameterType + "' cannot have values transferred from Global Variables.", MessageType.Warning);
                    }
                    else
                    {
                        globalVariableID = AdvGame.GlobalVariableGUI("Variable:", globalVariableID);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No Global Variables found!", MessageType.Warning);
                }
            }
            else if (setParamMethod == SetParamMethod.CopiedFromParameter)
            {
                if (changeOwn)
                {
                    parameterToCopyID = Action.ChooseParameterGUI(parameters, parameterToCopyID);
                }
                else
                {
                    if (actionListSource == ActionListSource.InScene && actionList != null)
                    {
                        if (actionList.source == ActionListSource.InScene)
                        {
                            if (actionList.useParameters && actionList.parameters.Count > 0)
                            {
                                parameterToCopyID = Action.ChooseParameterGUI(actionList.parameters, parameterToCopyID);
                            }
                        }
                        else if (actionList.source == ActionListSource.AssetFile && actionList.assetFile != null)
                        {
                            if (actionList.assetFile.useParameters && actionList.assetFile.parameters.Count > 0)
                            {
                                parameterToCopyID = Action.ChooseParameterGUI(actionList.assetFile.parameters, parameterToCopyID);
                            }
                        }
                    }
                    else if (actionListSource == ActionListSource.AssetFile && actionListAsset != null)
                    {
                        if (actionListAsset.useParameters && actionListAsset.parameters.Count > 0)
                        {
                            parameterToCopyID = Action.ChooseParameterGUI(actionListAsset.parameters, parameterToCopyID);
                        }
                    }
                }
            }
        }
コード例 #3
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuCycle)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            if (source != AC.MenuSource.AdventureCreator)
            {
                cycleUIBasis = (CycleUIBasis)CustomGUILayout.EnumPopup("UI basis:", cycleUIBasis, apiPrefix + ".cycleUIBasis", "What kind of UI element the Cycle is linked to");

                if (cycleUIBasis == CycleUIBasis.Button)
                {
                    uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source, "The Unity UI Button this is linked to");
                }
                else if (cycleUIBasis == CycleUIBasis.Dropdown)
                {
                    uiDropdown = LinkedUiGUI <Dropdown> (uiDropdown, "Linked Dropdown:", source);
                }
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle", "The method by which this element is hidden from view when made invisible");
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

            cycleType = (AC_CycleType)CustomGUILayout.EnumPopup("Cycle type:", cycleType, apiPrefix + ".cycleType", "What the value links to");

            if (cycleType == AC_CycleType.Language && KickStarter.speechManager != null && KickStarter.speechManager.separateVoiceAndTextLanguages)
            {
                splitLanguageType = (SplitLanguageType)CustomGUILayout.EnumPopup("Language type:", splitLanguageType, apiPrefix + ".splitLanguageType", "What kind of language this affects");
            }

            if (source == MenuSource.AdventureCreator || cycleUIBasis == CycleUIBasis.Button)
            {
                label = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label", "The text that's displayed on-screen, which prefixes the varying text");
            }

            if (cycleType == AC_CycleType.CustomScript || cycleType == AC_CycleType.Variable)
            {
                bool showOptionsGUI = true;

                if (cycleType == AC_CycleType.Variable)
                {
                    VariableType[] allowedVarTypes = new VariableType[2];
                    allowedVarTypes[0] = VariableType.Integer;
                    allowedVarTypes[1] = VariableType.PopUp;

                    varID = AdvGame.GlobalVariableGUI("Global variable:", varID, allowedVarTypes, "The Global PopUp or Integer variable that's value will be synced with the cycle");

                    if (AdvGame.GetReferences().variablesManager != null && AdvGame.GetReferences().variablesManager.GetVariable(varID) != null && AdvGame.GetReferences().variablesManager.GetVariable(varID).type == VariableType.PopUp)
                    {
                        showOptionsGUI = false;
                    }
                }

                if (showOptionsGUI)
                {
                    int numOptions = optionsArray.Count;
                    numOptions = EditorGUILayout.IntField("Number of choices:", optionsArray.Count);
                    if (numOptions < 0)
                    {
                        numOptions = 0;
                    }

                    if (numOptions < optionsArray.Count)
                    {
                        optionsArray.RemoveRange(numOptions, optionsArray.Count - numOptions);
                    }
                    else if (numOptions > optionsArray.Count)
                    {
                        if (numOptions > optionsArray.Capacity)
                        {
                            optionsArray.Capacity = numOptions;
                        }
                        for (int i = optionsArray.Count; i < numOptions; i++)
                        {
                            optionsArray.Add(string.Empty);
                        }
                    }

                    for (int i = 0; i < optionsArray.Count; i++)
                    {
                        optionsArray [i] = CustomGUILayout.TextField("Choice #" + i.ToString() + ":", optionsArray [i], apiPrefix + ".optionsArray[" + i.ToString() + "]");
                    }
                }

                if (cycleType == AC_CycleType.CustomScript)
                {
                    if (optionsArray.Count > 0)
                    {
                        selected = CustomGUILayout.IntField("Default option #:", selected, apiPrefix + ".selected");
                    }
                    ShowClipHelp();
                }

                actionListOnClick = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on click:", actionListOnClick, false, apiPrefix + ".actionListOnClick", "The ActionList asset to run when the element is clicked on");
            }
            alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton", "The name of the input button that triggers the element when pressed");

            bool showOptionTextures = (optionTextures.Length > 0);

            if (menu.menuSource != MenuSource.AdventureCreator && cycleUIBasis == CycleUIBasis.Dropdown)
            {
                showOptionTextures = false;
            }
            showOptionTextures = EditorGUILayout.Toggle("Per-option textures?", showOptionTextures);
            if (showOptionTextures)
            {
                int numOptions = (cycleType == AC_CycleType.Language) ? KickStarter.speechManager.languages.Count : optionsArray.Count;
                if (cycleType == AC_CycleType.Language)
                {
                    numOptions = 0;
                    if (KickStarter.speechManager != null && KickStarter.speechManager.languages != null)
                    {
                        numOptions = KickStarter.speechManager.languages.Count;
                    }
                }
                if (optionTextures.Length != numOptions)
                {
                    optionTextures = new Texture2D[numOptions];
                }
            }
            else
            {
                optionTextures = new Texture2D[0];
            }
            EditorGUILayout.EndVertical();

            if (showOptionTextures)
            {
                EditorGUILayout.BeginVertical("Button");
                for (int i = 0; i < optionTextures.Length; i++)
                {
                    optionTextures[i] = (Texture2D)EditorGUILayout.ObjectField("Option #" + i + " texture:", optionTextures[i], typeof(Texture2D), false);
                }
                if (menu.menuSource != MenuSource.AdventureCreator)
                {
                    EditorGUILayout.HelpBox("Per-option textures require a RawImage component on the linked Button.", MessageType.Info);
                }
                EditorGUILayout.EndVertical();
            }

            base.ShowGUI(menu);
        }
コード例 #4
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            saveHandling = (SaveHandling)EditorGUILayout.EnumPopup("Method:", saveHandling);

            if (saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.OverwriteExistingSave)
            {
                string _action = "load";
                if (saveHandling == SaveHandling.OverwriteExistingSave)
                {
                    _action = "overwrite";
                }

                selectSaveType = (SelectSaveType)EditorGUILayout.EnumPopup("Save to " + _action + ":", selectSaveType);
                if (selectSaveType == SelectSaveType.SetSlotIndex)
                {
                    saveIndexParameterID = Action.ChooseParameterGUI("Slot index to " + _action + ":", parameters, saveIndexParameterID, ParameterType.Integer);
                    if (saveIndexParameterID == -1)
                    {
                        saveIndex = EditorGUILayout.IntField("Slot index to " + _action + ":", saveIndex);
                    }
                }
                else if (selectSaveType == SelectSaveType.SlotIndexFromVariable)
                {
                    slotVarID = AdvGame.GlobalVariableGUI("Integer variable:", slotVarID);
                    if (slotVarID >= 0 && AdvGame.GetReferences() && AdvGame.GetReferences().variablesManager)
                    {
                        GVar _var = AdvGame.GetReferences().variablesManager.GetVariable(slotVarID);
                        if (_var != null && _var.type != VariableType.Integer)
                        {
                            EditorGUILayout.HelpBox("The chosen Variable must be an Integer.", MessageType.Warning);
                        }
                    }
                }

                if (selectSaveType != SelectSaveType.Autosave)
                {
                    EditorGUILayout.Space();
                    menuName    = EditorGUILayout.TextField("Menu with SavesList:", menuName);
                    elementName = EditorGUILayout.TextField("SavesList element:", elementName);
                }
            }

            if (saveHandling == SaveHandling.OverwriteExistingSave || saveHandling == SaveHandling.SaveNewGame)
            {
                if (selectSaveType != SelectSaveType.Autosave)
                {
                    EditorGUILayout.Space();
                    if (saveHandling == SaveHandling.OverwriteExistingSave)
                    {
                        updateLabel = EditorGUILayout.Toggle("Update label?", updateLabel);
                    }
                    if (updateLabel || saveHandling == SaveHandling.SaveNewGame)
                    {
                        customLabel = EditorGUILayout.Toggle("With custom label?", customLabel);
                        if (customLabel)
                        {
                            varID = AdvGame.GlobalVariableGUI("Label as String variable:", varID);
                            if (varID >= 0 && AdvGame.GetReferences() && AdvGame.GetReferences().variablesManager)
                            {
                                GVar _var = AdvGame.GetReferences().variablesManager.GetVariable(varID);
                                if (_var != null && _var.type != VariableType.String)
                                {
                                    EditorGUILayout.HelpBox("The chosen Variable must be a String.", MessageType.Warning);
                                }
                            }
                        }
                    }
                }
            }

            if (saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.ContinueFromLastSave)
            {
                doSelectiveLoad = EditorGUILayout.ToggleLeft("Selective loading?", doSelectiveLoad);
                if (doSelectiveLoad)
                {
                    selectiveLoad.ShowGUI();
                }
            }

            if (saveHandling == SaveHandling.OverwriteExistingSave || saveHandling == SaveHandling.SaveNewGame)
            {
                AfterRunningOption();
            }
        }
コード例 #5
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuToggle)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            if (source != MenuSource.AdventureCreator)
            {
                uiToggle = LinkedUiGUI <Toggle> (uiToggle, "Linked Toggle:", source);
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle");
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

            label       = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label");
            appendState = CustomGUILayout.Toggle("Append state to label?", appendState, apiPrefix + ".appendState");
            if (appendState)
            {
                onText  = CustomGUILayout.TextField("'On' state text:", onText, apiPrefix + ".onText");
                offText = CustomGUILayout.TextField("'Off' state text:", offText, apiPrefix + ".offText");
            }

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

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("'On' texture:", GUILayout.Width(145f));
                onTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (onTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".onTexture");
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("'Off' texture:", GUILayout.Width(145f));
                offTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (offTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".offTexture");
                EditorGUILayout.EndHorizontal();
            }

            toggleType = (AC_ToggleType)CustomGUILayout.EnumPopup("Toggle type:", toggleType, apiPrefix + ".toggleType");
            if (toggleType == AC_ToggleType.CustomScript)
            {
                isOn = CustomGUILayout.Toggle("On by default?", isOn, apiPrefix + ".isOn");
                ShowClipHelp();
            }
            else if (toggleType == AC_ToggleType.Variable)
            {
                varID = AdvGame.GlobalVariableGUI("Global boolean var:", varID, VariableType.Boolean);
            }

            isClickable = CustomGUILayout.Toggle("User can change value?", isClickable, apiPrefix + ".isClickable");
            if (isClickable)
            {
                if (toggleType != AC_ToggleType.Subtitles)
                {
                    actionListOnClick = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on click:", actionListOnClick, false, apiPrefix + ".actionListOnClick");
                }
                alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton");
            }
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
コード例 #6
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            obToReadParameterID = Action.ChooseParameterGUI("Object to record:", parameters, obToReadParameterID, ParameterType.GameObject);
            if (obToReadParameterID >= 0)
            {
                obToReadConstantID = 0;
                obToRead           = null;
            }
            else
            {
                obToRead = (GameObject)EditorGUILayout.ObjectField("Object to record:", obToRead, typeof(GameObject), true);

                obToReadConstantID = FieldToID(obToRead, obToReadConstantID);
                obToRead           = IDToField(obToRead, obToReadConstantID, false);
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Record:", GUILayout.MaxWidth(100f));
            transformLocation   = (GlobalLocal)EditorGUILayout.EnumPopup(transformLocation);
            transformRecordType = (TransformRecordType)EditorGUILayout.EnumPopup(transformRecordType);
            EditorGUILayout.EndHorizontal();

            variableLocation = (VariableLocation)EditorGUILayout.EnumPopup("Variable location:", variableLocation);

            switch (variableLocation)
            {
            case VariableLocation.Global:
                variableParameterID = Action.ChooseParameterGUI("Record to variable:", parameters, variableParameterID, ParameterType.GlobalVariable);
                if (variableParameterID < 0)
                {
                    variableID = AdvGame.GlobalVariableGUI("Record to variable:", variableID, VariableType.Vector3);
                }
                break;

            case VariableLocation.Local:
                if (!isAssetFile)
                {
                    variableParameterID = Action.ChooseParameterGUI("Record to variable:", parameters, variableParameterID, ParameterType.LocalVariable);
                    if (variableParameterID < 0)
                    {
                        variableID = AdvGame.LocalVariableGUI("Record to variable:", variableID, VariableType.Vector3);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("Local variables cannot be accessed in ActionList assets.", MessageType.Info);
                }
                break;

            case VariableLocation.Component:
                variableParameterID = Action.ChooseParameterGUI("Record to variable:", parameters, variableParameterID, ParameterType.ComponentVariable);
                if (variableParameterID >= 0)
                {
                    variables           = null;
                    variablesConstantID = 0;
                }
                else
                {
                    variables           = (Variables)EditorGUILayout.ObjectField("Component:", variables, typeof(Variables), true);
                    variablesConstantID = FieldToID <Variables> (variables, variablesConstantID);
                    variables           = IDToField <Variables> (variables, variablesConstantID, false);

                    if (variables != null)
                    {
                        variableID = AdvGame.ComponentVariableGUI("Record to variable:", variableID, VariableType.Vector3, variables);
                    }
                }
                break;
            }

            AfterRunningOption();
        }
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            isPlayer = EditorGUILayout.Toggle("Move Player?", isPlayer);
            if (!isPlayer)
            {
                parameterID = Action.ChooseParameterGUI("Moveable object:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    linkedProp = null;
                }
                else
                {
                    linkedProp = (Moveable)EditorGUILayout.ObjectField("Moveable object:", linkedProp, typeof(Moveable), true);

                    constantID = FieldToID <Moveable> (linkedProp, constantID);
                    linkedProp = IDToField <Moveable> (linkedProp, constantID, false);
                }
            }

            EditorGUILayout.BeginHorizontal();
            transformType = (TransformType)EditorGUILayout.EnumPopup(transformType);
            if (transformType != TransformType.CopyMarker)
            {
                toBy = (ToBy)EditorGUILayout.EnumPopup(toBy);
            }
            EditorGUILayout.EndHorizontal();

            if (transformType == TransformType.CopyMarker)
            {
                markerParameterID = Action.ChooseParameterGUI("Marker:", parameters, markerParameterID, ParameterType.GameObject);
                if (markerParameterID >= 0)
                {
                    markerID = 0;
                    marker   = null;
                }
                else
                {
                    marker = (Marker)EditorGUILayout.ObjectField("Marker:", marker, typeof(Marker), true);

                    markerID = FieldToID <Marker> (marker, markerID);
                    marker   = IDToField <Marker> (marker, markerID, false);
                }
            }
            else
            {
                setVectorMethod = (SetVectorMethod)EditorGUILayout.EnumPopup("Vector is: ", setVectorMethod);
                if (setVectorMethod == SetVectorMethod.EnteredHere)
                {
                    newVectorParameterID = Action.ChooseParameterGUI("Value:", parameters, newVectorParameterID, ParameterType.Vector3);
                    if (newVectorParameterID < 0)
                    {
                        newVector = EditorGUILayout.Vector3Field("Value:", newVector);
                    }
                }
                else if (setVectorMethod == SetVectorMethod.FromVector3Variable)
                {
                    if (isAssetFile)
                    {
                        variableLocation = VariableLocation.Global;
                    }
                    else
                    {
                        variableLocation = (VariableLocation)EditorGUILayout.EnumPopup("Source:", variableLocation);
                    }

                    if (variableLocation == VariableLocation.Global)
                    {
                        vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.GlobalVariable);
                        if (vectorVarParameterID < 0)
                        {
                            vectorVarID = AdvGame.GlobalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3);
                        }
                    }
                    else if (variableLocation == VariableLocation.Local)
                    {
                        vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.LocalVariable);
                        if (vectorVarParameterID < 0)
                        {
                            vectorVarID = AdvGame.LocalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3);
                        }
                    }
                }

                clearExisting = EditorGUILayout.Toggle("Stop existing transforms?", clearExisting);
            }

            if (transformType == TransformType.CopyMarker ||
                (transformType == TransformType.Translate && toBy == ToBy.To) ||
                (transformType == TransformType.Rotate && toBy == ToBy.To))
            {
                inWorldSpace = EditorGUILayout.Toggle("Act in world-space?", inWorldSpace);

                if (inWorldSpace && transformType == TransformType.CopyMarker)
                {
                    EditorGUILayout.HelpBox("The moveable object's scale will be changed in local space.", MessageType.Info);
                }
            }

            transitionTimeParameterID = Action.ChooseParameterGUI("Transition time (s):", parameters, transitionTimeParameterID, ParameterType.Float);
            if (transitionTimeParameterID < 0)
            {
                transitionTime = EditorGUILayout.FloatField("Transition time (s):", transitionTime);
            }

            if (transitionTime > 0f)
            {
                if (transformType == TransformType.Rotate)
                {
                    doEulerRotation = EditorGUILayout.Toggle("Euler rotation?", doEulerRotation);
                }
                moveMethod = (MoveMethod)EditorGUILayout.EnumPopup("Move method:", moveMethod);
                if (moveMethod == MoveMethod.CustomCurve)
                {
                    timeCurve = EditorGUILayout.CurveField("Time curve:", timeCurve);
                }
                willWait = EditorGUILayout.Toggle("Wait until finish?", willWait);
            }

            AfterRunningOption();
        }
コード例 #8
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            if (source != MenuSource.AdventureCreator)
            {
                uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

            labelType = (AC_LabelType)CustomGUILayout.EnumPopup("Label type:", labelType, apiPrefix + ".labelType");
            if (labelType == AC_LabelType.Normal)
            {
                label = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label");
            }
            else if (source == MenuSource.AdventureCreator)
            {
                label = CustomGUILayout.TextField("Placeholder text:", label, apiPrefix + ".label");
            }

            if (labelType == AC_LabelType.GlobalVariable)
            {
                variableID = AdvGame.GlobalVariableGUI("Global Variable:", variableID);
            }
            else if (labelType == AC_LabelType.DialogueLine)
            {
                useCharacterColour = CustomGUILayout.Toggle("Use Character text colour?", useCharacterColour, apiPrefix + ".useCharacterColour");
                if (sizeType == AC_SizeType.Manual)
                {
                    autoAdjustHeight = CustomGUILayout.Toggle("Auto-adjust height to fit?", autoAdjustHeight, apiPrefix + ".autoAdjustHeight");
                }
            }

            if (labelType == AC_LabelType.Hotspot || labelType == AC_LabelType.DialogueLine || labelType == AC_LabelType.DialogueSpeaker)
            {
                updateIfEmpty = CustomGUILayout.Toggle("Update if string is empty?", updateIfEmpty, apiPrefix + ".updateIfEmpty");

                if (labelType == AC_LabelType.Hotspot)
                {
                    showPendingWhileMovingToHotspot = CustomGUILayout.ToggleLeft("Show pending Interaction while moving to Hotspot?", showPendingWhileMovingToHotspot, apiPrefix + ".showPendingWhileMovingToHotspot");
                }
            }
            else if (labelType == AC_LabelType.InventoryProperty)
            {
                if (AdvGame.GetReferences().inventoryManager)
                {
                    if (AdvGame.GetReferences().inventoryManager.invVars != null && AdvGame.GetReferences().inventoryManager.invVars.Count > 0)
                    {
                        InvVar[]      invVars     = AdvGame.GetReferences().inventoryManager.invVars.ToArray();
                        List <string> invVarNames = new List <string>();

                        int itemPropertyNumber = 0;
                        for (int i = 0; i < invVars.Length; i++)
                        {
                            if (invVars[i].id == itemPropertyID)
                            {
                                itemPropertyNumber = i;
                            }
                            invVarNames.Add(invVars[i].id + ": " + invVars[i].label);
                        }

                        itemPropertyNumber = CustomGUILayout.Popup("Inventory property:", itemPropertyNumber, invVarNames.ToArray(), apiPrefix + ".itemPropertyNumber");
                        itemPropertyID     = invVars[itemPropertyNumber].id;

                        inventoryPropertyType = (InventoryPropertyType)CustomGUILayout.EnumPopup("Inventory item source:", inventoryPropertyType, apiPrefix + ".inventoryPropertyType");
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("No Inventory properties defined!", MessageType.Warning);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No Inventory Manager assigned!", MessageType.Warning);
                }
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
コード例 #9
0
        public override void ShowGUI(Menu menu)
        {
            string     apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";
            MenuSource source    = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            if (source != AC.MenuSource.AdventureCreator)
            {
                cycleUIBasis = (CycleUIBasis)CustomGUILayout.EnumPopup("UI basis:", cycleUIBasis, apiPrefix + ".cycleUIBasis");

                if (cycleUIBasis == CycleUIBasis.Button)
                {
                    uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source);
                }
                else if (cycleUIBasis == CycleUIBasis.Dropdown)
                {
                                        #if UNITY_5_3_OR_NEWER
                    uiDropdown = LinkedUiGUI <Dropdown> (uiDropdown, "Linked Dropdown:", source);
                                        #else
                    EditorGUILayout.HelpBox("This option is only available with Unity 5.4 or newer.", MessageType.Info);
                                        #endif
                }
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle");
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

            cycleType = (AC_CycleType)CustomGUILayout.EnumPopup("Cycle type:", cycleType, apiPrefix + ".cycleType");

            if (source == MenuSource.AdventureCreator || cycleUIBasis == CycleUIBasis.Button)
            {
                label = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label");
            }

            if (cycleType == AC_CycleType.CustomScript || cycleType == AC_CycleType.Variable)
            {
                int numOptions = optionsArray.Count;
                numOptions = EditorGUILayout.IntField("Number of choices:", optionsArray.Count);
                if (numOptions < 0)
                {
                    numOptions = 0;
                }

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

                for (int i = 0; i < optionsArray.Count; i++)
                {
                    optionsArray [i] = CustomGUILayout.TextField("Choice #" + i.ToString() + ":", optionsArray [i], apiPrefix + ".optionsArray[" + i.ToString() + "]");
                }

                if (cycleType == AC_CycleType.CustomScript)
                {
                    if (optionsArray.Count > 0)
                    {
                        selected = CustomGUILayout.IntField("Default option #:", selected, apiPrefix + ".selected");
                    }
                    ShowClipHelp();
                }
                else if (cycleType == AC_CycleType.Variable)
                {
                    varID = AdvGame.GlobalVariableGUI("Global integer var:", varID, VariableType.Integer);
                }

                actionListOnClick = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on click:", actionListOnClick, false, apiPrefix + ".actionListOnClick");
            }
            alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton");
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
コード例 #10
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuLabel)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            if (source != MenuSource.AdventureCreator)
            {
                                #if TextMeshProIsPresent
                uiText = LinkedUiGUI <TMPro.TextMeshProUGUI> (uiText, "Linked Text:", source);
                                #else
                uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                                #endif

                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

            labelType = (AC_LabelType)CustomGUILayout.EnumPopup("Label type:", labelType, apiPrefix + ".labelType", "What kind of text the label displays");
            if (labelType == AC_LabelType.Normal)
            {
                label = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label", "The display text");
            }
            else if (source == MenuSource.AdventureCreator)
            {
                label = CustomGUILayout.TextField("Placeholder text:", label, apiPrefix + ".label");
            }

            if (labelType == AC_LabelType.GlobalVariable)
            {
                variableID = AdvGame.GlobalVariableGUI("Global Variable:", variableID, "The Global Variable whose value will be displayed");
            }
            else if (labelType == AC_LabelType.DialogueLine)
            {
                useCharacterColour = CustomGUILayout.Toggle("Use Character text colour?", useCharacterColour, apiPrefix + ".useCharacterColour", "If True, then the displayed subtitle text will use the speaking character's subtitle text colour");
                if (sizeType == AC_SizeType.Manual)
                {
                    autoAdjustHeight = CustomGUILayout.Toggle("Auto-adjust height to fit?", autoAdjustHeight, apiPrefix + ".autoAdjustHeight", "If True, then the label's height will adjust itself to fit the text within it");
                }
            }

            if (labelType == AC_LabelType.Hotspot || labelType == AC_LabelType.DialogueLine || labelType == AC_LabelType.DialogueSpeaker)
            {
                updateIfEmpty = CustomGUILayout.Toggle("Update if string is empty?", updateIfEmpty, apiPrefix + ".updateIfEmpty", "If True, then the display text buffer can be empty ");

                if (labelType == AC_LabelType.Hotspot)
                {
                    showPendingWhileMovingToHotspot = CustomGUILayout.ToggleLeft("Show pending Interaction while moving to Hotspot?", showPendingWhileMovingToHotspot, apiPrefix + ".showPendingWhileMovingToHotspot", "If True, then the label will not change while the player is moving towards a Hotspot in order to run an interaction");
                }
            }
            else if (labelType == AC_LabelType.InventoryProperty)
            {
                if (AdvGame.GetReferences().inventoryManager)
                {
                    if (AdvGame.GetReferences().inventoryManager.invVars != null && AdvGame.GetReferences().inventoryManager.invVars.Count > 0)
                    {
                        InvVar[]      invVars     = AdvGame.GetReferences().inventoryManager.invVars.ToArray();
                        List <string> invVarNames = new List <string>();

                        int itemPropertyNumber = 0;
                        for (int i = 0; i < invVars.Length; i++)
                        {
                            if (invVars[i].id == itemPropertyID)
                            {
                                itemPropertyNumber = i;
                            }
                            invVarNames.Add(invVars[i].id + ": " + invVars[i].label);
                        }

                        itemPropertyNumber = CustomGUILayout.Popup("Inventory property:", itemPropertyNumber, invVarNames.ToArray(), apiPrefix + ".itemPropertyNumber", "The inventory property to show");
                        itemPropertyID     = invVars[itemPropertyNumber].id;

                        inventoryPropertyType = (InventoryPropertyType)CustomGUILayout.EnumPopup("Inventory item source:", inventoryPropertyType, apiPrefix + ".inventoryPropertyType", "What kind of item to display properties for");
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("No Inventory properties defined!", MessageType.Warning);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No Inventory Manager assigned!", MessageType.Warning);
                }
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
コード例 #11
0
ファイル: MenuSlider.cs プロジェクト: Keraunic-Tonic/GJ2021
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuSlider)";

            MenuSource source = menu.menuSource;

            CustomGUILayout.BeginVertical();

            sliderType = (AC_SliderType)CustomGUILayout.EnumPopup("Slider affects:", sliderType, apiPrefix + ".sliderType", "What the slider's value represents");

            if (source == MenuSource.AdventureCreator)
            {
                label = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label", "The text that's displayed on-screen");
            }

            if (sliderType == AC_SliderType.CustomScript)
            {
                ShowClipHelp();
                amount = CustomGUILayout.Slider("Default value:", amount, minValue, maxValue, apiPrefix + ".amount", "The slider's default value");
            }
            else if (sliderType == AC_SliderType.FloatVariable)
            {
                varID = AdvGame.GlobalVariableGUI("Global float var:", varID, VariableType.Float, "The global Float variable whose value is linked to the slider");
            }
            if (sliderType == AC_SliderType.CustomScript || sliderType == AC_SliderType.FloatVariable)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Min. value:", GUILayout.Width(80f));
                minValue = EditorGUILayout.FloatField(minValue);
                EditorGUILayout.LabelField("Max. value:", GUILayout.Width(80f));
                maxValue = EditorGUILayout.FloatField(maxValue);
                EditorGUILayout.EndHorizontal();
                maxValue = Mathf.Max(minValue, maxValue);
            }
            else
            {
                minValue = 0f;
                maxValue = 1f;
            }
            actionListOnChange = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on change:", actionListOnChange, false, apiPrefix + ".actionListOnChange");

            if (source == MenuSource.AdventureCreator)
            {
                numberOfSteps = CustomGUILayout.IntField("Number of steps:", numberOfSteps, apiPrefix + ".numberOfSteps", "The number of descrete values the slider can have");
            }

            if (source == MenuSource.AdventureCreator)
            {
                sliderOrientation = (SliderOrientation)CustomGUILayout.EnumPopup("Orientation:", sliderOrientation, apiPrefix + ".sliderOrientation", "Which way the slider is orientated");
                if (sliderOrientation == SliderOrientation.Horizontal)
                {
                    useFullWidth = CustomGUILayout.Toggle("Use full width?", useFullWidth, apiPrefix + ".useFullWidth", "If True, then the slider will be drawn across the whole width of the element. Otherwise, it will be drawn across only half.");
                }
                sliderDisplayType = (SliderDisplayType)CustomGUILayout.EnumPopup("Display type:", sliderDisplayType, apiPrefix + ".sliderDisplayType", "The display type of the slider");

                if (sliderDisplayType == SliderDisplayType.MoveableBlock)
                {
                    blockSize = EditorGUILayout.Vector2Field(new GUIContent("Block size:", "The dimensions of the block"), blockSize);
                }
            }
            else
            {
                uiSlider = LinkedUiGUI <Slider> (uiSlider, "Linked Slider:", source, "The Unity UI Slider this is linked to");
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle", "The method by which this element is hidden from view when made invisible");
                CustomGUILayout.EndVertical();
                CustomGUILayout.BeginVertical();
            }


            isClickable = CustomGUILayout.Toggle("User can change value?", isClickable, apiPrefix + ".isClickable", "If True, the slider is interactive and can be modified by the user");

            CustomGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
コード例 #12
0
ファイル: MenuLabel.cs プロジェクト: Firgof/metanoia-game
        public override void ShowGUI(Menu menu)
        {
            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            if (source != MenuSource.AdventureCreator)
            {
                uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

            labelType = (AC_LabelType)EditorGUILayout.EnumPopup("Label type:", labelType);
            if (labelType == AC_LabelType.Normal)
            {
                label = EditorGUILayout.TextField("Label text:", label);
            }
            else if (source == MenuSource.AdventureCreator)
            {
                label = EditorGUILayout.TextField("Placeholder text:", label);
            }

            if (labelType == AC_LabelType.GlobalVariable)
            {
                variableID = AdvGame.GlobalVariableGUI("Global Variable:", variableID);
            }
            else if (labelType == AC_LabelType.DialogueLine)
            {
                useCharacterColour = EditorGUILayout.Toggle("Use Character text colour?", useCharacterColour);
                if (sizeType == AC_SizeType.Manual)
                {
                    autoAdjustHeight = EditorGUILayout.Toggle("Auto-adjust height to fit?", autoAdjustHeight);
                }
            }

            if (labelType == AC_LabelType.Hotspot || labelType == AC_LabelType.DialogueLine || labelType == AC_LabelType.DialogueSpeaker)
            {
                updateIfEmpty = EditorGUILayout.Toggle("Update if string is empty?", updateIfEmpty);
            }
            else if (labelType == AC_LabelType.InventoryProperty)
            {
                if (AdvGame.GetReferences().inventoryManager)
                {
                    if (AdvGame.GetReferences().inventoryManager.invVars != null && AdvGame.GetReferences().inventoryManager.invVars.Count > 0)
                    {
                        InvVar[]      invVars     = AdvGame.GetReferences().inventoryManager.invVars.ToArray();
                        List <string> invVarNames = new List <string>();

                        int itemPropertyNumber = 0;
                        for (int i = 0; i < invVars.Length; i++)
                        {
                            if (invVars[i].id == itemPropertyID)
                            {
                                itemPropertyNumber = i;
                            }
                            invVarNames.Add(invVars[i].id + ": " + invVars[i].label);
                        }

                        itemPropertyNumber = EditorGUILayout.Popup("Inventory property:", itemPropertyNumber, invVarNames.ToArray());
                        itemPropertyID     = invVars[itemPropertyNumber].id;

                        inventoryPropertyType = (InventoryPropertyType)EditorGUILayout.EnumPopup("Inventory item source:", inventoryPropertyType);
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("No Inventory properties defined!", MessageType.Warning);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No Inventory Manager assigned!", MessageType.Warning);
                }
            }

            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);
                }
            }
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
コード例 #13
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            if (AdvGame.GetReferences().settingsManager != null && !AdvGame.GetReferences().settingsManager.useProfiles)
            {
                EditorGUILayout.HelpBox("Save game profiles are not enabled - please set in Settings Manager to use this Action.", MessageType.Warning);
                AfterRunningOption();
                return;
            }

            manageProfileType = (ManageProfileType)EditorGUILayout.EnumPopup("Method:", manageProfileType);

            if (manageProfileType == ManageProfileType.CreateProfile)
            {
                useCustomLabel = EditorGUILayout.Toggle("Use custom label?", useCustomLabel);
            }

            if ((manageProfileType == ManageProfileType.CreateProfile && useCustomLabel) || manageProfileType == AC.ManageProfileType.RenameProfile)
            {
                varID = AdvGame.GlobalVariableGUI("Label as String variable:", varID, VariableType.String);
            }

            if (manageProfileType == ManageProfileType.DeleteProfile ||
                manageProfileType == ManageProfileType.RenameProfile ||
                manageProfileType == ManageProfileType.SwitchActiveProfile)
            {
                string _action = "delete";
                if (manageProfileType == ManageProfileType.RenameProfile)
                {
                    _action = "rename";
                }
                else if (manageProfileType == ManageProfileType.SwitchActiveProfile)
                {
                    _action = "switch to";
                }

                deleteProfileType = (DeleteProfileType)EditorGUILayout.EnumPopup("Profile to " + _action + ":", deleteProfileType);
                if (deleteProfileType == DeleteProfileType.SetSlotIndex)
                {
                    profileIndexParameterID = Action.ChooseParameterGUI("Slot index to " + _action + ":", parameters, profileIndexParameterID, ParameterType.Integer);
                    if (profileIndexParameterID == -1)
                    {
                        profileIndex = EditorGUILayout.IntField("Slot index to " + _action + ":", profileIndex);
                    }
                }
                else if (deleteProfileType == DeleteProfileType.SlotIndexFromVariable)
                {
                    slotVarID = AdvGame.GlobalVariableGUI("Integer variable:", slotVarID, VariableType.Integer);
                }
                else if (deleteProfileType == DeleteProfileType.SetProfileID)
                {
                    profileIndexParameterID = Action.ChooseParameterGUI("Profile ID to " + _action + ":", parameters, profileIndexParameterID, ParameterType.Integer);
                    if (profileIndexParameterID == -1)
                    {
                        profileIndex = EditorGUILayout.IntField("Profile ID to " + _action + ":", profileIndex);
                    }
                }
                else if (deleteProfileType == DeleteProfileType.ActiveProfile)
                {
                    if (manageProfileType == ManageProfileType.SwitchActiveProfile)
                    {
                        EditorGUILayout.HelpBox("This combination of fields will no effect - please choose another.", MessageType.Info);
                    }
                }

                if (deleteProfileType == DeleteProfileType.SetSlotIndex ||
                    deleteProfileType == DeleteProfileType.SlotIndexFromVariable)
                {
                    EditorGUILayout.Space();
                    menuName    = EditorGUILayout.TextField("Menu with ProfilesList:", menuName);
                    elementName = EditorGUILayout.TextField("ProfilesList element:", elementName);
                }
            }

            AfterRunningOption();
        }
コード例 #14
0
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            location = (VariableLocation)EditorGUILayout.EnumPopup("Source:", location);

            switch (location)
            {
            case VariableLocation.Global:
                if (AdvGame.GetReferences().variablesManager != null)
                {
                    parameterID = Action.ChooseParameterGUI("Variable:", parameters, parameterID, ParameterType.GlobalVariable);
                    if (parameterID >= 0)
                    {
                        placeholderPopUpLabelDataID = AdvGame.GetReferences().variablesManager.ShowPlaceholderPresetData(placeholderPopUpLabelDataID);
                        if (placeholderPopUpLabelDataID <= 0)
                        {
                            placeholderNumValues = EditorGUILayout.DelayedIntField("Placeholder # of values:", placeholderNumValues);
                            if (placeholderNumValues < 1)
                            {
                                placeholderNumValues = 1;
                            }
                        }
                    }
                    else
                    {
                        variableID = AdvGame.GlobalVariableGUI("PopUp variable:", variableID, VariableType.PopUp);
                    }
                }
                break;

            case VariableLocation.Local:
                if (isAssetFile)
                {
                    EditorGUILayout.HelpBox("Local variables cannot be accessed in ActionList assets.", MessageType.Info);
                }
                else if (localVariables == null)
                {
                    EditorGUILayout.HelpBox("No 'Local Variables' component found in the scene. Please add an AC GameEngine object from the Scene Manager.", MessageType.Info);
                }
                else
                {
                    parameterID = Action.ChooseParameterGUI("Variable:", parameters, parameterID, ParameterType.LocalVariable);
                    if (parameterID >= 0)
                    {
                        placeholderPopUpLabelDataID = AdvGame.GetReferences().variablesManager.ShowPlaceholderPresetData(placeholderPopUpLabelDataID);
                        if (placeholderPopUpLabelDataID <= 0)
                        {
                            placeholderNumValues = EditorGUILayout.DelayedIntField("Placeholder # of values:", placeholderNumValues);
                            if (placeholderNumValues < 1)
                            {
                                placeholderNumValues = 1;
                            }
                        }
                    }
                    else
                    {
                        variableID = AdvGame.LocalVariableGUI("PopUp variable:", variableID, VariableType.PopUp);
                    }
                }
                break;

            case VariableLocation.Component:
                parameterID = Action.ChooseParameterGUI("Variable:", parameters, parameterID, ParameterType.ComponentVariable);
                if (parameterID >= 0)
                {
                    placeholderPopUpLabelDataID = AdvGame.GetReferences().variablesManager.ShowPlaceholderPresetData(placeholderPopUpLabelDataID);
                    if (placeholderPopUpLabelDataID <= 0)
                    {
                        placeholderNumValues = EditorGUILayout.DelayedIntField("Placeholder # of values:", placeholderNumValues);
                        if (placeholderNumValues < 1)
                        {
                            placeholderNumValues = 1;
                        }
                    }
                }
                else
                {
                    variables           = (Variables)EditorGUILayout.ObjectField("Component:", variables, typeof(Variables), true);
                    variablesConstantID = FieldToID <Variables> (variables, variablesConstantID);
                    variables           = IDToField <Variables> (variables, variablesConstantID, false);

                    if (variables != null)
                    {
                        variableID = AdvGame.ComponentVariableGUI("PopUp variable:", variableID, VariableType.PopUp, variables);
                    }
                }
                break;
            }

            if (parameterID >= 0)
            {
                numSockets = placeholderNumValues;
                PopUpLabelData popUpLabelData = AdvGame.GetReferences().variablesManager.GetPopUpLabelData(placeholderPopUpLabelDataID);
                if (popUpLabelData != null)
                {
                    numSockets           = popUpLabelData.Length;
                    placeholderNumValues = numSockets;
                }
            }
            else
            {
                GVar _var = GetVariable();
                if (_var != null)
                {
                    numSockets                  = _var.GetNumPopUpValues();
                    placeholderNumValues        = numSockets;
                    placeholderPopUpLabelDataID = _var.popUpID;
                }
            }

            if (numSockets == 0)
            {
                EditorGUILayout.HelpBox("The selected variable has no values!", MessageType.Warning);
            }
        }
コード例 #15
0
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            invAction = (InvAction)EditorGUILayout.EnumPopup("Method:", invAction);

            string _label = "Object to instantiate:";

            if (invAction == InvAction.Remove)
            {
                _label = "Object to delete:";
            }

            ParameterType[] parameterTypes = new ParameterType[2] {
                ParameterType.GameObject, ParameterType.InventoryItem
            };
            parameterID = Action.ChooseParameterGUI(_label, parameters, parameterID, parameterTypes);
            if (parameterID >= 0)
            {
                constantID = 0;
                gameObject = null;
            }
            else
            {
                gameObject = (GameObject)EditorGUILayout.ObjectField(_label, gameObject, typeof(GameObject), true);

                constantID = FieldToID(gameObject, constantID);
                gameObject = IDToField(gameObject, constantID, false);
            }

            if (invAction == InvAction.Add)
            {
                positionRelativeTo = (PositionRelativeTo)EditorGUILayout.EnumPopup("Position relative to:", positionRelativeTo);

                if (positionRelativeTo == PositionRelativeTo.RelativeToGameObject)
                {
                    relativeGameObjectParameterID = Action.ChooseParameterGUI("Relative GameObject:", parameters, relativeGameObjectParameterID, ParameterType.GameObject);
                    if (relativeGameObjectParameterID >= 0)
                    {
                        relativeGameObjectID = 0;
                        relativeGameObject   = null;
                    }
                    else
                    {
                        relativeGameObject = (GameObject)EditorGUILayout.ObjectField("Relative GameObject:", relativeGameObject, typeof(GameObject), true);

                        relativeGameObjectID = FieldToID(relativeGameObject, relativeGameObjectID);
                        relativeGameObject   = IDToField(relativeGameObject, relativeGameObjectID, false);
                    }
                }
                else if (positionRelativeTo == PositionRelativeTo.EnteredValue)
                {
                    relativeVectorParameterID = Action.ChooseParameterGUI("Value:", parameters, relativeVectorParameterID, ParameterType.Vector3);
                    if (relativeVectorParameterID < 0)
                    {
                        relativeVector = EditorGUILayout.Vector3Field("Value:", relativeVector);
                    }
                }
                else if (positionRelativeTo == PositionRelativeTo.VectorVariable)
                {
                    variableLocation = (VariableLocation)EditorGUILayout.EnumPopup("Source:", variableLocation);

                    switch (variableLocation)
                    {
                    case VariableLocation.Global:
                        vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.GlobalVariable);
                        if (vectorVarParameterID < 0)
                        {
                            vectorVarID = AdvGame.GlobalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3);
                        }
                        break;

                    case VariableLocation.Local:
                        if (!isAssetFile)
                        {
                            vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.LocalVariable);
                            if (vectorVarParameterID < 0)
                            {
                                vectorVarID = AdvGame.LocalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3);
                            }
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("Local variables cannot be accessed in ActionList assets.", MessageType.Info);
                        }
                        break;

                    case VariableLocation.Component:
                        vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.ComponentVariable);
                        if (vectorVarParameterID >= 0)
                        {
                            variables           = null;
                            variablesConstantID = 0;
                        }
                        else
                        {
                            variables           = (Variables)EditorGUILayout.ObjectField("Component:", variables, typeof(Variables), true);
                            variablesConstantID = FieldToID <Variables> (variables, variablesConstantID);
                            variables           = IDToField <Variables> (variables, variablesConstantID, false);

                            if (variables != null)
                            {
                                vectorVarID = AdvGame.ComponentVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3, variables);
                            }
                        }
                        break;
                    }
                }

                spawnedObjectParameterID = ChooseParameterGUI("Send to parameter:", parameters, spawnedObjectParameterID, ParameterType.GameObject);
            }
            else if (invAction == InvAction.Replace)
            {
                EditorGUILayout.Space();
                replaceParameterID = Action.ChooseParameterGUI("Object to delete:", parameters, replaceParameterID, ParameterType.GameObject);
                if (replaceParameterID >= 0)
                {
                    replaceConstantID = 0;
                    replaceGameObject = null;
                }
                else
                {
                    replaceGameObject = (GameObject)EditorGUILayout.ObjectField("Object to delete:", replaceGameObject, typeof(GameObject), true);

                    replaceConstantID = FieldToID(replaceGameObject, replaceConstantID);
                    replaceGameObject = IDToField(replaceGameObject, replaceConstantID, false);
                }
            }

            AfterRunningOption();
        }
コード例 #16
0
        public override void ShowGUI(MenuSource source)
        {
            EditorGUILayout.BeginVertical("Button");

            if (source != MenuSource.AdventureCreator)
            {
                uiToggle = LinkedUiGUI <Toggle> (uiToggle, "Linked Toggle:", source);
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

            label       = EditorGUILayout.TextField("Label text:", label);
            appendState = EditorGUILayout.Toggle("Append state to label?", appendState);

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

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("'On' texture:", GUILayout.Width(145f));
                onTexture = (Texture2D)EditorGUILayout.ObjectField(onTexture, typeof(Texture2D), false, GUILayout.Width(70f), GUILayout.Height(30f));
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("'Off' texture:", GUILayout.Width(145f));
                offTexture = (Texture2D)EditorGUILayout.ObjectField(offTexture, typeof(Texture2D), false, GUILayout.Width(70f), GUILayout.Height(30f));
                EditorGUILayout.EndHorizontal();
            }

            toggleType = (AC_ToggleType)EditorGUILayout.EnumPopup("Toggle type:", toggleType);
            if (toggleType == AC_ToggleType.CustomScript)
            {
                isOn = EditorGUILayout.Toggle("On by default?", isOn);
                ShowClipHelp();
            }
            else if (toggleType == AC_ToggleType.Variable)
            {
                varID = AdvGame.GlobalVariableGUI("Global boolean var:", varID);
                if (varID >= 0 && AdvGame.GetReferences() && AdvGame.GetReferences().variablesManager)
                {
                    GVar _var = AdvGame.GetReferences().variablesManager.GetVariable(varID);
                    if (_var != null && _var.type != VariableType.Boolean)
                    {
                        EditorGUILayout.HelpBox("The chosen Variable must be a Boolean.", MessageType.Warning);
                    }
                }
            }
            if (toggleType != AC_ToggleType.Subtitles)
            {
                actionListOnClick = (ActionListAsset)EditorGUILayout.ObjectField("ActionList on click:", actionListOnClick, typeof(ActionListAsset), false);
            }
            alternativeInputButton = EditorGUILayout.TextField("Alernative input button:", alternativeInputButton);
            EditorGUILayout.EndVertical();

            base.ShowGUI(source);
        }
コード例 #17
0
ファイル: MenuSlider.cs プロジェクト: careybrenda/Dunedin
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuSlider)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            sliderType = (AC_SliderType)CustomGUILayout.EnumPopup("Slider affects:", sliderType, apiPrefix + ".sliderType");

            if (source == MenuSource.AdventureCreator)
            {
                label = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label");
            }

            if (sliderType == AC_SliderType.CustomScript)
            {
                ShowClipHelp();
                amount = CustomGUILayout.Slider("Default value:", amount, minValue, maxValue, apiPrefix + ".amount");
            }
            else if (sliderType == AC_SliderType.FloatVariable)
            {
                varID = AdvGame.GlobalVariableGUI("Global float var:", varID, VariableType.Float);
            }
            if (sliderType == AC_SliderType.CustomScript || sliderType == AC_SliderType.FloatVariable)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Min. value:", GUILayout.Width(80f));
                minValue = EditorGUILayout.FloatField(minValue);
                EditorGUILayout.LabelField("Max. value:", GUILayout.Width(80f));
                maxValue = EditorGUILayout.FloatField(maxValue);
                EditorGUILayout.EndHorizontal();
                maxValue           = Mathf.Max(minValue, maxValue);
                actionListOnChange = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on change:", actionListOnChange, false, apiPrefix + ".actionListOnChange");
            }
            else
            {
                minValue = 0f;
                maxValue = 1f;
            }

            if (source == MenuSource.AdventureCreator)
            {
                numberOfSteps = CustomGUILayout.IntField("Number of steps:", numberOfSteps, apiPrefix + ".numberOfSteps");
            }

            if (source == MenuSource.AdventureCreator)
            {
                useFullWidth      = CustomGUILayout.Toggle("Use full width?", useFullWidth, apiPrefix + ".useFullWidth");
                sliderDisplayType = (SliderDisplayType)CustomGUILayout.EnumPopup("Display type:", sliderDisplayType, apiPrefix + ".sliderDisplayType");

                if (sliderDisplayType == SliderDisplayType.MoveableBlock)
                {
                    blockSize = EditorGUILayout.Vector2Field("Block size:", blockSize);
                }
            }
            else
            {
                uiSlider = LinkedUiGUI <Slider> (uiSlider, "Linked Slider:", source);
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle");
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }


            isClickable = CustomGUILayout.Toggle("User can change value?", isClickable, apiPrefix + ".isClickable");

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
コード例 #18
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer);
            if (!isPlayer)
            {
                obToMoveParameterID = Action.ChooseParameterGUI("Object to move:", parameters, obToMoveParameterID, ParameterType.GameObject);
                if (obToMoveParameterID >= 0)
                {
                    obToMoveID = 0;
                    obToMove   = null;
                }
                else
                {
                    obToMove = (GameObject)EditorGUILayout.ObjectField("Object to move:", obToMove, typeof(GameObject), true);

                    obToMoveID = FieldToID(obToMove, obToMoveID);
                    obToMove   = IDToField(obToMove, obToMoveID, false);
                }
            }

            markerParameterID = Action.ChooseParameterGUI("Teleport to:", parameters, markerParameterID, ParameterType.GameObject);
            if (markerParameterID >= 0)
            {
                markerID   = 0;
                teleporter = null;
            }
            else
            {
                teleporter = (Marker)EditorGUILayout.ObjectField("Teleport to:", teleporter, typeof(Marker), true);

                markerID   = FieldToID <Marker> (teleporter, markerID);
                teleporter = IDToField <Marker> (teleporter, markerID, false);
            }

            positionRelativeTo = (PositionRelativeTo)EditorGUILayout.EnumPopup("Position relative to:", positionRelativeTo);

            if (positionRelativeTo == PositionRelativeTo.RelativeToGameObject)
            {
                relativeGameObjectParameterID = Action.ChooseParameterGUI("Relative GameObject:", parameters, relativeGameObjectParameterID, ParameterType.GameObject);
                if (relativeGameObjectParameterID >= 0)
                {
                    relativeGameObjectID = 0;
                    relativeGameObject   = null;
                }
                else
                {
                    relativeGameObject = (GameObject)EditorGUILayout.ObjectField("Relative GameObject:", relativeGameObject, typeof(GameObject), true);

                    relativeGameObjectID = FieldToID(relativeGameObject, relativeGameObjectID);
                    relativeGameObject   = IDToField(relativeGameObject, relativeGameObjectID, false);
                }
            }
            else if (positionRelativeTo == PositionRelativeTo.EnteredValue)
            {
                relativeVectorParameterID = Action.ChooseParameterGUI("Value:", parameters, relativeVectorParameterID, ParameterType.Vector3);
                if (relativeVectorParameterID < 0)
                {
                    relativeVector = EditorGUILayout.Vector3Field("Value:", relativeVector);
                }
            }
            else if (positionRelativeTo == PositionRelativeTo.VectorVariable)
            {
                variableLocation = (VariableLocation)EditorGUILayout.EnumPopup("Source:", variableLocation);

                switch (variableLocation)
                {
                case VariableLocation.Global:
                    vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.GlobalVariable);
                    if (vectorVarParameterID < 0)
                    {
                        vectorVarID = AdvGame.GlobalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3);
                    }
                    break;

                case VariableLocation.Local:
                    if (!isAssetFile)
                    {
                        vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.LocalVariable);
                        if (vectorVarParameterID < 0)
                        {
                            vectorVarID = AdvGame.LocalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3);
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("Local variables cannot be accessed in ActionList assets.", MessageType.Info);
                    }
                    break;

                case VariableLocation.Component:
                    vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.ComponentVariable);
                    if (vectorVarParameterID >= 0)
                    {
                        variables           = null;
                        variablesConstantID = 0;
                    }
                    else
                    {
                        variables           = (Variables)EditorGUILayout.ObjectField("Component:", variables, typeof(Variables), true);
                        variablesConstantID = FieldToID <Variables> (variables, variablesConstantID);
                        variables           = IDToField <Variables> (variables, variablesConstantID, false);

                        if (variables != null)
                        {
                            vectorVarID = AdvGame.ComponentVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3, variables);
                        }
                    }
                    break;
                }
            }

            copyRotation = EditorGUILayout.Toggle("Copy rotation?", copyRotation);

            if (isPlayer)
            {
                snapCamera = EditorGUILayout.Toggle("Teleport active camera too?", snapCamera);
            }

            if (isPlayer || (obToMove != null && obToMove.GetComponent <Char>()))
            {
                recalculateActivePathFind = EditorGUILayout.Toggle("Recalculate pathfinding?", recalculateActivePathFind);
            }

            AfterRunningOption();
        }
コード例 #19
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuToggle)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            if (source != MenuSource.AdventureCreator)
            {
                uiToggle = LinkedUiGUI <Toggle> (uiToggle, "Linked Toggle:", source, "The Unity UI Toggle this is linked to");
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle", "The method by which this element is hidden from view when made invisible");
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

            label       = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label", "The text that's displayed on-screen");
            appendState = CustomGUILayout.Toggle("Append state to label?", appendState, apiPrefix + ".appendState", "If True, then the state (On/Off) will be added to the display label");
            if (appendState)
            {
                onText  = CustomGUILayout.TextField("'On' state text:", onText, apiPrefix + ".onText", "The text suffix when the toggle is 'on'");
                offText = CustomGUILayout.TextField("'Off' state text:", offText, apiPrefix + ".offText", "The text suffix when the toggle is 'off'");
            }

            if (source == MenuSource.AdventureCreator)
            {
                anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor", "The text alignment");
                textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects", "The special FX applied to the text");
                if (textEffects != TextEffects.None)
                {
                    outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize", "The outline thickness");
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("'On' texture:", "The background texture when in the 'on' state"), GUILayout.Width(145f));
                onTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (onTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".onTexture");
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("'Off' texture:", "The background texture when in the 'off' state"), GUILayout.Width(145f));
                offTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (offTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".offTexture");
                EditorGUILayout.EndHorizontal();
            }

            toggleType = (AC_ToggleType)CustomGUILayout.EnumPopup("Toggle type:", toggleType, apiPrefix + ".toggleType", "What the value of the toggle represents");
            if (toggleType == AC_ToggleType.CustomScript)
            {
                isOn = CustomGUILayout.Toggle("On by default?", isOn, apiPrefix + ".isOn", "If True, then the toggle will be in its 'on' state by default");
                ShowClipHelp();
            }
            else if (toggleType == AC_ToggleType.Variable)
            {
                varID = AdvGame.GlobalVariableGUI("Global boolean var:", varID, VariableType.Boolean, "The global Boolean variable whose value is linked to the Toggle");
            }

            isClickable = CustomGUILayout.Toggle("User can change value?", isClickable, apiPrefix + ".isClickable", "If True, the slider is interactive and can be modified by the user");
            if (isClickable)
            {
                if (toggleType != AC_ToggleType.Subtitles)
                {
                    actionListOnClick = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on click:", actionListOnClick, false, apiPrefix + ".actionListOnClick", "An ActionList asset that will run when the element is clicked on");
                }
                alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton", "The name of the input button that triggers the element when pressed");
            }
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
コード例 #20
0
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            saveHandling = (SaveHandling)EditorGUILayout.EnumPopup("Method:", saveHandling);

            if (saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.OverwriteExistingSave)
            {
                string _action = "load";
                if (saveHandling == SaveHandling.OverwriteExistingSave)
                {
                    _action = "overwrite";
                }

                selectSaveType = (SelectSaveType)EditorGUILayout.EnumPopup("Save to " + _action + ":", selectSaveType);
                if (selectSaveType == SelectSaveType.SetSlotIndex)
                {
                    saveIndexParameterID = Action.ChooseParameterGUI("Slot index to " + _action + ":", parameters, saveIndexParameterID, ParameterType.Integer);
                    if (saveIndexParameterID == -1)
                    {
                        saveIndex = EditorGUILayout.IntField("Slot index to " + _action + ":", saveIndex);
                    }
                }
                else if (selectSaveType == SelectSaveType.SlotIndexFromVariable)
                {
                    slotVarID = AdvGame.GlobalVariableGUI("Integer variable:", slotVarID, VariableType.Integer);
                }
                else if (selectSaveType == SelectSaveType.SetSaveID)
                {
                    saveIndexParameterID = Action.ChooseParameterGUI("Save ID to " + _action + ":", parameters, saveIndexParameterID, ParameterType.Integer);
                    if (saveIndexParameterID == -1)
                    {
                        saveIndex = EditorGUILayout.IntField("Save ID to " + _action + ":", saveIndex);
                    }
                }

                if (selectSaveType != SelectSaveType.Autosave && selectSaveType != SelectSaveType.SetSaveID)
                {
                    EditorGUILayout.Space();
                    menuName    = EditorGUILayout.TextField("Menu with SavesList:", menuName);
                    elementName = EditorGUILayout.TextField("SavesList element:", elementName);
                }
            }

            if ((saveHandling == SaveHandling.OverwriteExistingSave && selectSaveType != SelectSaveType.Autosave) || saveHandling == SaveHandling.SaveNewGame)
            {
                if (saveHandling == SaveHandling.OverwriteExistingSave)
                {
                    EditorGUILayout.Space();
                    updateLabel = EditorGUILayout.Toggle("Update label?", updateLabel);
                }
                if (updateLabel || saveHandling == SaveHandling.SaveNewGame)
                {
                    customLabel = EditorGUILayout.Toggle("With custom label?", customLabel);
                    if (customLabel)
                    {
                        varID = AdvGame.GlobalVariableGUI("Label as String variable:", varID, VariableType.String);
                    }
                }
            }

            if (saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.ContinueFromLastSave)
            {
                doSelectiveLoad = EditorGUILayout.Toggle("Selective loading?", doSelectiveLoad);
                if (doSelectiveLoad)
                {
                    EditorGUILayout.Space();
                    selectiveLoad.ShowGUI();
                }
            }

            if (saveHandling == SaveHandling.OverwriteExistingSave || saveHandling == SaveHandling.SaveNewGame)
            {
                AfterRunningOption();
            }
        }
コード例 #21
0
        public override void ShowGUI(MenuSource source)
        {
            EditorGUILayout.BeginVertical("Button");

            if (source == MenuSource.AdventureCreator)
            {
                label       = EditorGUILayout.TextField("Label text:", label);
                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);
                }
                useFullWidth      = EditorGUILayout.Toggle("Use full width?", useFullWidth);
                sliderDisplayType = (SliderDisplayType)EditorGUILayout.EnumPopup("Display type:", sliderDisplayType);

                EditorGUILayout.BeginHorizontal();
                if (sliderDisplayType == SliderDisplayType.FillBar)
                {
                    EditorGUILayout.LabelField("Fill-bar texture:", GUILayout.Width(145f));
                }
                else if (sliderDisplayType == SliderDisplayType.MoveableBlock)
                {
                    EditorGUILayout.LabelField("Movable block texture:", GUILayout.Width(145f));
                }
                sliderTexture = (Texture2D)EditorGUILayout.ObjectField(sliderTexture, typeof(Texture2D), false, GUILayout.Width(70f), GUILayout.Height(30f));
                EditorGUILayout.EndHorizontal();

                if (sliderDisplayType == SliderDisplayType.MoveableBlock)
                {
                    blockSize = EditorGUILayout.Vector2Field("Block size:", blockSize);
                }
            }
            else
            {
                uiSlider = LinkedUiGUI <Slider> (uiSlider, "Linked Slider:", source);
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

            sliderType = (AC_SliderType)EditorGUILayout.EnumPopup("Slider affects:", sliderType);
            if (sliderType == AC_SliderType.CustomScript)
            {
                ShowClipHelp();
                amount = EditorGUILayout.Slider("Default value:", amount, minValue, maxValue);
            }
            else if (sliderType == AC_SliderType.FloatVariable)
            {
                varID = AdvGame.GlobalVariableGUI("Global float var:", varID);
                if (varID >= 0 && AdvGame.GetReferences() && AdvGame.GetReferences().variablesManager)
                {
                    GVar _var = AdvGame.GetReferences().variablesManager.GetVariable(varID);
                    if (_var != null && _var.type != VariableType.Float)
                    {
                        EditorGUILayout.HelpBox("The chosen Variable must be a Float.", MessageType.Warning);
                    }
                }
            }
            if (sliderType == AC_SliderType.CustomScript || sliderType == AC_SliderType.FloatVariable)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Min. value:", GUILayout.Width(80f));
                minValue = EditorGUILayout.FloatField(minValue);
                EditorGUILayout.LabelField("Max. value:", GUILayout.Width(80f));
                maxValue = EditorGUILayout.FloatField(maxValue);
                EditorGUILayout.EndHorizontal();
                maxValue           = Mathf.Max(minValue, maxValue);
                actionListOnChange = (ActionListAsset)EditorGUILayout.ObjectField("ActionList on change:", actionListOnChange, typeof(ActionListAsset), false);
            }
            else
            {
                minValue = 0f;
                maxValue = 1f;
            }

            if (source == MenuSource.AdventureCreator)
            {
                numberOfSteps = EditorGUILayout.IntField("Number of steps:", numberOfSteps);
            }
            isClickable = EditorGUILayout.Toggle("User can change value?", isClickable);

            EditorGUILayout.EndVertical();

            base.ShowGUI(source);
        }
コード例 #22
0
        private void SetParamGUI(List <ActionParameter> parameters)
        {
            if (parameters == null || parameters.Count == 0)
            {
                parameterLabel = "";
                return;
            }

            _parameter = GetParameterWithID(parameters, parameterID);

            if (_parameter == null)
            {
                parameterLabel = "";
                return;
            }

            parameterLabel = _parameter.label;

            setParamMethod = (SetParamMethod)EditorGUILayout.EnumPopup("New value is:", setParamMethod);

            if (setParamMethod == SetParamMethod.EnteredHere)
            {
                if (_parameter.parameterType == ParameterType.Boolean)
                {
                    bool boolValue = (intValue == 1) ? true : false;
                    boolValue = EditorGUILayout.Toggle("Set as:", boolValue);
                    intValue  = (boolValue) ? 1 : 0;
                }
                else if (_parameter.parameterType == ParameterType.Integer)
                {
                    intValue = EditorGUILayout.IntField("Set as:", intValue);
                }
                else if (_parameter.parameterType == ParameterType.Float)
                {
                    floatValue = EditorGUILayout.FloatField("Set as:", floatValue);
                }
                else if (_parameter.parameterType == ParameterType.String)
                {
                    stringValue = EditorGUILayout.TextField("Set as:", stringValue);
                }
                else if (_parameter.parameterType == ParameterType.GameObject)
                {
                    gameobjectValue = (GameObject)EditorGUILayout.ObjectField("Set to:", gameobjectValue, typeof(GameObject), true);

                    gameObjectConstantID = FieldToID(gameobjectValue, gameObjectConstantID);
                    gameobjectValue      = IDToField(gameobjectValue, gameObjectConstantID, false);
                }
                else if (_parameter.parameterType == ParameterType.GlobalVariable)
                {
                    if (AdvGame.GetReferences().variablesManager == null || AdvGame.GetReferences().variablesManager.vars == null || AdvGame.GetReferences().variablesManager.vars.Count == 0)
                    {
                        EditorGUILayout.HelpBox("No Global variables exist!", MessageType.Info);
                    }
                    else
                    {
                        intValue = ShowVarSelectorGUI(AdvGame.GetReferences().variablesManager.vars, intValue);
                    }
                }
                else if (_parameter.parameterType == ParameterType.UnityObject)
                {
                    unityObjectValue = (Object)EditorGUILayout.ObjectField("Set to:", unityObjectValue, typeof(Object), true);
                }
                else if (_parameter.parameterType == ParameterType.InventoryItem)
                {
                    intValue = ShowInvSelectorGUI(intValue);
                }
                else if (_parameter.parameterType == ParameterType.LocalVariable)
                {
                    if (isAssetFile)
                    {
                        EditorGUILayout.HelpBox("Cannot access local variables from an asset file.", MessageType.Warning);
                    }
                    else if (KickStarter.localVariables == null || KickStarter.localVariables.localVars == null || KickStarter.localVariables.localVars.Count == 0)
                    {
                        EditorGUILayout.HelpBox("No Local variables exist!", MessageType.Info);
                    }
                    else
                    {
                        intValue = ShowVarSelectorGUI(KickStarter.localVariables.localVars, intValue);
                    }
                }
                else if (_parameter.parameterType == ParameterType.Vector3)
                {
                    vector3Value = EditorGUILayout.Vector3Field("Set as:", vector3Value);
                }
            }
            else
            {
                if (AdvGame.GetReferences() != null && AdvGame.GetReferences().variablesManager != null && AdvGame.GetReferences().variablesManager.vars != null && AdvGame.GetReferences().variablesManager.vars.Count > 0)
                {
                    if (_parameter.parameterType == ParameterType.Vector3)
                    {
                        globalVariableID = AdvGame.GlobalVariableGUI("Vector3 variable:", globalVariableID, VariableType.Vector3);
                    }
                    else if (_parameter.parameterType == ParameterType.GameObject || _parameter.parameterType == ParameterType.GlobalVariable || _parameter.parameterType == ParameterType.InventoryItem || _parameter.parameterType == ParameterType.LocalVariable || _parameter.parameterType == ParameterType.UnityObject)
                    {
                        EditorGUILayout.HelpBox("Parameters of type '" + _parameter.parameterType + "' cannot have values transferred from Global Variables.", MessageType.Warning);
                    }
                    else
                    {
                        globalVariableID = AdvGame.GlobalVariableGUI("Variable:", globalVariableID);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No Global Variables found!", MessageType.Warning);
                }
            }
        }