Пример #1
0
        /**
         * Shows the GUI.
         */
        public void ShowGUI()
        {
            if (icon == null)
            {
                icon = (Texture2D) AssetDatabase.LoadAssetAtPath ("Assets/AdventureCreator/Graphics/Textures/inspector-use.png", typeof (Texture2D));
            }

            #if UNITY_WEBPLAYER
            EditorGUILayout.HelpBox ("Exporting game text cannot be performed in WebPlayer mode - please switch platform to do so.", MessageType.Warning);
            GUILayout.Space (10);
            #endif

            EditorGUILayout.LabelField ("Subtitles", EditorStyles.boldLabel);

            separateLines = EditorGUILayout.ToggleLeft ("Treat carriage returns as separate speech lines?", separateLines);
            if (separateLines)
            {
                separateLinePause = EditorGUILayout.Slider ("Split line delay (s):", separateLinePause, 0.1f, 1f);
            }
            scrollSubtitles = EditorGUILayout.ToggleLeft ("Scroll speech text?", scrollSubtitles);
            scrollNarration = EditorGUILayout.ToggleLeft ("Scroll narration text?", scrollNarration);
            if (scrollSubtitles || scrollNarration)
            {
                textScrollSpeed = EditorGUILayout.FloatField ("Text scroll speed:", textScrollSpeed);
            }

            displayForever = EditorGUILayout.ToggleLeft ("Display speech forever until user skips it?", displayForever);
            if (displayForever)
            {
                endScrollBeforeSkip = EditorGUILayout.ToggleLeft ("Skipping speech first displays currently-scrolling text?", endScrollBeforeSkip);
                allowGameplaySpeechSkipping = EditorGUILayout.ToggleLeft ("Speech during gameplay can also be skipped?", allowGameplaySpeechSkipping);
            }
            else
            {
                screenTimeFactor = EditorGUILayout.FloatField ("Display time factor:", screenTimeFactor);
                allowSpeechSkipping = EditorGUILayout.ToggleLeft ("Subtitles can be skipped?", allowSpeechSkipping);
                if (allowSpeechSkipping)
                {
                    allowGameplaySpeechSkipping = EditorGUILayout.ToggleLeft ("Speech during gameplay can also be skipped?", allowGameplaySpeechSkipping);
                    if (scrollSubtitles)
                    {
                        endScrollBeforeSkip = EditorGUILayout.ToggleLeft ("Skipping speech first displays currently-scrolling text?", endScrollBeforeSkip);
                    }
                }
            }

            keepTextInBuffer = EditorGUILayout.ToggleLeft ("Retain subtitle text buffer once line has ended?", keepTextInBuffer);

            if (scrollSubtitles || scrollNarration)
            {
                EditorGUILayout.Space ();
                EditorGUILayout.LabelField ("Subtitle-scrolling audio", EditorStyles.boldLabel);
                textScrollCLip = (AudioClip) EditorGUILayout.ObjectField ("Default text scroll audio:", textScrollCLip, typeof (AudioClip), false);
                playScrollAudioEveryCharacter = EditorGUILayout.Toggle ("Play audio on every letter?", playScrollAudioEveryCharacter);
            }

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Speech audio", EditorStyles.boldLabel);

            forceSubtitles = EditorGUILayout.ToggleLeft ("Force subtitles to display when no speech audio is found?", forceSubtitles);
            searchAudioFiles = EditorGUILayout.ToggleLeft ("Auto-play speech audio files?", searchAudioFiles);
            autoNameSpeechFiles = EditorGUILayout.ToggleLeft ("Auto-name speech audio files?", autoNameSpeechFiles);
            translateAudio = EditorGUILayout.ToggleLeft ("Speech audio can be translated?", translateAudio);
            usePlayerRealName = EditorGUILayout.ToggleLeft ("Use Player prefab name in filenames?", usePlayerRealName);
            placeAudioInSubfolders = EditorGUILayout.ToggleLeft ("Place audio files in speaker subfolders?", placeAudioInSubfolders);
            sfxDucking = EditorGUILayout.Slider ("SFX reduction during:", sfxDucking, 0f, 1f);
            musicDucking = EditorGUILayout.Slider ("Music reduction during:", musicDucking, 0f, 1f);
            relegateBackgroundSpeechAudio = EditorGUILayout.ToggleLeft ("End background speech audio if non-background plays?", relegateBackgroundSpeechAudio);

            EditorGUILayout.Space ();

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Lip synching", EditorStyles.boldLabel);

            lipSyncMode = (LipSyncMode) EditorGUILayout.EnumPopup ("Lip syncing:", lipSyncMode);
            if (lipSyncMode == LipSyncMode.FromSpeechText || lipSyncMode == LipSyncMode.ReadPamelaFile || lipSyncMode == LipSyncMode.ReadSapiFile || lipSyncMode == LipSyncMode.ReadPapagayoFile)
            {
                lipSyncOutput = (LipSyncOutput) EditorGUILayout.EnumPopup ("Perform lipsync on:", lipSyncOutput);
                lipSyncSpeed = EditorGUILayout.FloatField ("Process speed:", lipSyncSpeed);

                if (GUILayout.Button ("Phonemes Editor"))
                {
                    PhonemesWindow window = (PhonemesWindow) EditorWindow.GetWindow (typeof (PhonemesWindow));
                    //window = (PhonemesWindow) AdvGame.SetWindowTitle (window, "Phonemes Editor");
                    window.Repaint ();
                }
            }
            else if (lipSyncMode == LipSyncMode.FaceFX && !FaceFXIntegration.IsDefinePresent ())
            {
                EditorGUILayout.HelpBox ("The 'FaceFXIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
            }
            else if (lipSyncMode == LipSyncMode.Salsa2D)
            {
                lipSyncOutput = (LipSyncOutput) EditorGUILayout.EnumPopup ("Perform lipsync on:", lipSyncOutput);

                EditorGUILayout.HelpBox ("Speaking animations must have 4 frames: Rest, Small, Medium and Large.", MessageType.Info);

                #if !SalsaIsPresent
                EditorGUILayout.HelpBox ("The 'SalsaIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
                #endif
            }
            else if (lipSyncMode == LipSyncMode.RogoLipSync && !RogoLipSyncIntegration.IsDefinePresent ())
            {
                EditorGUILayout.HelpBox ("The 'RogoLipSyncIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
            }

            EditorGUILayout.Space ();
            LanguagesGUI ();

            EditorGUILayout.Space ();

            GUILayout.Label ("Game text", EditorStyles.boldLabel);

            EditorGUILayout.BeginHorizontal ();
            if (GUILayout.Button ("Gather text", EditorStyles.miniButtonLeft))
            {
                PopulateList ();

                if (sceneFiles.Length > 0)
                {
                    Array.Sort (sceneFiles);
                }
            }
            if (GUILayout.Button ("Reset text", EditorStyles.miniButtonMid))
            {
                ClearList ();
            }

            if (lines.Count == 0)
            {
                GUI.enabled = false;
            }

            if (GUILayout.Button ("Create script sheet", EditorStyles.miniButtonRight))
            {
                if (lines.Count > 0)
                {
                    CreateScript ();
                }
            }
            EditorGUILayout.EndHorizontal ();

            EditorGUILayout.BeginHorizontal ();
            if (GUILayout.Button ("Import all translations", EditorStyles.miniButtonLeft))
            {
                ImportGameText ();
            }
            if (GUILayout.Button ("Export all translations", EditorStyles.miniButtonRight))
            {
                ExportGameText ();
            }
            EditorGUILayout.EndHorizontal ();

            GUI.enabled = true;

            if (lines.Count > 0)
            {
                EditorGUILayout.Space ();
                ListLines ();
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty (this);
            }
        }
Пример #2
0
		public void ShowGUI ()
		{
			#if UNITY_WEBPLAYER
			EditorGUILayout.HelpBox ("Exporting game text cannot be performed in WebPlayer mode - please switch platform to do so.", MessageType.Warning);
			GUILayout.Space (10);
			#endif

			EditorGUILayout.LabelField ("Subtitles", EditorStyles.boldLabel);

			separateLines = EditorGUILayout.Toggle ("Separate carriage returns?", separateLines);
			if (separateLines)
			{
				separateLinePause = EditorGUILayout.Slider ("Split line delay (s):", separateLinePause, 0.1f, 1f);
			}
			scrollSubtitles = EditorGUILayout.Toggle ("Scroll text?", scrollSubtitles);
			if (scrollSubtitles)
			{
				textScrollSpeed = EditorGUILayout.FloatField ("Text scroll speed:", textScrollSpeed);
				textScrollCLip = (AudioClip) EditorGUILayout.ObjectField ("Text scroll audio clip:", textScrollCLip, typeof (AudioClip), false);
			}

			displayForever = EditorGUILayout.Toggle ("Display indefinitely?", displayForever);
			if (displayForever)
			{
				endScrollBeforeSkip = EditorGUILayout.Toggle ("End scrolling before skip?", endScrollBeforeSkip);
			}
			else
			{
				screenTimeFactor = EditorGUILayout.FloatField ("Display time factor:", screenTimeFactor);
				allowSpeechSkipping = EditorGUILayout.Toggle ("Allow subtitle skipping?", allowSpeechSkipping);
				if (allowSpeechSkipping)
				{
					allowGameplaySpeechSkipping = EditorGUILayout.Toggle ("Skip background speech?", allowGameplaySpeechSkipping);
					if (scrollSubtitles)
					{
						endScrollBeforeSkip = EditorGUILayout.Toggle ("End scrolling before skip?", endScrollBeforeSkip);
					}
				}
			}

			keepTextInBuffer = EditorGUILayout.Toggle ("Retain text after playing?", keepTextInBuffer);

			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Audio", EditorStyles.boldLabel);

			forceSubtitles = EditorGUILayout.Toggle ("Force subtitles if no audio?", forceSubtitles);
			searchAudioFiles = EditorGUILayout.Toggle ("Auto-play audio files?", searchAudioFiles);
			translateAudio = EditorGUILayout.Toggle ("Audio translations?", translateAudio);

			EditorGUILayout.Space ();

			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Lip synching", EditorStyles.boldLabel);

			lipSyncMode = (LipSyncMode) EditorGUILayout.EnumPopup ("Lip syncing:", lipSyncMode);
			if (lipSyncMode == LipSyncMode.FromSpeechText || lipSyncMode == LipSyncMode.ReadPamelaFile || lipSyncMode == LipSyncMode.ReadSapiFile)
			{
				lipSyncOutput = (LipSyncOutput) EditorGUILayout.EnumPopup ("Perform lipsync on:", lipSyncOutput);
				lipSyncSpeed = EditorGUILayout.FloatField ("Process speed:", lipSyncSpeed);

				if (GUILayout.Button ("Phonemes Editor"))
				{
					PhonemesWindow window = (PhonemesWindow) EditorWindow.GetWindow (typeof (PhonemesWindow));
					window.title = "Phonemes Editor";
					window.Repaint ();
				}
			}
			else if (lipSyncMode == LipSyncMode.FaceFX && !FaceFXIntegration.IsDefinePresent ())
			{
				EditorGUILayout.HelpBox ("The 'FaceFXIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
			}

			EditorGUILayout.Space ();
			LanguagesGUI ();

			EditorGUILayout.Space ();
			
			GUILayout.Label ("Game text", EditorStyles.boldLabel);
			GUILayout.Label ("Speech audio files must be placed in: /Resources/Speech");

			EditorGUILayout.BeginHorizontal ();
			if (GUILayout.Button ("Gather text", EditorStyles.miniButtonLeft))
			{
				PopulateList ();
				
				if (sceneFiles.Length > 0)
				{
					Array.Sort (sceneFiles);
				}
			}
			if (GUILayout.Button ("Reset text", EditorStyles.miniButtonMid))
			{
				ClearList ();
			}
			if (GUILayout.Button ("Create script sheet", EditorStyles.miniButtonRight))
			{
				if (lines.Count > 0)
				{
					CreateScript ();
				}
			}
			EditorGUILayout.EndHorizontal ();

			EditorGUILayout.BeginHorizontal ();
			if (GUILayout.Button ("Import all translations", EditorStyles.miniButtonLeft))
			{
				ImportGameText ();
			}
			if (GUILayout.Button ("Export all translations", EditorStyles.miniButtonRight))
			{
				ExportGameText ();
			}
			EditorGUILayout.EndHorizontal ();

			if (lines.Count > 0)
			{
				ListLines ();
			}
			
			if (GUI.changed)
			{
				EditorUtility.SetDirty (this);
			}
		}