示例#1
0
        public override void OnInspectorGUI()
        {
            GameCamera _target = (GameCamera)target;

            _target.ShowCursorInfluenceGUI();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("X-axis movement", EditorStyles.boldLabel);

            _target.lockXLocAxis = CustomGUILayout.Toggle("Lock?", _target.lockXLocAxis, "", "If True, movement in the X-axis is prevented");

            if (!_target.lockXLocAxis)
            {
                _target.xLocConstrainType = (CameraLocConstrainType)CustomGUILayout.EnumPopup("Affected by:", _target.xLocConstrainType, "", "The constrain type on X-axis movement");

                EditorGUILayout.BeginVertical("Button");
                if (_target.xLocConstrainType == CameraLocConstrainType.SideScrolling)
                {
                    _target.xFreedom = CustomGUILayout.FloatField("Track freedom:", _target.xFreedom, "", "The track freedom along the X-axis");
                }
                else
                {
                    _target.xGradient = CustomGUILayout.FloatField("Influence:", _target.xGradient, "", "The influence of the target's position on X-axis movement");
                }
                _target.xOffset = CustomGUILayout.FloatField("Offset:", _target.xOffset, "", "The X-axis position offset");
                EditorGUILayout.EndVertical();

                _target.limitX = CustomGUILayout.Toggle("Constrain?", _target.limitX, "", "If True, then X-axis movement will be limited to minimum and maximum values");
                if (_target.limitX)
                {
                    EditorGUILayout.BeginVertical("Button");
                    _target.constrainX[0] = CustomGUILayout.FloatField("Minimum constraint:", _target.constrainX[0], "", "The lower X-axis movement limit");
                    _target.constrainX[1] = CustomGUILayout.FloatField("Maximum constraint:", _target.constrainX[1], "", "The upper X-axis movement limit");
                    EditorGUILayout.EndVertical();
                }
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Y-axis movement", EditorStyles.boldLabel);

            _target.lockYLocAxis = CustomGUILayout.Toggle("Lock?", _target.lockYLocAxis, "", "If True, movement in the Y-axis is prevented");

            if (!_target.lockYLocAxis)
            {
                _target.yLocConstrainType = (CameraLocConstrainType)CustomGUILayout.EnumPopup("Affected by:", _target.yLocConstrainType, "", "The constrain type on Y-axis movement");

                EditorGUILayout.BeginVertical("Button");
                if (_target.yLocConstrainType == CameraLocConstrainType.SideScrolling)
                {
                    _target.yFreedom = CustomGUILayout.FloatField("Track freedom:", _target.yFreedom, "", "The track freedom along the Y-axis");
                }
                else
                {
                    _target.yGradientLoc = CustomGUILayout.FloatField("Influence:", _target.yGradientLoc, "", "The influence of the target's position on Y-axis movement");
                }
                _target.yOffsetLoc = CustomGUILayout.FloatField("Offset:", _target.yOffsetLoc, "", "The Y-axis position offset");
                EditorGUILayout.EndVertical();

                _target.limitYLoc = CustomGUILayout.Toggle("Constrain?", _target.limitYLoc, "", "If True, then Y-axis movement will be limited to minimum and maximum values");
                if (_target.limitYLoc)
                {
                    EditorGUILayout.BeginVertical("Button");
                    _target.constrainYLoc[0] = CustomGUILayout.FloatField("Minimum constraint:", _target.constrainYLoc[0], "", "The lower Y-axis movement limit");
                    _target.constrainYLoc[1] = CustomGUILayout.FloatField("Maximum constraint:", _target.constrainYLoc[1], "", "The upper Y-axis movement limit");
                    EditorGUILayout.EndVertical();
                }
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Z-axis movement", EditorStyles.boldLabel);

            _target.lockZLocAxis = CustomGUILayout.Toggle("Lock?", _target.lockZLocAxis, "", "If True, movement in the Z-axis is prevented");

            if (!_target.lockZLocAxis)
            {
                _target.zLocConstrainType = (CameraLocConstrainType)CustomGUILayout.EnumPopup("Affected by:", _target.zLocConstrainType, "", "The constrain type on Z-axis movement");

                EditorGUILayout.BeginVertical("Button");
                if (_target.zLocConstrainType == CameraLocConstrainType.SideScrolling)
                {
                    _target.zFreedom = CustomGUILayout.FloatField("Track freedom:", _target.zFreedom, "", "The track freedom along the Z-axis");
                }
                else
                {
                    _target.zGradient = CustomGUILayout.FloatField("Influence:", _target.zGradient, "", "The influence of the target's position on Z-axis movement");
                }
                _target.zOffset = CustomGUILayout.FloatField("Offset:", _target.zOffset, "", "The Z-axis position offset");
                EditorGUILayout.EndVertical();

                _target.limitZ = CustomGUILayout.Toggle("Constrain?", _target.limitZ, "", "If True, then Z-axis movement will be limited to minimum and maximum values");
                if (_target.limitZ)
                {
                    EditorGUILayout.BeginVertical("Button");
                    _target.constrainZ[0] = CustomGUILayout.FloatField("Minimum constraint:", _target.constrainZ[0], "", "The lower Z-axis movement limit");
                    _target.constrainZ[1] = CustomGUILayout.FloatField("Maximum constraint:", _target.constrainZ[1], "", "The upper Z-axis movement limit");
                    EditorGUILayout.EndVertical();
                }
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

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

            _target.lockYRotAxis = CustomGUILayout.Toggle("Lock?", _target.lockYRotAxis, "", "If True, spin rotation is prevented");

            if (!_target.lockYRotAxis)
            {
                _target.yRotConstrainType = (CameraRotConstrainType)CustomGUILayout.EnumPopup("Affected by:", _target.yRotConstrainType, "", "The constrain type on spin rotation");

                if (_target.yRotConstrainType != CameraRotConstrainType.LookAtTarget)
                {
                    EditorGUILayout.BeginVertical("Button");
                    _target.directionInfluence = CustomGUILayout.FloatField("Target direction fac.:", _target.directionInfluence, "", "The influence that the target's facing direction has on the tracking position");
                    _target.yGradient          = CustomGUILayout.FloatField("Influence:", _target.yGradient, "", "The influence of the target's position on spin rotation");
                    _target.yOffset            = CustomGUILayout.FloatField("Offset:", _target.yOffset, "", "The spin rotation offset");
                    EditorGUILayout.EndVertical();
                }
                else
                {
                    EditorGUILayout.BeginVertical("Button");
                    _target.directionInfluence = CustomGUILayout.FloatField("Target direction fac.:", _target.directionInfluence, "", "The influence that the target's facing direction has on the tracking position");
                    _target.targetHeight       = CustomGUILayout.FloatField("Target height offset:", _target.targetHeight, "", "The target positional offset in the Y-axis");
                    _target.targetXOffset      = CustomGUILayout.FloatField("Target X offset:", _target.targetXOffset, "", "The target positional offset in the X-axis");
                    _target.targetZOffset      = CustomGUILayout.FloatField("Target Z offset:", _target.targetZOffset, "", "The target positional offset in the Z-axis");
                    EditorGUILayout.EndVertical();
                }

                _target.limitY = CustomGUILayout.Toggle("Constrain?", _target.limitY, "", "If True, then spin rotation will be limited to minimum and maximum values");
                if (_target.limitY)
                {
                    EditorGUILayout.BeginVertical("Button");
                    _target.constrainY[0] = CustomGUILayout.FloatField("Minimum constraint:", _target.constrainY[0], "", "The lower spin rotation limit");
                    _target.constrainY[1] = CustomGUILayout.FloatField("Maximum constraint:", _target.constrainY[1], "", "The upper spin rotation limit");
                    EditorGUILayout.EndVertical();
                }
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

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

            if (!_target.lockYRotAxis && _target.yRotConstrainType == CameraRotConstrainType.LookAtTarget)
            {
                EditorGUILayout.HelpBox("Pitch rotation is overriden by 'Look At Target' spin rotation.", MessageType.Info);

                _target.limitXRot = CustomGUILayout.Toggle("Constrain?", _target.limitXRot, "", "If True, then pitch rotation will be limited to minimum and maximum values");
            }
            else
            {
                _target.lockXRotAxis = CustomGUILayout.Toggle("Lock?", _target.lockXRotAxis, "", "If True, pitch rotation is prevented");

                if (!_target.lockXRotAxis)
                {
                    _target.xRotConstrainType = (CameraLocConstrainType)CustomGUILayout.EnumPopup("Affected by:", _target.xRotConstrainType, "", "The constrain type on pitch rotation");

                    if (_target.xRotConstrainType == CameraLocConstrainType.SideScrolling)
                    {
                        EditorGUILayout.HelpBox("This option is not available for Pitch rotation", MessageType.Warning);
                    }
                    else
                    {
                        EditorGUILayout.BeginVertical("Button");
                        _target.xGradientRot = CustomGUILayout.FloatField("Influence:", _target.xGradientRot, "", "The influence of the target's position on pitch rotation");
                        _target.xOffsetRot   = CustomGUILayout.FloatField("Offset:", _target.xOffsetRot, "", "The pitch rotation offset");
                        EditorGUILayout.EndVertical();
                    }

                    _target.limitXRot = CustomGUILayout.Toggle("Constrain?", _target.limitXRot, "", "If True, then pitch rotation will be limited to minimum and maximum values");
                    if (_target.limitXRot)
                    {
                        EditorGUILayout.BeginVertical("Button");
                        _target.constrainXRot[0] = CustomGUILayout.FloatField("Minimum constraint:", _target.constrainXRot[0], "", "The lower pitch rotation limit");
                        _target.constrainXRot[1] = CustomGUILayout.FloatField("Maximum constraint:", _target.constrainXRot[1], "", "The upper pitch rotation limit");
                        EditorGUILayout.EndVertical();
                    }
                }
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical("Button");
            if (_target.GetComponent <Camera>() && _target.GetComponent <Camera>().orthographic)
            {
                EditorGUILayout.LabelField("Orthographic size", EditorStyles.boldLabel);
            }
            else if (_target.GetComponentInChildren <Camera>() && _target.GetComponentInChildren <Camera>().orthographic)
            {
                EditorGUILayout.LabelField("Orthographic size", EditorStyles.boldLabel);
            }
            else
            {
                EditorGUILayout.LabelField("Field of view", EditorStyles.boldLabel);
            }

            _target.lockFOV = CustomGUILayout.Toggle("Lock?", _target.lockFOV, "", "If True, changing of the FOV is prevented");

            if (!_target.lockFOV)
            {
                EditorGUILayout.HelpBox("This value will vary with the target's distance from the camera.", MessageType.Info);

                EditorGUILayout.BeginVertical("Button");
                _target.FOVGradient = CustomGUILayout.FloatField("Influence:", _target.FOVGradient, "", "The influence of the target's position on FOV");
                _target.FOVOffset   = CustomGUILayout.FloatField("Offset:", _target.FOVOffset, "", "The FOV offset");
                EditorGUILayout.EndVertical();

                _target.limitFOV = CustomGUILayout.Toggle("Constrain?", _target.limitFOV, "", "If True, then FOV will be limited to minimum and maximum value");
                if (_target.limitFOV)
                {
                    EditorGUILayout.BeginVertical("Button");
                    _target.constrainFOV[0] = CustomGUILayout.FloatField("Minimum constraint:", _target.constrainFOV[0], "", "The lower FOV limit");
                    _target.constrainFOV[1] = CustomGUILayout.FloatField("Maximum constraint:", _target.constrainFOV[1], "", "The upper FOV limit");
                    EditorGUILayout.EndVertical();
                }
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Depth of field", EditorStyles.boldLabel);
            _target.focalPointIsTarget = CustomGUILayout.Toggle("Focal point is target object?", _target.focalPointIsTarget, "", "If True, then the focal distance will match the distance to the target");
            if (!_target.focalPointIsTarget)
            {
                _target.focalDistance = CustomGUILayout.FloatField("Focal distance:", _target.focalDistance, "", "The camera's focal distance.  When the MainCamera is attached to this camera, it can be read through script with 'AC.KickStarter.mainCamera.GetFocalDistance()' and used to update your post-processing method.");
            }
            else if (Application.isPlaying)
            {
                EditorGUILayout.LabelField("Focal distance: " + _target.focalDistance.ToString(), EditorStyles.miniLabel);
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            if (!_target.lockXLocAxis || !_target.lockYRotAxis || !_target.lockFOV || !_target.lockYLocAxis || !_target.lockZLocAxis || _target.focalPointIsTarget)
            {
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.LabelField("Target object to control camera movement", EditorStyles.boldLabel);

                _target.targetIsPlayer = CustomGUILayout.Toggle("Target is Player?", _target.targetIsPlayer, "", "If True, the camera will follow the active Player");

                if (!_target.targetIsPlayer)
                {
                    _target.target = (Transform)CustomGUILayout.ObjectField <Transform> ("Target:", _target.target, true, "", "The object for the camera to follow");
                }

                _target.dampSpeed = CustomGUILayout.FloatField("Follow speed:", _target.dampSpeed, "", "The follow speed when tracking a target");
                _target.actFromDefaultPlayerStart = CustomGUILayout.Toggle("Use default PlayerStart?", _target.actFromDefaultPlayerStart, "", "If True, then the camera's position will be relative to the scene's default PlayerStart, rather then the Player's initial position. This ensures that camera movement is the same regardless of where the Player begins in the scene");
                EditorGUILayout.EndVertical();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
示例#2
0
        /**
         * Shows the GUI.
         */
        public void ShowGUI()
        {
            settingsManager = AdvGame.GetReferences().settingsManager;

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showSettings = CustomGUILayout.ToggleHeader(showSettings, "Global cursor settings");
            if (showSettings)
            {
                cursorRendering = (CursorRendering)CustomGUILayout.EnumPopup("Cursor rendering:", cursorRendering, "AC.KickStarter.cursorManager.cursorRendering");
                if (cursorRendering == CursorRendering.Software)
                {
                    lockSystemCursor = CustomGUILayout.ToggleLeft("Lock system cursor when locking AC cursor?", lockSystemCursor, "AC.KickStarter.cursorManager.lockSystemCursor");
                }
                forceCursorInEditor = CustomGUILayout.ToggleLeft("Always show system cursor in Editor?", forceCursorInEditor, "AC.KickStarter.cursorManager.forceCursorInEditor");

                if (cursorRendering == CursorRendering.Software)
                {
                    keepCursorWithinScreen = CustomGUILayout.ToggleLeft("Always keep cursor within screen boundary?", keepCursorWithinScreen, "AC.KickStarter.cursorManager.keepCursorWithinScreen");
                }
                else
                {
                    keepCursorWithinScreen = CustomGUILayout.ToggleLeft("Always keep perceived cursor within screen boundary?", keepCursorWithinScreen, "AC.KickStarter.cursorManager.keepCursorWithinScreen");
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showMainCursor = CustomGUILayout.ToggleHeader(showMainCursor, "Main cursor settings");
            if (showMainCursor)
            {
                cursorDisplay = (CursorDisplay)CustomGUILayout.EnumPopup("Display cursor:", cursorDisplay, "AC.KickStarter.cursorManager.cursorDisplay");
                if (cursorDisplay != CursorDisplay.Never)
                {
                    allowMainCursor = CustomGUILayout.Toggle("Replace mouse cursor?", allowMainCursor, "AC.KickStarter.cursorManager.allowMainCursor");
                    if (allowMainCursor || (settingsManager && settingsManager.inputMethod == InputMethod.KeyboardOrController))
                    {
                        IconBaseGUI("", pointerIcon, "AC.KickStarter.cursorManager.pointerIcon", false);
                    }
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showWalkCursor = CustomGUILayout.ToggleHeader(showWalkCursor, "Walk cursor");
            if (showWalkCursor)
            {
                if (allowMainCursor)
                {
                    allowWalkCursor = CustomGUILayout.Toggle("Provide walk cursor?", allowWalkCursor, "AC.KickStarter.cursorManager.allowWalkCursor");
                    if (allowWalkCursor)
                    {
                        if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                        {
                            EditorGUILayout.LabelField("Input button:", "Icon_Walk");
                        }
                        IconBaseGUI("", walkIcon, "AC.KickStarter.cursorManager.walkIcon");
                        onlyWalkWhenOverNavMesh = CustomGUILayout.ToggleLeft("Only show 'Walk' Cursor when over NavMesh?", onlyWalkWhenOverNavMesh, "AC.KickStarter.cursorManager.onlyWalkWhenOverNavMesh");
                    }
                }
                addWalkPrefix = CustomGUILayout.Toggle("Prefix cursor labels?", addWalkPrefix, "AC.KickStarter.cursorManager.addWalkPrefix");
                if (addWalkPrefix)
                {
                    walkPrefix.label = CustomGUILayout.TextField("Walk prefix:", walkPrefix.label, "AC.KickStarter.cursorManager.walkPrefix");
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showHotspotCursor = CustomGUILayout.ToggleHeader(showHotspotCursor, "Hotspot cursor");
            if (showHotspotCursor)
            {
                addHotspotPrefix = CustomGUILayout.Toggle("Prefix cursor labels?", addHotspotPrefix, "AC.KickStarter.cursorManager.addHotspotPrefix");
                IconBaseGUI("", mouseOverIcon, "AC.KickStarter.cursorManager.mouseOverIcon");
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showInventoryCursor = CustomGUILayout.ToggleHeader(showInventoryCursor, "Inventory cursor");
            if (showInventoryCursor)
            {
                inventoryHandling = (InventoryHandling)CustomGUILayout.EnumPopup("When inventory selected:", inventoryHandling, "AC.KickStarter.cursorManager.inventoryHandling");
                if (inventoryHandling != InventoryHandling.ChangeCursor)
                {
                    onlyShowInventoryLabelOverHotspots = CustomGUILayout.ToggleLeft("Only show label when over Hotspots and Inventory?", onlyShowInventoryLabelOverHotspots, "AC.KickStarter.cursorManager.onlyShowInventoryLabelOverHotspots");
                }
                if (inventoryHandling != InventoryHandling.ChangeHotspotLabel)
                {
                    inventoryCursorSize = CustomGUILayout.FloatField("Inventory cursor size:", inventoryCursorSize, "AC.KickStarter.cursorManager.inventoryCursorSize");
                }
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Use syntax:", GUILayout.Width(100f));
                hotspotPrefix1.label = CustomGUILayout.TextField(hotspotPrefix1.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix1");
                EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f));
                hotspotPrefix2.label = CustomGUILayout.TextField(hotspotPrefix2.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix2");
                EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f));
                EditorGUILayout.EndHorizontal();
                if (AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.CanGiveItems())
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Give syntax:", GUILayout.Width(100f));
                    hotspotPrefix3.label = CustomGUILayout.TextField(hotspotPrefix3.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix3");
                    EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f));
                    hotspotPrefix4.label = CustomGUILayout.TextField(hotspotPrefix4.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix4");
                    EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f));
                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showInteractionIcons = CustomGUILayout.ToggleHeader(showInteractionIcons, "Interaction icons");
            if (showInteractionIcons)
            {
                if (settingsManager == null || settingsManager.interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    allowInteractionCursor = CustomGUILayout.ToggleLeft("Change cursor based on Interaction?", allowInteractionCursor, "AC.KickStarter.cursorManager.allowInteractionCursor");
                    if (allowInteractionCursor && (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive))
                    {
                        allowInteractionCursorForInventory = CustomGUILayout.ToggleLeft("Change when over Inventory items too?", allowInteractionCursorForInventory, "AC.KickStarter.cursorManager.allowInteractionCursorForInventory");
                    }
                    if (settingsManager && settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                    {
                        cycleCursors            = CustomGUILayout.ToggleLeft("Cycle Interactions with right-click?", cycleCursors, "AC.KickStarter.cursorManager.cycleCursors");
                        onlyAnimateOverHotspots = CustomGUILayout.ToggleLeft("Only animate icons when over Hotspots?", onlyAnimateOverHotspots, "AC.KickStarter.cursorManager.onlyAnimateOverHotspots");
                    }
                }

                IconsGUI();

                EditorGUILayout.Space();

                if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive)
                {
                    LookIconGUI();
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showCutsceneCursor = CustomGUILayout.ToggleHeader(showCutsceneCursor, "Cutscene cursor");
            if (showCutsceneCursor)
            {
                IconBaseGUI("", waitIcon, "AC.KickStarter.cursorManager.waitIcon");
            }
            EditorGUILayout.EndVertical();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(this);
            }
        }
示例#3
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuCrafting)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            craftingType = (CraftingElementType)CustomGUILayout.EnumPopup("Crafting element type:", craftingType, apiPrefix + ".craftingType", "What part of the crafting process this element is used for");

            if (craftingType == CraftingElementType.Ingredients)
            {
                numSlots = CustomGUILayout.IntSlider("Number of slots:", numSlots, 1, 12);
                if (source == MenuSource.AdventureCreator && numSlots > 1)
                {
                    slotSpacing = EditorGUILayout.Slider(new GUIContent("Slot spacing:", "The distance between slots"), slotSpacing, 0f, 20f);
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation", "The slot orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }
            else
            {
                autoCreate = CustomGUILayout.Toggle("Result is automatic?", autoCreate, apiPrefix + ".autoCreate", "If True, then the output ingredient will appear automatically when the correct ingredients are used. If False, then the player will have to run the 'Inventory: Crafting' Action as an additional step.");

                numSlots = 1;
                actionListOnWrongIngredients = ActionListAssetMenu.AssetGUI("ActionList on fail:", actionListOnWrongIngredients, menu.title + "_OnFailRecipe", apiPrefix + ".actionListOnWrongIngredients", "Ahe ActionList asset to run if a crafting attempt is made but no succesful recipe is possible. This only works if crafting is performed manually via the Inventory: Crafting Action.");
                if (actionListOnWrongIngredients != null)
                {
                    EditorGUILayout.HelpBox("This ActionList will only be run if the result is calculated manually via the 'Inventory: Crafting' Action.", MessageType.Info);
                }
            }

            displayType = (ConversationDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How items 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);
            }

            inventoryItemCountDisplay = (InventoryItemCountDisplay)CustomGUILayout.EnumPopup("Display item amounts:", inventoryItemCountDisplay, apiPrefix + ".inventoryItemCountDisplay", "How item counts are drawn");

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

                uiSlots = ResizeUISlots(uiSlots, numSlots);

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

            isClickable = true;
            EditorGUILayout.EndVertical();

            PopulateList(source);
            base.ShowGUI(menu);
        }
示例#4
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuProfilesList)";

            MenuSource source = menu.menuSource;

            CustomGUILayout.BeginVertical();

            fixedOption = CustomGUILayout.Toggle("Fixed Profile ID only?", fixedOption, apiPrefix + ".fixedOption", "If True, then only one profile slot will be shown");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntField("ID to display:", optionToShow, apiPrefix + ".optionToShow", "The index number of the profile to show");
            }
            else
            {
                showActive = CustomGUILayout.Toggle("Include active?", showActive, apiPrefix + ".showActive", "If True, then the current active profile will also be listed");
                maxSlots   = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots", "The maximum number of profiles that can be displayed at once");
                if (maxSlots < 0)
                {
                    maxSlots = 0;
                }

                if (source == MenuSource.AdventureCreator)
                {
                    if (maxSlots > 1)
                    {
                        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");
                        }
                    }
                    else
                    {
                        numSlots = Mathf.Max(0, maxSlots);
                    }
                }
            }

            autoHandle = CustomGUILayout.Toggle("Switch profile when click?", autoHandle, apiPrefix + ".autoHandle", "If True, then the profile will be switched to once its slot is clicked on");

            if (autoHandle)
            {
                ActionListGUI("ActionList after selecting:", menu.title, "After_Selecting", apiPrefix, "The ActionList asset to run once a profile has been switched to");
            }
            else
            {
                ActionListGUI("ActionList when click:", menu.title, "When_Click", apiPrefix, "The ActionList asset to run once a profile has been clicked on");
            }

            if (source != MenuSource.AdventureCreator)
            {
                CustomGUILayout.EndVertical();
                CustomGUILayout.BeginVertical();
                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);

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

            CustomGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
示例#5
0
        private void CraftingGUI()
        {
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            EditorGUILayout.LabelField("Crafting", CustomStyles.subHeader);
            EditorGUILayout.Space();

            if (items.Count == 0)
            {
                EditorGUILayout.HelpBox("No inventory items defined!", MessageType.Info);
                return;
            }

            foreach (Recipe recipe in recipes)
            {
                EditorGUILayout.BeginHorizontal();

                string buttonLabel = recipe.label;
                if (buttonLabel == "")
                {
                    buttonLabel = "(Untitled)";
                }

                if (GUILayout.Toggle(recipe.isEditing, recipe.id + ": " + buttonLabel, "Button"))
                {
                    if (selectedRecipe != recipe)
                    {
                        DeactivateAllRecipes();
                        ActivateRecipe(recipe);
                    }
                }

                if (GUILayout.Button("-", GUILayout.Width(20f), GUILayout.Height(15f)))
                {
                    Undo.RecordObject(this, "Delete recipe");
                    DeactivateAllRecipes();
                    recipes.Remove(recipe);
                    AssetDatabase.SaveAssets();
                    break;
                }

                EditorGUILayout.EndHorizontal();
            }

            if (GUILayout.Button("Create new recipe"))
            {
                Undo.RecordObject(this, "Create inventory recipe");

                Recipe newRecipe = new Recipe(GetIDArrayRecipe());
                recipes.Add(newRecipe);
                DeactivateAllRecipes();
                ActivateRecipe(newRecipe);
            }

            EditorGUILayout.EndVertical();

            if (selectedRecipe != null && recipes.Contains(selectedRecipe))
            {
                string apiPrefix = "AC.KickStarter.inventoryManager.GetRecipe (" + selectedRecipe.id + ")";

                EditorGUILayout.Space();
                EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                EditorGUILayout.LabelField("Recipe '" + selectedRecipe.label + "' properties", CustomStyles.subHeader);
                EditorGUILayout.Space();

                selectedRecipe.label = CustomGUILayout.TextField("Name:", selectedRecipe.label, apiPrefix + ".label");

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Resulting item:", GUILayout.Width(146f));
                int i = GetArraySlot(selectedRecipe.resultID);
                i = CustomGUILayout.Popup(i, GetLabelList(), apiPrefix + ".resultID");
                selectedRecipe.resultID = items[i].id;
                EditorGUILayout.EndHorizontal();

                selectedRecipe.autoCreate         = CustomGUILayout.Toggle("Result is automatic?", selectedRecipe.autoCreate, apiPrefix + ".autoCreate");
                selectedRecipe.useSpecificSlots   = CustomGUILayout.Toggle("Requires specific pattern?", selectedRecipe.useSpecificSlots, apiPrefix + ".useSpecificSlots");
                selectedRecipe.actionListOnCreate = ActionListAssetMenu.AssetGUI("ActionList when create:", selectedRecipe.actionListOnCreate, apiPrefix + ".actionListOnCreate");

                selectedRecipe.onCreateRecipe = (OnCreateRecipe)CustomGUILayout.EnumPopup("When click on result:", selectedRecipe.onCreateRecipe, apiPrefix + ".onCreateRecipe");
                if (selectedRecipe.onCreateRecipe == OnCreateRecipe.RunActionList)
                {
                    selectedRecipe.invActionList = ActionListAssetMenu.AssetGUI("ActionList when click:", selectedRecipe.invActionList, apiPrefix + ".invActionList");
                }

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Ingredients", CustomStyles.subHeader);

                foreach (Ingredient ingredient in selectedRecipe.ingredients)
                {
                    int j = selectedRecipe.ingredients.IndexOf(ingredient);

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Ingredient:", GUILayout.Width(70f));
                    i = GetArraySlot(ingredient.itemID);
                    i = CustomGUILayout.Popup(i, GetLabelList(), apiPrefix + ".ingredients [" + j + "].itemID");
                    ingredient.itemID = items[i].id;

                    if (items[i].canCarryMultiple)
                    {
                        EditorGUILayout.LabelField("Amount:", GUILayout.Width(50f));
                        ingredient.amount = EditorGUILayout.IntField(ingredient.amount, GUILayout.Width(30f));
                    }

                    if (selectedRecipe.useSpecificSlots)
                    {
                        EditorGUILayout.LabelField("Slot:", GUILayout.Width(30f));
                        ingredient.slotNumber = EditorGUILayout.IntField(ingredient.slotNumber, GUILayout.Width(30f));
                    }

                    if (GUILayout.Button("-", GUILayout.Width(20f), GUILayout.Height(15f)))
                    {
                        Undo.RecordObject(this, "Delete ingredient");
                        selectedRecipe.ingredients.Remove(ingredient);
                        AssetDatabase.SaveAssets();
                        break;
                    }

                    EditorGUILayout.EndHorizontal();
                }

                if (GUILayout.Button("Add new ingredient"))
                {
                    Undo.RecordObject(this, "Add recipe ingredient");

                    Ingredient newIngredient = new Ingredient();
                    selectedRecipe.ingredients.Add(newIngredient);
                }

                EditorGUILayout.EndVertical();
            }
        }
示例#6
0
        public static void PropertiesGUI(AC_Trigger _target)
        {
            string[] Options = { "On enter", "Continuous", "On exit" };

            if (Application.isPlaying)
            {
                if (!_target.IsOn())
                {
                    EditorGUILayout.HelpBox("Current state: OFF", MessageType.Info);
                }
            }

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Trigger properties", EditorStyles.boldLabel);
            _target.source = (ActionListSource)CustomGUILayout.EnumPopup("Actions source:", _target.source, string.Empty, "Where the Actions are stored");
            if (_target.source == ActionListSource.AssetFile)
            {
                _target.assetFile       = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList asset:", _target.assetFile, false, string.Empty, "The ActionList asset that stores the Actions");
                _target.syncParamValues = CustomGUILayout.Toggle("Sync parameter values?", _target.syncParamValues, string.Empty, "If True, the ActionList asset's parameter values will be shared amongst all linked ActionLists");
            }
            _target.actionListType = (ActionListType)CustomGUILayout.EnumPopup("When running:", _target.actionListType, string.Empty, "The effect that running the Actions has on the rest of the game");
            if (_target.actionListType == ActionListType.PauseGameplay)
            {
                _target.isSkippable = CustomGUILayout.Toggle("Is skippable?", _target.isSkippable, string.Empty, "If True, the Actions will be skipped when the user presses the 'EndCutscene' Input button");
            }
            _target.triggerType        = CustomGUILayout.Popup("Trigger type:", _target.triggerType, Options, string.Empty, "What kind of contact the Trigger reacts to");
            _target.triggerReacts      = (TriggerReacts)CustomGUILayout.EnumPopup("Reacts:", _target.triggerReacts, string.Empty, "The state of the game under which the trigger reacts");
            _target.cancelInteractions = CustomGUILayout.Toggle("Cancels interactions?", _target.cancelInteractions, string.Empty, "If True, and the Player sets off the Trigger while walking towards a Hotspot Interaction, then the Player will stop and the Interaction will be cancelled");
            _target.tagID = ShowTagUI(_target.actions.ToArray(), _target.tagID);

            if (_target.source == ActionListSource.InScene)
            {
                _target.useParameters = CustomGUILayout.Toggle("Set collider as parameter?", _target.useParameters, string.Empty, "If True, the colliding object will be provided as a GameObject parameter");
                if (_target.useParameters)
                {
                    EditorGUILayout.HelpBox("A GameObject parameter will be automatically defined by the Trigger.", MessageType.Info);
                }
            }
            else if (_target.source == ActionListSource.AssetFile &&
                     _target.assetFile != null &&
                     _target.assetFile.NumParameters > 0)
            {
                _target.gameObjectParameterID = Action.ChooseParameterGUI("Collider parameter:", _target.assetFile.DefaultParameters, _target.gameObjectParameterID, ParameterType.GameObject, -1, "The GameObject parameter to automatically set as the colliding object when run.");
            }

            _target.detectionMethod = (TriggerDetectionMethod)CustomGUILayout.EnumPopup("Detection method:", _target.detectionMethod, string.Empty, "How this Trigger detects objects. If 'Rigidbody Collider', then it requires that incoming objects have a Rigidbody and a Collider - and it will rely on collisions.  If 'Point Based', it will check an incoming object's root position for whether it is within the Trigger's collider boundary.");

            EditorGUILayout.Space();
            if (_target.detectionMethod == TriggerDetectionMethod.RigidbodyCollision)
            {
                _target.detects = (TriggerDetects)CustomGUILayout.EnumPopup("Trigger detects:", _target.detects, string.Empty, "What the Trigger will react to");
                switch (_target.detects)
                {
                case TriggerDetects.AnyObjectWithComponent:
                    _target.detectComponent = CustomGUILayout.TextField("Component name:", _target.detectComponent, string.Empty, "The component that must be attached to an object for the Trigger to react to");
                    EditorGUILayout.HelpBox("Multiple component names should be separated by a colon ';'", MessageType.Info);
                    break;

                case TriggerDetects.AnyObjectWithTag:
                    _target.detectComponent = CustomGUILayout.TextField("Tag name:", _target.detectComponent, string.Empty, "The tag that an object must have for the Trigger to react to");
                    EditorGUILayout.HelpBox("Multiple tags should be separated by a colon ';'", MessageType.Info);
                    break;

                case TriggerDetects.SetObject:
                    _target.obToDetect = (GameObject)CustomGUILayout.ObjectField <GameObject> ("Object to detect:", _target.obToDetect, true, string.Empty, "The GameObject that the Trigger reacts to");
                    break;

                case TriggerDetects.Player:
                    if (KickStarter.settingsManager != null && KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow)
                    {
                        EditorGUILayout.HelpBox("Only the active Player will be detected. To detect all Players, set the 'Detection method' to 'Component name'", MessageType.Info);
                    }
                    break;

                default:
                    break;
                }
            }
            else if (_target.detectionMethod == TriggerDetectionMethod.TransformPosition)
            {
                if (KickStarter.settingsManager == null || KickStarter.settingsManager.playerSwitching == PlayerSwitching.DoNotAllow)
                {
                    _target.detectsPlayer = CustomGUILayout.Toggle("Detect Player?", _target.detectsPlayer);
                }
                else
                {
                    _target.detectsPlayer = CustomGUILayout.Toggle("Detect active Player?", _target.detectsPlayer);
                    if (_target.detectsPlayer)
                    {
                        _target.detectsAllPlayers = CustomGUILayout.Toggle("Detect inactive Players?", _target.detectsAllPlayers);
                    }
                }

                if (_target.obsToDetect == null)
                {
                    _target.obsToDetect = new List <GameObject>();
                }
                int numObs    = _target.obsToDetect.Count;
                int newNumObs = EditorGUILayout.DelayedIntField("# " + ((_target.detectsPlayer) ? "other " : string.Empty) + "objects to detect:", numObs);
                if (newNumObs < 0)
                {
                    newNumObs = 0;
                }
                if (newNumObs != numObs)
                {
                    _target.obsToDetect = ResizeList(_target.obsToDetect, newNumObs);
                }

                for (int i = 0; i < _target.obsToDetect.Count; i++)
                {
                    _target.obsToDetect[i] = (GameObject)EditorGUILayout.ObjectField("Object #" + i + ":", _target.obsToDetect[i], typeof(GameObject), true);
                }
            }
            CustomGUILayout.EndVertical();

            if (_target.source == ActionListSource.InScene && _target.useParameters)
            {
                if (_target.parameters.Count < 1)
                {
                    ActionParameter newParameter = new ActionParameter(0);
                    newParameter.parameterType = ParameterType.GameObject;
                    newParameter.label         = "Collision object";
                    _target.parameters.Clear();
                    _target.parameters.Add(newParameter);
                }
            }
        }
        private void EditOptionGUI(ButtonDialog option, InteractionSource source)
        {
            CustomGUILayout.BeginVertical();

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

            option.label = CustomGUILayout.TextField("Label:", option.label, "", "The option's display label");

            if (source == InteractionSource.AssetFile)
            {
                option.assetFile = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("Interaction:", option.assetFile, false, "", "The ActionListAsset to run");
            }
            else if (source == InteractionSource.CustomScript)
            {
                option.customScriptObject   = (GameObject)CustomGUILayout.ObjectField <GameObject> ("Object with script:", option.customScriptObject, true, "", "The GameObject with the custom script to run");
                option.customScriptFunction = CustomGUILayout.TextField("Message to send:", option.customScriptFunction, "", "The name of the function to run");
            }
            else if (source == InteractionSource.InScene)
            {
                EditorGUILayout.BeginHorizontal();
                option.dialogueOption = (DialogueOption)CustomGUILayout.ObjectField <DialogueOption> ("DialogOption:", option.dialogueOption, true, "", "The DialogOption to run");
                if (option.dialogueOption == null)
                {
                    if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                    {
                        Undo.RecordObject(_target, "Auto-create dialogue option");
                        DialogueOption newDialogueOption = SceneManager.AddPrefab("Logic", "DialogueOption", true, false, true).GetComponent <DialogueOption>();

                        newDialogueOption.gameObject.name = AdvGame.UniqueName(_target.gameObject.name + "_Option");
                        newDialogueOption.Initialise();
                        EditorUtility.SetDirty(newDialogueOption);
                        option.dialogueOption = newDialogueOption;
                    }
                }
                EditorGUILayout.EndHorizontal();
            }

            option.cursorIcon.ShowGUI(false, true, "Icon texture:", CursorRendering.Software, "", "The icon to display in DialogList menu elements");

            option.isOn = CustomGUILayout.Toggle("Is enabled?", option.isOn, "", "If True, the option is enabled, and will be displayed in a MenuDialogList element");
            if (source == InteractionSource.CustomScript)
            {
                EditorGUILayout.HelpBox("Using a custom script will cause the conversation to end when finished, unless it is re-run explicitly.", MessageType.Info);
            }
            else
            {
                option.conversationAction = (ConversationAction)CustomGUILayout.EnumPopup("When finished:", option.conversationAction, "", "What happens when the DialogueOption ActionList has finished");
                if (option.conversationAction == AC.ConversationAction.RunOtherConversation)
                {
                    option.newConversation = (Conversation)CustomGUILayout.ObjectField <Conversation> ("Conversation to run:", option.newConversation, true, "", "The new Conversation to run");
                }
            }

            option.linkToInventory = CustomGUILayout.ToggleLeft("Only show if carrying specific inventory item?", option.linkToInventory, "", " If True, then the option will only be visible if a given inventory item is being carried");
            if (option.linkToInventory)
            {
                option.linkedInventoryID = CreateInventoryGUI(option.linkedInventoryID);
            }

            CustomGUILayout.EndVertical();
        }
示例#8
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuToggle)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

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

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

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

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

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

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

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

            base.ShowGUI(menu);
        }
示例#9
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 = KickStarter.CameraMain.transform.forward;
                    _target.transform.forward = -forwardVector;
                    EditorUtility.SetDirty(_target);
                }
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
示例#10
0
        public override void ShowGUI(Menu menu)
        {
            string     apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";
            MenuSource source    = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            craftingType = (CraftingElementType)CustomGUILayout.EnumPopup("Crafting element type:", craftingType, apiPrefix + ".craftingType");

            if (craftingType == CraftingElementType.Ingredients)
            {
                numSlots = CustomGUILayout.IntSlider("Number of slots:", numSlots, 1, 12, apiPrefix + ".numSlots");
                if (source == MenuSource.AdventureCreator)
                {
                    slotSpacing = EditorGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f);
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }
            else
            {
                numSlots = 1;
                actionListOnWrongIngredients = ActionListAssetMenu.AssetGUI("ActionList on fail:", actionListOnWrongIngredients, apiPrefix + ".actionListOnWrongIngredients", "ActionList_On_Fail_Recipe");
                if (actionListOnWrongIngredients != null)
                {
                    EditorGUILayout.HelpBox("This ActionList will only be run if the result is calculated manually via the 'Inventory: Crafting' Action.", MessageType.Info);
                }
            }

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

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

                uiSlots = ResizeUISlots(uiSlots, numSlots);

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

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

            isClickable = true;
            EditorGUILayout.EndVertical();

            PopulateList(source);
            base.ShowGUI(menu);
        }
示例#11
0
        public override void CharSettingsGUI()
        {
                        #if UNITY_EDITOR
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Mecanim parameters:", EditorStyles.boldLabel);

            character.spriteChild = (Transform)CustomGUILayout.ObjectField <Transform> ("Sprite child:", character.spriteChild, true, "", "The sprite Transform, which should be a child GameObject");

            if (character.spriteChild != null && character.spriteChild.GetComponent <Animator>() == null)
            {
                character.customAnimator = (Animator)CustomGUILayout.ObjectField <Animator> ("Animator (if not on s.c.):", character.customAnimator, true, "", "The Animator component, which will be assigned automatically if not set manually.");
            }

            character.moveSpeedParameter = CustomGUILayout.TextField("Move speed float:", character.moveSpeedParameter, "", "The name of the Animator float parameter set to the movement speed");
            character.turnParameter      = CustomGUILayout.TextField("Turn float:", character.turnParameter, "", "The name of the Animator float parameter set to the turning direction");

            if (character.spriteDirectionData.HasDirections())
            {
                character.directionParameter = CustomGUILayout.TextField("Direction integer:", character.directionParameter, "", "The name of the Animator integer parameter set to the sprite direction. This is set to 0 for down, 1 for left, 2 for right, 3 for up, 4 for down-left, 5 for down-right, 6 for up-left, and 7 for up-right");
            }
            character.angleParameter   = CustomGUILayout.TextField("Body angle float:", character.angleParameter, "", "The name of the Animator float parameter set to the facing angle");
            character.headYawParameter = CustomGUILayout.TextField("Head angle float:", character.headYawParameter, "", "The name of the Animator float parameter set to the head yaw");

            if (!string.IsNullOrEmpty(character.angleParameter) || !string.IsNullOrEmpty(character.headYawParameter))
            {
                character.angleSnapping = (AngleSnapping)CustomGUILayout.EnumPopup("Angle snapping:", character.angleSnapping, "", "The snapping method for the 'Body angle float' and 'Head angle float' parameters");
            }

            character.talkParameter = CustomGUILayout.TextField("Talk bool:", character.talkParameter, "", "The name of the Animator bool parameter set to True while talking");

            if (AdvGame.GetReferences() && AdvGame.GetReferences().speechManager)
            {
                if (AdvGame.GetReferences().speechManager.lipSyncOutput == LipSyncOutput.PortraitAndGameObject)
                {
                    character.phonemeParameter = CustomGUILayout.TextField("Phoneme integer:", character.phonemeParameter, "", "The name of the Animator integer parameter set to the lip-syncing phoneme integer");
                }
                else if (AdvGame.GetReferences().speechManager.lipSyncOutput == LipSyncOutput.GameObjectTexture)
                {
                    if (character.GetComponent <LipSyncTexture>() == null)
                    {
                        EditorGUILayout.HelpBox("Attach a LipSyncTexture script to allow texture lip-syncing.", MessageType.Info);
                    }
                }
            }

            if (character.useExpressions)
            {
                character.expressionParameter = CustomGUILayout.TextField("Expression ID integer:", character.expressionParameter, "", "The name of the Animator integer parameter set to the active Expression ID number");
            }

            character.verticalMovementParameter = CustomGUILayout.TextField("Vertical movement float:", character.verticalMovementParameter, "", "The name of the Animator float parameter set to the vertical movement speed");
            character.talkingAnimation          = TalkingAnimation.Standard;

            character.spriteDirectionData.ShowGUI();
            if (character.spriteDirectionData.HasDirections())
            {
                EditorGUILayout.HelpBox("The above field affects the 'Direction integer' parameter only.", MessageType.Info);
            }

            Animator charAnimator = character.GetAnimator();
            if (charAnimator == null || !charAnimator.applyRootMotion)
            {
                character.antiGlideMode = EditorGUILayout.ToggleLeft("Only move when sprite changes?", character.antiGlideMode);

                if (character.antiGlideMode)
                {
                    if (character.GetComponent <Rigidbody2D>())
                    {
                        EditorGUILayout.HelpBox("This feature will disable use of the Rigidbody2D component.", MessageType.Warning);
                    }
                    if (character is Player && AdvGame.GetReferences() != null && AdvGame.GetReferences().settingsManager != null)
                    {
                        if (AdvGame.GetReferences().settingsManager.movementMethod != MovementMethod.PointAndClick && AdvGame.GetReferences().settingsManager.movementMethod != MovementMethod.None)
                        {
                            EditorGUILayout.HelpBox("This feature will not work with collision - it is not recommended for " + AdvGame.GetReferences().settingsManager.movementMethod.ToString() + " movement.", MessageType.Warning);
                        }
                    }
                }
            }

            character.doWallReduction            = EditorGUILayout.BeginToggleGroup("Slow movement near walls?", character.doWallReduction);
            character.wallLayer                  = EditorGUILayout.TextField("Wall collider layer:", character.wallLayer);
            character.wallDistance               = EditorGUILayout.Slider("Collider distance:", character.wallDistance, 0f, 2f);
            character.wallReductionOnlyParameter = EditorGUILayout.Toggle("Only affects Mecanim parameter?", character.wallReductionOnlyParameter);
            EditorGUILayout.EndToggleGroup();

            if (SceneSettings.CameraPerspective != CameraPerspective.TwoD)
            {
                character.rotateSprite3D = (RotateSprite3D)EditorGUILayout.EnumPopup("Rotate sprite to:", character.rotateSprite3D);
            }

            EditorGUILayout.EndVertical();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(character);
            }
                        #endif
        }
示例#12
0
        private void ButtonGUI(Button button, string suffix, InteractionSource source, bool isForInventory = false)
        {
            bool isEnabled = !button.isDisabled;

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

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

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

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

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

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

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

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

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

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

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

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

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

                if (button.playerAction == PlayerAction.WalkTo)
                {
                    button.setProximity = CustomGUILayout.Toggle("Set minimum distance?", button.setProximity, "", "If True, then the Interaction will be run once the Player is within a certain distance of the Hotspot");
                    if (button.setProximity)
                    {
                        button.proximity = CustomGUILayout.FloatField("Proximity:", button.proximity, "", "The proximity the Player must be within");
                    }
                }
            }
        }
示例#13
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;
                        if (GameObject.Find("_Markers"))
                        {
                            go.transform.parent = GameObject.Find("_Markers").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);
        }
        public override NavigationMesh NavigationMeshGUI(NavigationMesh _target)
        {
            _target = base.NavigationMeshGUI(_target);

            _target.characterEvasion = (CharacterEvasion)CustomGUILayout.EnumPopup("Character evasion:", _target.characterEvasion, "", "The condition for which dynamic 2D pathfinding can occur by generating holes around characters");
            if (_target.characterEvasion != CharacterEvasion.None)
            {
                _target.characterEvasionPoints = (CharacterEvasionPoints)CustomGUILayout.EnumPopup("Evasion accuracy:", _target.characterEvasionPoints, "", "The number of vertices created around characters to evade");
                _target.characterEvasionYScale = CustomGUILayout.Slider("Evasion y-scale:", _target.characterEvasionYScale, 0.1f, 1f, "", "The scale of generated character evasion 'holes' in the NavMesh in the y-axis, relative to the x-axis");

                EditorGUILayout.HelpBox("Note: Characters can only be avoided if they have a Circle Collider 2D (no Trigger) component on their base.\n\n" +
                                        "For best results, set a non-zero 'Pathfinding update time' in the Settings Manager.", MessageType.Info);

                if (_target.transform.lossyScale != Vector3.one)
                {
                    EditorGUILayout.HelpBox("For character evasion to work, the NavMesh must have a unit scale (1,1,1).", MessageType.Warning);
                }

                                #if UNITY_ANDROID || UNITY_IOS
                EditorGUILayout.HelpBox("This is an expensive calculation - consider setting this to 'None' for mobile platforms.", MessageType.Warning);
                                #endif
            }

            _target.accuracy    = CustomGUILayout.Slider("Accuracy:", _target.accuracy, 0f, 1f, "", "A float that can be used as an accuracy parameter, should the algorithm require one");
            _target.gizmoColour = CustomGUILayout.ColorField("Gizmo colour:", _target.gizmoColour, "", "The colour of its Gizmo when used for 2D polygons");

            EditorGUILayout.Separator();
            GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
            EditorGUILayout.LabelField("NavMesh holes", EditorStyles.boldLabel);

            for (int i = 0; i < _target.polygonColliderHoles.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                _target.polygonColliderHoles [i] = (PolygonCollider2D)CustomGUILayout.ObjectField <PolygonCollider2D> ("Hole #" + i.ToString() + ":", _target.polygonColliderHoles [i], true, "", "A shape within the boundary of this PolygonCollider2D to create a hole from");

                if (GUILayout.Button("-", GUILayout.MaxWidth(20f)))
                {
                    _target.polygonColliderHoles.RemoveAt(i);
                    i = -1;
                    continue;
                }

                EditorGUILayout.EndHorizontal();

                if (_target.polygonColliderHoles[i] != null && _target.polygonColliderHoles[i].GetComponent <NavMeshBase>())
                {
                    EditorGUILayout.HelpBox("A NavMesh cannot use its own Polygon Collider component as a hole!", MessageType.Warning);
                }
            }

            if (GUILayout.Button("Create new hole"))
            {
                _target.polygonColliderHoles.Add(null);
            }

            if (_target.GetComponent <PolygonCollider2D>() != null)
            {
                int numPolys = _target.GetComponents <PolygonCollider2D>().Length;
                if (numPolys > 1)
                {
                    if (_target.polygonColliderHoles.Count > 0)
                    {
                        EditorGUILayout.HelpBox("Holes will only work if they are within the boundaries of " + _target.gameObject.name + "'s FIRST PolygonCollider component.", MessageType.Warning);
                    }
                    if (_target.characterEvasion != CharacterEvasion.None)
                    {
                        EditorGUILayout.HelpBox("Character-evasion will only work within the boundaries of " + _target.gameObject.name + "'s FIRST PolygonCollider component.", MessageType.Warning);
                    }
                }
            }

            return(_target);
        }
示例#15
0
        private void ShowVarGUI(VariableLocation location, List <VarPreset> _varPresets = null, string apiPrefix = "")
        {
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            EditorGUILayout.LabelField(location + " variable '" + selectedVar.label + "' properties", CustomStyles.subHeader);
            EditorGUILayout.Space();

            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() + "]");
            }
            else
            {
                EditorGUILayout.LabelField("Replacement token:", "[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");
            }
            else if (selectedVar.type == VariableType.String)
            {
                selectedVar.textVal = CustomGUILayout.TextField("Initial value:", selectedVar.textVal, apiPrefix + ".textVal");
            }
            else if (selectedVar.type == VariableType.Float)
            {
                selectedVar.floatVal = CustomGUILayout.FloatField("Initial value:", selectedVar.floatVal, apiPrefix + ".floatVal");
            }

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

            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();
        }
示例#16
0
        /**
         * Shows the GUI.
         */
        public void ShowGUI()
        {
            settingsManager = AdvGame.GetReferences().settingsManager;

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showSettings = CustomGUILayout.ToggleHeader(showSettings, "Global cursor settings");
            if (showSettings)
            {
                cursorRendering = (CursorRendering)CustomGUILayout.EnumPopup("Cursor rendering:", cursorRendering, "AC.KickStarter.cursorManager.cursorRendering", "The rendering method of all cursors");
                if (cursorRendering == CursorRendering.Software)
                {
                    lockSystemCursor = CustomGUILayout.ToggleLeft("Lock system cursor when locking AC cursor?", lockSystemCursor, "AC.KickStarter.cursorManager.lockSystemCursor", "If True, the system cursor will be locked when the AC cursor is");
                }
                forceCursorInEditor = CustomGUILayout.ToggleLeft("Always show system cursor in Editor?", forceCursorInEditor, "AC.KickStarter.cursorManager.forceCursorInEditor");

                if (cursorRendering == CursorRendering.Software)
                {
                    keepCursorWithinScreen = CustomGUILayout.ToggleLeft("Always keep cursor within screen boundary?", keepCursorWithinScreen, "AC.KickStarter.cursorManager.keepCursorWithinScreen", "If True, then the cursor will always be kept within the boundary of the game window");
                }
                else
                {
                    keepCursorWithinScreen = CustomGUILayout.ToggleLeft("Always keep perceived cursor within screen boundary?", keepCursorWithinScreen, "AC.KickStarter.cursorManager.keepCursorWithinScreen", "If True, then the cursor will always be kept within the boundary of the game window");
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showMainCursor = CustomGUILayout.ToggleHeader(showMainCursor, "Main cursor settings");
            if (showMainCursor)
            {
                cursorDisplay = (CursorDisplay)CustomGUILayout.EnumPopup("Display cursor:", cursorDisplay, "AC.KickStarter.cursorManager.cursorDisplay", "The rule that defines when the main cursor is shown");
                if (cursorDisplay != CursorDisplay.Never)
                {
                    allowMainCursor = CustomGUILayout.Toggle("Replace mouse cursor?", allowMainCursor, "AC.KickStarter.cursorManager.allowMainCursor", "If True, then the system's default hardware cursor will replaced with a custom one");
                    if (allowMainCursor || (settingsManager && settingsManager.inputMethod == InputMethod.KeyboardOrController))
                    {
                        IconBaseGUI("", pointerIcon, "AC.KickStarter.cursorManager.pointerIcon", "The game's default cursor", false);
                    }
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showWalkCursor = CustomGUILayout.ToggleHeader(showWalkCursor, "Walk cursor");
            if (showWalkCursor)
            {
                if (allowMainCursor)
                {
                    allowWalkCursor = CustomGUILayout.Toggle("Provide walk cursor?", allowWalkCursor, "AC.KickStarter.cursorManager.allowWalkCursor", "If True, then a separate cursor will display when in 'walk mode'");
                    if (allowWalkCursor)
                    {
                        if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot && allowIconInput)
                        {
                            EditorGUILayout.LabelField("Input button:", "Icon_Walk");
                        }
                        IconBaseGUI("", walkIcon, "AC.KickStarter.cursorManager.walkIcon", "The cursor when in 'walk mode'");
                        onlyWalkWhenOverNavMesh = CustomGUILayout.ToggleLeft("Only show 'Walk' Cursor when over NavMesh?", onlyWalkWhenOverNavMesh, "AC.KickStarter.cursorManager.onlyWalkWhenOverNavMesh", "If True, then the walk cursor will only show when the cursor is hovering over a NavMesh");
                    }
                }
                addWalkPrefix = CustomGUILayout.Toggle("Prefix cursor labels?", addWalkPrefix, "AC.KickStarter.cursorManager.addWalkPrefix", "If True, then a prefix can be added to the Hotspot label when in 'walk mode'");
                if (addWalkPrefix)
                {
                    walkPrefix.label = CustomGUILayout.TextField("Walk prefix:", walkPrefix.label, "AC.KickStarter.cursorManager.walkPrefix");
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showHotspotCursor = CustomGUILayout.ToggleHeader(showHotspotCursor, "Hotspot cursor");
            if (showHotspotCursor)
            {
                addHotspotPrefix = CustomGUILayout.Toggle("Prefix cursor labels?", addHotspotPrefix, "AC.KickStarter.cursorManager.addHotspotPrefix", "If True, then the Cursor's interaction verb will prefix the Hotspot label when hovering over Hotspots");
                IconBaseGUI("", mouseOverIcon, "AC.KickStarter.cursorManager.mouseOverIcon");
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showInventoryCursor = CustomGUILayout.ToggleHeader(showInventoryCursor, "Inventory cursor");
            if (showInventoryCursor)
            {
                inventoryHandling = (InventoryHandling)CustomGUILayout.EnumPopup("When inventory selected:", inventoryHandling, "AC.KickStarter.cursorManager.inventoryHandling", "What happens to the cursor when an inventory item is selected");
                if (inventoryHandling != InventoryHandling.ChangeCursor)
                {
                    onlyShowInventoryLabelOverHotspots = CustomGUILayout.ToggleLeft("Only show label when over Hotspots and Inventory?", onlyShowInventoryLabelOverHotspots, "AC.KickStarter.cursorManager.onlyShowInventoryLabelOverHotspots", "If True, then Hotspot labels will not show when an inventory item is selected unless the cursor is over another inventory item or a Hotspot");
                }
                if (inventoryHandling != InventoryHandling.ChangeHotspotLabel)
                {
                    inventoryCursorSize = CustomGUILayout.FloatField("Inventory cursor size:", inventoryCursorSize, "AC.KickStarter.cursorManager.inventoryCursorSize", "The size of selected inventory item graphics when used as a cursor");
                }
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Use syntax:", GUILayout.Width(100f));
                hotspotPrefix1.label = CustomGUILayout.TextField(hotspotPrefix1.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix1");
                EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f));
                hotspotPrefix2.label = CustomGUILayout.TextField(hotspotPrefix2.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix2");
                EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f));
                EditorGUILayout.EndHorizontal();
                if (AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.CanGiveItems())
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Give syntax:", GUILayout.Width(100f));
                    hotspotPrefix3.label = CustomGUILayout.TextField(hotspotPrefix3.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix3");
                    EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f));
                    hotspotPrefix4.label = CustomGUILayout.TextField(hotspotPrefix4.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix4");
                    EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f));
                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showInteractionIcons = CustomGUILayout.ToggleHeader(showInteractionIcons, "Interaction icons");
            if (showInteractionIcons)
            {
                if (settingsManager == null || settingsManager.interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    allowInteractionCursor = CustomGUILayout.ToggleLeft("Change cursor based on Interaction?", allowInteractionCursor, "AC.KickStarter.cursorManager.allowInteractionCursor", "If True, then the cursor will be controlled by the current Interaction when hovering over a Hotspot");
                    if (allowInteractionCursor && (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive))
                    {
                        allowInteractionCursorForInventory = CustomGUILayout.ToggleLeft("Change when over Inventory items too?", allowInteractionCursorForInventory, "AC.KickStarter.cursorManager.allowInteractionCursorForInventory", "If True, then the cursor will be controlled by the current Interaction when hovering over an inventory item (see InvItem)");
                    }
                    if (settingsManager && settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                    {
                        cycleCursors            = CustomGUILayout.ToggleLeft("Cycle Interactions with right-click?", cycleCursors, "AC.KickStarter.cursorManager.cycleCursors", "If True, then cursor modes can by clicked by right-clicking");
                        allowIconInput          = CustomGUILayout.ToggleLeft("Set Interaction with specific inputs?", allowIconInput, "AC.KickStarter.cursorManager.allowIconInput", "then the player can switch the active icon by invoking a specific input");
                        onlyAnimateOverHotspots = CustomGUILayout.ToggleLeft("Only animate icons when over Hotspots?", onlyAnimateOverHotspots, "AC.KickStarter.cursorManager.onlyAnimateOverHotspots", "If True, then animated cursors will only animate if the cursor is over a Hotspot");
                    }
                }

                IconsGUI();

                EditorGUILayout.Space();

                if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive)
                {
                    LookIconGUI();
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showCutsceneCursor = CustomGUILayout.ToggleHeader(showCutsceneCursor, "Cutscene cursor");
            if (showCutsceneCursor)
            {
                IconBaseGUI("", waitIcon, "AC.KickStarter.cursorManager.waitIcon", "The cursor while the game is running a gameplay-blocking cutscene");
            }
            EditorGUILayout.EndVertical();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(this);
            }
        }
        public override void OnInspectorGUI()
        {
            Paths _target = (Paths)target;

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

            int numNodes = _target.nodes.Count;

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

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Path properties", EditorStyles.boldLabel);
            _target.nodePause = CustomGUILayout.FloatField("Node wait time (s):", _target.nodePause, "", "The time, in seconds, that a character will wait at each node before continuing along the path");
            _target.pathSpeed = (PathSpeed)CustomGUILayout.EnumPopup("Walk or run:", _target.pathSpeed, "", "The speed at which characters will traverse a path");
            _target.pathType  = (AC_PathType)CustomGUILayout.EnumPopup("Path type:", _target.pathType, "", "The way in which characters move between each node");
            if (_target.pathType == AC_PathType.Loop)
            {
                _target.teleportToStart = CustomGUILayout.Toggle("Teleports when looping?", _target.teleportToStart, "", "If True, then the character will teleport to the first node before traversing the path");
            }
            _target.affectY       = CustomGUILayout.Toggle("Override gravity?", _target.affectY, "", "If True, then characters will attempt to move vertically to reach nodes");
            _target.commandSource = (ActionListSource)CustomGUILayout.EnumPopup("Node commands source:", _target.commandSource, "", "The source of ActionList objects that are run when nodes are reached");
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            // List nodes
            ResetCommandList(_target);

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            EditorGUILayout.LabelField("Origin node:");
            ShowNodeCommandGUI(_target, 0);
            EditorGUILayout.EndVertical();

            for (int i = 1; i < _target.nodes.Count; i++)
            {
                EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                EditorGUILayout.BeginHorizontal();

                if (_target.RelativeMode)
                {
                    EditorGUILayout.LabelField("Node " + i + ": " + _target.nodes[i].ToString());
                }
                else
                {
                    _target.nodes[i] = CustomGUILayout.Vector3Field("Node " + i + ": ", _target.nodes[i], "", "");
                }

                if (GUILayout.Button(insertContent, EditorStyles.miniButtonLeft, buttonWidth))
                {
                    Undo.RecordObject(_target, "Add path node");
                    Vector3 newNodePosition;
                    newNodePosition = _target.nodes[i] + new Vector3(1.0f, 0f, 0f);

                    if (i < (_target.nodes.Count - 1) && _target.nodes[i] != _target.nodes[i + 1])
                    {
                        newNodePosition = (_target.nodes[i] + _target.nodes[i + 1]) / 2f;
                    }

                    _target.nodes.Insert(i + 1, newNodePosition);
                    _target.nodeCommands.Insert(i + 1, new NodeCommand());
                    numNodes += 1;
                    ResetCommandList(_target);
                }
                if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(_target, "Delete path node");
                    _target.nodes.RemoveAt(i);
                    _target.nodeCommands.RemoveAt(i);
                    numNodes -= 1;
                    ResetCommandList(_target);
                }

                EditorGUILayout.EndHorizontal();
                ShowNodeCommandGUI(_target, i);
                EditorGUILayout.EndVertical();
            }

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

            if (numNodes > 1)
            {
                bool newRelativeMode = GUILayout.Toggle(_target.RelativeMode, "Lock relative positions?", "Button");
                if (newRelativeMode && _target.RelativeMode != newRelativeMode)
                {
                    _target.LastFramePosition = _target.transform.position;
                }
                _target.RelativeMode = newRelativeMode;
            }
            else
            {
                _target.RelativeMode = false;
            }
            EditorGUILayout.EndHorizontal();

            if (_target.RelativeMode)
            {
                EditorGUILayout.HelpBox("Before saving/exiting the scene, unlock the above button once nodes have been repositioned.", MessageType.Warning);
            }

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

            UnityVersionHandler.CustomSetDirty(_target);
        }
示例#18
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            saveListType = (AC_SaveListType)CustomGUILayout.EnumPopup("List type:", saveListType, apiPrefix + ".savesListType");
            if (saveListType == AC_SaveListType.Save)
            {
                showNewSaveOption = CustomGUILayout.Toggle("Show 'New save' option?", showNewSaveOption, apiPrefix + ".showNewSaveOption");
                if (showNewSaveOption)
                {
                    newSaveText = CustomGUILayout.TextField("'New save' text:", newSaveText, apiPrefix + ".newSaveText");
                }
                autoHandle = CustomGUILayout.Toggle("Save when click on?", autoHandle, apiPrefix + ".autoHandle");
                if (autoHandle)
                {
                    ActionListGUI("ActionList after saving:", menu.title, "After_Saving");
                }
                else
                {
                    ActionListGUI("ActionList when click:", menu.title, "When_Click");
                }
            }
            else if (saveListType == AC_SaveListType.Load)
            {
                autoHandle = CustomGUILayout.Toggle("Load when click on?", autoHandle, apiPrefix + ".autoHandle");
                if (autoHandle)
                {
                    ActionListGUI("ActionList after loading:", menu.title, "After_Loading");
                }
                else
                {
                    ActionListGUI("ActionList when click:", menu.title, "When_Click");
                }
            }
            else if (saveListType == AC_SaveListType.Import)
            {
                autoHandle = true;
                                #if UNITY_STANDALONE
                importProductName  = CustomGUILayout.TextField("Import product name:", importProductName, apiPrefix + ".importProductName");
                importSaveFilename = CustomGUILayout.TextField("Import save filename:", importSaveFilename, apiPrefix + ".importSaveFilename");
                ActionListGUI("ActionList after import:", menu.title, "After_Import");
                checkImportBool = CustomGUILayout.Toggle("Require Bool to be true?", checkImportBool, apiPrefix + ".checkImportBool");
                if (checkImportBool)
                {
                    if (KickStarter.variablesManager != null)
                    {
                        ShowVarGUI(KickStarter.variablesManager.vars);
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("A Variables Manager is required.", MessageType.Warning);
                    }
                    //checkImportVar = CustomGUILayout.IntField ("Global Variable ID:", checkImportVar, apiPrefix + "checkImportVar");
                }
                                #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");

            fixedOption = CustomGUILayout.Toggle("Fixed Save ID only?", fixedOption, apiPrefix + ".fixedOption");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntField("ID to display:", optionToShow, apiPrefix + ".optionToShow");
            }
            else
            {
                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");
                    }
                }
            }

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

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
示例#19
0
        public override void CharSettingsGUI()
        {
                        #if UNITY_EDITOR
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Standard 2D animations:", EditorStyles.boldLabel);

            character.talkingAnimation = (TalkingAnimation)CustomGUILayout.EnumPopup("Talk animation style:", character.talkingAnimation, "", "How talking animations are handled");
            character.spriteChild      = (Transform)CustomGUILayout.ObjectField <Transform> ("Sprite child:", character.spriteChild, true, "", "The sprite Transform, which should be a child GameObject");

            if (character.spriteChild != null && character.spriteChild.GetComponent <Animator>() == null)
            {
                character.customAnimator = (Animator)CustomGUILayout.ObjectField <Animator> ("Animator (if not on s.c.):", character.customAnimator, true, "", "The Animator component, which will be assigned automatically if not set manually.");
            }

            character.idleAnimSprite = CustomGUILayout.TextField("Idle name:", character.idleAnimSprite, "", "The name of the 'Idle' animation(s), without suffix");
            character.walkAnimSprite = CustomGUILayout.TextField("Walk name:", character.walkAnimSprite, "", "The name of the 'Walk' animation(s), without suffix");
            character.runAnimSprite  = CustomGUILayout.TextField("Run name:", character.runAnimSprite, "", "The name of the 'Run' animation(s), without suffix");
            if (character.talkingAnimation == TalkingAnimation.Standard)
            {
                character.talkAnimSprite       = CustomGUILayout.TextField("Talk name:", character.talkAnimSprite, "", "The name of the 'Talk' animation(s), without suffix");
                character.separateTalkingLayer = CustomGUILayout.Toggle("Head on separate layer?", character.separateTalkingLayer, "", "If True, the head animation will be handled on a non-root layer when talking");
                if (character.separateTalkingLayer)
                {
                    character.headLayer = CustomGUILayout.IntField("Head layer:", character.headLayer, "", "The Animator layer used to play head animations while talking");
                    if (character.headLayer < 1)
                    {
                        EditorGUILayout.HelpBox("The head layer index must be 1 or greater.", MessageType.Warning);
                    }
                }
            }

            character.spriteDirectionData.ShowGUI();
            character.angleSnapping = AngleSnapping.None;

            if (character.spriteDirectionData.HasDirections())
            {
                character.frameFlipping = (AC_2DFrameFlipping)CustomGUILayout.EnumPopup("Frame flipping:", character.frameFlipping, "", "The type of frame-flipping to use");
                if (character.frameFlipping != AC_2DFrameFlipping.None)
                {
                    character.flipCustomAnims = CustomGUILayout.Toggle("Flip custom animations?", character.flipCustomAnims, "", "If True, then custom animations will also be flipped");
                }
            }

            character.crossfadeAnims = CustomGUILayout.Toggle("Crossfade animation?", character.crossfadeAnims, "", "If True, characters will crossfade between standard animations");

            Animator charAnimator = character.GetAnimator();
            if (charAnimator == null || !charAnimator.applyRootMotion)
            {
                character.antiGlideMode = CustomGUILayout.ToggleLeft("Only move when sprite changes?", character.antiGlideMode, "", "If True, then sprite-based characters will only move when their sprite frame changes");

                if (character.antiGlideMode)
                {
                    if (character.GetComponent <Rigidbody2D>())
                    {
                        EditorGUILayout.HelpBox("This feature will disable use of the Rigidbody2D component.", MessageType.Warning);
                    }
                    if (character is Player && AdvGame.GetReferences() != null && AdvGame.GetReferences().settingsManager != null)
                    {
                        if (AdvGame.GetReferences().settingsManager.movementMethod != MovementMethod.PointAndClick && AdvGame.GetReferences().settingsManager.movementMethod != MovementMethod.None)
                        {
                            EditorGUILayout.HelpBox("This feature will not work with collision - it is not recommended for " + AdvGame.GetReferences().settingsManager.movementMethod.ToString() + " movement.", MessageType.Warning);
                        }
                    }
                }
            }

            if (SceneSettings.CameraPerspective != CameraPerspective.TwoD)
            {
                character.rotateSprite3D = (RotateSprite3D)CustomGUILayout.EnumPopup("Rotate sprite to:", character.rotateSprite3D, "", "The method by which the character should face the camera");
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(" ", GUILayout.Width(9));
            listExpectedAnimations = EditorGUILayout.Foldout(listExpectedAnimations, "List expected animations?");
            EditorGUILayout.EndHorizontal();
            if (listExpectedAnimations)
            {
                string result = "\n";
                result = ShowExpected(character, character.idleAnimSprite, result, 0);
                result = ShowExpected(character, character.walkAnimSprite, result, 0);
                result = ShowExpected(character, character.runAnimSprite, result, 0);
                if (character.talkingAnimation == TalkingAnimation.Standard)
                {
                    if (character.separateTalkingLayer)
                    {
                        result  = ShowExpected(character, character.idleAnimSprite, result, character.headLayer);
                        result  = ShowExpected(character, character.talkAnimSprite, result, character.headLayer);
                        result += "\n- " + hideHeadClip + "  (" + character.headLayer + ")";
                    }
                    else
                    {
                        result = ShowExpected(character, character.talkAnimSprite, result, 0);
                    }
                }

                EditorGUILayout.HelpBox("The following animations are required, based on the settings above (numbers are the Animator layer indices):" + result, MessageType.Info);
            }

            EditorGUILayout.EndVertical();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(character);
            }
                        #endif
        }
示例#20
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

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

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

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

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

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

            base.ShowGUI(menu);
        }
示例#21
0
        protected void EndGUI(string apiPrefix)
        {
            EditorGUILayout.BeginVertical("Button");
            positionType = (AC_PositionType2)CustomGUILayout.EnumPopup("Position:", positionType, apiPrefix + ".positionType");
            if (positionType == AC_PositionType2.AbsolutePixels)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("X:", GUILayout.Width(15f));
                relativeRect.x = EditorGUILayout.FloatField(relativeRect.x);
                EditorGUILayout.LabelField("Y:", GUILayout.Width(15f));
                relativeRect.y = EditorGUILayout.FloatField(relativeRect.y);
                EditorGUILayout.EndHorizontal();
            }
            else if (positionType == AC_PositionType2.RelativeToMenuSize)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("X:", GUILayout.Width(15f));
                relativePosition.x = EditorGUILayout.Slider(relativePosition.x, 0f, 100f);
                EditorGUILayout.LabelField("Y:", GUILayout.Width(15f));
                relativePosition.y = EditorGUILayout.Slider(relativePosition.y, 0f, 100f);
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            sizeType = (AC_SizeType)CustomGUILayout.EnumPopup("Size:", sizeType, apiPrefix + ".sizeType");
            if (sizeType == AC_SizeType.Manual)
            {
                Vector2 originalSlotSize = slotSize;

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("W:", GUILayout.Width(17f));
                originalSlotSize.x = EditorGUILayout.Slider(slotSize.x, 0f, 100f);
                EditorGUILayout.LabelField("H:", GUILayout.Width(15f));
                originalSlotSize.y = EditorGUILayout.Slider(slotSize.y, 0f, 100f);

                int iconNumber = (doProportionalScaling) ? 11 : 12;
                if (GUILayout.Button("", Resource.NodeSkin.customStyles [iconNumber]))
                {
                    doProportionalScaling = !doProportionalScaling;
                }
                EditorGUILayout.EndHorizontal();

                if (doProportionalScaling)
                {
                    if (!Mathf.Approximately(originalSlotSize.x, slotSize.x))
                    {
                        float proportion = slotSize.y / slotSize.x;
                        originalSlotSize.y = proportion * originalSlotSize.x;
                    }
                    else if (!Mathf.Approximately(originalSlotSize.y, slotSize.y))
                    {
                        float proportion = slotSize.x / slotSize.y;
                        originalSlotSize.x = proportion * originalSlotSize.y;
                    }
                }

                slotSize = originalSlotSize;
            }
            else if (sizeType == AC_SizeType.AbsolutePixels)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Width:", GUILayout.Width(50f));
                slotSize.x = EditorGUILayout.FloatField(slotSize.x);
                EditorGUILayout.LabelField("Height:", GUILayout.Width(50f));
                slotSize.y = EditorGUILayout.FloatField(slotSize.y);
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuLabel)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

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

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

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

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

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

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

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

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

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

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
示例#23
0
        private void PropertiesGUI()
        {
            List <string> binList = new List <string>();

            foreach (InvBin bin in bins)
            {
                binList.Add(bin.label);
            }

            EditorGUILayout.Space();
            CreatePropertiesGUI();
            EditorGUILayout.Space();

            if (selectedInvVar != null && invVars.Contains(selectedInvVar))
            {
                string apiPrefix = "AC.KickStarter.variablesManager.GetProperty (" + selectedInvVar.id + ")";
                EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                EditorGUILayout.LabelField("Inventory property '" + selectedInvVar.label + "' properties", CustomStyles.subHeader);
                EditorGUILayout.Space();

                selectedInvVar.label = CustomGUILayout.TextField("Name:", selectedInvVar.label, apiPrefix + ".label");
                selectedInvVar.type  = (VariableType)CustomGUILayout.EnumPopup("Type:", selectedInvVar.type, apiPrefix + ".type");
                if (selectedInvVar.type == VariableType.PopUp)
                {
                    selectedInvVar.popUps = VariablesManager.PopupsGUI(selectedInvVar.popUps);
                }

                selectedInvVar.limitToCategories = EditorGUILayout.BeginToggleGroup("Limit to set categories?", selectedInvVar.limitToCategories);

                if (bins.Count > 0)
                {
                    List <int> newCategoryIDs = new List <int>();
                    foreach (InvBin bin in bins)
                    {
                        bool usesCategory = false;
                        if (selectedInvVar.categoryIDs.Contains(bin.id))
                        {
                            usesCategory = true;
                        }
                        usesCategory = CustomGUILayout.Toggle("Use in '" + bin.label + "'?", usesCategory, apiPrefix + ".categoryIDs");

                        if (usesCategory)
                        {
                            newCategoryIDs.Add(bin.id);
                        }
                    }
                    selectedInvVar.categoryIDs = newCategoryIDs;
                }
                else if (selectedInvVar.limitToCategories)
                {
                    EditorGUILayout.HelpBox("No categories are defined!", MessageType.Warning);
                }
                EditorGUILayout.EndToggleGroup();

                EditorGUILayout.EndVertical();
            }

            if (GUI.changed)
            {
                foreach (InvItem item in items)
                {
                    RebuildProperties(item);
                }
            }
        }
示例#24
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)
            {
                uiToggle = LinkedUiGUI <Toggle> (uiToggle, "Linked Toggle:", source);
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle");
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
            }

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

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

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

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

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

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

            base.ShowGUI(menu);
        }
示例#25
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            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);
        }
        public override void CharSettingsGUI()
        {
                        #if UNITY_EDITOR
            if (!tk2DIntegration.IsDefinePresent())
            {
                EditorGUILayout.HelpBox("'tk2DIsPresent' must be listed in your Unity Player Setting's 'Scripting define symbols' for AC's 2D Toolkit integration to work.", MessageType.Warning);
            }

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Standard 2D animations", EditorStyles.boldLabel);

            character.talkingAnimation = TalkingAnimation.Standard;
            character.spriteChild      = (Transform)CustomGUILayout.ObjectField <Transform> ("Sprite child:", character.spriteChild, true, "", "The sprite Transform, which should be a child GameObject");
            character.idleAnimSprite   = CustomGUILayout.TextField("Idle name:", character.idleAnimSprite, "", "The name of the 'Idle' animation(s), without suffix");
            character.walkAnimSprite   = CustomGUILayout.TextField("Walk name:", character.walkAnimSprite, "", "The name of the 'Walk' animation(s), without suffix");
            character.runAnimSprite    = CustomGUILayout.TextField("Run name:", character.runAnimSprite, "", "The name of the 'Run' animation(s), without suffix");
            character.talkAnimSprite   = CustomGUILayout.TextField("Talk name:", character.talkAnimSprite, "", "The name of the 'Talk' animation(s), without suffix");

            character.spriteDirectionData.ShowGUI();
            character.angleSnapping = AngleSnapping.None;

            if (character.spriteDirectionData.HasDirections())
            {
                character.frameFlipping = (AC_2DFrameFlipping)CustomGUILayout.EnumPopup("Frame flipping:", character.frameFlipping, "", "The type of frame-flipping to use");
                if (character.frameFlipping != AC_2DFrameFlipping.None)
                {
                    character.flipCustomAnims = CustomGUILayout.Toggle("Flip custom animations?", character.flipCustomAnims, "", "If True, then custom animations will also be flipped");
                }
            }

            if (SceneSettings.CameraPerspective != CameraPerspective.TwoD)
            {
                character.rotateSprite3D = (RotateSprite3D)CustomGUILayout.EnumPopup("Rotate sprite to:", character.rotateSprite3D, "", "The method by which the character should face the camera");
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(" ", GUILayout.Width(9));
            listExpectedAnimations = EditorGUILayout.Foldout(listExpectedAnimations, "List expected animations?");
            EditorGUILayout.EndHorizontal();
            if (listExpectedAnimations)
            {
                string result = "\n";
                result = ShowExpected(character, character.idleAnimSprite, result);
                result = ShowExpected(character, character.walkAnimSprite, result);
                result = ShowExpected(character, character.runAnimSprite, result);
                if (character.talkingAnimation == TalkingAnimation.Standard)
                {
                    result = ShowExpected(character, character.talkAnimSprite, result);
                }

                EditorGUILayout.HelpBox("The following animations are required, based on the settings above:" + result, MessageType.Info);
            }

            EditorGUILayout.EndVertical();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(character);
            }
                        #endif
        }
示例#27
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuSlider)";

            MenuSource source = menu.menuSource;

            CustomGUILayout.BeginVertical();

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

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

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

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

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

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


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

            CustomGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
示例#28
0
        public void ShowGUI()
        {
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showEditing = CustomGUILayout.ToggleHeader(showEditing, "ActionList editing settings");
            if (showEditing)
            {
                displayActionsInInspector   = CustomGUILayout.ToggleLeft("List Actions in Inspector window?", displayActionsInInspector, "AC.KickStarter.actionsManager.displayActionsInInspector");
                displayActionsInEditor      = (DisplayActionsInEditor)CustomGUILayout.EnumPopup("Actions in Editor are:", displayActionsInEditor, "AC.KickStarter.actionsManager.displayActionsInEditor");
                actionListEditorScrollWheel = (ActionListEditorScrollWheel)CustomGUILayout.EnumPopup("Using scroll-wheel:", actionListEditorScrollWheel, "AC.KickStarter.actionsManager.actionListEditorScrollWheel");

                if (actionListEditorScrollWheel == ActionListEditorScrollWheel.ZoomsWindow)
                {
                    EditorGUILayout.HelpBox("Panning is possible by holding down the middle-mouse button.", MessageType.Info);
                }

                panSpeed      = CustomGUILayout.FloatField((actionListEditorScrollWheel == ActionListEditorScrollWheel.PansWindow) ? "Panning speed:" : "Zoom speed:", panSpeed, "AC.KickStarter.actionsManager.panSpeed");
                invertPanning = CustomGUILayout.ToggleLeft("Invert panning in ActionList Editor?", invertPanning, "AC.KickStarter.actionsManager.invertPanning");
                allowMultipleActionListWindows = CustomGUILayout.ToggleLeft("Allow multiple ActionList Editor windows?", allowMultipleActionListWindows, "AC.KickStarter.actionsManager.allowMultipleActionListWindows");
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showCustom = CustomGUILayout.ToggleHeader(showCustom, "Custom Action scripts");
            if (showCustom)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Folder to search:", GUILayout.Width(110f));
                GUILayout.Label(customFolderPath, EditorStyles.textField);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Set directory", EditorStyles.miniButtonLeft))
                {
                    string path     = EditorUtility.OpenFolderPanel("Set custom Actions directory", "Assets", "");
                    string dataPath = Application.dataPath;
                    if (path.Contains(dataPath))
                    {
                        if (path == dataPath)
                        {
                            customFolderPath = "";
                        }
                        else
                        {
                            customFolderPath = path.Replace(dataPath + "/", "");
                        }
                    }
                    else
                    {
                        ACDebug.LogError("Cannot set new directory - be sure to select within the Assets directory.");
                    }
                }
                if (GUILayout.Button("Clear", EditorStyles.miniButtonRight))
                {
                    customFolderPath = "";
                }
                GUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();

            if (AllActions.Count > 0)
            {
                GUILayout.Space(10);

                Upgrade();

                EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                showCategories = CustomGUILayout.ToggleHeader(showCategories, "Action categories");
                if (showCategories)
                {
                    ActionCategory[] categories = (ActionCategory[])System.Enum.GetValues(typeof(ActionCategory));

                    for (int i = 0; i < categories.Length; i++)
                    {
                        toggles[i] = GUILayout.Toggle(toggles[i], categories[i].ToString(), "Button");
                        if (toggles[i])
                        {
                            int j = -1;
                            foreach (ActionType subclass in AllActions)
                            {
                                if (subclass.category == categories[i])
                                {
                                    j++;
                                    int enabledIndex = -1;
                                    if (EnabledActions.Contains(subclass))
                                    {
                                        enabledIndex = EnabledActions.IndexOf(subclass);
                                    }

                                    if (selectedClass != null && subclass.category == selectedClass.category && subclass.title == selectedClass.title)
                                    {
                                        EditorGUILayout.BeginVertical("Button");
                                        SpeechLine.ShowField("Name:", subclass.GetFullTitle(), false);
                                        SpeechLine.ShowField("Filename:", subclass.fileName + ".cs", false);
                                        SpeechLine.ShowField("Description:", subclass.description, true);
                                        subclass.isEnabled = true;
                                        EditorGUILayout.BeginHorizontal();
                                        if (enabledIndex >= 0)
                                        {
                                            if (!string.IsNullOrEmpty(defaultClassName) && subclass.fileName == defaultClassName)
                                            {
                                                EditorGUILayout.LabelField("DEFAULT", CustomStyles.subHeader, GUILayout.Width(140f));
                                            }
                                            else if (subclass.isEnabled)
                                            {
                                                if (GUILayout.Button("Make default?", GUILayout.Width(140f)))
                                                {
                                                    if (EnabledActions.Contains(subclass))
                                                    {
                                                        defaultClassName = subclass.fileName;
                                                    }
                                                }
                                            }
                                        }
                                        subclass.color = EditorGUILayout.ColorField("Node colour:", subclass.color);

                                        EditorGUILayout.EndHorizontal();
                                        EditorGUILayout.BeginHorizontal();

                                        if (GUILayout.Button("Search local instances"))
                                        {
                                            SearchForInstances(true, subclass);
                                        }
                                        if (GUILayout.Button("Search all instances"))
                                        {
                                            if (UnityVersionHandler.SaveSceneIfUserWants())
                                            {
                                                SearchForInstances(false, subclass);
                                            }
                                        }

                                        EditorGUILayout.EndHorizontal();
                                        EditorGUILayout.EndVertical();
                                    }
                                    else
                                    {
                                        EditorGUILayout.BeginHorizontal();
                                        if (GUILayout.Button(j.ToString() + ": " + subclass.GetFullTitle(), EditorStyles.label, GUILayout.Width(200f)))
                                        {
                                            selectedClass = subclass;
                                        }
                                        if (!string.IsNullOrEmpty(defaultClassName) && subclass.fileName == defaultClassName)
                                        {
                                            EditorGUILayout.LabelField("DEFAULT", CustomStyles.subHeader, GUILayout.Width(60f));
                                        }
                                        EditorGUILayout.EndHorizontal();
                                        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                                    }
                                }
                            }
                            if (j < 0)
                            {
                                EditorGUILayout.HelpBox("There are no Actions of this category type present!", MessageType.Info);
                            }
                        }
                    }
                }
                EditorGUILayout.EndVertical();

                if (defaultClass > EnabledActions.Count - 1)
                {
                    defaultClass = EnabledActions.Count - 1;
                }
            }
            else
            {
                EditorGUILayout.HelpBox("No Action subclass files found.", MessageType.Warning);
            }

            if (GUI.changed)
            {
                SetEnabled();
                Upgrade();
                EditorUtility.SetDirty(this);
            }
        }
示例#29
0
        public override void CharSettingsGUI()
        {
                        #if UNITY_EDITOR
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Standard 3D animations", EditorStyles.boldLabel);

            if (SceneSettings.IsTopDown())
            {
                character.spriteChild = (Transform)CustomGUILayout.ObjectField <Transform> ("Animation child:", character.spriteChild, true, "", "The child object that contains the Animation component");
            }
            else
            {
                character.spriteChild = null;
            }

            character.talkingAnimation = (TalkingAnimation)CustomGUILayout.EnumPopup("Talk animation style:", character.talkingAnimation, "", "How talking animations are handled");
            character.idleAnim         = (AnimationClip)CustomGUILayout.ObjectField <AnimationClip> ("Idle:", character.idleAnim, false, "", "The 'Idle' animation");
            character.walkAnim         = (AnimationClip)CustomGUILayout.ObjectField <AnimationClip> ("Walk:", character.walkAnim, false, "", "The 'Walk' animation");
            character.runAnim          = (AnimationClip)CustomGUILayout.ObjectField <AnimationClip> ("Run:", character.runAnim, false, "", "The 'Run' animation");
            if (character.talkingAnimation == TalkingAnimation.Standard)
            {
                character.talkAnim = (AnimationClip)CustomGUILayout.ObjectField <AnimationClip> ("Talk:", character.talkAnim, false, "", "The 'Talk' animation");
            }

            if (AdvGame.GetReferences() && AdvGame.GetReferences().speechManager)
            {
                if (AdvGame.GetReferences() && AdvGame.GetReferences().speechManager&&
                    AdvGame.GetReferences().speechManager.lipSyncMode != LipSyncMode.Off && AdvGame.GetReferences().speechManager.lipSyncMode != LipSyncMode.FaceFX)
                {
                    if (AdvGame.GetReferences().speechManager.lipSyncOutput == LipSyncOutput.PortraitAndGameObject)
                    {
                        if (character.GetShapeable())
                        {
                            character.lipSyncGroupID = ActionBlendShape.ShapeableGroupGUI("Phoneme shape group:", character.GetShapeable().shapeGroups, character.lipSyncGroupID);
                            character.lipSyncBlendShapeSpeedFactor = CustomGUILayout.Slider("Shapeable speed factor:", character.lipSyncBlendShapeSpeedFactor, 0f, 1f, "", "The rate at which Blendshapes will be animated when using a Shapeable component, with 1 = normal speed and lower = faster speed");
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("Attach a Shapeable script to show phoneme options", MessageType.Info);
                        }
                    }
                    else if (AdvGame.GetReferences().speechManager.lipSyncOutput == LipSyncOutput.GameObjectTexture)
                    {
                        if (character.GetComponent <LipSyncTexture>() == null)
                        {
                            EditorGUILayout.HelpBox("Attach a LipSyncTexture script to allow texture lip-syncing.", MessageType.Info);
                        }
                    }
                }
            }

            character.turnLeftAnim      = (AnimationClip)CustomGUILayout.ObjectField <AnimationClip> ("Turn left:", character.turnLeftAnim, false, "", "The 'Turn left' animation");
            character.turnRightAnim     = (AnimationClip)CustomGUILayout.ObjectField <AnimationClip> ("Turn right:", character.turnRightAnim, false, "", "The 'Turn right' animation");
            character.headLookLeftAnim  = (AnimationClip)CustomGUILayout.ObjectField <AnimationClip> ("Head look left:", character.headLookLeftAnim, false, "", "The 'Look left' animation");
            character.headLookRightAnim = (AnimationClip)CustomGUILayout.ObjectField <AnimationClip> ("Head look right:", character.headLookRightAnim, false, "", "The 'Look right' animation");
            character.headLookUpAnim    = (AnimationClip)CustomGUILayout.ObjectField <AnimationClip> ("Head look up:", character.headLookUpAnim, false, "", "The 'Look up' animation");
            character.headLookDownAnim  = (AnimationClip)CustomGUILayout.ObjectField <AnimationClip> ("Head look down:", character.headLookDownAnim, false, "", "The 'Look down' animation");

            Player player = character as Player;
            if (player != null)
            {
                player.jumpAnim = (AnimationClip)CustomGUILayout.ObjectField <AnimationClip> ("Jump:", player.jumpAnim, false, "", "The 'Jump' animation");
            }
            EditorGUILayout.EndVertical();

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

            character.upperBodyBone = (Transform)CustomGUILayout.ObjectField <Transform> ("Upper body:", character.upperBodyBone, true, "", "The 'Upper body bone' Transform, used to isolate animations");
            character.neckBone      = (Transform)CustomGUILayout.ObjectField <Transform> ("Neck bone:", character.neckBone, true, "", "The 'Neck bone' Transform, used to isolate animations");
            character.leftArmBone   = (Transform)CustomGUILayout.ObjectField <Transform> ("Left arm:", character.leftArmBone, true, "", "The 'Left arm bone' Transform, used to isolate animations");
            character.rightArmBone  = (Transform)CustomGUILayout.ObjectField <Transform> ("Right arm:", character.rightArmBone, true, "", "The 'Right arm bone' Transform, used to isolate animations");
            character.leftHandBone  = (Transform)CustomGUILayout.ObjectField <Transform> ("Left hand:", character.leftHandBone, true, "", "The 'Left hand bone' Transform, used to isolate animations");
            character.rightHandBone = (Transform)CustomGUILayout.ObjectField <Transform> ("Right hand:", character.rightHandBone, true, "", "The 'Right hand bone' Transform, used to isolate animations");
            EditorGUILayout.EndVertical();

            if (GUI.changed && character != null)
            {
                EditorUtility.SetDirty(character);
            }
                        #endif
        }
示例#30
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuButton)";

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

            if (source != MenuSource.AdventureCreator)
            {
                uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source, "The Unity UI Button this is linked to");
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle", "The method by which this element is hidden from view when made invisible");
                uiPointerState        = (UIPointerState)CustomGUILayout.EnumPopup("Responds to:", uiPointerState, apiPrefix + ".uiPointerState", "What pointer state registers as a 'click' for Unity UI Menus");
                CustomGUILayout.EndVertical();
                CustomGUILayout.BeginVertical();
            }

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

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

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

            base.ShowGUI(menu);
        }