Exemplo n.º 1
0
        /**
         * Displays the GUI of the class's entry within the Speech Manager.
         */
        public void ShowGUI()
        {
            SpeechManager speechManager = AdvGame.GetReferences().speechManager;
            string        apiPrefix     = "KickStarter.speechManager.GetLine (" + lineID + ")";

            if (lineID == speechManager.activeLineID)
            {
                EditorGUILayout.BeginVertical("Button");

                EditorGUILayout.BeginHorizontal();

                EditorGUILayout.LabelField("ID #:", GUILayout.Width(85f));
                EditorGUILayout.LabelField(lineID.ToString(), GUILayout.MaxWidth(570f));

                if (textType == AC_TextType.Speech && GUILayout.Button("Locate source", GUILayout.MaxWidth(100)))
                {
                    KickStarter.speechManager.LocateLine(this);
                }
                EditorGUILayout.EndHorizontal();

                ShowField("Type:", textType.ToString(), false, apiPrefix + ".textType");
                ShowField("Original text:", text, true, apiPrefix + ".text");

                string sceneName = scene.Replace("Assets/", "");
                sceneName = sceneName.Replace(".unity", "");
                ShowField("Scene:", sceneName, true, apiPrefix + ".scene");

                if (textType == AC_TextType.Speech)
                {
                    ShowField("Speaker:", GetSpeakerName(), false, apiPrefix + ".owner");
                }

                if (speechManager.languages != null && speechManager.languages.Count > 1)
                {
                    for (int i = 0; i < speechManager.languages.Count; i++)
                    {
                        if (i == 0)
                        {
                        }
                        else if (translationText.Count > (i - 1))
                        {
                            translationText [i - 1] = EditField(speechManager.languages[i] + ":", translationText [i - 1], true);
                        }
                        else
                        {
                            ShowField(speechManager.languages[i] + ":", "(Not defined)", false);
                        }

                        if (speechManager.translateAudio && textType == AC_TextType.Speech)
                        {
                            string language = "";
                            if (i > 0)
                            {
                                language = speechManager.languages[i];
                            }

                            if (KickStarter.speechManager.autoNameSpeechFiles)
                            {
                                if (speechManager.UseFileBasedLipSyncing())
                                {
                                    ShowField(" (Lipsync path):", GetFolderName(language, true), false);
                                }
                                ShowField(" (Audio path):", GetFolderName(language), false);
                            }
                            else
                            {
                                if (i > 0)
                                {
                                    SetCustomArraySizes(speechManager.languages.Count - 1);
                                    if (speechManager.UseFileBasedLipSyncing())
                                    {
                                        customTranslationLipsyncFiles[i - 1] = EditField <Object> ("Lipsync file:", customTranslationLipsyncFiles[i - 1], apiPrefix + ".customTranslationLipsyncFiles[i-1]");
                                    }
                                    customTranslationAudioClips[i - 1] = EditField <AudioClip> ("Audio clip:", customTranslationAudioClips[i - 1], apiPrefix + ".customTranslationAudioClips[i-1]");
                                }
                                else
                                {
                                    if (speechManager.UseFileBasedLipSyncing())
                                    {
                                        customLipsyncFile = EditField <Object> ("Lipsync file:", customLipsyncFile, apiPrefix + ".customLipsyncFile");
                                    }
                                    customAudioClip = EditField <AudioClip> ("Audio clip:", customAudioClip, apiPrefix + ".customAudioClip");
                                }
                            }

                            EditorGUILayout.Space();
                        }
                    }

                    if (!speechManager.translateAudio && textType == AC_TextType.Speech)
                    {
                        if (KickStarter.speechManager.autoNameSpeechFiles)
                        {
                            if (speechManager.UseFileBasedLipSyncing())
                            {
                                ShowField("Lipsync path:", GetFolderName("", true), false);
                            }
                            ShowField("Audio path:", GetFolderName(""), false);
                        }
                        else
                        {
                            if (speechManager.UseFileBasedLipSyncing())
                            {
                                customLipsyncFile = EditField <Object> ("Lipsync file:", customLipsyncFile, apiPrefix + ".customLipsyncFile");
                            }
                            customAudioClip = EditField <AudioClip> ("Audio clip:", customAudioClip, apiPrefix + ".customAudioClip");
                        }
                    }
                }
                else if (textType == AC_TextType.Speech)
                {
                    //ShowField ("Text:", "'" + text + "'", true);

                    if (KickStarter.speechManager.autoNameSpeechFiles)
                    {
                        if (speechManager.UseFileBasedLipSyncing())
                        {
                            ShowField("Lipsync path:", GetFolderName("", true), false);
                        }
                        ShowField("Audio Path:", GetFolderName(""), false);
                    }
                    else
                    {
                        if (speechManager.UseFileBasedLipSyncing())
                        {
                            customLipsyncFile = EditField <Object> ("Lipsync file:", customLipsyncFile, apiPrefix + ".customLipsyncFile");
                        }
                        customAudioClip = EditField <AudioClip> ("Audio clip:", customAudioClip, apiPrefix + ".customAudioClip");
                    }
                }

                if (textType == AC_TextType.Speech)
                {
                    if (speechManager.autoNameSpeechFiles)
                    {
                        ShowField("Filename:", GetFilename() + lineID.ToString(), false);
                    }
                    description = EditField("Description:", description, true, apiPrefix + ".description");
                    if (tagID >= 0 && KickStarter.speechManager.useSpeechTags)
                    {
                        SpeechTag speechTag = speechManager.GetSpeechTag(tagID);
                        if (speechTag != null && speechTag.label.Length > 0)
                        {
                            ShowField("Tag: ", speechTag.label, false, apiPrefix + ".tagID");
                        }
                    }
                }

                EditorGUILayout.EndVertical();
            }
            else
            {
                if (GUILayout.Button(lineID.ToString() + ": '" + text + "'", EditorStyles.label, GUILayout.MaxWidth(300)))
                {
                    speechManager.activeLineID        = lineID;
                    EditorGUIUtility.editingTextField = false;
                }
                GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
            }
        }
Exemplo n.º 2
0
        public void ShowGUI()
        {
            SpeechManager speechManager = AdvGame.GetReferences().speechManager;

            if (this == speechManager.activeLine)
            {
                EditorGUILayout.BeginVertical("Button");
                ShowField("ID #:", lineID.ToString(), false);
                ShowField("Type:", textType.ToString(), false);

                string sceneName = scene.Replace("Assets/", "");
                sceneName = sceneName.Replace(".unity", "");
                ShowField("Scene:", sceneName, true);

                if (textType == AC_TextType.Speech)
                {
                    if (isPlayer)
                    {
                        if (KickStarter.speechManager && KickStarter.speechManager.usePlayerRealName)
                        {
                            ShowField("Speaker", owner, false);
                        }
                        else
                        {
                            ShowField("Speaker:", "Player", false);
                        }
                    }
                    else
                    {
                        ShowField("Speaker:", owner, false);
                    }
                }

                if (speechManager.languages != null && speechManager.languages.Count > 1)
                {
                    for (int i = 0; i < speechManager.languages.Count; i++)
                    {
                        if (i == 0)
                        {
                            ShowField("Original:", "'" + text + "'", true);
                        }
                        else if (translationText.Count > (i - 1))
                        {
                            ShowField(speechManager.languages[i] + ":", "'" + translationText [i - 1] + "'", true);
                        }
                        else
                        {
                            ShowField(speechManager.languages[i] + ":", "(Not defined)", false);
                        }
                        if (speechManager.translateAudio && textType == AC_TextType.Speech)
                        {
                            if (i == 0)
                            {
                                if (speechManager.UseFileBasedLipSyncing())
                                {
                                    ShowField(" (Lipsync path):", GetFolderName("", true), false);
                                }
                                ShowField(" (Audio path):", GetFolderName(""), false);
                            }
                            else
                            {
                                if (speechManager.UseFileBasedLipSyncing())
                                {
                                    ShowField(" (Lipsync path):", GetFolderName(speechManager.languages[i], true), false);
                                }
                                ShowField(" (Audio path):", GetFolderName(speechManager.languages[i]), false);
                            }
                            EditorGUILayout.Space();
                        }
                    }

                    if (!speechManager.translateAudio && textType == AC_TextType.Speech)
                    {
                        if (speechManager.UseFileBasedLipSyncing())
                        {
                            ShowField("Lipsync path:", GetFolderName("", true), false);
                        }
                        ShowField("Audio path:", GetFolderName(""), false);
                    }
                }
                else if (textType == AC_TextType.Speech)
                {
                    ShowField("Text:", "'" + text + "'", true);
                    if (speechManager.UseFileBasedLipSyncing())
                    {
                        ShowField("Lipsync path:", GetFolderName("", true), false);
                    }
                    ShowField("Audio Path:", GetFolderName(""), false);
                }

                if (textType == AC_TextType.Speech)
                {
                    ShowField("Filename:", GetFilename() + lineID.ToString(), false);
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Description:", GUILayout.Width(65f));
                    description = EditorGUILayout.TextField(description);
                    EditorGUILayout.EndHorizontal();
                }

                EditorGUILayout.EndVertical();
            }
            else
            {
                if (GUILayout.Button(lineID.ToString() + ": '" + text + "'", EditorStyles.label, GUILayout.MaxWidth(300)))
                {
                    speechManager.activeLine = this;
                }
                GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
            }
        }
        /**
         * <summary>Displays the GUI of the class's entry within the Speech Manager.</summary>
         */
        public void ShowGUI()
        {
            SpeechManager speechManager = AdvGame.GetReferences().speechManager;
            string        apiPrefix     = "KickStarter.speechManager.GetLine (" + lineID + ")";

            if (lineID == speechManager.activeLineID)
            {
                EditorGUILayout.BeginVertical("Button");

                EditorGUILayout.BeginHorizontal();

                EditorGUILayout.LabelField("ID #:", GUILayout.Width(85f));
                EditorGUILayout.LabelField(lineID.ToString(), GUILayout.MaxWidth(570f));


                if ((textType == AC_TextType.Speech || textType == AC_TextType.DialogueOption) && GUILayout.Button("Locate source", GUILayout.MaxWidth(100)))
                {
                    KickStarter.speechManager.LocateLine(this);
                }
                EditorGUILayout.EndHorizontal();

                ShowField("Type:", textType.ToString(), false, apiPrefix + ".textType");
                ShowField("Original text:", text, true, apiPrefix + ".text");

                string sceneName = scene.Replace("Assets/", string.Empty);
                sceneName = sceneName.Replace(".unity", string.Empty);
                ShowField("Scene:", sceneName, true, apiPrefix + ".scene");

                if (textType == AC_TextType.Speech)
                {
                    ShowField("Speaker:", GetSpeakerName(), false, apiPrefix + ".owner");
                }

                if (speechManager.languages != null && speechManager.languages.Count > 1)
                {
                    for (int i = 0; i < speechManager.languages.Count; i++)
                    {
                        if (i == 0)
                        {
                            if (speechManager.languages.Count > 1 && speechManager.translateAudio && !speechManager.ignoreOriginalText && textType == AC_TextType.Speech)
                            {
                                EditorGUILayout.Space();
                                EditorGUILayout.LabelField("Original language:");
                            }
                        }
                        else if (translationText.Count > (i - 1))
                        {
                            translationText [i - 1] = EditField(speechManager.languages[i] + ":", translationText [i - 1], true);
                        }
                        else
                        {
                            ShowField(speechManager.languages[i] + ":", "(Not defined)", false);
                        }

                        if (speechManager.translateAudio && textType == AC_TextType.Speech)
                        {
                            string language = string.Empty;
                            if (i > 0)
                            {
                                language = speechManager.languages[i];
                            }
                            else if (speechManager.ignoreOriginalText && speechManager.languages.Count > 1)
                            {
                                continue;
                            }

                            if (speechManager.autoNameSpeechFiles)
                            {
                                if (SeparatePlayerAudio() && speechManager.placeAudioInSubfolders)
                                {
                                    for (int j = 0; j < KickStarter.settingsManager.players.Count; j++)
                                    {
                                        if (KickStarter.settingsManager.players[j].playerOb)
                                        {
                                            if (speechManager.UseFileBasedLipSyncing())
                                            {
                                                ShowField("Lipsync path " + j.ToString() + ":", GetFolderName(language, true, KickStarter.settingsManager.players[j].playerOb.name), false);
                                            }
                                            ShowField("Audio Path " + j.ToString() + ":", GetFolderName(language, false, KickStarter.settingsManager.players[j].playerOb.name), false);
                                        }
                                    }
                                }
                                else
                                {
                                    if (speechManager.useAssetBundles)
                                    {
                                        if (speechManager.UseFileBasedLipSyncing())
                                        {
                                            if (!string.IsNullOrEmpty(speechManager.languageLipsyncAssetBundles[i]))
                                            {
                                                ShowField(" (Lipsync AB):", "StreamingAssets/" + speechManager.languageLipsyncAssetBundles[i], false);
                                            }
                                        }

                                        if (!string.IsNullOrEmpty(speechManager.languageAudioAssetBundles[i]))
                                        {
                                            ShowField(" (Audio AB):", "StreamingAssets/" + speechManager.languageAudioAssetBundles[i], false);
                                        }
                                    }
                                    else
                                    {
                                        if (speechManager.UseFileBasedLipSyncing())
                                        {
                                            EditorGUILayout.BeginHorizontal();
                                            ShowField(" (Lipsync path):", GetFolderName(language, true), false);
                                            ShowLocateButton(i, true);
                                            EditorGUILayout.EndHorizontal();
                                        }

                                        EditorGUILayout.BeginHorizontal();
                                        ShowField(" (Audio path):", GetFolderName(language), false);
                                        ShowLocateButton(i);
                                        EditorGUILayout.EndHorizontal();
                                    }
                                }
                            }
                            else
                            {
                                if (i > 0)
                                {
                                    SetCustomArraySizes(speechManager.languages.Count - 1);
                                    if (speechManager.UseFileBasedLipSyncing())
                                    {
                                        customTranslationLipsyncFiles[i - 1] = EditField <Object> ("Lipsync file:", customTranslationLipsyncFiles[i - 1], apiPrefix + ".customTranslationLipsyncFiles[i-1]");
                                    }
                                    customTranslationAudioClips[i - 1] = EditField <AudioClip> ("Audio clip:", customTranslationAudioClips[i - 1], apiPrefix + ".customTranslationAudioClips[i-1]");
                                }
                                else
                                {
                                    if (speechManager.UseFileBasedLipSyncing())
                                    {
                                        customLipsyncFile = EditField <Object> ("Lipsync file:", customLipsyncFile, apiPrefix + ".customLipsyncFile");
                                    }
                                    customAudioClip = EditField <AudioClip> ("Audio clip:", customAudioClip, apiPrefix + ".customAudioClip");
                                }
                            }

                            EditorGUILayout.Space();
                        }
                    }
                }

                // Original language
                if (textType == AC_TextType.Speech)
                {
                    if (speechManager.languages == null || speechManager.languages.Count <= 1 || !speechManager.translateAudio)
                    {
                        if (speechManager.autoNameSpeechFiles)
                        {
                            if (SeparatePlayerAudio() && speechManager.placeAudioInSubfolders)
                            {
                                for (int i = 0; i < KickStarter.settingsManager.players.Count; i++)
                                {
                                    if (KickStarter.settingsManager.players[i].playerOb)
                                    {
                                        if (speechManager.UseFileBasedLipSyncing())
                                        {
                                            ShowField("Lipsync path " + i.ToString() + ":", GetFolderName(string.Empty, true, KickStarter.settingsManager.players[i].playerOb.name), false);
                                        }
                                        ShowField("Audio Path " + i.ToString() + ":", GetFolderName(string.Empty, false, KickStarter.settingsManager.players[i].playerOb.name), false);
                                    }
                                }
                            }
                            else
                            {
                                if (speechManager.useAssetBundles)
                                {
                                    if (speechManager.UseFileBasedLipSyncing())
                                    {
                                        if (!string.IsNullOrEmpty(speechManager.languageLipsyncAssetBundles[0]))
                                        {
                                            ShowField("Lipsync AB:", "StreamingAssets/" + speechManager.languageLipsyncAssetBundles[0], false);
                                        }
                                    }

                                    if (!string.IsNullOrEmpty(speechManager.languageAudioAssetBundles[0]))
                                    {
                                        ShowField("Audio AB:", "StreamingAssets/" + speechManager.languageAudioAssetBundles[0], false);
                                    }
                                }
                                else
                                {
                                    if (speechManager.UseFileBasedLipSyncing())
                                    {
                                        EditorGUILayout.BeginHorizontal();
                                        ShowField("Lipsync path:", GetFolderName(string.Empty, true), false);
                                        ShowLocateButton(0, true);
                                        EditorGUILayout.EndHorizontal();
                                    }

                                    EditorGUILayout.BeginHorizontal();
                                    ShowField("Audio Path:", GetFolderName(string.Empty), false);
                                    ShowLocateButton(0);
                                    EditorGUILayout.EndHorizontal();
                                }
                            }
                        }
                        else
                        {
                            if (speechManager.UseFileBasedLipSyncing())
                            {
                                customLipsyncFile = EditField <Object> ("Lipsync file:", customLipsyncFile, apiPrefix + ".customLipsyncFile");
                            }
                            customAudioClip = EditField <AudioClip> ("Audio clip:", customAudioClip, apiPrefix + ".customAudioClip");
                        }
                    }

                    if (speechManager.autoNameSpeechFiles)
                    {
                        if (SeparatePlayerAudio())
                        {
                            for (int i = 0; i < KickStarter.settingsManager.players.Count; i++)
                            {
                                if (KickStarter.settingsManager.players[i].playerOb)
                                {
                                    ShowField("Filename " + i.ToString() + ":", GetFilename(KickStarter.settingsManager.players[i].playerOb.name) + lineID.ToString(), false);
                                }
                            }
                        }
                        else
                        {
                            ShowField("Filename:", GetFilename() + lineID.ToString(), false);
                        }
                    }

                    if (tagID >= 0 && speechManager.useSpeechTags)
                    {
                        SpeechTag speechTag = speechManager.GetSpeechTag(tagID);
                        if (speechTag != null && speechTag.label.Length > 0)
                        {
                            ShowField("Tag: ", speechTag.label, false, apiPrefix + ".tagID");
                        }
                    }
                }

                if (SupportsDescriptions())
                {
                    description = EditField("Description:", description, true, apiPrefix + ".description");
                }

                EditorGUILayout.EndVertical();
            }
            else
            {
                if (GUILayout.Button(lineID.ToString() + ": '" + GetShortText() + "'", EditorStyles.label, GUILayout.MaxWidth(300)))
                {
                    speechManager.activeLineID        = lineID;
                    EditorGUIUtility.editingTextField = false;
                }
                GUILayout.Box(string.Empty, GUILayout.ExpandWidth(true), GUILayout.Height(1));
            }
        }
Exemplo n.º 4
0
        /**
         * Displays the GUI of the class's entry within the Speech Manager.
         */
        public void ShowGUI()
        {
            SpeechManager speechManager = AdvGame.GetReferences().speechManager;

            if (this == speechManager.activeLine)
            {
                EditorGUILayout.BeginVertical("Button");

                ShowField("ID #:", lineID.ToString(), false);
                ShowField("Type:", textType.ToString(), false);
                ShowField("Original text:", text, true);

                string sceneName = scene.Replace("Assets/", "");
                sceneName = sceneName.Replace(".unity", "");
                ShowField("Scene:", sceneName, true);

                if (textType == AC_TextType.Speech)
                {
                    ShowField("Speaker:", GetSpeakerName(), false);
                }

                if (speechManager.languages != null && speechManager.languages.Count > 1)
                {
                    for (int i = 0; i < speechManager.languages.Count; i++)
                    {
                        if (i == 0)
                        {
                        }
                        else if (translationText.Count > (i - 1))
                        {
                            translationText [i - 1] = EditField(speechManager.languages[i] + ":", translationText [i - 1], true);
                        }
                        else
                        {
                            ShowField(speechManager.languages[i] + ":", "(Not defined)", false);
                        }

                        if (speechManager.translateAudio && textType == AC_TextType.Speech)
                        {
                            string language = "";
                            if (i > 0)
                            {
                                language = speechManager.languages[i];
                            }

                            if (KickStarter.speechManager.autoNameSpeechFiles)
                            {
                                if (speechManager.UseFileBasedLipSyncing())
                                {
                                    ShowField(" (Lipsync path):", GetFolderName(language, true), false);
                                }
                                ShowField(" (Audio path):", GetFolderName(language), false);
                            }
                            else
                            {
                                if (i > 0)
                                {
                                    SetCustomArraySizes(speechManager.languages.Count - 1);
                                    if (speechManager.UseFileBasedLipSyncing())
                                    {
                                        customTranslationLipsyncFiles[i - 1] = (TextAsset)EditorGUILayout.ObjectField("Lipsync file:", customTranslationLipsyncFiles[i - 1], typeof(TextAsset), false);
                                    }
                                    customTranslationAudioClips[i - 1] = (AudioClip)EditorGUILayout.ObjectField("Audio clip:", customTranslationAudioClips[i - 1], typeof(AudioClip), false);
                                }
                                else
                                {
                                    if (speechManager.UseFileBasedLipSyncing())
                                    {
                                        customLipsyncFile = (TextAsset)EditorGUILayout.ObjectField("Lipsync file:", customLipsyncFile, typeof(TextAsset), false);
                                    }
                                    customAudioClip = (AudioClip)EditorGUILayout.ObjectField("Audio clip:", customAudioClip, typeof(AudioClip), false);
                                }
                            }

                            EditorGUILayout.Space();
                        }
                    }

                    if (!speechManager.translateAudio && textType == AC_TextType.Speech)
                    {
                        if (KickStarter.speechManager.autoNameSpeechFiles)
                        {
                            if (speechManager.UseFileBasedLipSyncing())
                            {
                                ShowField("Lipsync path:", GetFolderName("", true), false);
                            }
                            ShowField("Audio path:", GetFolderName(""), false);
                        }
                        else
                        {
                            if (speechManager.UseFileBasedLipSyncing())
                            {
                                customLipsyncFile = (TextAsset)EditorGUILayout.ObjectField("Lipsync file:", customLipsyncFile, typeof(TextAsset), false);
                            }
                            customAudioClip = (AudioClip)EditorGUILayout.ObjectField("Audio clip:", customAudioClip, typeof(AudioClip), false);
                        }
                    }
                }
                else if (textType == AC_TextType.Speech)
                {
                    ShowField("Text:", "'" + text + "'", true);

                    if (KickStarter.speechManager.autoNameSpeechFiles)
                    {
                        if (speechManager.UseFileBasedLipSyncing())
                        {
                            ShowField("Lipsync path:", GetFolderName("", true), false);
                        }
                        ShowField("Audio Path:", GetFolderName(""), false);
                    }
                    else
                    {
                        if (speechManager.UseFileBasedLipSyncing())
                        {
                            customLipsyncFile = (TextAsset)EditorGUILayout.ObjectField("Lipsync file:", customLipsyncFile, typeof(TextAsset), false);
                        }
                        customAudioClip = (AudioClip)EditorGUILayout.ObjectField("Audio clip:", customAudioClip, typeof(AudioClip), false);
                    }
                }

                if (textType == AC_TextType.Speech)
                {
                    if (speechManager.autoNameSpeechFiles)
                    {
                        ShowField("Filename:", GetFilename() + lineID.ToString(), false);
                    }

                    /*else
                     * {
                     *      customAudioClip = (AudioClip) EditorGUILayout.ObjectField ("Audio clip:", customAudioClip, typeof (AudioClip), false);
                     * }*/
                    description = EditField("Description:", description, true);
                }

                EditorGUILayout.EndVertical();
            }
            else
            {
                if (GUILayout.Button(lineID.ToString() + ": '" + text + "'", EditorStyles.label, GUILayout.MaxWidth(300)))
                {
                    speechManager.activeLine = this;
                }
                GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
            }
        }