public override void OnInspectorGUI()
        {
            FootstepSounds _target = (FootstepSounds)target;

            EditorGUILayout.Space();
            _target.footstepSounds = ShowClipsGUI(_target.footstepSounds, "Walking sounds");
            EditorGUILayout.Space();
            _target.runSounds = ShowClipsGUI(_target.runSounds, "Running sounds (optional)");
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical("Button");
            _target.character = (Char)CustomGUILayout.ObjectField <Char> ("Character:", _target.character, true, "", "The Player or NPC that this component is for");
            if (_target.doGroundedCheck)
            {
                _target.doGroundedCheck = CustomGUILayout.ToggleLeft("Only play when grounded?", _target.doGroundedCheck, "", "If True, sounds will only play when the character is grounded");
            }
            _target.soundToPlayFrom = (Sound)CustomGUILayout.ObjectField <Sound> ("Sound to play from:", _target.soundToPlayFrom, true, "", "The Sound object to play from");

            _target.footstepPlayMethod = (FootstepSounds.FootstepPlayMethod)CustomGUILayout.EnumPopup("Play sounds:", _target.footstepPlayMethod, "", "How the sounds are played");
            if (_target.footstepPlayMethod == FootstepSounds.FootstepPlayMethod.Automatically)
            {
                _target.walkSeparationTime = CustomGUILayout.FloatField("Walking separation time (s):", _target.walkSeparationTime, "", "The separation time between sounds when walking");
                _target.runSeparationTime  = CustomGUILayout.FloatField("Running separation time (s):", _target.runSeparationTime, "", "The separation time between sounds when running");
            }
            else if (_target.footstepPlayMethod == FootstepSounds.FootstepPlayMethod.ViaAnimationEvents)
            {
                EditorGUILayout.HelpBox("A sound will be played whenever this component's PlayFootstep function is run. This component should be placed on the same GameObject as the Animator.", MessageType.Info);
            }
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
        public override void OnInspectorGUI()
        {
            DragTrack_Hinge _target = (DragTrack_Hinge)target;

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

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

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

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

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

            EditorGUILayout.EndVertical();

            SharedGUI(false);
        }
예제 #3
0
        public override void OnInspectorGUI()
        {
            DragTrack_Curved _target = (DragTrack_Curved)target;

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

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

            _target.doLoop = CustomGUILayout.Toggle("Is looped?", _target.doLoop, "", "If True, then the track forms a complete loop");
            if (!_target.doLoop)
            {
                _target.maxAngle = CustomGUILayout.FloatField("Maximum angle:", _target.maxAngle, "", "The angle of the tracks's curve");

                if (_target.maxAngle > 360f)
                {
                    _target.maxAngle = 360f;
                }
            }

            EditorGUILayout.EndVertical();

            SharedGUI(true);
        }
예제 #4
0
        public override void OnInspectorGUI()
        {
            PlayerStart _target = (PlayerStart)target;

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

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

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

            UnityVersionHandler.CustomSetDirty(_target);
        }
예제 #5
0
        private void ShowEditingGUI()
        {
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showEditing = CustomGUILayout.ToggleHeader(showEditing, "ActionList editing settings");
            if (showEditing)
            {
                displayActionsInInspector   = CustomGUILayout.Toggle("List Actions in Inspector?", displayActionsInInspector, "AC.KickStarter.actionsManager.displayActionsInInspector", "If True, then Actions can be displayed in an ActionList's Inspector window");
                displayActionsInEditor      = (DisplayActionsInEditor)CustomGUILayout.EnumPopup("Actions in Editor are:", displayActionsInEditor, "AC.KickStarter.actionsManager.displayActionsInEditor", "How Actions are arranged in the ActionList Editor window");
                actionListEditorScrollWheel = (ActionListEditorScrollWheel)CustomGUILayout.EnumPopup("Using scroll-wheel:", actionListEditorScrollWheel, "AC.KickStarter.actionsManager.actionListEditorScrollWheel", "The effect the mouse scrollwheel has inside the ActionList Editor window");

                                #if UNITY_EDITOR_OSX
                string altKey = "Option";
                                #else
                string altKey = "Alt";
                                #endif
                if (actionListEditorScrollWheel == ActionListEditorScrollWheel.ZoomsWindow)
                {
                    EditorGUILayout.HelpBox("Panning is possible by holding down the middle-mouse button, or by scrolling with the " + altKey + " key pressed.", MessageType.Info);
                }
                else
                {
                    EditorGUILayout.HelpBox("Zooming is possible by scrolling with the " + altKey + " key pressed.", MessageType.Info);
                }

                autoPanNearWindowEdge = CustomGUILayout.Toggle("Auto-panning in Editor?", autoPanNearWindowEdge, "AC.KickStarter.actionListManager.autoPanNearWindowEdge", "If True, the ActionList Editor will pan automatically when dragging the cursor near the window's edge");
                panSpeed      = CustomGUILayout.FloatField((actionListEditorScrollWheel == ActionListEditorScrollWheel.PansWindow) ? "Panning speed:" : "Zoom speed:", panSpeed, "AC.KickStarter.actionsManager.panSpeed", "The speed factor for panning/zooming");
                invertPanning = CustomGUILayout.Toggle("Invert panning in Editor?", invertPanning, "AC.KickStarter.actionsManager.invertPanning", "If True, then panning is inverted in the ActionList Editor window (useful for Macbooks)");
                allowMultipleActionListWindows = CustomGUILayout.Toggle("Allow multiple Editors?", allowMultipleActionListWindows, "AC.KickStarter.actionsManager.allowMultipleActionListWindows", "If True, then multiple ActionList Editor windows can be opened at once");
            }
            EditorGUILayout.EndVertical();
        }
        public override void OnInspectorGUI()
        {
            if (_target)
            {
                _target.Upgrade();
            }
            else
            {
                return;
            }

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Conversation settings", EditorStyles.boldLabel);
            _target.interactionSource = (AC.InteractionSource)CustomGUILayout.EnumPopup("Interaction source:", _target.interactionSource, "", "The source of the commands that are run when an option is chosen");
            _target.autoPlay          = CustomGUILayout.Toggle("Auto-play lone option?", _target.autoPlay, "", "If True, and only one option is available, then the option will be chosen automatically");
            _target.isTimed           = CustomGUILayout.Toggle("Is timed?", _target.isTimed, "", "If True, then the Conversation is timed, and the options will only be shown for a fixed period");
            if (_target.isTimed)
            {
                _target.timer = CustomGUILayout.FloatField("Timer length (s):", _target.timer, "", "The duration, in seconds, that the Conversation is active");

                if (_target.options != null && _target.options.Count > 0)
                {
                    bool noDefault = (_target.defaultOption < 0);
                    noDefault = CustomGUILayout.Toggle("End if timer runs out?", noDefault, "", "If True, the Conversation will end when the timer runs out - and no option will be chosen");
                    if (noDefault)
                    {
                        _target.defaultOption = -1;
                    }
                    else if (_target.defaultOption < 0)
                    {
                        _target.defaultOption = 0;
                    }
                }
                else
                {
                    _target.defaultOption = -1;
                }
            }
            if (GUILayout.Button("Conversation Editor"))
            {
                ConversationEditorWindow window = (ConversationEditorWindow)EditorWindow.GetWindow(typeof(ConversationEditorWindow));
                window.Repaint();
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            CreateOptionsGUI();
            EditorGUILayout.Space();

            if (_target.selectedOption != null && _target.options.Contains(_target.selectedOption))
            {
                EditorGUILayout.LabelField("Dialogue option '" + _target.selectedOption.label + "' properties", EditorStyles.boldLabel);
                EditOptionGUI(_target.selectedOption, _target.interactionSource);
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
예제 #7
0
        public void SnapDataGUI(DragTrack _target, bool useAngles)
        {
            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Track regions", EditorStyles.boldLabel);

            for (int i = 0; i < _target.allTrackSnapData.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Region " + _target.allTrackSnapData[i].ID.ToString());
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("-"))
                {
                    Undo.RecordObject(this, "Delete region");
                    _target.allTrackSnapData.RemoveAt(i);
                    i = -1;
                    break;
                }
                EditorGUILayout.EndHorizontal();

                _target.allTrackSnapData[i] = _target.allTrackSnapData[i].ShowGUI(_target, useAngles);
                EditorGUILayout.Space();

                if (i < _target.allTrackSnapData.Count - 1)
                {
                    GUILayout.Box(string.Empty, GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }
            }
            if (GUILayout.Button("Create new track region"))
            {
                Undo.RecordObject(this, "Create track region");
                TrackSnapData trackSnapData = new TrackSnapData(0f, GetSnapIDArray(_target.allTrackSnapData));
                _target.allTrackSnapData.Add(trackSnapData);
            }

            CustomGUILayout.EndVertical();

            if (_target.allTrackSnapData.Count > 0)
            {
                CustomGUILayout.BeginVertical();
                EditorGUILayout.LabelField("Snapping", EditorStyles.boldLabel);

                _target.doSnapping = CustomGUILayout.Toggle("Enable region snapping?", _target.doSnapping, string.Empty, "If True, then snapping is enabled and any object attached to the track can snap to pre-set regions along it when let go by the player");
                if (_target.doSnapping)
                {
                    _target.snapSpeed = CustomGUILayout.FloatField("Snap speed:", _target.snapSpeed, string.Empty, "The speed to move by when attached objects snap");
                    _target.onlySnapOnPlayerRelease = CustomGUILayout.Toggle("Only snap on release?", _target.onlySnapOnPlayerRelease, string.Empty, "If True, then snapping will only occur when the player releases the object - and not when moving on its own accord");
                    _target.actionListSource        = (ActionListSource)CustomGUILayout.EnumPopup("ActionList source:", _target.actionListSource, string.Empty, "The source of ActionLists that can be run when a draggable option snaps to a region.");
                }

                CustomGUILayout.EndVertical();
            }


            UnityVersionHandler.CustomSetDirty(_target);
        }
예제 #8
0
 protected void NPC_GUI(NPC _target)
 {
     CustomGUILayout.BeginVertical();
     EditorGUILayout.LabelField("NPC settings:", EditorStyles.boldLabel);
     _target.moveOutOfPlayersWay = CustomGUILayout.Toggle("Keep out of Player's way?", _target.moveOutOfPlayersWay, "", "If True, the NPC will attempt to keep out of the Player's way");
     if (_target.moveOutOfPlayersWay)
     {
         _target.minPlayerDistance = CustomGUILayout.FloatField("Min. distance to keep:", _target.minPlayerDistance, "", "The minimum distance to keep from the Player");
     }
     CustomGUILayout.EndVertical();
 }
예제 #9
0
        public override void OnInspectorGUI()
        {
            GameCamera2DDrag _target = (GameCamera2DDrag)target;

            // X
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("X movement", "How movement along the X-axis is affected"), EditorStyles.boldLabel, GUILayout.Width(130f));
            _target.xLock = (RotationLock)EditorGUILayout.EnumPopup(_target.xLock);
            EditorGUILayout.EndHorizontal();
            if (_target.xLock != RotationLock.Locked)
            {
                _target.xSpeed        = CustomGUILayout.FloatField("Speed:", _target.xSpeed, "", "The speed of X-axis movement");
                _target.xAcceleration = CustomGUILayout.FloatField("Acceleration:", _target.xAcceleration, "", "The acceleration of X-axis movement");
                _target.xDeceleration = CustomGUILayout.FloatField("Deceleration:", _target.xDeceleration, "", "The deceleration of X-axis movement");
                _target.invertX       = CustomGUILayout.Toggle("Invert?", _target.invertX, "", "If True, then X-axis movement will be inverted");
                _target.xOffset       = CustomGUILayout.FloatField("Offset:", _target.xOffset, "", "The X-axis offset");

                if (_target.xLock == RotationLock.Limited)
                {
                    _target.minX = CustomGUILayout.FloatField("Minimum X:", _target.minX, "", "The minimum X-axis value");
                    _target.maxX = CustomGUILayout.FloatField("Maximum X:", _target.maxX, "", "The maximum X-axis value");
                }
            }
            EditorGUILayout.EndVertical();

            // Y
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Y movement", "How movement along the Y-axis is affected"), EditorStyles.boldLabel, GUILayout.Width(130f));
            _target.yLock = (RotationLock)EditorGUILayout.EnumPopup(_target.yLock);
            EditorGUILayout.EndHorizontal();
            if (_target.yLock != RotationLock.Locked)
            {
                _target.ySpeed        = CustomGUILayout.FloatField("Speed:", _target.ySpeed, "", "The speed of Y-axis movement");
                _target.yAcceleration = CustomGUILayout.FloatField("Acceleration:", _target.yAcceleration, "", "The acceleration of Y-axis movement");
                _target.yDeceleration = CustomGUILayout.FloatField("Deceleration:", _target.yDeceleration, "", "The deceleration of Y-axis movement");
                _target.invertY       = CustomGUILayout.Toggle("Invert?", _target.invertY, "", "If True, then Y-axis movement will be inverted");
                _target.yOffset       = CustomGUILayout.FloatField("Offset:", _target.yOffset, "", "The Y-axis offset");

                if (_target.yLock == RotationLock.Limited)
                {
                    _target.minY = CustomGUILayout.FloatField("Minimum Y:", _target.minY, "", "The minimum Y-axis value");
                    _target.maxY = CustomGUILayout.FloatField("Maximum Y:", _target.maxY, "", "The maximum Y-axis value");
                }
            }
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
예제 #10
0
        public override void OnInspectorGUI()
        {
            DragTrack_Hinge _target = (DragTrack_Hinge)target;

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

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

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

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

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

            CustomGUILayout.EndVertical();

            SnapDataGUI(_target, true);

            UnityVersionHandler.CustomSetDirty(_target);
        }
예제 #11
0
        public override void OnInspectorGUI()
        {
            DragTrack_Curved _target = (DragTrack_Curved)target;

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

            _target.radius = CustomGUILayout.FloatField("Radius:", _target.radius, "", "The track's radius");
            if (_target.radius < 0f)
            {
                _target.radius = 0f;
            }

            _target.handleColour = CustomGUILayout.ColorField("Handles colour:", _target.handleColour, "", "The colour of Scene window Handles");

            _target.doLoop = CustomGUILayout.Toggle("Is looped?", _target.doLoop, "", "If True, then the track forms a complete loop");
            if (!_target.doLoop)
            {
                _target.maxAngle = CustomGUILayout.Slider("Maximum angle:", _target.maxAngle, 0f, 360, "", "The angle of the tracks's curve");
            }
            _target.dragMovementCalculation = (DragMovementCalculation)CustomGUILayout.EnumPopup("Movement input:", _target.dragMovementCalculation);
            if (_target.dragMovementCalculation == DragMovementCalculation.CursorPosition && !_target.Loops)
            {
                _target.preventEndToEndJumping = CustomGUILayout.ToggleLeft("Prevent end-to-end jumping?", _target.preventEndToEndJumping, "", "If True, then the dragged object will be prevented from jumping from one end to the other without first moving somewhere in between");
            }
            _target.discSize = CustomGUILayout.Slider("Gizmo size:", _target.discSize, 0f, 2f, "", "The size of the track's ends, as seen in the Scene window");



            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("End-colliders", EditorStyles.boldLabel);

            if (!_target.Loops)
            {
                _target.generateColliders = CustomGUILayout.Toggle("Generate end-colliders?", _target.generateColliders);
            }
            if (_target.generateColliders && !_target.Loops)
            {
                _target.colliderMaterial = (PhysicMaterial)CustomGUILayout.ObjectField <PhysicMaterial> ("Material:", _target.colliderMaterial, false, "", "Physics Material to give the track's end colliders");
            }

            EditorGUILayout.EndVertical();

            SnapDataGUI(_target, true);

            UnityVersionHandler.CustomSetDirty(_target);
        }
예제 #12
0
        public override void OnInspectorGUI()
        {
            _Camera _target = (_Camera)target;

            EditorGUILayout.HelpBox("Attach this script to a custom Camera type to integrate it with Adventure Creator.", MessageType.Info);

            _target.isFor2D = CustomGUILayout.Toggle("Is for a 2D game?", _target.isFor2D, "", "Check this box if the scene is in 2D, i.e. makes use of 2D Colliders and Raycasts");

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Depth of field", EditorStyles.boldLabel);
            _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.");
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
예제 #13
0
        protected void SharedGUIOne(AC.Char _target)
        {
            _target.GetAnimEngine();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Animation settings:", EditorStyles.boldLabel);
            _target.animationEngine = (AnimationEngine)CustomGUILayout.EnumPopup("Animation engine:", _target.animationEngine, "", "The animation engine that the character relies on for animation playback");
            if (_target.animationEngine == AnimationEngine.Custom)
            {
                _target.customAnimationClass = CustomGUILayout.TextField("Script name:", _target.customAnimationClass, "", "The class name of the AnimEngine ScriptableObject subclass that animates the character");
            }
            _target.motionControl = (MotionControl)CustomGUILayout.EnumPopup("Motion control:", _target.motionControl, "", "How motion is controlled");
            EditorGUILayout.EndVertical();

            _target.GetAnimEngine().CharSettingsGUI();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Movement settings:", EditorStyles.boldLabel);

            if (_target.GetMotionControl() == MotionControl.Automatic)
            {
                _target.walkSpeedScale       = CustomGUILayout.FloatField("Walk speed scale:", _target.walkSpeedScale, "", "The movement speed when walking");
                _target.runSpeedScale        = CustomGUILayout.FloatField("Run speed scale:", _target.runSpeedScale, "", "The movement speed when running");
                _target.acceleration         = CustomGUILayout.FloatField("Acceleration:", _target.acceleration, "", "The acceleration factor");
                _target.deceleration         = CustomGUILayout.FloatField("Deceleration:", _target.deceleration, "", "The deceleration factor");
                _target.runDistanceThreshold = CustomGUILayout.FloatField("Minimum run distance:", _target.runDistanceThreshold, "", "The minimum distance between the character and its destination for running to be possible");
            }
            if (_target.GetMotionControl() != MotionControl.Manual)
            {
                _target.turnSpeed = CustomGUILayout.FloatField("Turn speed:", _target.turnSpeed, "", "The turn speed");

                if (_target.GetAnimEngine().isSpriteBased)
                {
                    _target.turn2DCharactersIn3DSpace = CustomGUILayout.Toggle("Turn root object in 3D?", _target.turn2DCharactersIn3DSpace, "", "If True, then the root object of a 2D, sprite-based character will rotate around the Z-axis. Otherwise, turning will be simulated and the actual rotation will be unaffected");
                }
            }
            _target.turnBeforeWalking = CustomGUILayout.Toggle("Turn before walking?", _target.turnBeforeWalking, "", "If True, the character will turn on the spot to face their destination before moving");
            _target.retroPathfinding  = CustomGUILayout.Toggle("Retro-style movement?", _target.retroPathfinding, "", "Enables 'retro-style' movement when pathfinding, where characters ignore Acceleration and Deceleration values, and turn instantly when moving");

            _target.headTurnSpeed = CustomGUILayout.Slider("Head turn speed:", _target.headTurnSpeed, 0.1f, 20f, "", "The speed of head-turning");
            if (_target is Player && AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.PlayerCanReverse())
            {
                _target.reverseSpeedFactor = CustomGUILayout.Slider("Reverse speed factor:", _target.reverseSpeedFactor, 0f, 1f, "", "The factor by which speed is reduced when reversing");
            }

            EditorGUILayout.EndVertical();
        }
예제 #14
0
        public override void OnInspectorGUI()
        {
            PlayerStart _target = (PlayerStart)target;

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

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

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

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

            CustomGUILayout.EndVertical();

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

            UnityVersionHandler.CustomSetDirty(_target);
        }
예제 #15
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.BeginVertical("Button");
            _target.reactsTo = (ParallaxReactsTo)CustomGUILayout.EnumPopup("Reacts to:", _target.reactsTo, "", "What entity affects the parallax behaviour");
            _target.depth    = CustomGUILayout.FloatField("Depth:", _target.depth, "", "The intensity of the depth effect. Positive values will make the GameObject appear further away (i.e. in the background), negative values will make it appear closer to the camera (i.e. in the foreground).");
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            _target.xScroll = CustomGUILayout.Toggle("Scroll in X direction?", _target.xScroll, "", "If True, then the GameObject will scroll in the X-axis");
            if (_target.xScroll)
            {
                _target.xOffset = CustomGUILayout.FloatField("Offset:", _target.xOffset, "", "An offset for the GameObject's initial position along the X-axis");
                _target.limitX  = CustomGUILayout.Toggle("Constrain?", _target.limitX, "If True, scrolling in the X-axis will be constrained");
                if (_target.limitX)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Minimum constraint:", GUILayout.Width(70f));
                    _target.minX = EditorGUILayout.FloatField(_target.minX);
                    EditorGUILayout.LabelField("Maximum constraint:", GUILayout.Width(70f));
                    _target.maxX = EditorGUILayout.FloatField(_target.maxX);
                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            _target.yScroll = CustomGUILayout.Toggle("Scroll in Y direction?", _target.yScroll, "", "If True, then the GameObject will scroll in the Y-axis");
            if (_target.yScroll)
            {
                _target.yOffset = CustomGUILayout.FloatField("Offset:", _target.yOffset, "", "An offset for the GameObject's initial position along the Y-axis");
                _target.limitY  = CustomGUILayout.Toggle("Constrain?", _target.limitY, "", "If True, scrolling in the Y-axis will be constrained");
                if (_target.limitY)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Minimum constraint:", GUILayout.Width(70f));
                    _target.minY = EditorGUILayout.FloatField(_target.minY);
                    EditorGUILayout.LabelField("Maximum constraint:", GUILayout.Width(70f));
                    _target.maxY = EditorGUILayout.FloatField(_target.maxY);
                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
        public override void OnInspectorGUI()
        {
            NPC _target = (NPC)target;

            SharedGUIOne(_target);

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("NPC settings:", EditorStyles.boldLabel);
            _target.moveOutOfPlayersWay = CustomGUILayout.Toggle("Keep out of Player's way?", _target.moveOutOfPlayersWay, "", "If True, the NPC will attempt to keep out of the Player's way");
            if (_target.moveOutOfPlayersWay)
            {
                _target.minPlayerDistance = CustomGUILayout.FloatField("Min. distance to keep:", _target.minPlayerDistance, "", "The minimum distance to keep from the Player");
            }
            EditorGUILayout.EndVertical();

            SharedGUITwo(_target);

            UnityVersionHandler.CustomSetDirty(_target);
        }
예제 #17
0
        public override void OnInspectorGUI()
        {
            DragTrack_Straight _target = (DragTrack_Straight)target;

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

            _target.maxDistance  = CustomGUILayout.FloatField("Length:", _target.maxDistance, "", "The track's length");
            _target.handleColour = CustomGUILayout.ColorField("Handles colour:", _target.handleColour, "", "The colour of Scene window Handles");
            _target.rotationType = (DragRotationType)CustomGUILayout.EnumPopup("Rotation type:", _target.rotationType, "", "The way in which the Moveable_Drag object rotates as it moves");

            if (_target.rotationType == DragRotationType.Screw)
            {
                _target.screwThread = CustomGUILayout.FloatField("Screw thread:", _target.screwThread, "", "The 'thread' if the Moveable_Drag object rotates like a screw - effectively how fast the object rotates as it moves");
            }

            _target.dragMovementCalculation = (DragMovementCalculation)CustomGUILayout.EnumPopup("Movement input:", _target.dragMovementCalculation);

            if (_target.rotationType == DragRotationType.Screw && _target.dragMovementCalculation == DragMovementCalculation.DragVector)
            {
                _target.dragMustScrew = CustomGUILayout.Toggle("Drag must rotate too?", _target.dragMustScrew, "", "If True, then the input drag vector must also rotate, so that it is always tangential to the dragged object");
            }
            _target.discSize = CustomGUILayout.Slider("Gizmo size:", _target.discSize, 0f, 2f, "", "The size of the track's ends, as seen in the Scene window");

            CustomGUILayout.EndVertical();

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("End-colliders", EditorStyles.boldLabel);

            _target.generateColliders = CustomGUILayout.Toggle("Generate end-colliders?", _target.generateColliders);

            if (_target.generateColliders)
            {
                _target.colliderMaterial = (PhysicMaterial)CustomGUILayout.ObjectField <PhysicMaterial> ("Material:", _target.colliderMaterial, false, "", "Physics Material to give the track's end colliders");
            }

            CustomGUILayout.EndVertical();

            SnapDataGUI(_target, false);

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

            if (texture == null)
            {
                return;
            }

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

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

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

                animSpeed          = CustomGUILayout.FloatField("Animation speed:", animSpeed, apiPrefix + ".animSpeed");
                endAnimOnLastFrame = CustomGUILayout.Toggle("End on last frame?", endAnimOnLastFrame, apiPrefix + ".endAnimOnLastFrame");
            }
        }
예제 #19
0
        public void SnapDataGUI(DragTrack _target, bool useAngles)
        {
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Snapping", EditorStyles.boldLabel);

            _target.doSnapping = CustomGUILayout.Toggle("Enable snapping?", _target.doSnapping, "", "If True, then snapping is enabled and any object attached to the track can snap to pre-set points along it when let go by the player");
            if (_target.doSnapping)
            {
                _target.snapSpeed = CustomGUILayout.FloatField("Snap speed:", _target.snapSpeed, "", "The speed to move by when attached objects snap");
                _target.onlySnapOnPlayerRelease = CustomGUILayout.ToggleLeft("Only snap on player release?", _target.onlySnapOnPlayerRelease, "", "If True, then snapping will only occur when the player releases the object - and not when moving on its own accord");

                for (int i = 0; i < _target.allTrackSnapData.Count; i++)
                {
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Snap " + _target.allTrackSnapData[i].ID.ToString());
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("-"))
                    {
                        Undo.RecordObject(this, "Delete snap point");
                        _target.allTrackSnapData.RemoveAt(i);
                        i = -1;
                        break;
                    }
                    EditorGUILayout.EndHorizontal();

                    _target.allTrackSnapData[i] = _target.allTrackSnapData[i].ShowGUI(useAngles);
                    EditorGUILayout.Space();
                }
                if (GUILayout.Button("Create new snap point"))
                {
                    Undo.RecordObject(this, "Create snap point");
                    TrackSnapData trackSnapData = new TrackSnapData(0f, GetSnapIDArray(_target.allTrackSnapData));
                    _target.allTrackSnapData.Add(trackSnapData);
                }
            }
            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
예제 #20
0
        public override void OnInspectorGUI()
        {
            DragTrack_Straight _target = (DragTrack_Straight)target;

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

            _target.maxDistance  = CustomGUILayout.FloatField("Length:", _target.maxDistance, "", "The track's length");
            _target.handleColour = CustomGUILayout.ColorField("Handles colour:", _target.handleColour, "", "The colour of Scene window Handles");
            _target.rotationType = (DragRotationType)CustomGUILayout.EnumPopup("Rotation type:", _target.rotationType, "", "The way in which the Moveable_Drag object rotates as it moves");

            if (_target.rotationType == DragRotationType.Screw)
            {
                _target.screwThread   = CustomGUILayout.FloatField("Screw thread:", _target.screwThread, "", "The 'thread' if the Moveable_Drag object rotates like a screw - effectively how fast the object rotates as it moves");
                _target.dragMustScrew = CustomGUILayout.Toggle("Drag must rotate too?", _target.dragMustScrew, "", "If True, then the input drag vector must also rotate, so that it is always tangential to the dragged object");
            }

            EditorGUILayout.EndVertical();

            SharedGUI(true);
        }
예제 #21
0
        public void ShowGUI(string apiPrefix)
        {
            string _label = label + ":";

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

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

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

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

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

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

            case VariableType.Vector3:
                vector3Val = CustomGUILayout.Vector3Field(_label, vector3Val, apiPrefix + ".Vector3Value", "The property's value for this item");
                break;
            }
        }
예제 #22
0
        protected void SharedGUI(DragBase _target, bool isOnHinge)
        {
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Collision settings:", EditorStyles.boldLabel);
            _target.ignorePlayerCollider      = CustomGUILayout.ToggleLeft("Ignore Player's collider?", _target.ignorePlayerCollider, "", "If True, then the Physics system will ignore collisions between this object and the player");
            _target.ignoreMoveableRigidbodies = CustomGUILayout.ToggleLeft("Ignore Moveable Rigidbodies?", _target.ignoreMoveableRigidbodies, "", " If True, then the Physics system will ignore collisions between this object and the bounday colliders of any DragTrack that this is not locked to");
            _target.childrenShareLayer        = CustomGUILayout.ToggleLeft("Place children on same layer?", _target.childrenShareLayer, "", "If True, then this object's children will be placed on the same layer");
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Icon settings:", EditorStyles.boldLabel);
            _target.showIcon = CustomGUILayout.Toggle("Icon at contact point?", _target.showIcon, "", "If True, then an icon will be displayed at the 'grab point' when the object is held");
            if (_target.showIcon)
            {
                if (cursorManager && cursorManager.cursorIcons.Count > 0)
                {
                    int cursorInt = cursorManager.GetIntFromID(_target.iconID);
                    cursorInt      = CustomGUILayout.Popup("Cursor icon:", cursorInt, cursorManager.GetLabelsArray(), "", "The cursor that gets shown when held");
                    _target.iconID = cursorManager.cursorIcons [cursorInt].id;
                }
                else
                {
                    _target.iconID = -1;
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Sound settings:", EditorStyles.boldLabel);
            _target.moveSoundClip       = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Move sound:", _target.moveSoundClip, false, "", "The sound to play when the object is moved");
            _target.slideSoundThreshold = CustomGUILayout.FloatField("Min. move speed:", _target.slideSoundThreshold, "", "The minimum speed that the object must be moving by for sound to play");
            _target.slidePitchFactor    = CustomGUILayout.FloatField("Pitch factor:", _target.slidePitchFactor, "", "The factor by which the movement sound's pitch is adjusted in relation to speed");

            _target.collideSoundClip = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Collide sound:", _target.collideSoundClip, false, "", "The sound to play when the object has a collision");
            if (isOnHinge)
            {
                _target.onlyPlayLowerCollisionSound = CustomGUILayout.Toggle("Only on lower boundary?", _target.onlyPlayLowerCollisionSound, "", "If True, then the collision sound will only play when the object collides with its lower boundary collider");
            }
            EditorGUILayout.EndVertical();
        }
예제 #23
0
        public override void OnInspectorGUI()
        {
            _target.cameraToAlignTo = (_Camera)CustomGUILayout.ObjectField <_Camera> ("Camera to align to:", _target.cameraToAlignTo, true, "", "The AC _Camera that this GameObject should align itself to");

            if (_target.cameraToAlignTo)
            {
                _target.alignType    = (AlignType)CustomGUILayout.EnumPopup("Align type:", _target.alignType, "", "The way in which this GameObject is aligned to " + _target.cameraToAlignTo.name);
                _target.lockDistance = CustomGUILayout.Toggle("Lock distance?", _target.lockDistance, "", "If True, the distance from the camera will be fixed (though adjustable in the Inspector)");
                if (_target.lockDistance)
                {
                    _target.distanceToCamera = CustomGUILayout.FloatField("Distance from camera:", _target.distanceToCamera, "", "How far to place the GameObject away from " + _target.cameraToAlignTo.name + ", once set");
                    _target.lockScale        = CustomGUILayout.Toggle("Lock perceived scale?", _target.lockScale, "", "If True, the percieved scale of the GameObject, as seen through " + _target.cameraToAlignTo.name + ", will be fixed even if the distance between the two changes");
                }

                if (GUILayout.Button("Centre to camera"))
                {
                    Undo.RecordObject(_target, "Centre to camera");
                    _target.CentreToCamera();
                }
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
예제 #24
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);
            }
        }
예제 #25
0
        private void ButtonGUI(Button button, string suffix, InteractionSource source, bool isForInventory = false)
        {
            bool isEnabled = !button.isDisabled;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if (button.playerAction == PlayerAction.WalkTo)
                {
                    button.setProximity = CustomGUILayout.Toggle("Set minimum distance?", button.setProximity, "", "If True, then the Interaction will be run once the Player is within a certain distance of the Hotspot");
                    if (button.setProximity)
                    {
                        button.proximity = CustomGUILayout.FloatField("Proximity:", button.proximity, "", "The proximity the Player must be within");
                    }
                }
            }
        }
예제 #26
0
        public void ShowGUI(bool includeSize, bool includeAlwaysAnimate = true, string _label = "Texture:", CursorRendering cursorRendering = CursorRendering.Software, string apiPrefix = "", string tooltip = "")
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent(_label, tooltip), GUILayout.Width(145));
            texture = (Texture)CustomGUILayout.ObjectField <Texture> (texture, false, GUILayout.Width(70), GUILayout.Height(70), string.IsNullOrEmpty(apiPrefix) ? "" : (apiPrefix + ".texture"));
            EditorGUILayout.EndHorizontal();

            if (texture == null)
            {
                return;
            }

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

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

                        #if ALLOW_MOVIETEXTURE
            if (!(texture is MovieTexture))
                        #endif
            {
                isAnimated = CustomGUILayout.Toggle("Animate?", isAnimated, string.IsNullOrEmpty(apiPrefix) ? "" : (apiPrefix + ".isAnimated"));
                if (isAnimated)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Frames:", GUILayout.Width(50f));
                    numFrames = CustomGUILayout.IntField(numFrames, GUILayout.Width(70f), string.IsNullOrEmpty(apiPrefix) ? "" : (apiPrefix + ".numFrames"));
                    EditorGUILayout.LabelField("Rows:", GUILayout.Width(50f));
                    numRows = CustomGUILayout.IntField(numRows, GUILayout.Width(70f), string.IsNullOrEmpty(apiPrefix) ? "" : (apiPrefix + ".numRows"));
                    EditorGUILayout.LabelField("Columns:", GUILayout.Width(50f));
                    numCols = CustomGUILayout.IntField(numCols, GUILayout.Width(70f), string.IsNullOrEmpty(apiPrefix) ? "" : (apiPrefix + ".numCols"));
                    EditorGUILayout.EndHorizontal();

                    animSpeed = CustomGUILayout.FloatField("Animation speed:", animSpeed, string.IsNullOrEmpty(apiPrefix) ? "" : (apiPrefix + ".animSpeed"));

                    showExtra = EditorGUILayout.Foldout(showExtra, "Additional settings:");
                    if (showExtra)
                    {
                        EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                        if (includeAlwaysAnimate)
                        {
                            alwaysAnimate = CustomGUILayout.ToggleLeft("Always animate?", alwaysAnimate, string.IsNullOrEmpty(apiPrefix) ? "" : (apiPrefix + ".alwaysAnimate"));
                        }
                        endAnimOnLastFrame        = CustomGUILayout.ToggleLeft("End on last frame?", endAnimOnLastFrame, string.IsNullOrEmpty(apiPrefix) ? "" : (apiPrefix + ".endAnimOnLastFrame"));
                        skipFirstFrameWhenLooping = CustomGUILayout.ToggleLeft("Skip first when animating?", skipFirstFrameWhenLooping, string.IsNullOrEmpty(apiPrefix) ? "" : (apiPrefix + ".skipFirstFrameWhenLooping"));

                        SyncFrameSpeeds();
                        for (int i = 0; i < numFrames; i++)
                        {
                            if (i == 0 && skipFirstFrameWhenLooping)
                            {
                                continue;
                            }
                            if (i == (numFrames - 1) && endAnimOnLastFrame)
                            {
                                continue;
                            }

                            frameSpeeds[i] = EditorGUILayout.Slider("Frame #" + (i + 1).ToString() + " relative speed:", frameSpeeds[i], 0.01f, 1f);
                        }
                        EditorGUILayout.EndVertical();
                    }
                }
            }
        }
예제 #27
0
        public override void OnInspectorGUI()
        {
            GameCamera2D _target = (GameCamera2D)target;

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

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

            _target.lockHorizontal = CustomGUILayout.Toggle("Lock?", _target.lockHorizontal, "", "If True, then horizontal panning is prevented");
            if (!_target.GetComponent <Camera>().orthographic || !_target.lockHorizontal)
            {
                _target.afterOffset.x = CustomGUILayout.FloatField("Offset:", _target.afterOffset.x, "", "The horizontal panning offset");
            }

            if (!_target.lockHorizontal)
            {
                _target.freedom.x            = CustomGUILayout.FloatField("Track freedom:", _target.freedom.x, "", "The amount of freedom when tracking a target. Higher values will result in looser tracking");
                _target.directionInfluence.x = CustomGUILayout.FloatField("Target direction factor:", _target.directionInfluence.x, "", "The influence that the target's facing direction has on the tracking position");
                _target.limitHorizontal      = CustomGUILayout.Toggle("Constrain?", _target.limitHorizontal, "", "If True, then horizontal panning will be limited to minimum and maximum values");

                if (_target.limitHorizontal)
                {
                    EditorGUILayout.BeginVertical("Button");
                    _target.constrainHorizontal[0] = CustomGUILayout.FloatField("Minimum constraint:", _target.constrainHorizontal[0], "", "The lower horizontal panning limit");
                    _target.constrainHorizontal[1] = CustomGUILayout.FloatField("Maximum constraint:", _target.constrainHorizontal[1], "", "The upper horizontal panning limit");
                    EditorGUILayout.EndVertical();
                }
            }
            EditorGUILayout.EndVertical();

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

            _target.lockVertical = CustomGUILayout.Toggle("Lock?", _target.lockVertical, "", "If True, then vertical panning is prevented");
            if (!_target.GetComponent <Camera>().orthographic || !_target.lockVertical)
            {
                _target.afterOffset.y = CustomGUILayout.FloatField("Offset:", _target.afterOffset.y, "", "The vertical panning offset");
            }

            if (!_target.lockVertical)
            {
                _target.freedom.y            = CustomGUILayout.FloatField("Track freedom:", _target.freedom.y, "", "The amount of freedom when tracking a target. Higher values will result in looser tracking");
                _target.directionInfluence.y = CustomGUILayout.FloatField("Target direction factor:", _target.directionInfluence.y, "", "The influence that the target's facing direction has on the tracking position");
                _target.limitVertical        = CustomGUILayout.Toggle("Constrain?", _target.limitVertical, "", "If True, then vertical panning will be limited to minimum and maximum values");

                if (_target.limitVertical)
                {
                    EditorGUILayout.BeginVertical("Button");
                    _target.constrainVertical[0] = CustomGUILayout.FloatField("Minimum constraint:", _target.constrainVertical[0], "", "The lower vertical panning limit");
                    _target.constrainVertical[1] = CustomGUILayout.FloatField("Maximum constraint:", _target.constrainVertical[1], "", "The upper vertical panning limit");
                    EditorGUILayout.EndVertical();
                }
            }
            EditorGUILayout.EndVertical();

            if (!_target.lockHorizontal || !_target.lockVertical)
            {
                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.doSnapping = CustomGUILayout.Toggle("Snap to grid?", _target.doSnapping, "", "If True, the camera will only move in steps, as if snapping to a grid");
                if (_target.doSnapping)
                {
                    _target.unitSnap = CustomGUILayout.FloatField("Snap unit size:", _target.unitSnap, "", "The step size when snapping");
                }

                EditorGUILayout.EndVertical();
            }

            if (!_target.IsCorrectRotation())
            {
                if (GUILayout.Button("Set correct rotation"))
                {
                    Undo.RecordObject(_target, "Clear " + _target.name + " rotation");
                    _target.SetCorrectRotation();
                }
            }

            if (!Application.isPlaying)
            {
                _target.GetComponent <Camera>().ResetProjectionMatrix();
                if (!_target.GetComponent <Camera>().orthographic)
                {
                    _target.SnapToOffset();
                }
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
        /**
         * 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");
                }

                                #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
                confineSystemCursor = CustomGUILayout.ToggleLeft("Confine system cursor to game window?", confineSystemCursor, "AC.KickStarter.cursorManager.confineSystemCursor", "If True, then the system cursor will be confined to the game window");
                                #endif
            }
            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);
            }
        }
예제 #29
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuButton)";

            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, apiPrefix);
            }
            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);
        }
예제 #30
0
        private void ShowVarGUI(VariableLocation location, List <VarPreset> _varPresets = null, string apiPrefix = "")
        {
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showVariablesProperties = CustomGUILayout.ToggleHeader(showVariablesProperties, location + " variable '" + selectedVar.label + "' properties");
            if (showVariablesProperties)
            {
                selectedVar.label = CustomGUILayout.TextField("Label:", selectedVar.label, apiPrefix + ".label");
                selectedVar.type  = (VariableType)CustomGUILayout.EnumPopup("Type:", selectedVar.type, apiPrefix + ".type");

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

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

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

                        _varPreset.UpdateCollection(selectedVar);

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

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