Beispiel #1
0
        public void ShowCursorInfluenceGUI()
        {
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Cursor influence", EditorStyles.boldLabel);
            followCursor = CustomGUILayout.Toggle("Follow cursor?", followCursor, "", "If True, then the camera will rotate towards the cursor's position on-screen");
            if (followCursor)
            {
                cursorInfluence           = CustomGUILayout.Vector2Field("Panning factor:", cursorInfluence, "", "The influence that the cursor's position has on rotation");
                constrainCursorInfluenceX = CustomGUILayout.ToggleLeft("Constrain panning in X direction?", constrainCursorInfluenceX, "", "If True, then camera rotation according to the cursor's X position will be limited");
                if (constrainCursorInfluenceX)
                {
                    limitCursorInfluenceX[0] = CustomGUILayout.Slider("Minimum X constraint:", limitCursorInfluenceX[0], -1.4f, 0f, "", "The cursor influence's lower limit in the X-direction");
                    limitCursorInfluenceX[1] = CustomGUILayout.Slider("Maximum X constraint:", limitCursorInfluenceX[1], 0f, 1.4f, "", "The cursor influence's upper limit in the X-direction");
                }
                constrainCursorInfluenceY = CustomGUILayout.ToggleLeft("Constrain panning in Y direction?", constrainCursorInfluenceY, "", "If True, then camera rotation according to the cursor's Y position will be limited");
                if (constrainCursorInfluenceY)
                {
                    limitCursorInfluenceY[0] = CustomGUILayout.Slider("Minimum Y constraint:", limitCursorInfluenceY[0], -1.4f, 0f, "", "The cursor influence's lower limit in the Y-direction");
                    limitCursorInfluenceY[1] = CustomGUILayout.Slider("Maximum Y constraint:", limitCursorInfluenceY[1], 0f, 1.4f, "", "The cursor influence's upper limit in the Y-direction");
                }

                if (Application.isPlaying && KickStarter.mainCamera != null && KickStarter.mainCamera.attachedCamera == this)
                {
                    EditorGUILayout.HelpBox("Changes made to this panel will not be felt until the MainCamera switches to this camera again.", MessageType.Info);
                }
            }
            EditorGUILayout.EndVertical();
        }
Beispiel #2
0
        public override void OnInspectorGUI()
        {
            Highlight _target = (Highlight)target;

            _target.highlightWhenSelected = CustomGUILayout.ToggleLeft("Enable when associated Hotspot is selected?", _target.highlightWhenSelected, "", "If True, then the Highlight effect will be enabled automatically when the Hotspot is selected");
            _target.brightenMaterials     = CustomGUILayout.ToggleLeft("Auto-brighten materials when enabled?", _target.brightenMaterials, "", "If True, then Materials associated with the GameObject's Renderer will be affected. Otherwise, their intended values will be calculated, but not applied, allowing for custom effects to be achieved");
            if (_target.brightenMaterials)
            {
                _target.affectChildren = CustomGUILayout.ToggleLeft("Also affect child Renderer components?", _target.affectChildren, "", "If True, then child Renderer GameObjects will be brightened as well");
            }
            _target.maxHighlight  = CustomGUILayout.Slider("Maximum highlight intensity:", _target.maxHighlight, 1f, 5f, "", "The maximum highlight intensity (1 = no effect)");
            _target.fadeTime      = CustomGUILayout.Slider("Transition time (s):", _target.fadeTime, 0f, 5f, "", "The fade time for the highlight transition effect");
            _target.flashHoldTime = CustomGUILayout.Slider("Flash hold time (s)", _target.flashHoldTime, 0f, 5f, "", "The length of time that a flash will hold for");

            _target.callEvents = CustomGUILayout.ToggleLeft("Call custom events?", _target.callEvents, "", "If True, then custom events can be called when highlighting the object");
            if (_target.callEvents)
            {
                this.serializedObject.Update();
                EditorGUILayout.PropertyField(this.serializedObject.FindProperty("onHighlightOn"), true);
                EditorGUILayout.PropertyField(this.serializedObject.FindProperty("onHighlightOff"), true);
                this.serializedObject.ApplyModifiedProperties();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
        protected void OnGUI()
        {
            if (AdvGame.GetReferences().settingsManager == null)
            {
                EditorGUILayout.HelpBox ("A Settings Manager must be assigned before this window can display correctly.", MessageType.Warning);
                return;
            }

            if (KickStarter.settingsManager)
            {
                EditorGUILayout.BeginVertical (CustomStyles.thinBox);
                showOptions = CustomGUILayout.ToggleHeader (showOptions, "Ambience settings");
                if (showOptions)
                {
                    KickStarter.settingsManager.playAmbienceWhilePaused = CustomGUILayout.ToggleLeft ("Can play when game is paused?", KickStarter.settingsManager.playAmbienceWhilePaused, "AC.KickStarter.settingsManager.playAmbienceWhilePaused", "If True, then ambience can play when the game is paused");
                    KickStarter.settingsManager.loadAmbienceFadeTime = CustomGUILayout.Slider ("Fade time after loading:", KickStarter.settingsManager.loadAmbienceFadeTime, 0f, 5f, "AC.KickStarter.settingsManager.loadAmbienceFadeTime", "The fade-in duration when resuming ambience audio after loading a save game");
                    if (KickStarter.settingsManager.loadAmbienceFadeTime > 0f)
                    {
                        KickStarter.settingsManager.crossfadeAmbienceWhenLoading = CustomGUILayout.ToggleLeft ("Crossfade after loading?", KickStarter.settingsManager.crossfadeAmbienceWhenLoading, "AC.KickStarter.settingsManager.crossfadeAmbienceWhenLoading", "If True, previously-playing ambience audio will be crossfaded out upon loading");
                    }
                    KickStarter.settingsManager.restartAmbienceTrackWhenLoading = CustomGUILayout.ToggleLeft ("Restart track after loading?", KickStarter.settingsManager.restartAmbienceTrackWhenLoading, "AC.KickStarter.settingsManager.restartAmbienceTrackWhenLoading", "If True, then the ambience track at the time of saving will be resumed from the start upon loading");

                    if (GUI.changed)
                    {
                        EditorUtility.SetDirty (KickStarter.settingsManager);
                    }
                }

                EditorGUILayout.Space ();
                CustomGUILayout.EndVertical ();
            }

            SharedGUI("Ambience tracks");
        }
Beispiel #4
0
 public TrackSnapData ShowGUI(bool useAngles)
 {
     positionAlong = CustomGUILayout.Slider("Snap to " + ((useAngles) ? "angle" : "position:"), positionAlong, 0f, 1f, "", "How far along the track (as a decimal) to snap to.");
     width         = CustomGUILayout.Slider("Catchment size:", width, 0f, 1f, "", "How far apart from the snapping point (as a decimal of the track's length) the object can be for this to be enforced.");
     gizmoColor    = CustomGUILayout.ColorField("Editor colour:", gizmoColor, "", "What colour to draw handles in the Scene with.");
     return(this);
 }
Beispiel #5
0
 protected override void ShowTextGUI(string apiPrefix)
 {
     textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects", "The special FX applied to the text");
     if (textEffects != TextEffects.None)
     {
         outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize", "The outline thickness");
     }
 }
Beispiel #6
0
 protected override void ShowTextGUI(string apiPrefix)
 {
     textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects");
     if (textEffects != TextEffects.None)
     {
         outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize");
     }
 }
Beispiel #7
0
        public TrackSnapData ShowGUI(DragTrack dragTrack, bool useAngles)
        {
            label = CustomGUILayout.TextField("Editor label:", label, string.Empty, "The region's label when displayed in Actions.");

            bool isEnabled = !isDisabled;

            isEnabled  = CustomGUILayout.Toggle("Is enabled?", isEnabled, string.Empty, "If True, the region is enabled");
            isDisabled = !isEnabled;

            positionAlong = CustomGUILayout.Slider("Centre " + ((useAngles) ? "angle" : "position:"), positionAlong, 0f, 1f, string.Empty, "How far along the track (as a decimal) the region lies.");

            width      = CustomGUILayout.Slider("Catchment size:", width, 0f, 1f, string.Empty, "How far apart from the snapping point (as a decimal of the track's length) the object can be for this to be enforced.");
            gizmoColor = CustomGUILayout.ColorField("Editor colour:", gizmoColor, string.Empty, "What colour to draw handles in the Scene with.");

            if (dragTrack.doSnapping)
            {
                if (dragTrack.actionListSource == ActionListSource.InScene)
                {
                    cutsceneOnSnap = (Cutscene)CustomGUILayout.ObjectField <Cutscene> ("Cutscene on snap:", cutsceneOnSnap, true, "", "An optional Cutscene to run when a Draggable object snaps to this region");
                }
                else if (dragTrack.actionListSource == ActionListSource.AssetFile)
                {
                    actionListAssetOnSnap = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on snap:", actionListAssetOnSnap, false, "", "An optional ActionList asset to run when a Draggable object snaps to this region");
                }
            }

            if (dragTrack.TypeSupportsSnapConnections())
            {
                if (connections.Count == 0)
                {
                    TrackSnapConnection trackSnapConnection = new TrackSnapConnection();
                    connections.Add(trackSnapConnection);
                }

                for (int i = 0; i < connections.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    connections[i] = connections[i].ShowGUI(dragTrack, i);
                    if (GUILayout.Button("+", GUILayout.MaxWidth(20f)))
                    {
                        Undo.RecordObject(dragTrack, "Add connection");
                        TrackSnapConnection trackSnapConnection = new TrackSnapConnection();
                        connections.Insert(i + 1, trackSnapConnection);
                        i = -1;
                        break;
                    }
                    if (connections.Count > 1 && GUILayout.Button("-", GUILayout.MaxWidth(20f)))
                    {
                        Undo.RecordObject(dragTrack, "Delete connection");
                        connections.RemoveAt(i);
                        i = -1;
                        break;
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }
            return(this);
        }
 protected override void ShowTextGUI(string apiPrefix)
 {
     anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor", "The text alignment");
     textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".anchor");
     if (textEffects != TextEffects.None)
     {
         outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize", "The outline thickness");
     }
 }
Beispiel #9
0
        public virtual void ShowGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            if (menu.menuSource != MenuSource.AdventureCreator)
            {
                if (isClickable)
                {
                    EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                    hoverSound = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Hover sound:", hoverSound, false, apiPrefix + ".hoverSound");
                    clickSound = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Click sound:", clickSound, false, apiPrefix + ".clickSound");
                    EditorGUILayout.EndVertical();
                }
                return;
            }

            if (!(this is MenuGraphic))
            {
                EditorGUILayout.BeginVertical("Button");
                font            = (Font)CustomGUILayout.ObjectField <Font> ("Font:", font, false, apiPrefix + ".font");
                fontScaleFactor = CustomGUILayout.Slider("Text size:", fontScaleFactor, 1f, 4f, apiPrefix + ".fontScaleFactor");

                ShowTextGUI(apiPrefix);

                fontColor = CustomGUILayout.ColorField("Text colour:", fontColor, apiPrefix + ".fontColor");
                if (isClickable)
                {
                    fontHighlightColor = CustomGUILayout.ColorField("Text colour (highlighted):", fontHighlightColor, apiPrefix + ".fontHighlightColor");
                }
                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.BeginVertical("Button");

            ShowTextureGUI(apiPrefix);

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

            if (isClickable)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Highlight texture:", GUILayout.Width(145f));
                highlightTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (highlightTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".highlightTexture");
                EditorGUILayout.EndHorizontal();

                hoverSound = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Hover sound:", hoverSound, false, apiPrefix + ".hoverSound");
                clickSound = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Click sound:", clickSound, false, apiPrefix + ".clickSound");
            }

            EditorGUILayout.EndVertical();

            EndGUI(apiPrefix);
        }
Beispiel #10
0
        public static void PropertiesGUI(Cutscene _target)
        {
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Cutscene properties", EditorStyles.boldLabel);
            _target.source = (ActionListSource)CustomGUILayout.EnumPopup("Actions source:", _target.source, "", "Where the Actions are stored");
            if (_target.source == ActionListSource.AssetFile)
            {
                _target.assetFile       = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList asset:", _target.assetFile, false, "", "The ActionList asset that stores the Actions");
                _target.syncParamValues = CustomGUILayout.Toggle("Sync parameter values?", _target.syncParamValues, "", "If True, the ActionList asset's parameter values will be shared amongst all linked ActionLists");
            }
            _target.actionListType = (ActionListType)CustomGUILayout.EnumPopup("When running:", _target.actionListType, "", "The effect that running the Actions has on the rest of the game");
            if (_target.actionListType == ActionListType.PauseGameplay)
            {
                _target.isSkippable = CustomGUILayout.Toggle("Is skippable?", _target.isSkippable, "", "If True, the Actions will be skipped when the user presses the 'EndCutscene' Input button");
            }
            _target.triggerTime   = CustomGUILayout.Slider("Start delay (s):", _target.triggerTime, 0f, 10f, "", "The delay, in seconds, before the Actions are run when the ActionList is triggered");
            _target.autosaveAfter = CustomGUILayout.Toggle("Autosave after?", _target.autosaveAfter, "", "If True, the game will auto-save when the Actions have finished running");
            _target.tagID         = ShowTagUI(_target.actions.ToArray(), _target.tagID);
            if (_target.source == ActionListSource.InScene)
            {
                _target.useParameters = CustomGUILayout.Toggle("Use parameters?", _target.useParameters, "", "If True, ActionParameters can be used to override values within the Action objects");
            }
            else if (_target.source == ActionListSource.AssetFile && _target.assetFile != null && !_target.syncParamValues && _target.assetFile.useParameters)
            {
                _target.useParameters = CustomGUILayout.Toggle("Set local parameter values?", _target.useParameters, "", "If True, parameter values set here will be assigned locally, and not on the ActionList asset");
            }
            EditorGUILayout.EndVertical();

            if (_target.useParameters)
            {
                if (_target.source == ActionListSource.InScene)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.BeginVertical("Button");

                    EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel);
                    ActionListEditor.ShowParametersGUI(_target, null, _target.parameters);

                    EditorGUILayout.EndVertical();
                }
                else if (!_target.syncParamValues && _target.source == ActionListSource.AssetFile && _target.assetFile != null && _target.assetFile.useParameters)
                {
                    bool isAsset = UnityVersionHandler.IsPrefabFile(_target.gameObject);

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

                    EditorGUILayout.LabelField("Local parameter values", EditorStyles.boldLabel);
                    ActionListEditor.ShowLocalParametersGUI(_target.parameters, _target.assetFile.GetParameters(), isAsset);

                    EditorGUILayout.EndVertical();
                }
            }
        }
 protected override void ShowTextGUI(string apiPrefix)
 {
     if (displayType != AC_DisplayType.IconOnly)
     {
         anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor", "The text alignment");
         textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects", "The special FX applied to the text");
         if (textEffects != TextEffects.None)
         {
             outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize", "The outline thickness");
         }
     }
 }
Beispiel #12
0
 protected override void ShowTextGUI(string apiPrefix)
 {
     if (displayType != ConversationDisplayType.IconOnly)
     {
         anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor");
         textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects");
         if (textEffects != TextEffects.None)
         {
             outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize");
         }
     }
 }
Beispiel #13
0
        public override void OnInspectorGUI()
        {
            GameCamera25D _target = (GameCamera25D)target;

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Background image", EditorStyles.boldLabel);

            EditorGUILayout.BeginHorizontal();
            _target.backgroundImage = (BackgroundImage)CustomGUILayout.ObjectField <BackgroundImage> ("Background:", _target.backgroundImage, true, "", "The BackgroundImage to display underneath all scene objects");

            if (_target.backgroundImage)
            {
                if (!Application.isPlaying && GUILayout.Button("Set as active", GUILayout.MaxWidth(90f)))
                {
                    Undo.RecordObject(_target, "Set active background");

                    _target.SetActiveBackground();
                }
            }
            else
            {
                if (GUILayout.Button("Create", GUILayout.MaxWidth(90f)))
                {
                    Undo.RecordObject(_target, "Create Background Image");
                    BackgroundImage newBackgroundImage = SceneManager.AddPrefab("SetGeometry", "BackgroundImage", true, false, true).GetComponent <BackgroundImage>();

                    string cameraName = _target.gameObject.name;

                    newBackgroundImage.gameObject.name = AdvGame.UniqueName(cameraName + ": Background");
                    _target.backgroundImage            = newBackgroundImage;
                }
            }

            EditorGUILayout.EndHorizontal();

            if (MainCamera.AllowProjectionShifting(_target.GetComponent <Camera>()))
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Perspective offset", EditorStyles.boldLabel);
                _target.perspectiveOffset.x = CustomGUILayout.Slider("Horizontal:", _target.perspectiveOffset.x, -0.05f, 0.05f, "", "The horizontal offset in perspective from the camera's centre");
                _target.perspectiveOffset.y = CustomGUILayout.Slider("Vertical:", _target.perspectiveOffset.y, -0.05f, 0.05f, "", "The vertical offset in perspective from the camera's centre");
            }

            CustomGUILayout.EndVertical();

            if (_target.isActiveEditor)
            {
                _target.UpdateCameraSnap();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Beispiel #14
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);
        }
        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);
        }
Beispiel #16
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();
        }
Beispiel #17
0
        protected void SharedGUI(bool useColliders)
        {
            DragTrack _target = (DragTrack)target;

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

            _target.discSize = CustomGUILayout.Slider("Gizmo size:", _target.discSize, 0f, 2f, "", "The size of the track's end colliders, as seen in the Scene window");
            if (useColliders)
            {
                _target.colliderMaterial = (PhysicMaterial)CustomGUILayout.ObjectField <PhysicMaterial> ("Material:", _target.colliderMaterial, false, "", "Physics Material to give the track's end colliders");
            }

            EditorGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
Beispiel #18
0
        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();

            CustomGUILayout.BeginVertical();
            _target.character = (Char)CustomGUILayout.ObjectField <Char> ("Character:", _target.character, true, string.Empty, "The Player or NPC that this component is for");
            if (_target.character != null || _target.GetComponent <Char>())
            {
                _target.doGroundedCheck = CustomGUILayout.ToggleLeft("Only play when grounded?", _target.doGroundedCheck, string.Empty, "If True, sounds will only play when the character is grounded");

                if (_target.footstepPlayMethod == FootstepSounds.FootstepPlayMethod.ViaAnimationEvents)
                {
                    _target.doMovementCheck = CustomGUILayout.ToggleLeft("Only play when moving?", _target.doMovementCheck, string.Empty, "If True, sounds will only play when the character is walking or running");
                }
            }
            _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.Slider("Walk separation (s):", _target.walkSeparationTime, 0f, 3f, string.Empty, "The separation time between sounds when walking");
                _target.runSeparationTime  = CustomGUILayout.Slider("Run separation (s):", _target.runSeparationTime, 0f, 3f, string.Empty, "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);
            }
            _target.pitchVariance  = CustomGUILayout.Slider("Pitch variance:", _target.pitchVariance, 0f, 0.8f, string.Empty, "How much the audio pitch can randomly vary by.");
            _target.volumeVariance = CustomGUILayout.Slider("Volume variance:", _target.volumeVariance, 0f, 0.8f, string.Empty, "How much the audio volume can randomly vary by.");
            CustomGUILayout.EndVertical();

            if (_target.soundToPlayFrom == null && _target.GetComponent <AudioSource>() == null)
            {
                EditorGUILayout.HelpBox("To play sounds, the 'Sound to play from' must be assigned, or an AudioSource must be attached.", MessageType.Warning);
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Beispiel #19
0
        public void ShowGUI()
        {
            string defaultName = "ActiveInput_" + Label;

            label     = CustomGUILayout.TextField("Label:", label, string.Empty, "An Editor-friendly name");
            inputName = CustomGUILayout.TextField("Input button:", inputName, string.Empty, "The name of the Input button, as defined in the Input Manager");
            inputType = (SimulateInputType)CustomGUILayout.EnumPopup("Input type:", inputType, string.Empty, "What type of input is expected");
            if (inputType == SimulateInputType.Axis)
            {
                axisThreshold = CustomGUILayout.Slider("Axis threshold:", axisThreshold, -1f, 1f, string.Empty, "The threshold value for the axis to trigger the ActionListAsset");
            }
            else if (inputType == SimulateInputType.Button)
            {
                buttonType = (ActiveInputButtonType)CustomGUILayout.EnumPopup("Responds to:", buttonType, string.Empty, "What type of button press this responds to");
            }
            enabledOnStart  = CustomGUILayout.Toggle("Enabled by default?", enabledOnStart, string.Empty, "If True, the active input is enabled when the game begins");
            gameState       = (GameState)CustomGUILayout.EnumPopup("Available when game is:", gameState, string.Empty, "What state the game must be in for the actionListAsset to run");
            actionListAsset = ActionListAssetMenu.AssetGUI("ActionList when triggered:", actionListAsset, defaultName, string.Empty, "The ActionListAsset to run when the input button is pressed");
        }
Beispiel #20
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);
        }
Beispiel #21
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuTimer)";

            MenuSource source = menu.menuSource;

            CustomGUILayout.BeginVertical();

            timerType = (AC_TimerType)CustomGUILayout.EnumPopup("Timer type:", timerType, apiPrefix + ".timerType", "What the value of the timer represents");
            if (timerType == AC_TimerType.LoadingProgress && AdvGame.GetReferences().settingsManager&& !AdvGame.GetReferences().settingsManager.useAsyncLoading)
            {
                EditorGUILayout.HelpBox("Loading progress cannot be displayed unless asynchonised loading is enabled within the Settings Manager.", MessageType.Warning);
            }
            else if (timerType == AC_TimerType.Conversation)
            {
                autoSetVisibility = CustomGUILayout.Toggle("Auto-set visibility?", autoSetVisibility, apiPrefix + ".autoSetVisibility", "If True, the Timer will be hidden if the active Conversation is not timed");
            }
            doInvert = CustomGUILayout.Toggle("Invert value?", doInvert, apiPrefix + ".doInvert", "If True, then the value will be inverted, and the timer will move in the opposite direction");

            smoothingFactor = CustomGUILayout.Slider("Value smoothing:", smoothingFactor, 0f, 1f, ".smoothingFactor", "The amount of smoothing to apply (0 = no smoothing)");

            if (source == MenuSource.AdventureCreator)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("Timer texture:", "The texture of the slider bar"), GUILayout.Width(145f));
                timerTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (timerTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".timerTexture");
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                uiSlider = LinkedUiGUI <Slider> (uiSlider, "Linked Slider:", source, "The Unity UI Slider this is linked to");
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle", "The method by which this element is hidden from view when made invisible");
            }
            CustomGUILayout.EndVertical();

            if (source == MenuSource.AdventureCreator)
            {
                EndGUI(apiPrefix);
            }
        }
Beispiel #22
0
        private void GetCursorGUI(string apiPrefix, MenuSource source)
        {
            fixedIcon = CustomGUILayout.Toggle("For fixed icon?", fixedIcon, apiPrefix + ".fixedIcon", "If True, the element will always be associated with the same single icon. If False, the element will represent all available icons.");

            if (fixedIcon)
            {
                numSlots = 1;

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

                if (source == MenuSource.AdventureCreator)
                {
                    numSlots    = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 30f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }
        }
Beispiel #23
0
        public override void OnInspectorGUI()
        {
            ArrowPrompt _target = (ArrowPrompt)target;

            CustomGUILayout.BeginVertical();
            GUILayout.Label("Settings", EditorStyles.boldLabel);
            _target.arrowPromptType = (ArrowPromptType)CustomGUILayout.EnumPopup("Input type:", _target.arrowPromptType, "", "What kind of input the arrows respond to");
            _target.disableHotspots = CustomGUILayout.ToggleLeft("Disable Hotspots when active?", _target.disableHotspots, "", "If True, then Hotspots will be disabled when the arrows are on screen");
            _target.positionFactor  = CustomGUILayout.Slider("Position factor:", _target.positionFactor, 0.5f, 4f, "", "A factor for the arrow position");
            _target.scaleFactor     = CustomGUILayout.Slider("Scale factor:", _target.scaleFactor, 0.5f, 4f, "", "A factor for the arrow size");
            _target.source          = (ActionListSource)CustomGUILayout.EnumPopup("Actions source:", _target.source, "", "Where the Actions are stored when not being run");
            CustomGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            GUILayout.Label("Up arrow", EditorStyles.boldLabel);
            ArrowGUI(_target.upArrow, _target.source, "Up");
            CustomGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            GUILayout.Label("Left arrow", EditorStyles.boldLabel);
            ArrowGUI(_target.leftArrow, _target.source, "Left");
            CustomGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            GUILayout.Label("Right arrow", EditorStyles.boldLabel);
            ArrowGUI(_target.rightArrow, _target.source, "Right");
            CustomGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            GUILayout.Label("Down arrow", EditorStyles.boldLabel);
            ArrowGUI(_target.downArrow, _target.source, "Down");
            CustomGUILayout.EndVertical();

            UnityVersionHandler.CustomSetDirty(_target);
        }
Beispiel #24
0
        public override void OnInspectorGUI()
        {
            Sound _target = (Sound)target;

            _target.soundType       = (SoundType)CustomGUILayout.EnumPopup("Sound type:", _target.soundType, "", "The type of sound, so far as volume levels go");
            _target.playWhilePaused = CustomGUILayout.Toggle("Play while game paused?", _target.playWhilePaused, "", "If True, then the sound can play when the game is paused");
            _target.relativeVolume  = CustomGUILayout.Slider("Relative volume:", _target.relativeVolume, 0f, 1f, "", "The volume of the sound, relative to its categoriy's 'global' volume set within OptionsData");

            _target.surviveSceneChange = CustomGUILayout.Toggle("Play across scenes?", _target.surviveSceneChange, "", "If True, then the GameObject this is attached to will not be destroyed when changing scene");
            if (_target.surviveSceneChange)
            {
                if (_target.transform.root != null && _target.transform.root != _target.gameObject.transform)
                {
                    EditorGUILayout.HelpBox("For Sound to survive scene-changes, please move this object out of its hierarchy, so that it has no parent GameObject.", MessageType.Warning);
                }
                if (_target.GetComponent <ConstantID>() == null)
                {
                    EditorGUILayout.HelpBox("To avoid duplicates when re-loading the scene, please attach a ConstantID or RememberSound script component.", MessageType.Warning);
                }
            }

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

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

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

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

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

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

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

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

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

                uiSlots = ResizeUISlots(uiSlots, maxSlots);

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

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

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

            base.ShowGUI(menu);
        }
Beispiel #26
0
        public override void CharSettingsGUI()
        {
                        #if UNITY_EDITOR
            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Standard 3D animations", EditorStyles.boldLabel);

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

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

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

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

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

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

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

            if (GUI.changed && character != null)
            {
                EditorUtility.SetDirty(character);
            }
                        #endif
        }
Beispiel #27
0
        public override NavigationMesh NavigationMeshGUI(NavigationMesh _target)
        {
            _target = base.NavigationMeshGUI(_target);

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

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

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

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

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

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

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

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

                EditorGUILayout.EndHorizontal();

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

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

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

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

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

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

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

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

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

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

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

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

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

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

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

            EditorGUILayout.EndVertical();

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

            MenuSource source = menu.menuSource;

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

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

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

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

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

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

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

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

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

            ChangeCursorGUI(menu);
            EditorGUILayout.EndVertical();

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

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

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

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

                showPage = 1;

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

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

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

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

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

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

                numPages = pages.Count;

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

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

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

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

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

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }