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

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");
            if (source == MenuSource.AdventureCreator)
            {
                inputType = (AC_InputType)CustomGUILayout.EnumPopup("Input type:", inputType, apiPrefix + ".inputType", "What kind of characters can be entered in by the player");
                label     = EditorGUILayout.TextField("Default text:", label);
                if (inputType == AC_InputType.AlphaNumeric)
                {
                    allowSpaces = CustomGUILayout.Toggle("Allow spaces?", allowSpaces, apiPrefix + ".allowSpace", "If True, then spaces are recognised");
                }
                characterLimit = CustomGUILayout.IntField("Character limit:", characterLimit, apiPrefix + ".characterLimit", "The character limit on text that can be entered");

                                #if (UNITY_IPHONE || UNITY_ANDROID) && !UNITY_2018_3_OR_NEWER
                EditorGUILayout.HelpBox("For the character limit to be obeyed on Android and iOS, Unity 2018.3 or later must be used.", MessageType.Info);
                                #endif

                linkedButton     = CustomGUILayout.TextField("'Enter' key's linked Button:", linkedButton, apiPrefix + ".linkedPrefab", "The name of the MenuButton element that is synced with the 'Return' key when this element is active");
                requireSelection = CustomGUILayout.ToggleLeft("Require selection to accept input?", requireSelection, apiPrefix + ".requireSelection", "If True, then the element will need to be selected before it receives input");
            }
            else
            {
                uiInput = LinkedUiGUI <InputField> (uiInput, "Linked InputField:", 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();

            base.ShowGUI(menu);
        }
Exemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            if (_target == null)
            {
                return;
            }

            if (Application.isPlaying)
            {
                EditorGUILayout.LabelField("Menu name:", _target.menuName);
                EditorGUILayout.LabelField("Element name:", _target.elementName);
                EditorGUILayout.LabelField("Slot number:", _target.slot.ToString());
                EditorGUILayout.LabelField("Is visible?", _target.IsVisible().ToString());

                if (GUILayout.Button("Interact"))
                {
                    _target.Interact();
                }
            }
            else
            {
                _target.menuName    = CustomGUILayout.TextField("Menu name:", _target.menuName, "", "The name of the associated Menu");
                _target.elementName = CustomGUILayout.TextField("Element name:", _target.elementName, "", "The name of the associated MenuElement in the Menu above");
                _target.slot        = CustomGUILayout.IntField("Slot number (optional):", _target.slot, "", "The slot index of the associated MenuElement");
            }

            _target.setTextLabels = CustomGUILayout.Toggle("Set guiText / TextMesh labels?", _target.setTextLabels, "", "If True, then any GUIText or TextMesh components will have their text values overridden by that of the associated MenuElement");

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemplo n.º 3
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)
            {
                inputType = (AC_InputType)CustomGUILayout.EnumPopup("Input type:", inputType, apiPrefix + ".inputType");
                label     = EditorGUILayout.TextField("Default text:", label);
                if (inputType == AC_InputType.AlphaNumeric)
                {
                    allowSpaces = CustomGUILayout.Toggle("Allow spaces?", allowSpaces, apiPrefix + ".allowSpace");
                }
                characterLimit = CustomGUILayout.IntField("Character limit:", characterLimit, apiPrefix + ".characterLimit");

                linkedButton = CustomGUILayout.TextField("'Enter' key's linked Button:", linkedButton, apiPrefix + ".linkedPrefab");
            }
            else
            {
                uiInput = LinkedUiGUI <InputField> (uiInput, "Linked InputField:", source);
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle");
            }
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Exemplo n.º 4
0
        public void ShowStartDataGUI(string apiPrefix)
        {
            GUILayout.Label("Starting point data for Player " + ID.ToString() + ": " + ((playerOb) ? playerOb.name : "(EMPTY)"), EditorStyles.boldLabel);

            chooseSceneBy = (ChooseSceneBy)CustomGUILayout.EnumPopup("Choose scene by:", chooseSceneBy);
            switch (chooseSceneBy)
            {
            case ChooseSceneBy.Name:
                startingSceneName = CustomGUILayout.TextField("Scene name:", startingSceneName);
                break;

            case ChooseSceneBy.Number:
                startingSceneIndex = CustomGUILayout.IntField("Scene index:", startingSceneIndex);
                break;
            }

            useSceneDefaultPlayerStart = EditorGUILayout.Toggle("Use default PlayerStart?", useSceneDefaultPlayerStart);
            if (!useSceneDefaultPlayerStart)
            {
                PlayerStart playerStart = ConstantID.GetComponent <PlayerStart> (startingPlayerStartID);
                playerStart           = (PlayerStart)CustomGUILayout.ObjectField <PlayerStart> ("PlayerStart:", playerStart, true, apiPrefix + ".startingPlayerStartID", "The PlayerStart that this character starts from.");
                startingPlayerStartID = FieldToID <PlayerStart> (playerStart, startingPlayerStartID);

                if (startingPlayerStartID != 0)
                {
                    CustomGUILayout.BeginVertical();
                    EditorGUILayout.LabelField("Recorded ConstantID: " + startingPlayerStartID.ToString(), EditorStyles.miniLabel);
                    CustomGUILayout.EndVertical();
                }
            }
        }
        public override void OnInspectorGUI()
        {
            RememberTransform _target = (RememberTransform)target;

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Transform", EditorStyles.boldLabel);
            _target.transformSpace    = (GlobalLocal)CustomGUILayout.EnumPopup("Co-ordinate space:", _target.transformSpace, "", "The co-ordinate space to store position and rotation values in");
            _target.saveParent        = CustomGUILayout.Toggle("Save change in Parent?", _target.saveParent, "", "If True, the GameObject's change in parent should be recorded");
            _target.saveScenePresence = CustomGUILayout.Toggle("Save scene presence?", _target.saveScenePresence, "", "If True, the GameObject's change in scene presence should be recorded");

            if (_target.saveScenePresence)
            {
                if (Application.isPlaying && _target.gameObject.IsPersistent())
                {
                    EditorGUILayout.HelpBox("Objects that survive scene-changes cannot have their scene presence saved.", MessageType.Warning);
                }
                else
                {
                    _target.linkedPrefabID = CustomGUILayout.IntField("Linked prefab ConstantID:", _target.linkedPrefabID, "", "If non-zero, the Constant ID number of the prefab to re-spawn if not present in the scene, but saveScenePresence = true.  If zero, the prefab will be assumed to have the same ID as this.");
                    EditorGUILayout.HelpBox("If the above is non-zero, the Resources prefab with that ID number will be spawned if this is not present in the scene.  This allows for multiple instances of the object to be spawned.", MessageType.Info);

                    _target.retainInPrefab = true;
                    EditorGUILayout.HelpBox("This prefab must be placed in a 'Resources' asset folder", MessageType.Info);
                }
            }
            CustomGUILayout.EndVertical();

            SharedGUI();
        }
        public override void OnInspectorGUI()
        {
            DragTrack_Hinge _target = (DragTrack_Hinge)target;

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Track shape:", EditorStyles.boldLabel);

            _target.radius       = CustomGUILayout.FloatField("Radius:", _target.radius, "", "The track's radius (for visualising in the Scene window)");
            _target.handleColour = CustomGUILayout.ColorField("Handles colour:", _target.handleColour, "", "The colour of Scene window Handles");

            _target.doLoop = CustomGUILayout.Toggle("Is looped?", _target.doLoop, "", "If True, then objects can be rotated a full revolution");
            if (!_target.doLoop)
            {
                _target.maxAngle = CustomGUILayout.FloatField("Maximum angle:", _target.maxAngle, "", "How much an object can be rotated by");

                if (_target.maxAngle > 360f)
                {
                    _target.maxAngle = 360f;
                }
            }
            else
            {
                _target.limitRevolutions = CustomGUILayout.Toggle("Limit revolutions?", _target.limitRevolutions, "", "If True, then the number of revolutions an object can rotate is limited");
                if (_target.limitRevolutions)
                {
                    _target.maxRevolutions = CustomGUILayout.IntField("Max revolutions:", _target.maxRevolutions, "", "The maximum number of revolutions an object can be rotated by");
                }
            }

            _target.alignDragToFront = CustomGUILayout.Toggle("Align drag vector to front?", _target.alignDragToFront, "", "If True, then the calculated drag vector will be based on the track's orientation, rather than the object being rotated, so that the input drag vector will always need to be the same direction");

            EditorGUILayout.EndVertical();

            SharedGUI(false);
        }
Exemplo n.º 7
0
        public override void OnInspectorGUI()
        {
            PlayerStart _target = (PlayerStart)target;

            if (KickStarter.sceneSettings != null && KickStarter.sceneSettings.defaultPlayerStart == _target)
            {
                EditorGUILayout.HelpBox("This PlayerStart is the scene's default, and will be used if a more appropriate one is not found.", MessageType.Info);
            }

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Previous scene that activates", EditorStyles.boldLabel);
            _target.chooseSceneBy = (ChooseSceneBy)CustomGUILayout.EnumPopup("Choose scene by:", _target.chooseSceneBy, "", "The way in which the previous scene is identified by");
            if (_target.chooseSceneBy == ChooseSceneBy.Name)
            {
                _target.previousSceneName = CustomGUILayout.TextField("Previous scene:", _target.previousSceneName, "", "The name of the previous scene to check for");
            }
            else
            {
                _target.previousScene = CustomGUILayout.IntField("Previous scene:", _target.previousScene, "", "The build-index number of the previous scene to check for");
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Camera settings", EditorStyles.boldLabel);
            _target.cameraOnStart = (_Camera)CustomGUILayout.ObjectField <_Camera> ("Camera on start:", _target.cameraOnStart, true, "", "The AC _Camera that should be made active when the Player starts the scene from this point");
            _target.fadeInOnStart = CustomGUILayout.Toggle("Fade in on start?", _target.fadeInOnStart, "", "If True, then the MainCamera will fade in when the Player starts the scene from this point");
            if (_target.fadeInOnStart)
            {
                _target.fadeSpeed = CustomGUILayout.FloatField("Fade speed:", _target.fadeSpeed, "", "The speed of the fade");
            }
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemplo n.º 8
0
        public override void OnInspectorGUI()
        {
            DragTrack_Hinge _target = (DragTrack_Hinge)target;

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Track shape:", EditorStyles.boldLabel);

            _target.radius = CustomGUILayout.FloatField("Radius:", _target.radius, "", "The track's radius (for visualising in the Scene window)");
            if (_target.radius < 0f)
            {
                _target.radius = 0f;
            }
            _target.handleColour = CustomGUILayout.ColorField("Handles colour:", _target.handleColour, "", "The colour of Scene window Handles");

            _target.doLoop = CustomGUILayout.Toggle("Is looped?", _target.doLoop, "", "If True, then objects can be rotated a full revolution");
            if (!_target.doLoop)
            {
                _target.maxAngle = CustomGUILayout.Slider("Maximum angle:", _target.maxAngle, 0f, 360, "", "How much an object can be rotated by");
            }
            else
            {
                _target.limitRevolutions = CustomGUILayout.Toggle("Limit revolutions?", _target.limitRevolutions, "", "If True, then the number of revolutions an object can rotate is limited");
                if (_target.limitRevolutions)
                {
                    _target.maxRevolutions = CustomGUILayout.IntField("Max revolutions:", _target.maxRevolutions, "", "The maximum number of revolutions an object can be rotated by");
                    if (_target.maxRevolutions < 1)
                    {
                        _target.maxRevolutions = 1;
                    }
                }
            }

            _target.dragMovementCalculation = (DragMovementCalculation)CustomGUILayout.EnumPopup("Movement input:", _target.dragMovementCalculation);
            if (_target.dragMovementCalculation == DragMovementCalculation.DragVector)
            {
                _target.alignDragToFront = CustomGUILayout.ToggleLeft("Align drag vector to front?", _target.alignDragToFront, "", "If True, then the calculated drag vector will be based on the track's orientation, rather than the object being rotated, so that the input drag vector will always need to be the same direction");
            }
            else if (_target.dragMovementCalculation == DragMovementCalculation.CursorPosition && !_target.Loops)
            {
                _target.preventEndToEndJumping = CustomGUILayout.ToggleLeft("Prevent end-to-end jumping?", _target.preventEndToEndJumping, "", "If True, then the dragged object will be prevented from jumping from one end to the other without first moving somewhere in between");
            }

            _target.discSize = CustomGUILayout.Slider("Gizmo size:", _target.discSize, 0f, 2f, "", "The size of the track's ends, as seen in the Scene window");

            CustomGUILayout.EndVertical();

            SnapDataGUI(_target, true);

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemplo n.º 9
0
        private ShapeKey KeyGUI(ShapeKey shapeKey, string[] blendShapeNames)
        {
            EditorGUILayout.LabelField("Shape key " + shapeKey.label, EditorStyles.boldLabel);

            shapeKey.label = CustomGUILayout.TextField("Key label:", shapeKey.label, "", "An editor-friendly name of the blendshape");

            if (blendShapeNames != null && blendShapeNames.Length > 0)
            {
                shapeKey.index = CustomGUILayout.Popup("Blendshape:", shapeKey.index, blendShapeNames, "", "The Blendshape that this relates to");
            }
            else
            {
                shapeKey.index = CustomGUILayout.IntField("BlendShape index:", shapeKey.index, "", "The Blendshape that this relates to");
            }

            return(shapeKey);
        }
Exemplo n.º 10
0
        public override void OnInspectorGUI()
        {
            PlayerStart _target = (PlayerStart)target;

            if (KickStarter.sceneSettings != null && KickStarter.sceneSettings.defaultPlayerStart == _target)
            {
                EditorGUILayout.HelpBox("This PlayerStart is the scene's default, and will be used if a more appropriate one is not found.", MessageType.Info);
            }

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Previous scene activation", EditorStyles.boldLabel);
            _target.chooseSceneBy = (ChooseSceneBy)CustomGUILayout.EnumPopup("Choose scene by:", _target.chooseSceneBy, "", "The way in which the previous scene is identified by");
            if (_target.chooseSceneBy == ChooseSceneBy.Name)
            {
                _target.previousSceneName = CustomGUILayout.TextField("Previous scene:", _target.previousSceneName, "", "The name of the previous scene to check for");
            }
            else
            {
                _target.previousScene = CustomGUILayout.IntField("Previous scene:", _target.previousScene, "", "The build-index number of the previous scene to check for");
            }

            if (KickStarter.settingsManager != null && KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow)
            {
                _target.limitByActive = (PlayerStartActiveOption)CustomGUILayout.EnumPopup("Limit by active:", _target.limitByActive, "", "Lets you limit activation to active or inactive Players only");

                _target.limitByPlayer = CustomGUILayout.Toggle("Limit by Player?", _target.limitByPlayer, "", "If True, then only specific Players can use this when entering from a previous scene");
                if (_target.limitByPlayer)
                {
                    _target.playerIDs = ChoosePlayerGUI(_target.playerIDs);
                }
            }

            CustomGUILayout.EndVertical();

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Camera settings", EditorStyles.boldLabel);
            _target.cameraOnStart = (_Camera)CustomGUILayout.ObjectField <_Camera> ("Camera on start:", _target.cameraOnStart, true, "", "The AC _Camera that should be made active when the Player starts the scene from this point");
            _target.fadeInOnStart = CustomGUILayout.Toggle("Fade in on activate?", _target.fadeInOnStart, "", "If True, then the MainCamera will fade in when the Player starts the scene from this point");
            if (_target.fadeInOnStart)
            {
                _target.fadeSpeed = CustomGUILayout.FloatField("Fade speed:", _target.fadeSpeed, "", "The speed of the fade");
            }
            CustomGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
        public override void OnInspectorGUI()
        {
            if (_target.GetComponent <Char>() == null)
            {
                EditorGUILayout.HelpBox("This component must be placed alongside either the NPC or Player component.", MessageType.Warning);
            }

            _target.skinnedMeshRenderer = (SkinnedMeshRenderer)CustomGUILayout.ObjectField <SkinnedMeshRenderer> ("Skinned Mesh Renderer:", _target.skinnedMeshRenderer, true, "", "The SkinnedMeshRenderer to affect");
            _target.materialIndex       = CustomGUILayout.IntField("Material to affect (index):", _target.materialIndex, "", "The index of the material to affect");
            _target.propertyName        = CustomGUILayout.TextField("Texture property name:", _target.propertyName, "", "The material's property name that will be replaced");

            _target.LimitTextureArray();

            for (int i = 0; i < _target.textures.Count; i++)
            {
                _target.textures[i] = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Texture for phoneme #" + i.ToString() + ":", _target.textures[i], false, "", "The Texture that corresponds to the phoneme defined in the Phonemes Editor");
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemplo n.º 12
0
        public void ShowGUI(bool includeSize, string _label = "Texture:", CursorRendering cursorRendering = CursorRendering.Software, string apiPrefix = "")
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(_label, GUILayout.Width(145));
            texture = (Texture)CustomGUILayout.ObjectField <Texture> (texture, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".texture");
            EditorGUILayout.EndHorizontal();

            if (texture == null)
            {
                return;
            }

            if (includeSize)
            {
                if (cursorRendering == CursorRendering.Software)
                {
                    size = CustomGUILayout.FloatField("Size:", size, apiPrefix + ".size");
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Click offset (from " + ((cursorRendering == CursorRendering.Software) ? "centre):" : "top left):"), GUILayout.Width(150f));
                clickOffset = CustomGUILayout.Vector2Field("", clickOffset, apiPrefix + ".clickOffset");
                EditorGUILayout.EndHorizontal();
            }

            isAnimated = CustomGUILayout.Toggle("Animate?", isAnimated, apiPrefix + ".isAnimated");
            if (isAnimated)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Frames:", GUILayout.Width(50f));
                numFrames = CustomGUILayout.IntField(numFrames, GUILayout.Width(70f), apiPrefix + ".numFrames");
                EditorGUILayout.LabelField("Rows:", GUILayout.Width(50f));
                numRows = CustomGUILayout.IntField(numRows, GUILayout.Width(70f), apiPrefix + ".numRows");
                EditorGUILayout.LabelField("Columns:", GUILayout.Width(50f));
                numCols = CustomGUILayout.IntField(numCols, GUILayout.Width(70f), apiPrefix + ".numCols");
                EditorGUILayout.EndHorizontal();

                animSpeed          = CustomGUILayout.FloatField("Animation speed:", animSpeed, apiPrefix + ".animSpeed");
                endAnimOnLastFrame = CustomGUILayout.Toggle("End on last frame?", endAnimOnLastFrame, apiPrefix + ".endAnimOnLastFrame");
            }
        }
        public override void OnInspectorGUI()
        {
            RememberTransform _target = (RememberTransform)target;

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Transform", EditorStyles.boldLabel);
            _target.saveParent        = CustomGUILayout.Toggle("Save change in Parent?", _target.saveParent, "", "If True, the GameObject's change in parent should be recorded");
            _target.saveScenePresence = CustomGUILayout.Toggle("Save scene presence?", _target.saveScenePresence, "", "If True, the GameObject's change in scene presence should be recorded");

            if (_target.saveScenePresence)
            {
                _target.linkedPrefabID = CustomGUILayout.IntField("Linked prefab ConstantID:", _target.linkedPrefabID, "", "If non-zero, the Constant ID number of the prefab to re-spawn if not present in the scene, but saveScenePresence = true.  If zero, the prefab will be assumed to have the same ID as this.");
                EditorGUILayout.HelpBox("If the above is non-zero, the Resources prefab with that ID number will be spawned if this is not present in the scene.  This allows for multiple instances of the object to be spawned.", MessageType.Info);

                _target.retainInPrefab = true;
                EditorGUILayout.HelpBox("This prefab must be placed in a 'Resources' asset folder", MessageType.Info);
            }
            EditorGUILayout.EndVertical();

            SharedGUI();
        }
Exemplo n.º 14
0
        public void ShowGUI(string apiPrefix)
        {
            string _label = label + ":";

            if (string.IsNullOrEmpty(label))
            {
                _label = "Property " + id.ToString() + ":";
            }

            switch (type)
            {
            case VariableType.Boolean:
                if (val != 1)
                {
                    val = 0;
                }
                val = CustomGUILayout.Popup(_label, val, boolType, apiPrefix + ".BooleanValue", "The property's value for this item");
                break;

            case VariableType.Integer:
                val = CustomGUILayout.IntField(_label, val, apiPrefix + ".IntegerValue", "The property's value for this item");
                break;

            case VariableType.PopUp:
                val = CustomGUILayout.Popup(_label, val, GenerateEditorPopUpLabels(), apiPrefix + ".IntegerValue", "The property's value for this item");
                break;

            case VariableType.String:
                textVal = CustomGUILayout.TextField(_label, textVal, apiPrefix + ".TextValue", "The property's value for this item");
                break;

            case VariableType.Float:
                floatVal = CustomGUILayout.FloatField(_label, floatVal, apiPrefix + ".FloatValue", "The property's value for this item");
                break;

            case VariableType.Vector3:
                vector3Val = CustomGUILayout.Vector3Field(_label, vector3Val, apiPrefix + ".Vector3Value", "The property's value for this item");
                break;
            }
        }
Exemplo n.º 15
0
        private void GetCursorGUI(string apiPrefix, MenuSource source)
        {
            fixedIcon = CustomGUILayout.Toggle("For fixed icon?", fixedIcon, apiPrefix + ".fixedIcon", "If True, the element will always be associated with the same single icon. If False, the element will represent all available icons.");

            if (fixedIcon)
            {
                numSlots = 1;

                if (AdvGame.GetReferences().cursorManager&& AdvGame.GetReferences().cursorManager.cursorIcons.Count > 0)
                {
                    int iconInt = AdvGame.GetReferences().cursorManager.GetIntFromID(iconID);
                    iconInt = EditorGUILayout.Popup("Cursor:", iconInt, AdvGame.GetReferences().cursorManager.GetLabelsArray());
                    iconID  = AdvGame.GetReferences().cursorManager.cursorIcons [iconInt].id;
                }
                else
                {
                    iconID = -1;
                }
            }
            else
            {
                maxSlots = CustomGUILayout.IntField("Maximum # of icons:", maxSlots, apiPrefix + ".maxSlots", "The maximum number of icons that can be shown at once");
                if (KickStarter.cursorManager != null && maxSlots > KickStarter.cursorManager.cursorIcons.Count)
                {
                    maxSlots = KickStarter.cursorManager.cursorIcons.Count;
                }

                if (source == MenuSource.AdventureCreator)
                {
                    numSlots    = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 30f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }
        }
Exemplo n.º 16
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            journalType = (JournalType)CustomGUILayout.EnumPopup("Journal type:", journalType, apiPrefix + ".journalType");
            if (journalType == JournalType.DisplayExistingJournal)
            {
                EditorGUILayout.HelpBox("This Journal will share pages from another Journal element in the same Menu.", MessageType.Info);
                otherJournalTitle = CustomGUILayout.TextField("Existing element name:", otherJournalTitle, apiPrefix + ".otherJournalTitle");
                pageOffset        = CustomGUILayout.IntField("Page offset #:", pageOffset, apiPrefix + ".pageOffset");

                if (pages == null || pages.Count != 1)
                {
                    pages.Clear();
                    pages.Add(new JournalPage());
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Placeholder text:", GUILayout.Width(146f));
                pages[0].text = CustomGUILayout.TextArea(pages[0].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[0].text");
                showPage      = 1;
                EditorGUILayout.EndHorizontal();

                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");
                    }
                }
                else
                {
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical("Button");
                    uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                }
            }
            else
            {
                if (pages == null || pages.Count == 0)
                {
                    pages.Clear();
                    pages.Add(new JournalPage());
                }
                numPages = pages.Count;

                for (int i = 0; i < pages.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();

                    if (pages[i].lineID >= 0)
                    {
                        EditorGUILayout.LabelField("Page #" + (i + 1).ToString() + ", Text ID #" + pages[i].lineID + ":");
                    }
                    else
                    {
                        EditorGUILayout.LabelField("Page #" + (i + 1).ToString() + ":");
                    }

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

                    pages[i].text = CustomGUILayout.TextArea(pages[i].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[" + i.ToString() + "].text");
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }

                if (GUILayout.Button("Create new page", EditorStyles.miniButton))
                {
                    Undo.RecordObject(this, "Create journal page");
                    pages.Add(new JournalPage());
                }

                numPages = pages.Count;

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

                if (numPages > 1)
                {
                    showPage      = CustomGUILayout.IntSlider("Preview page #:", showPage, 1, numPages, apiPrefix + ".showPage");
                    startFromPage = CustomGUILayout.Toggle("Start from this page?", startFromPage, apiPrefix + ".startFromPage");
                }
                else
                {
                    showPage = 1;
                }

                if (source == MenuSource.AdventureCreator)
                {
                    anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor");
                    textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects");
                }
                else
                {
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical("Button");
                    uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                }

                actionListOnAddPage = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on add page:", actionListOnAddPage, false, apiPrefix + ".actionListOnAddPage");
            }
            EditorGUILayout.EndVertical();

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

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            fixedOption = CustomGUILayout.Toggle("Fixed Profile ID only?", fixedOption, apiPrefix + ".fixedOption");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntField("ID to display:", optionToShow, apiPrefix + ".optionToShow");
            }
            else
            {
                showActive = CustomGUILayout.Toggle("Include active?", showActive, apiPrefix + ".showActive");
                maxSlots   = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots");

                if (source == MenuSource.AdventureCreator)
                {
                    numSlots    = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }

            autoHandle = CustomGUILayout.Toggle("Switch profile when click?", autoHandle, apiPrefix + ".autoHandle");

            if (autoHandle)
            {
                ActionListGUI("ActionList after selecting:", menu.title, "After_Selecting", apiPrefix);
            }
            else
            {
                ActionListGUI("ActionList when click:", menu.title, "When_Click", apiPrefix);
            }

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

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

                linkUIGraphic = (LinkUIGraphic)EditorGUILayout.EnumPopup("Link graphics to:", linkUIGraphic);
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Exemplo n.º 18
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuJournal)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            journalType = (JournalType)CustomGUILayout.EnumPopup("Journal type:", journalType, apiPrefix + ".journalType", "What type of journal this is");
            if (journalType == JournalType.DisplayExistingJournal || journalType == JournalType.DisplayActiveDocument)
            {
                if (journalType == JournalType.DisplayExistingJournal)
                {
                    EditorGUILayout.HelpBox("This Journal will share pages from another Journal element in the same Menu.", MessageType.Info);
                    otherJournalTitle = CustomGUILayout.TextField("Existing element name:", otherJournalTitle, apiPrefix + ".otherJournalTitle", "The name of the Journal element within the same Menu that is used as reference");
                    pageOffset        = CustomGUILayout.IntField("Page offset #:", pageOffset, apiPrefix + ".pageOffset", "The difference in page index between this and the reference Journal");
                }

                if (pages == null || pages.Count != 1)
                {
                    pages.Clear();
                    pages.Add(new JournalPage());
                }

                showPage = 1;

                if (source == MenuSource.AdventureCreator)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Placeholder text:", GUILayout.Width(146f));
                    pages[0].text = CustomGUILayout.TextArea(pages[0].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[0].text");
                    EditorGUILayout.EndHorizontal();
                }
            }
            else if (journalType == JournalType.NewJournal)
            {
                if (pages == null)
                {
                    pages = new List <JournalPage>();
                    pages.Clear();
                    pages.Add(new JournalPage());
                }
                numPages = pages.Count;

                for (int i = 0; i < pages.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();

                    if (pages[i].lineID >= 0)
                    {
                        CustomGUILayout.LabelField("Page #" + (i + 1).ToString() + ", Text ID #" + pages[i].lineID + ":", apiPrefix + ".pages[" + i.ToString() + "].text");
                    }
                    else
                    {
                        CustomGUILayout.LabelField("Page #" + (i + 1).ToString() + ":", apiPrefix + ".pages[" + i.ToString() + "].text");
                    }

                    if (GUILayout.Button("", CustomStyles.IconCog))
                    {
                        sideMenu = i;
                        SideMenu();
                    }
                    EditorGUILayout.EndHorizontal();

                    pages[i].text = CustomGUILayout.TextArea(pages[i].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[" + i.ToString() + "].text");
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }

                if (GUILayout.Button("Create new page", EditorStyles.miniButton))
                {
                    Undo.RecordObject(this, "Create journal page");
                    pages.Add(new JournalPage());
                }

                numPages = pages.Count;

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

                if (numPages > 1)
                {
                    showPage      = CustomGUILayout.IntSlider("Preview page #:", showPage, 1, numPages, apiPrefix + ".showPage", "The index number of the current page being shown ");
                    startFromPage = CustomGUILayout.Toggle("Start from this page?", startFromPage, apiPrefix + ".startFromPage", "If True, then the page index above will be the first open when the game begins");
                }
                else if (numPages == 1)
                {
                    showPage = 1;
                }
                else
                {
                    showPage = 0;
                }
            }

            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");
                }
            }
            else
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");

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

            if (journalType == JournalType.NewJournal)
            {
                actionListOnAddPage = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on add page:", actionListOnAddPage, false, apiPrefix + ".actionListOnAddPage", "An ActionList to run whenever a new page is added");
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Exemplo n.º 19
0
        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);
        }
Exemplo n.º 20
0
        public override void OnInspectorGUI()
        {
            if (AdvGame.GetReferences() == null)
            {
                ACDebug.LogError("A References file is required - please use the Adventure Creator window to create one.");
                EditorGUILayout.LabelField("No References file found!");
            }
            else
            {
                if (AdvGame.GetReferences().inventoryManager)
                {
                    inventoryManager = AdvGame.GetReferences().inventoryManager;
                }
                if (AdvGame.GetReferences().cursorManager)
                {
                    cursorManager = AdvGame.GetReferences().cursorManager;
                }
                if (AdvGame.GetReferences().settingsManager)
                {
                    settingsManager = AdvGame.GetReferences().settingsManager;
                }

                if (Application.isPlaying)
                {
                    if (_target.gameObject.layer != LayerMask.NameToLayer(settingsManager.hotspotLayer))
                    {
                        EditorGUILayout.HelpBox("Current state: OFF", MessageType.Info);
                    }
                }

                if (_target.lineID > -1)
                {
                    EditorGUILayout.LabelField("Speech Manager ID:", _target.lineID.ToString());
                }

                _target.interactionSource = (AC.InteractionSource)CustomGUILayout.EnumPopup("Interaction source:", _target.interactionSource, "", "The source of the commands that are run when an option is chosen");
                _target.hotspotName       = CustomGUILayout.TextField("Label (if not name):", _target.hotspotName, "", "The display name, if not the GameObject's name");
                _target.highlight         = (Highlight)CustomGUILayout.ObjectField <Highlight> ("Object to highlight:", _target.highlight, true, "", "The Highlight component that controls any highlighting effects associated with the Hotspot");

                if (AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.hotspotDrawing == ScreenWorld.WorldSpace)
                {
                    _target.iconSortingLayer = CustomGUILayout.TextField("Icon sorting layer:", _target.iconSortingLayer, "", "The 'Sorting Layer' of the icon's SpriteRenderer");
                    _target.iconSortingOrder = CustomGUILayout.IntField("Icon sprite order:", _target.iconSortingOrder, "", "The 'Order in Layer' of the icon's SpriteRenderer");
                }

                EditorGUILayout.BeginHorizontal();
                _target.centrePoint = (Transform)CustomGUILayout.ObjectField <Transform> ("Centre point (override):", _target.centrePoint, true, "", "A Transform that represents the centre of the Hotspot, if it is not physically at the same point as the Hotspot's GameObject itself");

                if (_target.centrePoint == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        string     prefabName = "Hotspot centre: " + _target.gameObject.name;
                        GameObject go         = SceneManager.AddPrefab("Navigation", "HotspotCentre", true, false, false);
                        go.name = prefabName;
                        go.transform.position = _target.transform.position;
                        _target.centrePoint   = go.transform;
                        go.transform.parent   = _target.transform;
                    }
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                _target.walkToMarker = (Marker)CustomGUILayout.ObjectField <Marker> ("Walk-to Marker:", _target.walkToMarker, true, "", "The Marker that the player can optionally automatically walk to before an Interaction runs");
                if (_target.walkToMarker == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        string prefabName = "Marker";
                        if (SceneSettings.IsUnity2D())
                        {
                            prefabName += "2D";
                        }
                        Marker newMarker = SceneManager.AddPrefab("Navigation", prefabName, true, false, true).GetComponent <Marker>();
                        newMarker.gameObject.name   += (": " + _target.gameObject.name);
                        newMarker.transform.position = _target.transform.position;
                        _target.walkToMarker         = newMarker;
                    }
                }
                EditorGUILayout.EndHorizontal();

                _target.limitToCamera = (_Camera)CustomGUILayout.ObjectField <_Camera> ("Limit to camera:", _target.limitToCamera, true, "", "If assigned, then the Hotspot will only be interactive when the assigned _Camera is active");

                EditorGUILayout.BeginHorizontal();
                _target.interactiveBoundary = (InteractiveBoundary)CustomGUILayout.ObjectField <InteractiveBoundary> ("Interactive boundary:", _target.interactiveBoundary, true, "", "If assigned, then the Hotspot will only be interactive when the player is within this Trigger Collider's boundary");
                if (_target.interactiveBoundary == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        string prefabName = "InteractiveBoundary";
                        if (SceneSettings.IsUnity2D())
                        {
                            prefabName += "2D";
                        }
                        InteractiveBoundary newInteractiveBoundary = SceneManager.AddPrefab("Logic", prefabName, true, false, true).GetComponent <InteractiveBoundary>();
                        newInteractiveBoundary.gameObject.name   += (": " + _target.gameObject.name);
                        newInteractiveBoundary.transform.position = _target.transform.position;
                        _target.interactiveBoundary = newInteractiveBoundary;

                        UnityVersionHandler.PutInFolder(newInteractiveBoundary.gameObject, "_Hotspots");
                    }
                }
                EditorGUILayout.EndHorizontal();

                _target.drawGizmos = CustomGUILayout.Toggle("Draw yellow cube?", _target.drawGizmos, "", "If True, then a Gizmo may be drawn in the Scene window at the Hotspots's position");

                if (settingsManager != null && (settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction || settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot || settingsManager.interactionMethod == AC_InteractionMethod.CustomScript))
                {
                    _target.oneClick = CustomGUILayout.Toggle("Single 'Use' Interaction?", _target.oneClick, "", "If True, then clicking the Hotspot will run the Hotspot's first interaction in useButtons, regardless of the Settings Manager's Interaction method");

                    if (_target.oneClick && settingsManager.interactionMethod == AC_InteractionMethod.CustomScript)
                    {
                        EditorGUILayout.HelpBox("The above property can be accessed by reading the Hotspot script's IsSingleInteraction() method.", MessageType.Info);
                    }
                }
                if (_target.oneClick || (settingsManager != null && settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive))
                {
                    if (settingsManager != null && settingsManager.interactionMethod == AC_InteractionMethod.CustomScript)
                    {
                    }
                    else
                    {
                        _target.doubleClickingHotspot = (DoubleClickingHotspot)CustomGUILayout.EnumPopup("Double-clicking:", _target.doubleClickingHotspot, "", "The effect that double-clicking on the Hotspot has");
                    }
                }
                if (settingsManager != null && settingsManager.playerFacesHotspots)
                {
                    _target.playerTurnsHead = CustomGUILayout.Toggle("Players turn heads when active?", _target.playerTurnsHead, "", "If True, then the player will turn their head when the Hotspot is selected");
                }

                EditorGUILayout.Space();

                UseInteractionGUI();

                if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive || settingsManager.interactionMethod == AC_InteractionMethod.CustomScript)
                {
                    EditorGUILayout.Space();
                    LookInteractionGUI();
                }

                EditorGUILayout.Space();
                InvInteractionGUI();

                EditorGUILayout.Space();
                UnhandledInvInteractionGUI();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemplo n.º 21
0
        private void ShowVarGUI(VariableLocation location, List <VarPreset> _varPresets = null, string apiPrefix = "")
        {
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showVariablesProperties = CustomGUILayout.ToggleHeader(showVariablesProperties, location + " variable '" + selectedVar.label + "' properties");
            if (showVariablesProperties)
            {
                selectedVar.label = CustomGUILayout.TextField("Label:", selectedVar.label, apiPrefix + ".label");
                selectedVar.type  = (VariableType)CustomGUILayout.EnumPopup("Type:", selectedVar.type, apiPrefix + ".type");

                if (location == VariableLocation.Local)
                {
                    //EditorGUILayout.LabelField ("Replacement token:", "[localvar:" + selectedVar.id.ToString () + "]");
                    CustomGUILayout.TokenLabel("[localvar:" + selectedVar.id.ToString() + "]");
                }
                else
                {
                    //EditorGUILayout.LabelField ("Replacement token:", "[var:" + selectedVar.id.ToString () + "]");
                    CustomGUILayout.TokenLabel("[var:" + selectedVar.id.ToString() + "]");
                }

                if (selectedVar.type == VariableType.Boolean)
                {
                    if (selectedVar.val != 1)
                    {
                        selectedVar.val = 0;
                    }
                    selectedVar.val = CustomGUILayout.Popup("Initial value:", selectedVar.val, boolType, apiPrefix + ".val");
                }
                else if (selectedVar.type == VariableType.Integer)
                {
                    selectedVar.val = CustomGUILayout.IntField("Initial value:", selectedVar.val, apiPrefix + ".val");
                }
                else if (selectedVar.type == VariableType.PopUp)
                {
                    selectedVar.popUps       = PopupsGUI(selectedVar.popUps);
                    selectedVar.val          = CustomGUILayout.Popup("Initial value:", selectedVar.val, selectedVar.popUps, apiPrefix + ".val");
                    selectedVar.canTranslate = CustomGUILayout.Toggle("Values can be translated?", selectedVar.canTranslate, apiPrefix + ".canTranslate");
                }
                else if (selectedVar.type == VariableType.String)
                {
                    selectedVar.textVal      = CustomGUILayout.TextField("Initial value:", selectedVar.textVal, apiPrefix + ".textVal");
                    selectedVar.canTranslate = CustomGUILayout.Toggle("Values can be translated?", selectedVar.canTranslate, apiPrefix + ".canTranslate");
                }
                else if (selectedVar.type == VariableType.Float)
                {
                    selectedVar.floatVal = CustomGUILayout.FloatField("Initial value:", selectedVar.floatVal, apiPrefix + ".floatVal");
                }
                else if (selectedVar.type == VariableType.Vector3)
                {
                    selectedVar.vector3Val = CustomGUILayout.Vector3Field("Initial value:", selectedVar.vector3Val, apiPrefix + ".vector3Val");
                }

                if (_varPresets != null)
                {
                    foreach (VarPreset _varPreset in _varPresets)
                    {
                        // Local
                        string apiPrefix2 = (location == VariableLocation.Local) ?
                                            "AC.KickStarter.localVariables.GetPreset (" + _varPreset.ID + ").GetPresetValue (" + selectedVar.id + ")" :
                                            "AC.KickStarter.runtimeVariables.GetPreset (" + _varPreset.ID + ").GetPresetValue (" + selectedVar.id + ")";

                        _varPreset.UpdateCollection(selectedVar);

                        string      label       = "'" + _varPreset.label + "' value:";
                        PresetValue presetValue = _varPreset.GetPresetValue(selectedVar);
                        if (selectedVar.type == VariableType.Boolean)
                        {
                            presetValue.val = CustomGUILayout.Popup(label, presetValue.val, boolType, apiPrefix2 + ".val");
                        }
                        else if (selectedVar.type == VariableType.Integer)
                        {
                            presetValue.val = CustomGUILayout.IntField(label, presetValue.val, apiPrefix2 + ".val");
                        }
                        else if (selectedVar.type == VariableType.PopUp)
                        {
                            presetValue.val = CustomGUILayout.Popup(label, presetValue.val, selectedVar.popUps, apiPrefix2 + ".val");
                        }
                        else if (selectedVar.type == VariableType.String)
                        {
                            presetValue.textVal = CustomGUILayout.TextField(label, presetValue.textVal, apiPrefix2 + ".textVal");
                        }
                        else if (selectedVar.type == VariableType.Float)
                        {
                            presetValue.floatVal = CustomGUILayout.FloatField(label, presetValue.floatVal, apiPrefix2 + ".floatVal");
                        }
                        else if (selectedVar.type == VariableType.Vector3)
                        {
                            presetValue.vector3Val = CustomGUILayout.Vector3Field(label, presetValue.vector3Val, apiPrefix2 + ".vector3Val");
                        }
                    }
                }

                if (location == VariableLocation.Local)
                {
                    selectedVar.link = VarLink.None;
                }
                else
                {
                    EditorGUILayout.Space();
                    selectedVar.link = (VarLink)CustomGUILayout.EnumPopup("Link to:", selectedVar.link, apiPrefix + ".link");
                    if (selectedVar.link == VarLink.PlaymakerGlobalVariable)
                    {
                        if (PlayMakerIntegration.IsDefinePresent())
                        {
                            selectedVar.pmVar             = CustomGUILayout.TextField("Playmaker Global Variable:", selectedVar.pmVar, apiPrefix + ".pmVar");
                            selectedVar.updateLinkOnStart = CustomGUILayout.Toggle("Use PM for initial value?", selectedVar.updateLinkOnStart, apiPrefix + ".updateLinkOnStart");
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("The 'PlayMakerIsPresent' Scripting Define Symbol must be listed in the\nPlayer Settings. Please set it from Edit -> Project Settings -> Player", MessageType.Warning);
                        }
                    }
                    else if (selectedVar.link == VarLink.OptionsData)
                    {
                        EditorGUILayout.HelpBox("This Variable will be stored in PlayerPrefs, and not in saved game files.", MessageType.Info);
                    }
                }
            }
            EditorGUILayout.EndVertical();
        }
Exemplo n.º 22
0
        public override void OnInspectorGUI()
        {
            SortingMap _target = (SortingMap)target;

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Properties", EditorStyles.boldLabel);

            _target.mapType     = (SortingMapType)CustomGUILayout.EnumPopup("Affect sprite's:", _target.mapType);
            _target.affectScale = CustomGUILayout.Toggle("Affect Character scale?", _target.affectScale, "", "If True, characters that follow this map should have their scale affected");
            if (_target.affectScale)
            {
                _target.affectSpeed = CustomGUILayout.Toggle("Affect Character speed?", _target.affectSpeed, "", "If True, characters that follow this map should have their movement speed affected by the scale factor");

                _target.sortingMapScaleType = (SortingMapScaleType)CustomGUILayout.EnumPopup("Character scaling mode:", _target.sortingMapScaleType, "", "How scaling values are defined");
                if (_target.sortingMapScaleType == SortingMapScaleType.Linear || _target.sortingAreas.Count == 0)
                {
                    _target.originScale = CustomGUILayout.IntField("Start scale (%):", _target.originScale, "", "The scale (as a percentage) that characters will have at the very top of the map");

                    if (_target.sortingMapScaleType == SortingMapScaleType.AnimationCurve)
                    {
                        EditorGUILayout.HelpBox("The Sorting Map must have at least one area defined to make use of an animation curve.", MessageType.Warning);
                    }
                }
                else
                {
                    if (_target.scalingAnimationCurve == null)
                    {
                        _target.scalingAnimationCurve = AnimationCurve.Linear(0f, 0.1f, 1f, 1f);
                    }
                    _target.scalingAnimationCurve = CustomGUILayout.CurveField("Scaling curve:", _target.scalingAnimationCurve, "", "The AnimationCurve used to define character scaling, where 0s is the smallest scale, and 1s is the largest");
                    EditorGUILayout.HelpBox("The curve's values will be read from 0s to 1s only.", MessageType.Info);
                }

                if (_target.sortingMapScaleType == SortingMapScaleType.Linear && _target.sortingAreas.Count > 1)
                {
                    if (GUILayout.Button("Interpolate in-between scales"))
                    {
                        Undo.RecordObject(_target, "Interpolate scales");
                        _target.SetInBetweenScales();
                        EditorUtility.SetDirty(_target);
                    }
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Sorting areas", EditorStyles.boldLabel);
            foreach (SortingArea area in _target.sortingAreas)
            {
                int i = _target.sortingAreas.IndexOf(area);

                EditorGUILayout.BeginVertical();
                EditorGUILayout.BeginHorizontal();

                area.color = EditorGUILayout.ColorField(area.color);

                EditorGUILayout.LabelField("Position:", GUILayout.Width(50f));
                area.z = EditorGUILayout.FloatField(area.z, GUILayout.Width(80f));

                if (_target.mapType == SortingMapType.OrderInLayer)
                {
                    EditorGUILayout.LabelField("Order:", labelWidth);
                    area.order = EditorGUILayout.IntField(area.order);
                }
                else if (_target.mapType == SortingMapType.SortingLayer)
                {
                    EditorGUILayout.LabelField("Layer:", labelWidth);
                    area.layer = EditorGUILayout.TextField(area.layer);
                }

                if (GUILayout.Button(insertContent, EditorStyles.miniButtonLeft, buttonWidth))
                {
                    Undo.RecordObject(_target, "Add area");
                    if (i < _target.sortingAreas.Count - 1)
                    {
                        _target.sortingAreas.Insert(i + 1, new SortingArea(area, _target.sortingAreas[i + 1]));
                    }
                    else
                    {
                        _target.sortingAreas.Insert(i + 1, new SortingArea(area));
                    }
                    break;
                }
                if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(_target, "Delete area");
                    _target.sortingAreas.Remove(area);
                    break;
                }

                EditorGUILayout.EndHorizontal();

                if (_target.affectScale && _target.sortingMapScaleType == SortingMapScaleType.Linear)
                {
                    area.scale = CustomGUILayout.IntField("End scale (%):", area.scale, "", "The factor by which characters that use FollowSortingMap will be scaled by when positioned at the bottom boundary of this region");
                }

                EditorGUILayout.EndVertical();
                GUILayout.Box(string.Empty, GUILayout.ExpandWidth(true), GUILayout.Height(1));
            }

            if (GUILayout.Button("Add area"))
            {
                Undo.RecordObject(_target, "Add area");

                if (_target.sortingAreas.Count > 0)
                {
                    SortingArea lastArea = _target.sortingAreas [_target.sortingAreas.Count - 1];
                    _target.sortingAreas.Add(new SortingArea(lastArea));
                }
                else
                {
                    _target.sortingAreas.Add(new SortingArea(_target.transform.position.z + 1f, 1));
                }
            }

            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            if (SceneSettings.IsTopDown())
            {
            }
            else if (SceneSettings.IsUnity2D())
            {
            }
            else
            {
                if (GUILayout.Button("Face active camera"))
                {
                    Undo.RecordObject(_target, "Face active camera");
                    Vector3 forwardVector = Camera.main.transform.forward;
                    _target.transform.forward = -forwardVector;
                    EditorUtility.SetDirty(_target);
                }
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemplo n.º 23
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuDialogList)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");
            fixedOption = CustomGUILayout.Toggle("Fixed option number?", fixedOption, apiPrefix + ".fixedOption");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntSlider("Option to display:", optionToShow, 1, 10, apiPrefix + ".optionToShow");
            }
            else
            {
                maxSlots = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots");
                resetOffsetWhenRestart = CustomGUILayout.ToggleLeft("Always reset offset when turn on?", resetOffsetWhenRestart, apiPrefix + ".resetOffsetWhenRestart");

                if (source == MenuSource.AdventureCreator)
                {
                    numSlots    = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }

            displayType = (ConversationDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType");
            if (displayType == ConversationDisplayType.IconAndText && source == MenuSource.AdventureCreator)
            {
                EditorGUILayout.HelpBox("'Icon And Text' mode is only available for Unity UI-based Menus.", MessageType.Warning);
            }

            markAlreadyChosen = CustomGUILayout.Toggle("Mark options already used?", markAlreadyChosen, apiPrefix + ".markAlreadyChosen");
            if (markAlreadyChosen)
            {
                alreadyChosenFontColour            = (Color)CustomGUILayout.ColorField("'Already chosen' colour:", alreadyChosenFontColour, apiPrefix + ".alreadyChosenFontColour");
                alreadyChosenFontHighlightedColour = (Color)CustomGUILayout.ColorField("'Already chosen' highlighted colour:", alreadyChosenFontHighlightedColour, apiPrefix + ".alreadyChosenFontHighlightedColour");
            }

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                if (fixedOption)
                {
                    uiSlots = ResizeUISlots(uiSlots, 1);
                }
                else
                {
                    uiSlots = ResizeUISlots(uiSlots, maxSlots);
                }

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

                linkUIGraphic = (LinkUIGraphic)EditorGUILayout.EnumPopup("Link graphics to:", linkUIGraphic);
            }

            if (displayType == ConversationDisplayType.TextOnly || displayType == ConversationDisplayType.IconAndText)
            {
                showIndexNumbers = CustomGUILayout.Toggle("Prefix with index numbers?", showIndexNumbers, apiPrefix + ".showIndexNumbers");
            }

            ChangeCursorGUI(menu);
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Exemplo n.º 24
0
        public void ShowGUI(string apiPrefix, List <string> binList)
        {
            Upgrade();

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

            bool isPronoun = !canBeLowerCase;

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

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

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

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

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

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

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

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

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

            CustomGUILayout.DrawUILine();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                RebuildProperties();

                // UI for setting property values
                if (vars.Count > 0)
                {
                    foreach (InvVar invVar in vars)
                    {
                        invVar.ShowGUI(apiPrefix + ".GetProperty (" + invVar.id + ")");
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No properties have been defined that this inventory item can use.", MessageType.Info);
                }
            }
        }
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuSavesList)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            saveListType = (AC_SaveListType)CustomGUILayout.EnumPopup("List type:", saveListType, apiPrefix + ".savesListType", "How this list behaves");
            if (saveListType == AC_SaveListType.Save)
            {
                if (fixedOption || !allowEmptySlots)
                {
                    showNewSaveOption = CustomGUILayout.Toggle("Show 'New save' option?", showNewSaveOption, apiPrefix + ".showNewSaveOption", "If True, a slot that represents a 'new save' space can be displayed if appropriate");
                }

                if ((!fixedOption && allowEmptySlots) || showNewSaveOption)
                {
                    newSaveText = CustomGUILayout.TextField("'New save' text:", newSaveText, apiPrefix + ".newSaveText", "The display text when a slot represents a 'new save' space");
                }
                autoHandle = CustomGUILayout.Toggle("Save when click on?", autoHandle, apiPrefix + ".autoHandle");
                if (autoHandle)
                {
                    ActionListGUI("ActionList after saving:", menu.title, "AfterSaving", apiPrefix, "An ActionList asset that runs after the game is saved");
                }
                else
                {
                    ActionListGUI("ActionList when click:", menu.title, "OnClick", apiPrefix, "An ActionList asset that runs after the user clicks on a save file");
                }
            }
            else if (saveListType == AC_SaveListType.Load)
            {
                autoHandle = CustomGUILayout.Toggle("Load when click on?", autoHandle, apiPrefix + ".autoHandle");
                if (autoHandle)
                {
                    ActionListGUI("ActionList after loading:", menu.title, "AfterLoading", apiPrefix, "An ActionList asset that runs after the game is loaded");
                }
                else
                {
                    ActionListGUI("ActionList when click:", menu.title, "OnClick", apiPrefix, "An ActionList asset that runs after the user clicks on a save file");
                }
            }
            else if (saveListType == AC_SaveListType.Import)
            {
                autoHandle = true;
                                #if UNITY_STANDALONE
                importProductName  = CustomGUILayout.TextField("Import product name:", importProductName, apiPrefix + ".importProductName", "The name of the project to import files from");
                importSaveFilename = CustomGUILayout.TextField("Import save filename:", importSaveFilename, apiPrefix + ".importSaveFilename", "The filename syntax of import files");
                ActionListGUI("ActionList after import:", menu.title, "After_Import", apiPrefix, "An ActionList asset that runs after a save file is imported");
                checkImportBool = CustomGUILayout.Toggle("Require Bool to be true?", checkImportBool, apiPrefix + ".checkImportBool", "If True, then a specific Boolean global variable must = True for an import file to be listed");
                if (checkImportBool)
                {
                    if (KickStarter.variablesManager != null)
                    {
                        ShowVarGUI(KickStarter.variablesManager.vars);
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("A Variables Manager is required.", MessageType.Warning);
                    }
                }
                                #else
                EditorGUILayout.HelpBox("This feature is only available for standalone platforms (PC, Mac, Linux)", MessageType.Warning);
                                #endif
            }

            displayType = (SaveDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How save files are displayed");

            fixedOption = CustomGUILayout.Toggle("Fixed Save ID only?", fixedOption, apiPrefix + ".fixedOption", "If True, then only one save slot will be shown");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntField("ID to display:", optionToShow, apiPrefix + ".optionToShow", "The index number of the save slot to show");

                if (saveListType == AC_SaveListType.Load)
                {
                    hideIfNotValid = CustomGUILayout.Toggle("Hide if no save file found?", hideIfNotValid, apiPrefix + ".hideIfNotValid", "If True, then the element will be hidden if the slot ID it represents is not filled with a valid save");
                }
            }
            else
            {
                maxSlots        = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots", "The maximum number of slots that can be displayed at once");
                allowEmptySlots = CustomGUILayout.Toggle("Allow empty slots?", allowEmptySlots, apiPrefix + ".allowEmptySlots", "If True, then all slots will be shown even if they are not already assigned a save file.");

                if (source == MenuSource.AdventureCreator)
                {
                    if (allowEmptySlots)
                    {
                        numSlots = maxSlots;
                    }
                    else
                    {
                        numSlots = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    }
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 30f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle", "The method by which this element (or slots within it) are hidden from view when made invisible");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                if (fixedOption)
                {
                    uiSlots = ResizeUISlots(uiSlots, 1);
                }
                else
                {
                    uiSlots = ResizeUISlots(uiSlots, maxSlots);
                }

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

                linkUIGraphic = (LinkUIGraphic)CustomGUILayout.EnumPopup("Link graphics to:", linkUIGraphic, "", "What Image component the element's graphics should be linked to");
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Exemplo n.º 26
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuDialogList)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");
            fixedOption = CustomGUILayout.Toggle("Fixed option number?", fixedOption, apiPrefix + ".fixedOption", "If True, then only one dialogue option will be shown");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntSlider("Option to display:", optionToShow, 1, 10, apiPrefix + ".optionToShow", "The index number of the dialogue option to show");
            }
            else
            {
                maxSlots = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots", "The maximum number of dialogue options that can be shown at once");
                resetOffsetWhenRestart = CustomGUILayout.Toggle("Reset offset when turn on?", resetOffsetWhenRestart, apiPrefix + ".resetOffsetWhenRestart", "If True, then the offset value will be reset when the parent menu is turned on for the same Conversation that it last displayed");

                if (source == MenuSource.AdventureCreator)
                {
                    numSlots    = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 30f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }

            displayType = (ConversationDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How the Conversation's dialogue options are displayed");
            if (displayType == ConversationDisplayType.IconAndText && source == MenuSource.AdventureCreator)
            {
                EditorGUILayout.HelpBox("'Icon And Text' mode is only available for Unity UI-based Menus.", MessageType.Warning);
            }

            markAlreadyChosen = CustomGUILayout.Toggle("Mark options already used?", markAlreadyChosen, apiPrefix + ".markAlreadyChosen", "If True, then options that have already been clicked can be displayed in a different colour");
            if (markAlreadyChosen)
            {
                alreadyChosenFontColour            = (Color)CustomGUILayout.ColorField("'Already chosen' colour:", alreadyChosenFontColour, apiPrefix + ".alreadyChosenFontColour", "The font colour for options already chosen");
                alreadyChosenFontHighlightedColour = (Color)CustomGUILayout.ColorField("'Already chosen' highlighted colour:", alreadyChosenFontHighlightedColour, apiPrefix + ".alreadyChosenFontHighlightedColour", "The font colour when the option is highlighted but has already been chosen");
            }

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle", "The method by which this element (or slots within it) are hidden from view when made invisible");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                if (fixedOption)
                {
                    uiSlots = ResizeUISlots(uiSlots, 1);
                }
                else
                {
                    uiSlots = ResizeUISlots(uiSlots, maxSlots);
                }

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

                linkUIGraphic = (LinkUIGraphic)CustomGUILayout.EnumPopup("Link graphics to:", linkUIGraphic, "", "What Image component the element's graphics should be linked to");
            }

            if (displayType == ConversationDisplayType.TextOnly || displayType == ConversationDisplayType.IconAndText)
            {
                showIndexNumbers = CustomGUILayout.Toggle("Prefix with index numbers?", showIndexNumbers, apiPrefix + ".showIndexNumbers", "If True, then each option's index number will be prefixed to the label");
            }

            ChangeCursorGUI(menu);
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Exemplo n.º 27
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            inventoryBoxType = (AC_InventoryBoxType)CustomGUILayout.EnumPopup("Inventory box type:", inventoryBoxType, apiPrefix + ".inventoryBoxType");
            if (inventoryBoxType == AC_InventoryBoxType.Default || inventoryBoxType == AC_InventoryBoxType.CustomScript)
            {
                maxSlots    = CustomGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30, apiPrefix + ".maxSlots");
                isClickable = true;
            }
            else if (inventoryBoxType == AC_InventoryBoxType.DisplaySelected)
            {
                isClickable = false;
                maxSlots    = 1;
            }
            else if (inventoryBoxType == AC_InventoryBoxType.DisplayLastSelected)
            {
                isClickable = true;
                maxSlots    = 1;
            }
            else if (inventoryBoxType == AC_InventoryBoxType.Container)
            {
                isClickable            = true;
                maxSlots               = CustomGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30, apiPrefix + ".maxSlots");
                selectItemsAfterTaking = CustomGUILayout.Toggle("Select item after taking?", selectItemsAfterTaking, apiPrefix + ".selectItemsAfterTaking");
            }
            else
            {
                isClickable = true;
                if (source == MenuSource.AdventureCreator)
                {
                    numSlots = CustomGUILayout.IntField("Test slots:", numSlots, apiPrefix + ".numSlots");
                }
                maxSlots = CustomGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30, apiPrefix + ".maxSlots");
            }

            if (inventoryBoxType == AC_InventoryBoxType.HotspotBased)
            {
                limitToDefinedInteractions = CustomGUILayout.ToggleLeft("Only show items referenced in Interactions?", limitToDefinedInteractions, apiPrefix + ".limitToDefinedInteractions");
            }

            displayType = (ConversationDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType");
            if (displayType == ConversationDisplayType.IconAndText && source == MenuSource.AdventureCreator)
            {
                EditorGUILayout.HelpBox("'Icon And Text' mode is only available for Unity UI-based Menus.", MessageType.Warning);
            }

            if (inventoryBoxType != AC_InventoryBoxType.DisplaySelected && inventoryBoxType != AC_InventoryBoxType.DisplayLastSelected && source == MenuSource.AdventureCreator)
            {
                slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f, apiPrefix + ".slotSpacing");
                orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                if (orientation == ElementOrientation.Grid)
                {
                    gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                }
            }

            if (inventoryBoxType == AC_InventoryBoxType.CustomScript)
            {
                ShowClipHelp();
            }

            uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When slot is empty:", uiHideStyle, apiPrefix + ".uiHideStyle");

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                uiSlots = ResizeUISlots(uiSlots, maxSlots);

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

                linkUIGraphic = (LinkUIGraphic)EditorGUILayout.EnumPopup("Link graphics to:", linkUIGraphic);
            }
            EditorGUILayout.EndVertical();

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

            base.ShowGUI(menu);
        }
Exemplo n.º 28
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);
        }
Exemplo n.º 29
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)
                {
                                        #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", "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 (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)
            {
                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, "The Global Integer variable that's value will be synced with the cycle");
                }

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

            base.ShowGUI(menu);
        }
Exemplo n.º 30
0
        /**
         * Shows the GUI.
         */
        public void ShowGUI()
        {
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            drawInEditor = EditorGUILayout.Toggle("Test in Game Window?", drawInEditor);
            drawOutlines = EditorGUILayout.Toggle("Draw outlines?", drawOutlines);
            if (drawOutlines && Application.platform == RuntimePlatform.WindowsEditor)
            {
                doWindowsPreviewFix = EditorGUILayout.Toggle("Apply outline offset fix?", doWindowsPreviewFix);
            }
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Pause background texture:", GUILayout.Width(255f));
            pauseTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (pauseTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), "AC.Kickstarter.menuManager.pauseTexture");
            EditorGUILayout.EndHorizontal();
            scaleTextEffects = CustomGUILayout.Toggle("Scale text effects?", scaleTextEffects, "AC.KickStarter.menuManager.scaleTextEffects");
            globalDepth      = CustomGUILayout.IntField("GUI depth:", globalDepth, "AC.KickStarter.menuManager.globalDepth");
            eventSystem      = (UnityEngine.EventSystems.EventSystem)CustomGUILayout.ObjectField <UnityEngine.EventSystems.EventSystem> ("Event system prefab:", eventSystem, false, "AC.KickStarter.menuManager.eventSystem");

            if (AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.inputMethod == InputMethod.KeyboardOrController)
            {
                EditorGUILayout.Space();
                keyboardControlWhenPaused        = CustomGUILayout.ToggleLeft("Directly-navigate Menus when paused?", keyboardControlWhenPaused, "AC.KickStarter.menuManager.keyboardControlWhenPaused");
                keyboardControlWhenDialogOptions = CustomGUILayout.ToggleLeft("Directly-navigate Menus during Conversations?", keyboardControlWhenDialogOptions, "AC.KickStarter.menuManager.keyboardControlWhenDialogOptions");
            }

            if (drawInEditor && KickStarter.menuPreview == null)
            {
                EditorGUILayout.HelpBox("A GameEngine prefab is required to display menus while editing - please click Organise Room Objects within the Scene Manager.", MessageType.Warning);
            }
            else if (Application.isPlaying)
            {
                EditorGUILayout.HelpBox("Changes made to the menus will not be registed by the game until the game is restarted.", MessageType.Info);
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            CreateMenusGUI();

            if (selectedMenu != null)
            {
                EditorGUILayout.Space();

                string menuTitle = selectedMenu.title;
                if (menuTitle == "")
                {
                    menuTitle = "(Untitled)";
                }

                EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                EditorGUILayout.LabelField("Menu " + selectedMenu.id + ": '" + menuTitle + "' properties", CustomStyles.subHeader);
                EditorGUILayout.Space();
                selectedMenu.ShowGUI();
                EditorGUILayout.EndVertical();

                EditorGUILayout.Space();

                EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                EditorGUILayout.LabelField("Menu " + selectedMenu.id + ": '" + menuTitle + "' elements", CustomStyles.subHeader);
                EditorGUILayout.Space();
                CreateElementsGUI(selectedMenu);
                EditorGUILayout.EndVertical();

                if (selectedMenuElement != null)
                {
                    EditorGUILayout.Space();

                    string elementName = selectedMenuElement.title;
                    if (elementName == "")
                    {
                        elementName = "(Untitled)";
                    }

                    string elementType = "";
                    foreach (string _elementType in elementTypes)
                    {
                        if (selectedMenuElement.GetType().ToString().Contains(_elementType))
                        {
                            elementType = _elementType;
                            break;
                        }
                    }

                    EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                    EditorGUILayout.LabelField(elementType + " " + selectedMenuElement.ID + ": '" + elementName + "' properties", CustomStyles.subHeader);
                    oldVisibility = selectedMenuElement.isVisible;
                    selectedMenuElement.ShowGUIStart(selectedMenu);
                    if (selectedMenuElement.isVisible != oldVisibility)
                    {
                        if (!Application.isPlaying)
                        {
                            selectedMenu.Recalculate();
                        }
                    }
                }
            }

            if (GUI.changed)
            {
                if (!Application.isPlaying)
                {
                    SaveAllMenus();
                }
                EditorUtility.SetDirty(this);
            }
        }