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

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

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

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

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

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

            EditorGUILayout.EndVertical();

            SharedGUI(false);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public override void OnInspectorGUI()
        {
            DragTrack_Hinge _target = (DragTrack_Hinge)target;

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

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

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

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

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

            CustomGUILayout.EndVertical();

            SnapDataGUI(_target, true);

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuDialogList)";

            MenuSource source = menu.menuSource;

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

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

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

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

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

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

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

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

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

            ChangeCursorGUI(menu);
            EditorGUILayout.EndVertical();

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

            MenuSource source = menu.menuSource;

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

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

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

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

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

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

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

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

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

            ChangeCursorGUI(menu);
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
Exemplo n.º 13
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", "The sound to play when the cursor hovers over the element");
                    clickSound = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Click sound:", clickSound, false, apiPrefix + ".clickSound", "The sound to play when the element is clicked on");
                    EditorGUILayout.EndVertical();
                }
                return;
            }

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

                ShowTextGUI(apiPrefix);

                fontColor = CustomGUILayout.ColorField("Text colour:", fontColor, apiPrefix + ".fontColor", "The font colour");
                if (isClickable)
                {
                    fontHighlightColor = CustomGUILayout.ColorField("Text colour (highlighted):", fontHighlightColor, apiPrefix + ".fontHighlightColor", "The font colour when the element is highlighted");
                }
                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.BeginVertical("Button");

            ShowTextureGUI(apiPrefix);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Background texture:", "A texture to display underneath the element text"), GUILayout.Width(145f));
            backgroundTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (backgroundTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".backgroundTexture");
            EditorGUILayout.EndHorizontal();

            if (numSlots > 1 && backgroundTexture != null)
            {
                singleSlotBackgrounds = CustomGUILayout.ToggleLeft("Background texture is per slot?", singleSlotBackgrounds, apiPrefix + ".singleSlotBackgrounds", "If True, then each slot will have its own background texture - as opposed to a single background texture that spans the whole element");
            }

            if (isClickable)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("Highlight texture:", "The texture to overlay when the element is highlighted"), 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", "The sound to play when the cursor hovers over the element");
                clickSound = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Click sound:", clickSound, false, apiPrefix + ".clickSound", "The sound to play when the element is clicked on");
            }

            EditorGUILayout.EndVertical();

            EndGUI(apiPrefix);
        }
Exemplo n.º 14
0
        protected void SharedGUITwo(AC.Char _target)
        {
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Physics settings", EditorStyles.boldLabel);
            _target.ignoreGravity = CustomGUILayout.Toggle("Ignore gravity?", _target.ignoreGravity, "", "If True, the character will ignore the effects of gravity");
            if (_target.GetComponent <Rigidbody>() != null || _target.GetComponent <Rigidbody2D>() != null)
            {
                if (_target.motionControl == MotionControl.Automatic)
                {
                    _target.freezeRigidbodyWhenIdle = CustomGUILayout.Toggle("Freeze Rigidbody when Idle?", _target.freezeRigidbodyWhenIdle, "", "If True, the character's Rigidbody will be frozen in place when idle. This is to help slipping when on sloped surfaces");
                }

                if (_target.motionControl != MotionControl.Manual)
                {
                    if (_target.GetComponent <Rigidbody>() != null)
                    {
                        _target.useRigidbodyForMovement = CustomGUILayout.Toggle("Move with Rigidbody?", _target.useRigidbodyForMovement, "", "If True, then it will be moved by adding forces in FixedUpdate, as opposed to the transform being manipulated in Update");

                        if (_target.useRigidbodyForMovement)
                        {
                            if (_target.GetAnimator() != null && _target.GetAnimator().applyRootMotion)
                            {
                                EditorGUILayout.HelpBox("Rigidbody movement will be disabled as 'Root motion' is enabled in the Animator.", MessageType.Warning);
                            }
                            else if (_target.GetComponent <Rigidbody>().interpolation == RigidbodyInterpolation.None)
                            {
                                EditorGUILayout.HelpBox("For smooth movement, the Rigidbody's 'Interpolation' should be set to either 'Interpolate' or 'Extrapolate'.", MessageType.Warning);
                            }
                        }
                    }
                    else if (_target.GetComponent <Rigidbody2D>() != null)
                    {
                        _target.useRigidbody2DForMovement = CustomGUILayout.Toggle("Move with Rigidbody 2D?", _target.useRigidbody2DForMovement, "", "If True, then it will be moved by adding forces in FixedUpdate, as opposed to the transform being manipulated in Update");

                        if (_target.useRigidbody2DForMovement)
                        {
                            if (_target.GetAnimator() != null && _target.GetAnimator().applyRootMotion)
                            {
                                EditorGUILayout.HelpBox("Rigidbody movement will be disabled as 'Root motion' is enabled in the Animator.", MessageType.Warning);
                            }
                            else if (_target.GetComponent <Rigidbody2D>().interpolation == RigidbodyInterpolation2D.None)
                            {
                                EditorGUILayout.HelpBox("For smooth movement, the Rigidbody's 'Interpolation' should be set to either 'Interpolate' or 'Extrapolate'.", MessageType.Warning);
                            }

                            if (SceneSettings.CameraPerspective != CameraPerspective.TwoD)
                            {
                                EditorGUILayout.HelpBox("Rigidbody2D-based motion only allows for X and Y movement, not Z, which may not be appropriate for 3D.", MessageType.Warning);
                            }

                            if (_target.GetAnimEngine().isSpriteBased&& _target.turn2DCharactersIn3DSpace)
                            {
                                EditorGUILayout.HelpBox("For best results, 'Turn root object in 3D space?' above should be disabled.", MessageType.Warning);
                            }
                        }
                    }
                }
            }

            if (_target.GetComponent <Collider>() != null && _target.GetComponent <CharacterController>() == null)
            {
                _target.groundCheckLayerMask = LayerMaskField("Ground-check layer(s):", _target.groundCheckLayerMask);
            }
            EditorGUILayout.EndVertical();


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

            _target.walkSound = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Walk sound:", _target.walkSound, false, "", "The sound to play when walking");
            _target.runSound  = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Run sound:", _target.runSound, false, "", "The sound to play when running");
            if (AdvGame.GetReferences() != null && AdvGame.GetReferences().speechManager != null && AdvGame.GetReferences().speechManager.scrollSubtitles)
            {
                _target.textScrollClip = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Text scroll override:", _target.textScrollClip, false, "", "The sound to play when the character's speech text is scrolling");
            }
            _target.soundChild        = (Sound)CustomGUILayout.ObjectField <Sound> ("SFX Sound child:", _target.soundChild, true, "", "");
            _target.speechAudioSource = (AudioSource)CustomGUILayout.ObjectField <AudioSource> ("Speech AudioSource:", _target.speechAudioSource, true, "", "The AudioSource from which to play speech audio");
            EditorGUILayout.EndVertical();

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

            _target.speechColor         = CustomGUILayout.ColorField("Speech text colour:", _target.speechColor, "", "");
            _target.speechLabel         = CustomGUILayout.TextField("Speaker label:", _target.speechLabel, "", "");
            _target.speechMenuPlacement = (Transform)CustomGUILayout.ObjectField <Transform> ("Speech menu placement child:", _target.speechMenuPlacement, true, "", "The Transform at which to place Menus set to appear 'Above Speaking Character'. If this is not set, the placement will be set automatically");

            if (_target.useExpressions)
            {
                EditorGUILayout.LabelField("Default portrait graphic:");
            }
            else
            {
                EditorGUILayout.LabelField("Portrait graphic:");
            }
            _target.portraitIcon.ShowGUI(false);

            _target.useExpressions = CustomGUILayout.Toggle("Use expressions?", _target.useExpressions, "", "If True, speech text can use expression tokens to change the character's expression");
            if (_target.useExpressions)
            {
                _target.GetAnimEngine().CharExpressionsGUI();

                EditorGUILayout.Space();
                EditorGUILayout.BeginVertical("Button");
                for (int i = 0; i < _target.expressions.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Expression #" + _target.expressions[i].ID.ToString(), EditorStyles.boldLabel);

                    if (GUILayout.Button("", CustomStyles.IconCog))
                    {
                        ExpressionSideMenu(_target, i);
                    }
                    EditorGUILayout.EndHorizontal();
                    _target.expressions[i].ShowGUI();
                }

                if (GUILayout.Button("Add new expression"))
                {
                    _target.expressions.Add(new Expression(GetExpressionIDArray(_target.expressions)));
                }
                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.EndVertical();
        }