Exemple #1
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.BeginVertical("Button");

                        #if ALLOW_LEGACY_UI
            _target.backgroundMethod25D = (BackgroundImage.BackgroundMethod25D)CustomGUILayout.EnumPopup("Method:", _target.backgroundMethod25D, "", "How 2.5D backgrounds are renderered");
            if (_target.backgroundMethod25D == BackgroundImage.BackgroundMethod25D.GUITexture)
            {
                if (Object.FindObjectOfType <BackgroundImageUI>() != null)
                {
                    BackgroundImageUI.Instance.ClearTexture(null);
                }

                if (_target.GUITexture == null)
                {
                    EditorGUILayout.HelpBox("A GUITexture component must be attached to this object for the chosen method to work.", MessageType.Warning);
                }
            }
            else if (_target.backgroundMethod25D == BackgroundImage.BackgroundMethod25D.UnityUI)
            {
                        #endif
            _target.backgroundTexture = (Texture)CustomGUILayout.ObjectField <Texture> ("Background texture:", _target.backgroundTexture, false, "", "The texture to display full-screen");
                        #if ALLOW_LEGACY_UI
        }
                        #endif

                        #if UNITY_STANDALONE && (UNITY_5 || UNITY_2017_1_OR_NEWER || UNITY_PRO_LICENSE) && !UNITY_2018_2_OR_NEWER
            EditorGUILayout.LabelField("When playing a MovieTexture:");
            _target.loopMovie = CustomGUILayout.Toggle("Loop clip?", _target.loopMovie, "", "If True, then any MovieTexture set as the background will be looped");
            _target.restartMovieWhenTurnOn = CustomGUILayout.Toggle("Restart clip each time?", _target.restartMovieWhenTurnOn, "", "If True, then any MovieTexture set as the background will start from the beginning when the associated Camera is activated");
                        #endif

            EditorGUILayout.EndVertical();
            UnityVersionHandler.CustomSetDirty(_target);
        }
        public override void OnInspectorGUI()
        {
            FootstepSounds _target = (FootstepSounds)target;

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

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

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

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemple #3
0
        public override void OnInspectorGUI()
        {
            PlayerStart _target = (PlayerStart)target;

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

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

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

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

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            timerType = (AC_TimerType)CustomGUILayout.EnumPopup("Timer type:", timerType, apiPrefix + ".timerType");
            if (timerType == AC_TimerType.LoadingProgress && AdvGame.GetReferences().settingsManager != null && !AdvGame.GetReferences().settingsManager.useAsyncLoading)
            {
                EditorGUILayout.HelpBox("Loading progress cannot be displayed unless asynchonised loading is enabled within the Settings Manager.", MessageType.Warning);
            }
            doInvert = CustomGUILayout.Toggle("Invert value?", doInvert, apiPrefix + ".doInvert");

            if (source == MenuSource.AdventureCreator)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Timer texture:", 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);
                uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle");
            }
            EditorGUILayout.EndVertical();

            if (source == MenuSource.AdventureCreator)
            {
                EndGUI(apiPrefix);
            }
        }
        public void ShowStartDataGUI(string apiPrefix)
        {
            GUILayout.Label("Starting point data for Player " + ID.ToString() + ": " + ((playerOb) ? playerOb.name : "(EMPTY)"), EditorStyles.boldLabel);

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

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

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

                if (startingPlayerStartID != 0)
                {
                    CustomGUILayout.BeginVertical();
                    EditorGUILayout.LabelField("Recorded ConstantID: " + startingPlayerStartID.ToString(), EditorStyles.miniLabel);
                    CustomGUILayout.EndVertical();
                }
            }
        }
        public static ActionListAsset AssetGUI(string label, ActionListAsset actionListAsset, string api = "", string defaultName = "")
        {
            EditorGUILayout.BeginHorizontal();
            actionListAsset = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> (label, actionListAsset, false, api);

            if (actionListAsset == null)
            {
                if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                {
                                        #if !(UNITY_WP8 || UNITY_WINRT)
                    defaultName = System.Text.RegularExpressions.Regex.Replace(defaultName, "[^\\w\\_]", "");
                                        #else
                    defaultName = "";
                                        #endif

                    if (defaultName != "")
                    {
                        actionListAsset = ActionListAssetMenu.CreateAsset(defaultName);
                    }
                    else
                    {
                        actionListAsset = ActionListAssetMenu.CreateAsset();
                    }
                }
            }

            EditorGUILayout.EndHorizontal();
            return(actionListAsset);
        }
 public TrackSnapConnection ShowGUI(DragTrack ownTrack, int i)
 {
     connectedTrack = (DragTrack)CustomGUILayout.ObjectField <DragTrack> ("Connected track " + i + ":", connectedTrack, true, "", "A connected track that a draggable object can transfer to when positioned at this point.");
     if (connectedTrack)
     {
         if (connectedTrack == ownTrack)
         {
             ACDebug.LogWarning(ownTrack + " cannot connect to itself", connectedTrack);
             connectedTrack = null;
         }
         else if (connectedTrack.allTrackSnapData == null || connectedTrack.allTrackSnapData.Count == 0)
         {
             //EditorGUILayout.HelpBox ("Cannot connect to this track - no snap regions defined!", MessageType.Warning);
             ACDebug.LogWarning(ownTrack + " cannot connect to track " + connectedTrack + ", - no snap regions defined", connectedTrack);
             connectedTrack = null;
         }
         else if (!connectedTrack.TypeSupportsSnapConnections())
         {
             //EditorGUILayout.HelpBox ("This track type does not support connections.", MessageType.Warning);
             ACDebug.LogWarning(ownTrack + " cannot connect to track " + connectedTrack + ", - this track type does not support connections", connectedTrack);
             connectedTrack = null;
         }
     }
     return(this);
 }
Exemple #8
0
        private void ArrowGUI(Arrow arrow, ActionListSource source, string label)
        {
            if (arrow != null)
            {
                ArrowPrompt _target = (ArrowPrompt)target;

                arrow.isPresent = CustomGUILayout.Toggle("Provide?", arrow.isPresent, "", "If True, the Arrow is defined and used in the ArrowPrompt");

                if (arrow.isPresent)
                {
                    arrow.texture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Icon texture:", arrow.texture, true, "", "The texture to draw on-screen");

                    EditorGUILayout.BeginHorizontal();
                    if (source == ActionListSource.InScene)
                    {
                        arrow.linkedCutscene = ActionListAssetMenu.CutsceneGUI("Linked Cutscene", arrow.linkedCutscene, _target.gameObject.name + ": " + label, "The Cutscene to run when the Arrow is triggered");
                    }
                    else if (source == ActionListSource.AssetFile)
                    {
                        arrow.linkedActionList = ActionListAssetMenu.AssetGUI("Linked ActionList:", arrow.linkedActionList, _target.gameObject.name + "_" + label, "", "The ActionList asset to run when the Arrow is triggered");
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }
        }
Exemple #9
0
        public override void OnInspectorGUI()
        {
            FollowSortingMap _target = (FollowSortingMap)target;

            _target.followSortingMap = CustomGUILayout.Toggle("Follow default Sorting Map?", _target.followSortingMap, "", "If True, then the component will follow the default Sorting Map defined in the Scene Manager");
            if (!_target.followSortingMap)
            {
                _target.customSortingMap = (SortingMap)CustomGUILayout.ObjectField <SortingMap> ("Sorting Map to follow:", _target.customSortingMap, true, "", "The Sorting Map to follow");
            }

            if (_target.followSortingMap || _target.customSortingMap != null)
            {
                _target.offsetOriginal = CustomGUILayout.Toggle("Offset original Order?", _target.offsetOriginal, "", "If True, then the SpriteRenderer's sorting values will be increased by their original values when the game began");
                _target.affectChildren = CustomGUILayout.Toggle("Also affect children?", _target.affectChildren, "", "If True, then the sorting values of child SpriteRenderers will be affected as well");

                bool oldPreviewValue = _target.livePreview;
                _target.livePreview = CustomGUILayout.Toggle("Edit-mode preview?", _target.livePreview, "", "If True, then the script will update the SpriteRender's sorting values when the game is not running");
                if (oldPreviewValue && !_target.livePreview)
                {
                    // Just unchecked, so reset scale
                    if (!Application.isPlaying && _target.GetComponentInParent <Char>() != null && _target.GetComponentInParent <Char>().spriteChild != null)
                    {
                        _target.GetComponentInParent <Char>().transform.localScale = Vector3.one;
                    }
                }
            }

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

            EditorGUILayout.BeginVertical("Button");
            _target.fadeTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Fade texture:", _target.fadeTexture, false, "", "The texture to display fullscreen when fading");

                        #if ALLOW_VR
            if (PlayerSettings.virtualRealitySupported)
            {
                _target.restoreTransformOnLoadVR = CustomGUILayout.ToggleLeft("Restore transform when loading?", _target.restoreTransformOnLoadVR, "", "If True, the camera's position and rotation will be restored when loading (Hand for VR)");
            }
                        #endif

            EditorGUILayout.EndVertical();

            if (Application.isPlaying)
            {
                EditorGUILayout.BeginVertical("Button");
                if (_target.attachedCamera)
                {
                    _target.attachedCamera = (_Camera)CustomGUILayout.ObjectField <_Camera> ("Attached camera:", _target.attachedCamera, true, "", "The current active camera, i.e. the one that the MainCamera is attaching itself to");
                }
                else
                {
                    EditorGUILayout.LabelField("Attached camera: None");
                }
                EditorGUILayout.EndVertical();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemple #11
0
 private T EditField <T> (string label, T field, string api = "") where T : Object
 {
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.LabelField(label, GUILayout.Width(85f));
     field = (T)CustomGUILayout.ObjectField <T> (field, false, GUILayout.MaxWidth(570f), api);
     EditorGUILayout.EndHorizontal();
     return(field);
 }
        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);
        }
Exemple #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");
                    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);
        }
Exemple #14
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();
                }
            }
        }
Exemple #15
0
        public void ShowGUI()
        {
            isPlayerLine = CustomGUILayout.Toggle("Player line?", isPlayerLine, "", "If True, the line is spoken by the active Player");
            if (isPlayerLine)
            {
                if (KickStarter.settingsManager != null && KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow)
                {
                    playerID = ChoosePlayerGUI(playerID);
                }
            }
            else
            {
                // For some reason, dynamically generating an ID number for a Char component destroys the component (?!), so we need to store a GameObject instead and convert to Char in the GUI
                Char speakerPrefab = (speakerObject != null) ? speakerObject.GetComponent <Char>() : null;
                speakerPrefab = (Char)CustomGUILayout.ObjectField <Char> ("Speaker prefab:", speakerPrefab, false, "", "The prefab of the character who is speaking the lines on this track");
                speakerObject = (speakerPrefab != null) ? speakerPrefab.gameObject : null;

                if (speakerObject != null)
                {
                    if (speakerObject.GetComponent <ConstantID>() == null || speakerObject.GetComponent <ConstantID>().constantID == 0)
                    {
                        UnityVersionHandler.AddConstantIDToGameObject <ConstantID> (speakerObject, true);
                    }

                    if (speakerObject.GetComponent <ConstantID>())
                    {
                        speakerConstantID = speakerObject.GetComponent <ConstantID>().constantID;
                    }

                    if (speakerObject.GetComponent <ConstantID>() == null || speakerConstantID == 0)
                    {
                        EditorGUILayout.HelpBox("A Constant ID number must be assigned to " + speakerObject + ".  Attach a ConstantID component and check 'Retain in prefab?'", MessageType.Warning);
                    }
                    else
                    {
                        EditorGUILayout.BeginVertical("Button");
                        EditorGUILayout.LabelField("Recorded ConstantID: " + speakerConstantID.ToString(), EditorStyles.miniLabel);
                        EditorGUILayout.EndVertical();
                    }
                }
            }

            playbackMode = (SpeechTrackPlaybackMode)EditorGUILayout.EnumPopup("Playback mode:", playbackMode);

            if (playbackMode == SpeechTrackPlaybackMode.Natural)
            {
                EditorGUILayout.HelpBox("Speech lines will last as long as the settings in the Speech Manager dictate.", MessageType.Info);
            }
            else if (playbackMode == SpeechTrackPlaybackMode.ClipDuration)
            {
                EditorGUILayout.HelpBox("Speech lines will last for the duration of their associated Timeline clip.", MessageType.Info);
            }
        }
Exemple #16
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);
        }
        public static void PropertiesGUI(DialogueOption _target)
        {
            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Dialogue Option 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");
            }
            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.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");
            }
            CustomGUILayout.EndVertical();

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

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

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

                    EditorGUILayout.Space();
                    CustomGUILayout.BeginVertical();

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

                    CustomGUILayout.EndVertical();
                }
            }
        }
Exemple #18
0
        public override void OnInspectorGUI()
        {
            TintMap _target = (TintMap)target;

            _target.tintMapTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Texture to use (optional):", _target.tintMapTexture, false, "", "An optional texture to make use of.  If this field is empty, then the texture found on the attached MeshRenderer's material will be used instead");
            if (_target.tintMapTexture && !Application.isPlaying)
            {
                EditorGUILayout.HelpBox("The supplied texture will be applied to the Mesh Renderer's material when the game begins.", MessageType.Info);
            }
            _target.colorModifier   = EditorGUILayout.ColorField("Color modifier:", _target.colorModifier);
            _target.disableRenderer = CustomGUILayout.Toggle("Disable mesh renderer?", _target.disableRenderer, "", "If True, then the MeshRenderer component will be disabled automatically when the game begins");

            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);
        }
Exemple #20
0
        public static ActionListAsset AssetGUI(string label, ActionListAsset actionListAsset, string api = "")
        {
            EditorGUILayout.BeginHorizontal();
            actionListAsset = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> (label, actionListAsset, false, api);

            if (actionListAsset == null)
            {
                if (GUILayout.Button("Create", GUILayout.MaxWidth(60f)))
                {
                    actionListAsset = ActionListAssetMenu.CreateAsset();
                }
            }

            EditorGUILayout.EndHorizontal();
            return(actionListAsset);
        }
        private AudioClip[] ShowClipsGUI(AudioClip[] clips, string headerLabel)
        {
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField(headerLabel, EditorStyles.boldLabel);
            List <AudioClip> clipsList = new List <AudioClip>();

            if (clips != null)
            {
                foreach (AudioClip clip in clips)
                {
                    clipsList.Add(clip);
                }
            }

            int numParameters = clipsList.Count;

            numParameters = EditorGUILayout.DelayedIntField("# of footstep sounds:", numParameters);

            if (numParameters < clipsList.Count)
            {
                clipsList.RemoveRange(numParameters, clipsList.Count - numParameters);
            }
            else if (numParameters > clipsList.Count)
            {
                if (numParameters > clipsList.Capacity)
                {
                    clipsList.Capacity = numParameters;
                }
                for (int i = clipsList.Count; i < numParameters; i++)
                {
                    clipsList.Add(null);
                }
            }

            for (int i = 0; i < clipsList.Count; i++)
            {
                clipsList[i] = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Sound #" + (i + 1).ToString(), clipsList[i], false, "", headerLabel);
            }
            if (clipsList.Count > 1)
            {
                EditorGUILayout.HelpBox("Sounds will be chosen at random.", MessageType.Info);
            }
            EditorGUILayout.EndVertical();

            return(clipsList.ToArray());
        }
        public override void OnInspectorGUI()
        {
            PlayerStart _target = (PlayerStart)target;

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

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

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

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

            CustomGUILayout.EndVertical();

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

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemple #23
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);
        }
Exemple #24
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);
        }
        public override void OnInspectorGUI()
        {
            LimitVisibility _target = (LimitVisibility)target;

            _target.Upgrade();

            int numOptions = _target.limitToCameras.Count;

            numOptions = EditorGUILayout.DelayedIntField("Number of cameras:", _target.limitToCameras.Count);
            if (_target.limitToCameras.Count < 0)
            {
                numOptions = 0;
            }
            if (numOptions < 1)
            {
                numOptions = 1;
            }

            if (numOptions < _target.limitToCameras.Count)
            {
                _target.limitToCameras.RemoveRange(numOptions, _target.limitToCameras.Count - numOptions);
            }
            else if (numOptions > _target.limitToCameras.Count)
            {
                if (numOptions > _target.limitToCameras.Capacity)
                {
                    _target.limitToCameras.Capacity = numOptions;
                }
                for (int i = _target.limitToCameras.Count; i < numOptions; i++)
                {
                    _target.limitToCameras.Add(null);
                }
            }

            for (int i = 0; i < _target.limitToCameras.Count; i++)
            {
                _target.limitToCameras [i] = (_Camera)CustomGUILayout.ObjectField <_Camera> ("Camera #" + i.ToString() + ":", _target.limitToCameras [i], true, "", "An AC _Camera to limit the GameObject's visibility to");
            }

            _target.negateEffect   = CustomGUILayout.Toggle("Negate effect?", _target.negateEffect, "", "If True, then the GameObject will instead be visible when the above cameras are not used");
            _target.affectChildren = CustomGUILayout.Toggle("Affect children too?", _target.affectChildren, "", "If True, then child GameObjects will be affected in the same way");

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemple #26
0
        public void ShowGUI(string apiPrefix)
        {
            EditorGUILayout.BeginHorizontal();

            string label = "Player " + ID + ":";

            if (isDefault)
            {
                label += " (DEFAULT)";
            }
            playerOb = (Player)CustomGUILayout.ObjectField <Player> (label, playerOb, false, "AC.KickStarter.settingsManager.players");

            if (GUILayout.Button(string.Empty, CustomStyles.IconCog))
            {
                SideMenu(this);
            }

            EditorGUILayout.EndHorizontal();
        }
Exemple #27
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);
        }
        public override void OnInspectorGUI()
        {
            if (_target.GetComponent <Char>() == null)
            {
                EditorGUILayout.HelpBox("This component must be placed alongside either the NPC or Player component.", MessageType.Warning);
            }

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

            _target.LimitTextureArray();

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

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

            if (texture == null)
            {
                return;
            }

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

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

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

                animSpeed          = CustomGUILayout.FloatField("Animation speed:", animSpeed, apiPrefix + ".animSpeed");
                endAnimOnLastFrame = CustomGUILayout.Toggle("End on last frame?", endAnimOnLastFrame, apiPrefix + ".endAnimOnLastFrame");
            }
        }
        private BackgroundImage ShowUnityUIMethod(BackgroundImage _target)
        {
                        #if ALLOW_VIDEO
            _target.backgroundImageSource = (BackgroundImage.BackgroundImageSource)CustomGUILayout.EnumPopup("Background type:", _target.backgroundImageSource, string.Empty, "What type of asset is used as a background");
            switch (_target.backgroundImageSource)
            {
            case BackgroundImage.BackgroundImageSource.Texture:
                _target.backgroundTexture = (Texture)CustomGUILayout.ObjectField <Texture> ("Texture:", _target.backgroundTexture, false, string.Empty, "The texture to display full-screen");
                break;

            case BackgroundImage.BackgroundImageSource.VideoClip:
                _target.backgroundTexture = (Texture)CustomGUILayout.ObjectField <Texture> ("Placeholder texture:", _target.backgroundTexture, false, string.Empty, "The texture to display full-screen while the VideoClip is being prepared");
                _target.backgroundVideo   = (VideoClip)CustomGUILayout.ObjectField <VideoClip> ("Video clip:", _target.backgroundVideo, false, string.Empty, "The VideoClip to animate full-screen");
                break;
            }
                        #else
            _target.backgroundTexture = (Texture)CustomGUILayout.ObjectField <Texture> ("Background texture:", _target.backgroundTexture, false, string.Empty, "The texture to display full-screen");
                        #endif

            return(_target);
        }