Beispiel #1
0
        public override void ShowGUI(List <ActionParameter> parameters)
        {
                        #if (UNITY_IOS || UNITY_ANDROID || UNITY_WP8 || UNITY_TVOS)
            movieClipType = (MovieClipType)EditorGUILayout.EnumPopup("Play clip:", movieClipType);
                        #else
            movieClipType = MovieClipType.VideoPlayer;
                        #endif

            if (movieClipType == MovieClipType.VideoPlayer)
            {
                                #if ALLOW_VIDEO
                videoPlayerParameterID = Action.ChooseParameterGUI("Video player:", parameters, videoPlayerParameterID, ParameterType.GameObject);
                if (videoPlayerParameterID >= 0)
                {
                    videoPlayerConstantID = 0;
                    videoPlayer           = null;
                }
                else
                {
                    videoPlayer = (VideoPlayer)EditorGUILayout.ObjectField("Video player:", videoPlayer, typeof(VideoPlayer), true);

                    videoPlayerConstantID = FieldToID <VideoPlayer> (videoPlayer, videoPlayerConstantID);
                    videoPlayer           = IDToField <VideoPlayer> (videoPlayer, videoPlayerConstantID, false);
                }

                movieMaterialMethod = (MovieMaterialMethod)EditorGUILayout.EnumPopup("Method:", movieMaterialMethod);

                if (movieMaterialMethod == MovieMaterialMethod.PlayMovie)
                {
                                        #if UNITY_WEBGL
                    movieURLParameterID = Action.ChooseParameterGUI("Movie URL:", parameters, movieURLParameterID, ParameterType.String);
                    if (movieURLParameterID < 0)
                    {
                        movieURL = EditorGUILayout.TextField("Movie URL:", movieURL);
                    }
                                        #else
                    newClip = (VideoClip)EditorGUILayout.ObjectField("New Clip (optional):", newClip, typeof(VideoClip), true);
                                        #endif

                    prepareOnly = EditorGUILayout.Toggle("Prepare only?", prepareOnly);
                    willWait    = EditorGUILayout.Toggle("Wait until finish?", willWait);

                    if (willWait && !prepareOnly)
                    {
                        pauseWithGame = EditorGUILayout.Toggle("Pause when game does?", pauseWithGame);
                        canSkip       = EditorGUILayout.Toggle("Player can skip?", canSkip);
                        if (canSkip)
                        {
                            skipKey = EditorGUILayout.TextField("Skip with Input Button:", skipKey);
                        }
                    }
                }
                                #elif UNITY_SWITCH
                EditorGUILayout.HelpBox("This option not available on Switch.", MessageType.Info);
                                #else
                EditorGUILayout.HelpBox("This option is only available when using Unity 5.6 or later.", MessageType.Info);
                                #endif

                AfterRunningOption();
                return;
            }

                        #if (UNITY_IOS || UNITY_ANDROID || UNITY_WP8 || UNITY_TVOS)
            if (movieClipType == MovieClipType.OnMaterial)
            {
                EditorGUILayout.HelpBox("This option is not available on the current platform.", MessageType.Info);
            }
            else
            {
                filePath = EditorGUILayout.TextField("Path to clip file:", filePath);
                canSkip  = EditorGUILayout.Toggle("Player can skip?", canSkip);

                EditorGUILayout.HelpBox("The clip must be placed in a folder named 'StreamingAssets'.", MessageType.Info);
            }
                        #endif

            AfterRunningOption();
        }
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            movieClipType = (MovieClipType)EditorGUILayout.EnumPopup("Play clip:", movieClipType);

            if (movieClipType == MovieClipType.VideoPlayer)
            {
                                #if ALLOW_VIDEO
                videoPlayerParameterID = Action.ChooseParameterGUI("Video player:", parameters, videoPlayerParameterID, ParameterType.GameObject);
                if (videoPlayerParameterID >= 0)
                {
                    videoPlayerConstantID = 0;
                    videoPlayer           = null;
                }
                else
                {
                    videoPlayer = (VideoPlayer)EditorGUILayout.ObjectField("Video player:", videoPlayer, typeof(VideoPlayer), true);

                    videoPlayerConstantID = FieldToID <VideoPlayer> (videoPlayer, videoPlayerConstantID);
                    videoPlayer           = IDToField <VideoPlayer> (videoPlayer, videoPlayerConstantID, false);
                }

                movieMaterialMethod = (MovieMaterialMethod)EditorGUILayout.EnumPopup("Method:", movieMaterialMethod);

                if (movieMaterialMethod == MovieMaterialMethod.PlayMovie)
                {
                                        #if UNITY_WEBGL
                    movieURLParameterID = Action.ChooseParameterGUI("Movie URL:", parameters, movieURLParameterID, ParameterType.String);
                    if (movieURLParameterID < 0)
                    {
                        movieURL = EditorGUILayout.TextField("Movie URL:", movieURL);
                    }
                                        #else
                    newClip = (VideoClip)EditorGUILayout.ObjectField("New Clip (optional):", newClip, typeof(VideoClip), true);
                                        #endif

                    prepareOnly = EditorGUILayout.Toggle("Prepare only?", prepareOnly);
                    willWait    = EditorGUILayout.Toggle("Wait until finish?", willWait);

                    if (willWait && !prepareOnly)
                    {
                        pauseWithGame = EditorGUILayout.Toggle("Pause when game does?", pauseWithGame);
                        canSkip       = EditorGUILayout.Toggle("Player can skip?", canSkip);
                        if (canSkip)
                        {
                            skipKey = EditorGUILayout.TextField("Skip with Input Button:", skipKey);
                        }
                    }
                }
                                #elif UNITY_SWITCH
                EditorGUILayout.HelpBox("This option not available on Switch.", MessageType.Info);
                                #else
                EditorGUILayout.HelpBox("This option is only available when using Unity 5.6 or later.", MessageType.Info);
                                #endif

                AfterRunningOption();
                return;
            }

                        #if (UNITY_IOS || UNITY_ANDROID || UNITY_WP8 || UNITY_TVOS)
            if (movieClipType == MovieClipType.OnMaterial)
            {
                EditorGUILayout.HelpBox("This option is not available on the current platform.", MessageType.Info);
            }
            else
            {
                filePath = EditorGUILayout.TextField("Path to clip file:", filePath);
                canSkip  = EditorGUILayout.Toggle("Player can skip?", canSkip);

                EditorGUILayout.HelpBox("The clip must be placed in a folder named 'StreamingAssets'.", MessageType.Info);
            }
                        #elif UNITY_STANDALONE && (UNITY_5 || UNITY_2017_1_OR_NEWER || UNITY_PRO_LICENSE) && !UNITY_2017_2_OR_NEWER
            movieClipParameterID = Action.ChooseParameterGUI("Movie clip:", parameters, movieClipParameterID, ParameterType.UnityObject);
            if (movieClipParameterID < 0)
            {
                movieClip = (MovieTexture)EditorGUILayout.ObjectField("Movie clip:", movieClip, typeof(MovieTexture), false);
            }

            if (movieClipType == MovieClipType.OnMaterial)
            {
                movieMaterialMethod = (MovieMaterialMethod)EditorGUILayout.EnumPopup("Method:", movieMaterialMethod);

                string label = "Material to play on:";
                if (movieMaterialMethod == MovieMaterialMethod.PauseMovie)
                {
                    label = "Material to pause:";
                }
                else if (movieMaterialMethod == MovieMaterialMethod.StopMovie)
                {
                    label = "Material to stop:";
                }

                materialParameterID = Action.ChooseParameterGUI(label, parameters, materialParameterID, ParameterType.UnityObject);
                if (materialParameterID < 0)
                {
                    material = (Material)EditorGUILayout.ObjectField(label, material, typeof(Material), true);
                }
            }

            if (movieClipType == MovieClipType.OnMaterial && movieMaterialMethod != MovieMaterialMethod.PlayMovie)
            {
            }
            else
            {
                includeAudio = EditorGUILayout.Toggle("Include audio?", includeAudio);
                if (includeAudio)
                {
                    sound = (Sound)EditorGUILayout.ObjectField("'Sound' to play audio:", sound, typeof(Sound), true);

                    soundID = FieldToID(sound, soundID);
                    sound   = IDToField(sound, soundID, false);
                }

                if (movieClipType == MovieClipType.OnMaterial && movieMaterialMethod == MovieMaterialMethod.PlayMovie)
                {
                    willWait = EditorGUILayout.Toggle("Wait until finish?", willWait);
                }
                if (movieClipType == MovieClipType.FullScreen || willWait)
                {
                    canSkip = EditorGUILayout.Toggle("Player can skip?", canSkip);
                    if (canSkip)
                    {
                        skipKey = EditorGUILayout.TextField("Skip with Input Button:", skipKey);
                    }
                }
            }
                        #else
            EditorGUILayout.HelpBox("On standalone, this Action is only available in Unity 5 or Unity Pro.", MessageType.Warning);
                        #endif

            AfterRunningOption();
        }