コード例 #1
0
            public bool Process(string cellText, SpeechLine speechLine)
            {
                if (cellText == null)
                {
                    return(false);
                }

                cellText = AddLineBreaks(cellText);
                //cellText = cellText.Replace (CSVReader.csvTemp, CSVReader.csvComma);

                if (importColumnType != ImportColumnType.DoNotImport)
                {
                    if (importColumnType == ImportColumnType.ImportAsDescription)
                    {
                        if (speechLine.description != cellText)
                        {
                            speechLine.description = cellText;
                            return(true);
                        }
                    }
                    else if (importColumnType == ImportColumnType.ImportAsTranslation)
                    {
                        if (speechLine.translationText != null && speechLine.translationText.Count > translationIndex)
                        {
                            if (speechLine.translationText [translationIndex] != cellText)
                            {
                                speechLine.translationText [translationIndex] = cellText;
                                return(true);
                            }
                        }
                    }
                }

                return(false);
            }
コード例 #2
0
        private void ShowActionTypeGUI()
        {
            if (selectedClass == null || string.IsNullOrEmpty(selectedClass.fileName))
            {
                return;
            }

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showActionType = CustomGUILayout.ToggleHeader(showActionType, selectedClass.GetFullTitle());
            if (showActionType)
            {
                SpeechLine.ShowField("Name:", selectedClass.GetFullTitle(), false);
                SpeechLine.ShowField("Filename:", selectedClass.fileName + ".cs", false);
                SpeechLine.ShowField("Description:", selectedClass.description, true);

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Node colour:", GUILayout.Width(85f));
                selectedClass.color = EditorGUILayout.ColorField(selectedClass.color);
                EditorGUILayout.EndHorizontal();

                if (!string.IsNullOrEmpty(defaultClassName) && selectedClass.fileName == defaultClassName)
                {
                    EditorGUILayout.HelpBox("This is marked as the default Action", MessageType.Info);
                }
                else
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Is enabled?", GUILayout.Width(85f));
                    selectedClass.isEnabled = EditorGUILayout.Toggle(selectedClass.isEnabled);
                    EditorGUILayout.EndHorizontal();
                }
            }
            CustomGUILayout.EndVertical();
        }
コード例 #3
0
 public bool IsMatch(SpeechLine newLine)
 {
     if (lineID == newLine.lineID && text == newLine.text && textType == newLine.textType && owner == newLine.owner)
     {
         return(true);
     }
     return(false);
 }
コード例 #4
0
ファイル: ScriptSheetWindow.cs プロジェクト: katuokite/TTLY
        private bool HasAudio(SpeechLine line, SpeechManager speechManager)
        {
            if (speechManager.autoNameSpeechFiles)
            {
                string language = (languageIndex == 0) ? string.Empty : speechManager.languages[languageIndex];

                if (KickStarter.settingsManager != null && line.SeparatePlayerAudio())
                {
                    bool doDisplay = false;
                    foreach (PlayerPrefab player in KickStarter.settingsManager.players)
                    {
                        if (player != null && player.playerOb != null)
                        {
                            string    fullName = line.GetAutoAssetPathAndName(language, false, player.playerOb.name);
                            AudioClip clipObj  = Resources.Load(fullName) as AudioClip;

                            if (clipObj == null)
                            {
                                doDisplay = true;
                            }
                        }
                    }

                    if (!doDisplay)
                    {
                        return(false);
                    }
                    return(true);
                }
                else
                {
                    string    fullName = line.GetAutoAssetPathAndName(language);
                    AudioClip clipObj  = Resources.Load(fullName) as AudioClip;

                    if (clipObj != null)
                    {
                        return(true);
                    }
                }
            }
            else
            {
                if (languageIndex == 0 && line.customAudioClip != null)
                {
                    return(true);
                }
                if (speechManager.translateAudio && languageIndex > 0 && line.customTranslationAudioClips.Count > (languageIndex - 1) && line.customTranslationAudioClips[languageIndex - 1] != null)
                {
                    return(true);
                }
                if (!speechManager.translateAudio && line.customAudioClip != null)
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #5
0
        /**
         * <summary>Initialises a new Speech line. This differs from the other StartDialog function in that it requires a lineID, which must be present in the Speech Manager and is used to source the line's actual text.</summary>
         * <param name = "_speaker">The speaking character. If null, the line will be treated as narration</param>
         * <param name = "lineID">The ID number of the line, if it is listed in the Speech Manager</param>
         * <param name = "isBackground">True if the line should play in the background, and not interrupt any Actions or gameplay</param>
         * <param name = "noAnimation">True if the character should not play a talking animation</param>
         * <returns>The generated Speech line</returns>
         */
        public Speech StartDialog(Char _speaker, int lineID, bool isBackground = false, bool noAnimation = false)
        {
            string _text = "";

            SpeechLine speechLine = KickStarter.speechManager.GetLine(lineID);

            if (speechLine != null)
            {
                _text = speechLine.text;
            }
            else
            {
                ACDebug.LogWarning("Cannot start dialog because the line ID " + lineID + " was not found in the Speech Manager.");
                return(null);
            }

            // Get the language
            string _language     = "";
            int    lanuageNumber = Options.GetLanguage();

            if (lanuageNumber > 0)
            {
                // Not in original language, so pull translation in from Speech Manager
                _language = KickStarter.runtimeLanguages.Languages [lanuageNumber];
            }

            // Remove speaker's previous line
            for (int i = 0; i < speechList.Count; i++)
            {
                if (speechList[i].GetSpeakingCharacter() == _speaker)
                {
                    EndSpeech(i);
                    i = 0;
                }
            }

            Speech speech = new Speech(_speaker, _text, lineID, _language, isBackground, noAnimation);

            speechList.Add(speech);

            KickStarter.runtimeVariables.AddToSpeechLog(speech.log);
            KickStarter.playerMenus.AssignSpeechToMenu(speech);

            if (speech.hasAudio)
            {
                if (KickStarter.speechManager.relegateBackgroundSpeechAudio)
                {
                    EndBackgroundSpeechAudio(speech);
                }

                KickStarter.stateHandler.UpdateAllMaxVolumes();
            }

            return(speech);
        }
コード例 #6
0
 /**
  * <summary>Checks if the class matches another, in terms of line ID, text, type and owner.
  * Used to determine if a speech line is a duplicate of another.</summary>
  * <param name = "newLine">The SpeechLine class to check against</param>
  * <param name = "ignoreID">If True, then a difference in lineID number will not matter</param>
  * <returns>True if the two classes have the same line ID, text, type and owner</returns>
  */
 public bool IsMatch(SpeechLine newLine, bool ignoreID = false)
 {
     if (text == newLine.text && textType == newLine.textType && owner == newLine.owner)
     {
         if (lineID == newLine.lineID || ignoreID)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #7
0
            public string GetCellText(SpeechLine speechLine)
            {
                string cellText = " ";

                if (columnType == ColumnType.DisplayText)
                {
                    if (language > 0)
                    {
                        int translation = language - 1;
                        if (speechLine.translationText != null && speechLine.translationText.Count > translation)
                        {
                            cellText = speechLine.translationText[translation];
                        }
                    }
                    else
                    {
                        cellText = speechLine.text;
                    }
                }
                else if (columnType == ColumnType.Type)
                {
                    cellText = speechLine.textType.ToString();
                }
                else if (columnType == ColumnType.AssociatedObject)
                {
                    if (speechLine.isPlayer && speechLine.owner == "" && speechLine.textType == AC_TextType.Speech)
                    {
                        cellText = "Player";
                    }
                    else
                    {
                        cellText = speechLine.owner;
                    }
                }
                else if (columnType == ColumnType.Scene)
                {
                    cellText = speechLine.scene;
                }
                else if (columnType == ColumnType.Description)
                {
                    cellText = speechLine.description;
                }
                else if (columnType == ColumnType.TagID)
                {
                    cellText = speechLine.tagID.ToString();
                }

                if (cellText == "")
                {
                    cellText = " ";
                }
                return(RemoveLineBreaks(cellText));
            }
コード例 #8
0
        public void RestoreBackup(SpeechLine backupLine)
        {
            translationText               = backupLine.translationText;
            customAudioClip               = backupLine.customAudioClip;
            customLipsyncFile             = backupLine.customLipsyncFile;
            customTranslationAudioClips   = backupLine.customTranslationAudioClips;
            customTranslationLipsyncFiles = backupLine.customTranslationLipsyncFiles;

            if (!gotCommentFromDescription && !string.IsNullOrEmpty(backupLine.description))
            {
                description = backupLine.description;
            }
        }
コード例 #9
0
 protected void PrepareAddressable()
 {
     if (!isAwaitingAddressable && KickStarter.speechManager.referenceSpeechFiles == ReferenceSpeechFiles.ByAddressable && speechPlayableData.lineID >= 0)
     {
         SpeechLine speechLine = KickStarter.speechManager.GetLine(speechPlayableData.lineID);
         if (speechLine != null)
         {
             string filename = speechLine.GetFilename();
             Addressables.LoadAssetAsync <AudioClip>(filename).Completed += OnCompleteLoad;
             isAwaitingAddressable = true;
         }
     }
 }
コード例 #10
0
            public bool Process(SpeechManager speechManager, string cellText, SpeechLine speechLine)
            {
                if (cellText == null)
                {
                    return(false);
                }

                cellText = AddLineBreaks(cellText);

                switch (importColumnType)
                {
                case ImportColumnType.ImportAsDescription:
                    if (speechLine.description != cellText)
                    {
                        speechLine.description = cellText;
                        return(true);
                    }
                    break;

                case ImportColumnType.ImportAsTranslation:
                    if (speechLine.translationText != null && speechLine.translationText.Count > translationIndex)
                    {
                        if (speechLine.translationText[translationIndex] != cellText)
                        {
                            speechLine.translationText[translationIndex] = cellText;
                            return(true);
                        }
                    }
                    break;

                case ImportColumnType.ImportAsOriginalText:
                    return(speechManager.UpdateOriginalText(speechLine, cellText));

                case ImportColumnType.ImportAsCustomFilename:
                    if (speechLine.textType == AC_TextType.Speech && speechLine.customFilename != cellText)
                    {
                        if (cellText == speechLine.DefaultFilename)
                        {
                            cellText = string.Empty;
                        }
                        speechLine.customFilename = cellText;
                        return(true);
                    }
                    break;

                default:
                    break;
                }

                return(false);
            }
コード例 #11
0
        /**
         * <summary>Initialises a new Speech line. This differs from the other StartDialog function in that it requires a lineID, which must be present in the Speech Manager and is used to source the line's actual text.</summary>
         * <param name = "_speaker">The speaking character. If null, the line will be treated as narration</param>
         * <param name = "lineID">The ID number of the line, if it is listed in the Speech Manager</param>
         * <param name = "isBackground">True if the line should play in the background, and not interrupt any Actions or gameplay</param>
         * <param name = "noAnimation">True if the character should not play a talking animation</param>
         * <returns>The generated Speech line</returns>
         */
        public Speech StartDialog(Char _speaker, int lineID, bool isBackground = false, bool noAnimation = false)
        {
            string _text = string.Empty;

            SpeechLine speechLine = KickStarter.speechManager.GetLine(lineID);

            if (speechLine != null)
            {
                _text = speechLine.text;
            }
            else
            {
                ACDebug.LogWarning("Cannot start dialog because the line ID " + lineID + " was not found in the Speech Manager.");
                return(null);
            }

            if (!KickStarter.runtimeLanguages.MarkLineAsSpoken(lineID))
            {
                return(null);
            }

            // Remove speaker's previous line
            for (int i = 0; i < speechList.Count; i++)
            {
                if (speechList[i].GetSpeakingCharacter() == _speaker)
                {
                    EndSpeech(i);
                    i = 0;
                }
            }

            Speech speech = new Speech(_speaker, _text, lineID, isBackground, noAnimation);

            speechList.Add(speech);

            KickStarter.runtimeVariables.AddToSpeechLog(speech.log);
            KickStarter.playerMenus.AssignSpeechToMenu(speech);

            if (speech.hasAudio)
            {
                if (KickStarter.speechManager.relegateBackgroundSpeechAudio)
                {
                    EndBackgroundSpeechAudio(speech);
                }

                KickStarter.stateHandler.UpdateAllMaxVolumes();
            }

            return(speech);
        }
コード例 #12
0
        private void Import()
        {
                        #if UNITY_WEBPLAYER
            ACDebug.LogWarning("Game text cannot be exported in WebPlayer mode - please switch platform and try again.");
                        #else
            if (speechManager == null || importColumns == null || importColumns.Count == 0 || speechManager.lines == null || speechManager.lines.Count == 0)
            {
                return;
            }
            int lineID = -1;

            int numUpdated = 0;
            for (int row = 1; row < numRows; row++)
            {
                if (csvData [0, row] != null && csvData [0, row].Length > 0)
                {
                    lineID = -1;
                    if (int.TryParse(csvData [0, row], out lineID))
                    {
                        SpeechLine speechLine = speechManager.GetLine(lineID);

                        if (speechLine != null)
                        {
                            for (int col = 0; col < numCols; col++)
                            {
                                if (importColumns.Count > col)
                                {
                                    string cellData = csvData [col, row];
                                    if (importColumns[col].Process(cellData, speechLine))
                                    {
                                        numUpdated++;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        ACDebug.LogWarning("Error importing translation (ID:" + csvData [0, row] + ") - make sure that the CSV file is delimited by a '" + CSVReader.csvDelimiter + "' character.");
                    }
                }
            }

            EditorUtility.SetDirty(speechManager);

            ACDebug.Log((numRows - 2).ToString() + " line(s) imported, " + numUpdated.ToString() + " line(s) updated.");
            this.Close();
                        #endif
        }
コード例 #13
0
ファイル: SpeechLine.cs プロジェクト: mcbodge/eidolon
 /**
  * A Constructor that copies all values from another SpeechLine.
  * This way ensures that no connection remains to the original class.
  */
 public SpeechLine(SpeechLine _speechLine)
 {
     isPlayer                      = _speechLine.isPlayer;
     lineID                        = _speechLine.lineID;
     scene                         = _speechLine.scene;
     owner                         = _speechLine.owner;
     text                          = _speechLine.text;
     description                   = _speechLine.description;
     textType                      = _speechLine.textType;
     translationText               = _speechLine.translationText;
     customAudioClip               = _speechLine.customAudioClip;
     customLipsyncFile             = _speechLine.customLipsyncFile;
     customTranslationAudioClips   = _speechLine.customTranslationAudioClips;
     customTranslationLipsyncFiles = _speechLine.customTranslationLipsyncFiles;
 }
コード例 #14
0
        private void CreateLanguage(string name, bool isRTL)
        {
            languages.Add(name);
            languageIsRightToLeft.Add(isRTL);

            foreach (SpeechLine speechManagerLine in KickStarter.speechManager.lines)
            {
                int _lineID = speechManagerLine.lineID;

                SpeechLine speechLine = null;
                if (speechLinesDictionary.TryGetValue(_lineID, out speechLine))
                {
                    speechLine.translationText.Add(speechLine.text);
                    continue;
                }
            }
        }
コード例 #15
0
        /**
         * <summary>Gets the translation of a line of text.</summary>
         * <param name = "originalText">The line in its original language.</param>
         * <param name = "_lineID">The translation ID number generated by SpeechManager's PopulateList() function</param>
         * <param name = "language">The index number of the language to return the line in, where 0 = the game's original language.</param>
         * <returns>The translation of the line, if it exists. If a translation does not exist, then the original line will be returned.</returns>
         */
        public string GetTranslation(string originalText, int _lineID, int language)
        {
            if (language == 0 || string.IsNullOrEmpty(originalText))
            {
                return(originalText);
            }

            if (_lineID == -1 || language <= 0)
            {
                ACDebug.Log("Cannot find translation for '" + originalText + "' because the text has not been added to the Speech Manager.");
                return(originalText);
            }
            else
            {
                SpeechLine speechLine;
                if (speechLinesDictionary.TryGetValue(_lineID, out speechLine))
                {
                    if (speechLine.translationText.Count > (language - 1))
                    {
                        return(speechLine.translationText [language - 1]);
                    }
                    else
                    {
                        ACDebug.LogWarning("A translation is being requested that does not exist!");
                    }
                }
                else
                {
                    if (KickStarter.settingsManager.showDebugLogs != ShowDebugLogs.Never)
                    {
                        SpeechLine originalLine = KickStarter.speechManager.GetLine(_lineID);
                        if (originalLine == null)
                        {
                            ACDebug.LogWarning("Cannot find translation for '" + originalText + "' because it's Line ID (" + _lineID + ") was not found in the Speech Manager.");
                        }
                    }
                    return(originalText);
                }
            }

            return(string.Empty);
        }
コード例 #16
0
        public SpeechLine(SpeechLine _speechLine, int voiceLanguage)
        {
            isPlayer                      = _speechLine.isPlayer;
            lineID                        = _speechLine.lineID;
            scene                         = _speechLine.scene;
            owner                         = _speechLine.owner;
            text                          = _speechLine.text;
            description                   = _speechLine.description;
            textType                      = _speechLine.textType;
            translationText               = _speechLine.translationText;
            customAudioClip               = (voiceLanguage == 0 || KickStarter.speechManager.fallbackAudio) ? _speechLine.customAudioClip : null;
            customLipsyncFile             = (voiceLanguage == 0 || KickStarter.speechManager.fallbackAudio) ? _speechLine.customLipsyncFile : null;
            customTranslationAudioClips   = GetAudioListForTranslation(_speechLine.customTranslationAudioClips, voiceLanguage);
            customTranslationLipsyncFiles = GetLipsyncListForTranslation(_speechLine.customTranslationLipsyncFiles, voiceLanguage);
            tagID                         = _speechLine.tagID;

                        #if UNITY_EDITOR
            orderID     = _speechLine.orderID;
            orderPrefix = _speechLine.orderPrefix;
                        #endif
        }
コード例 #17
0
        /**
         * A Constructor that copies all values from another SpeechLine.
         * This way ensures that no connection remains to the original class.
         */
        public SpeechLine(SpeechLine _speechLine)
        {
            isPlayer                      = _speechLine.isPlayer;
            lineID                        = _speechLine.lineID;
            scene                         = _speechLine.scene;
            owner                         = _speechLine.owner;
            text                          = _speechLine.text;
            description                   = _speechLine.description;
            textType                      = _speechLine.textType;
            translationText               = _speechLine.translationText;
            customAudioClip               = _speechLine.customAudioClip;
            customLipsyncFile             = _speechLine.customLipsyncFile;
            customTranslationAudioClips   = _speechLine.customTranslationAudioClips;
            customTranslationLipsyncFiles = _speechLine.customTranslationLipsyncFiles;
            tagID                         = _speechLine.tagID;

                        #if UNITY_EDITOR
            orderID     = _speechLine.orderID;
            orderPrefix = _speechLine.orderPrefix;
                        #endif
        }
コード例 #18
0
		private void ExtractHotspot (Hotspot hotspot, bool onlySeekNew)
		{
			if (hotspot.interactionSource == InteractionSource.AssetFile)
			{
				if (hotspot.useButton.IsButtonModified () && hotspot.useButton.assetFile)
				{
					ProcessActionList (hotspot.useButton.assetFile.actions, onlySeekNew, true);
					EditorUtility.SetDirty (hotspot.useButton.assetFile);
				}

				if (hotspot.lookButton.assetFile)
				{
					ProcessActionList (hotspot.lookButton.assetFile.actions, onlySeekNew, true);
					EditorUtility.SetDirty (hotspot.lookButton.assetFile);
				}

				foreach (Button _button in hotspot.useButtons)
				{
					if (_button.assetFile)
					{
						ProcessActionList (_button.assetFile.actions, onlySeekNew, true);
						EditorUtility.SetDirty (_button.assetFile);
					}
				}

				foreach (Button _button in hotspot.invButtons)
				{
					if (_button.assetFile)
					{
						ProcessActionList (_button.assetFile.actions, onlySeekNew, true);
						EditorUtility.SetDirty (_button.assetFile);
					}
				}
			}

			string hotspotName = hotspot.name;
			if (hotspot.hotspotName != "")
			{
				hotspotName = hotspot.hotspotName;
			}

			if (onlySeekNew && hotspot.lineID == -1)
			{
				// Assign a new ID on creation
				SpeechLine newLine;
				newLine = new SpeechLine (GetIDArray(), EditorApplication.currentScene, hotspotName, languages.Count - 1, AC_TextType.Hotspot);
				hotspot.lineID = newLine.lineID;
				lines.Add (newLine);
			}
			
			else if (!onlySeekNew && hotspot.lineID > -1)
			{
				// Already has an ID, so don't replace
				lines.Add (new SpeechLine (hotspot.lineID, EditorApplication.currentScene, hotspotName, languages.Count - 1, AC_TextType.Hotspot));
			}
		}
コード例 #19
0
 /**
  * <summary>Checks if the class matches another, in terms of line ID, text, type and owner.
  * Used to determine if a speech line is a duplicate of another.</summary>
  * <param name = "newLine">The SpeechLine class to check against</param>
  * <returns>True if the two classes have the same line ID, text, type and owner</returns>
  */
 public bool IsMatch(SpeechLine newLine)
 {
     if (lineID == newLine.lineID && text == newLine.text && textType == newLine.textType && owner == newLine.owner)
     {
         return true;
     }
     return false;
 }
コード例 #20
0
		private void ExtractPrefix (HotspotPrefix prefix, bool onlySeekNew)
		{
			if (onlySeekNew && prefix.lineID == -1)
			{
				// Assign a new ID on creation
				SpeechLine newLine;
				newLine = new SpeechLine (GetIDArray(), EditorApplication.currentScene, prefix.label, languages.Count - 1, AC_TextType.HotspotPrefix);
				prefix.lineID = newLine.lineID;
				lines.Add (newLine);
			}
			
			else if (!onlySeekNew && prefix.lineID > -1)
			{
				// Already has an ID, so don't replace
				lines.Add (new SpeechLine (prefix.lineID, EditorApplication.currentScene, prefix.label, languages.Count - 1, AC_TextType.HotspotPrefix));
			}
		}
コード例 #21
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private void ExtractHotspotOverride(MenuButton button, string hotspotLabel, bool onlySeekNew)
        {
            if (hotspotLabel == "")
            {
                button.hotspotLabelID = -1;
                return;
            }

            if (onlySeekNew && button.lineID == -1)
            {
                // Assign a new ID on creation
                SpeechLine newLine = new SpeechLine (GetIDArray(), "", button.title, hotspotLabel, languages.Count - 1, AC_TextType.MenuElement);
                button.hotspotLabelID = newLine.lineID;
                lines.Add (newLine);
            }

            else if (!onlySeekNew && button.hotspotLabelID > -1)
            {
                // Already has an ID, so don't replace
                SpeechLine existingLine = new SpeechLine (button.hotspotLabelID, "", button.title, hotspotLabel, languages.Count - 1, AC_TextType.MenuElement);

                int lineID = SmartAddLine (existingLine);
                if (lineID >= 0) button.hotspotLabelID = lineID;
            }
        }
コード例 #22
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private void ExtractHotspot(Hotspot hotspot, bool onlySeekNew)
        {
            if (hotspot.interactionSource == InteractionSource.AssetFile)
            {
                ProcessActionListAsset (hotspot.useButton.assetFile, onlySeekNew);
                ProcessActionListAsset (hotspot.lookButton.assetFile, onlySeekNew);
                ProcessActionListAsset (hotspot.unhandledInvButton.assetFile, onlySeekNew);

                foreach (Button _button in hotspot.useButtons)
                {
                    ProcessActionListAsset (_button.assetFile, onlySeekNew);
                }

                foreach (Button _button in hotspot.invButtons)
                {
                    ProcessActionListAsset (_button.assetFile, onlySeekNew);
                }
            }

            string hotspotName = hotspot.name;
            if (hotspot.hotspotName != "")
            {
                hotspotName = hotspot.hotspotName;
            }

            if (onlySeekNew && hotspot.lineID == -1)
            {
                // Assign a new ID on creation
                SpeechLine newLine = new SpeechLine (GetIDArray(), UnityVersionHandler.GetCurrentSceneName (), hotspotName, languages.Count - 1, AC_TextType.Hotspot);

                hotspot.lineID = newLine.lineID;
                lines.Add (newLine);
            }

            else if (!onlySeekNew && hotspot.lineID > -1)
            {
                // Already has an ID, so don't replace
                SpeechLine existingLine = new SpeechLine (hotspot.lineID, UnityVersionHandler.GetCurrentSceneName (), hotspotName, languages.Count - 1, AC_TextType.Hotspot);

                int lineID = SmartAddLine (existingLine);
                if (lineID >= 0) hotspot.lineID = lineID;
            }
        }
コード例 #23
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private void ExtractInventory(InvItem invItem, bool onlySeekNew)
        {
            if (onlySeekNew && invItem.lineID == -1)
            {
                // Assign a new ID on creation
                SpeechLine newLine;
                string _label = invItem.label;
                if (invItem.altLabel != "")
                {
                    _label = invItem.altLabel;
                }

                newLine = new SpeechLine (GetIDArray(), UnityVersionHandler.GetCurrentSceneName (), _label, languages.Count - 1, AC_TextType.InventoryItem);
                invItem.lineID = newLine.lineID;
                lines.Add (newLine);
            }

            else if (!onlySeekNew && invItem.lineID > -1)
            {
                // Already has an ID, so don't replace
                string _label = invItem.label;
                if (invItem.altLabel != "")
                {
                    _label = invItem.altLabel;
                }

                SpeechLine existingLine = new SpeechLine (invItem.lineID, UnityVersionHandler.GetCurrentSceneName (), _label, languages.Count - 1, AC_TextType.InventoryItem);

                int lineID = SmartAddLine (existingLine);
                if (lineID >= 0) invItem.lineID = lineID;
            }
        }
コード例 #24
0
ファイル: SpeechLine.cs プロジェクト: mcbodge/eidolon
 /**
  * A Constructor that copies all values from another SpeechLine.
  * This way ensures that no connection remains to the original class.
  */
 public SpeechLine(SpeechLine _speechLine)
 {
     isPlayer = _speechLine.isPlayer;
     lineID = _speechLine.lineID;
     scene = _speechLine.scene;
     owner = _speechLine.owner;
     text = _speechLine.text;
     description = _speechLine.description;
     textType = _speechLine.textType;
     translationText = _speechLine.translationText;
     customAudioClip = _speechLine.customAudioClip;
     customLipsyncFile = _speechLine.customLipsyncFile;
     customTranslationAudioClips = _speechLine.customTranslationAudioClips;
     customTranslationLipsyncFiles = _speechLine.customTranslationLipsyncFiles;
 }
コード例 #25
0
ファイル: ActionsManager.cs プロジェクト: IJkeB/Ekster1
        public void ShowGUI()
        {
            EditorGUILayout.BeginVertical("Button");
            GUILayout.Label("Actionlist editing settings", EditorStyles.boldLabel);
            displayActionsInInspector   = EditorGUILayout.ToggleLeft("List Actions in Inspector window?", displayActionsInInspector);
            displayActionsInEditor      = (DisplayActionsInEditor)EditorGUILayout.EnumPopup("Actions in Editor are:", displayActionsInEditor);
            actionListEditorScrollWheel = (ActionListEditorScrollWheel)EditorGUILayout.EnumPopup("Using scroll-wheel:", actionListEditorScrollWheel);
            invertPanning = EditorGUILayout.ToggleLeft("Invert panning in ActionList Editor?", invertPanning);
            allowMultipleActionListWindows = EditorGUILayout.ToggleLeft("Allow multiple ActionList Editor windows?", allowMultipleActionListWindows);
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical("Button");
            GUILayout.Label("Custom Action scripts", EditorStyles.boldLabel);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Folder to search:", GUILayout.Width(110f));
            GUILayout.Label(customFolderPath, EditorStyles.textField);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Set directory"))
            {
                string path     = EditorUtility.OpenFolderPanel("Set custom Actions directory", "Assets", "");
                string dataPath = Application.dataPath;
                if (path.Contains(dataPath))
                {
                    if (path == dataPath)
                    {
                        customFolderPath = "";
                    }
                    else
                    {
                        customFolderPath = path.Replace(dataPath + "/", "");
                    }
                }
                else
                {
                    Debug.LogError("Cannot set new directory - be sure to select within the Assets directory.");
                }
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();

            if (AllActions.Count > 0)
            {
                GUILayout.Space(10);

                foreach (ActionType subclass in AllActions)
                {
                    int enabledIndex = -1;
                    if (EnabledActions.Contains(subclass))
                    {
                        enabledIndex = EnabledActions.IndexOf(subclass);
                    }

                    if (selectedClass != null && subclass.category == selectedClass.category && subclass.title == selectedClass.title)
                    {
                        EditorGUILayout.BeginVertical("Button");
                        SpeechLine.ShowField("Name:", subclass.GetFullTitle(), false);
                        SpeechLine.ShowField("Filename:", subclass.fileName, false);
                        SpeechLine.ShowField("Description:", subclass.description, true);
                        subclass.isEnabled = true;                         // This is being set OnEnable anyway, because Action Types are now refreshed/generated automatically, so can't disable
                        //subclass.isEnabled = EditorGUILayout.Toggle ("Is enabled?", subclass.isEnabled);

                        EditorGUILayout.BeginHorizontal();
                        if (enabledIndex >= 0)
                        {
                            if (enabledIndex == defaultClass)
                            {
                                EditorGUILayout.LabelField("DEFAULT", EditorStyles.boldLabel, GUILayout.Width(70f));
                            }
                            else if (subclass.isEnabled)
                            {
                                if (GUILayout.Button("Make default?"))
                                {
                                    if (EnabledActions.Contains(subclass))
                                    {
                                        defaultClass = EnabledActions.IndexOf(subclass);
                                    }
                                }
                            }
                        }

                        if (GUILayout.Button("Search local instances"))
                        {
                            SearchForInstances(true, subclass);
                        }
                        if (GUILayout.Button("Search all instances"))
                        {
                            SearchForInstances(false, subclass);
                        }

                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.EndVertical();
                    }
                    else
                    {
                        EditorGUILayout.BeginHorizontal();
                        if (GUILayout.Button(subclass.GetFullTitle(), EditorStyles.label, GUILayout.Width(200f)))
                        {
                            selectedClass = subclass;
                        }
                        if (enabledIndex >= 0 && enabledIndex == defaultClass)
                        {
                            EditorGUILayout.LabelField("DEFAULT", EditorStyles.boldLabel, GUILayout.Width(60f));
                        }
                        EditorGUILayout.EndHorizontal();
                        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                    }
                }

                if (defaultClass > EnabledActions.Count - 1)
                {
                    defaultClass = EnabledActions.Count - 1;
                }
            }
            else
            {
                EditorGUILayout.HelpBox("No Action subclass files found.", MessageType.Warning);
            }

            if (GUI.changed)
            {
                SetEnabled();
                EditorUtility.SetDirty(this);
            }
        }
コード例 #26
0
ファイル: SpeechManager.cs プロジェクト: IJkeB/Ekster_Final
        private void ExtractSpeech(ActionSpeech action, bool onlySeekNew, bool isInScene)
        {
            string speaker = "";
            bool isPlayer = action.isPlayer;

            if (action.isPlayer)
            {
                if (KickStarter.settingsManager && KickStarter.settingsManager.player)
                {
                    speaker = KickStarter.settingsManager.player.name;
                }
                else
                {
                    speaker = "Player";
                }
            }
            else
            {
                if (!isInScene)
                {
                    action.SetSpeaker ();
                }

                if (action.speaker)
                {
                    speaker = action.speaker.name;
                }
                else
                {
                    speaker = "Narrator";
                }
            }

            if (speaker != "" && action.messageText != "")
            {
                if (onlySeekNew && action.lineID == -1)
                {
                    // Assign a new ID on creation
                    string _scene = "";
                    SpeechLine newLine;
                    if (isInScene)
                    {
                        _scene = EditorApplication.currentScene;
                    }
                    newLine = new SpeechLine (GetIDArray(), _scene, speaker, action.messageText, languages.Count - 1, AC_TextType.Speech, isPlayer);

                    action.lineID = newLine.lineID;
                    lines.Add (newLine);
                }

                else if (!onlySeekNew && action.lineID > -1)
                {
                    // Already has an ID, so don't replace
                    string _scene = "";
                    SpeechLine existingLine;
                    if (isInScene)
                    {
                        _scene = EditorApplication.currentScene;
                    }
                    existingLine = new SpeechLine (action.lineID, _scene, speaker, action.messageText, languages.Count - 1, AC_TextType.Speech, isPlayer);

                    int lineID = SmartAddLine (existingLine);
                    if (lineID >= 0) action.lineID = lineID;
                }
            }
            else
            {
                // Remove from SpeechManager
                action.lineID = -1;
            }
        }
コード例 #27
0
		private void ExtractSpeech (ActionSpeech action, bool onlySeekNew, bool isInScene)
		{
			string speaker = "";
			
			if (action.isPlayer)
			{
				speaker = "Player";
			}
			else if (action.speaker)
			{
				speaker = action.speaker.name;
			}
			else
			{
				speaker = "Narrator";
			}
			
			if (speaker != "" && action.messageText != "")
			{
				if (onlySeekNew && action.lineID == -1)
				{
					// Assign a new ID on creation
					SpeechLine newLine;
					if (isInScene)
					{
						newLine = new SpeechLine (GetIDArray(), EditorApplication.currentScene, speaker, action.messageText, languages.Count - 1, AC_TextType.Speech);
					}
					else
					{
						newLine = new SpeechLine (GetIDArray(), "", speaker, action.messageText, languages.Count - 1, AC_TextType.Speech);
					}
					action.lineID = newLine.lineID;
					lines.Add (newLine);
				}
				
				else if (!onlySeekNew && action.lineID > -1)
				{
					// Already has an ID, so don't replace
					if (isInScene)
					{
						lines.Add (new SpeechLine (action.lineID, EditorApplication.currentScene, speaker, action.messageText, languages.Count - 1, AC_TextType.Speech));
					}
					else
					{
						lines.Add (new SpeechLine (action.lineID, "", speaker, action.messageText, languages.Count - 1, AC_TextType.Speech));
					}
				}
			}
			else
			{
				// Remove from SpeechManager
				action.lineID = -1;
			}
		}
コード例 #28
0
		private void ExtractJournalEntry (ActionMenuState action, bool onlySeekNew, bool isInScene)
		{
			if (action.changeType == ActionMenuState.MenuChangeType.AddJournalPage && action.journalText != "")
			{
				if (onlySeekNew && action.lineID == -1)
				{
					// Assign a new ID on creation
					SpeechLine newLine;
					if (isInScene)
					{
						newLine = new SpeechLine (GetIDArray(), EditorApplication.currentScene, action.journalText, languages.Count - 1, AC_TextType.JournalEntry);
					}
					else
					{
						newLine = new SpeechLine (GetIDArray(), "", action.journalText, languages.Count - 1, AC_TextType.JournalEntry);
					}
					action.lineID = newLine.lineID;
					lines.Add (newLine);
				}
				
				else if (!onlySeekNew && action.lineID > -1)
				{
					// Already has an ID, so don't replace
					if (isInScene)
					{
						lines.Add (new SpeechLine (action.lineID, EditorApplication.currentScene, action.journalText, languages.Count - 1, AC_TextType.JournalEntry));
					}
					else
					{
						lines.Add (new SpeechLine (action.lineID, "", action.journalText, languages.Count - 1, AC_TextType.JournalEntry));
					}
				}
			}
			else
			{
				// Remove from SpeechManager
				action.lineID = -1;
			}
		}
コード例 #29
0
            public string GetCellText(SpeechLine speechLine)
            {
                string cellText = " ";

                switch (columnType)
                {
                case ColumnType.DisplayText:
                    if (language > 0)
                    {
                        int translation = language - 1;
                        if (speechLine.translationText != null && speechLine.translationText.Count > translation)
                        {
                            cellText = speechLine.translationText[translation];
                        }
                    }
                    else
                    {
                        cellText = speechLine.text;
                    }
                    break;

                case ColumnType.Type:
                    cellText = speechLine.textType.ToString();
                    break;

                case ColumnType.AssociatedObject:
                    if (speechLine.isPlayer && string.IsNullOrEmpty(speechLine.owner) && speechLine.textType == AC_TextType.Speech)
                    {
                        cellText = "Player";
                    }
                    else
                    {
                        cellText = speechLine.owner;
                    }
                    break;

                case ColumnType.Scene:
                    cellText = speechLine.scene;
                    break;

                case ColumnType.Description:
                    cellText = speechLine.description;
                    break;

                case ColumnType.TagID:
                    cellText = speechLine.tagID.ToString();
                    break;

                case ColumnType.TagName:
                    SpeechTag speechTag = KickStarter.speechManager.GetSpeechTag(speechLine.tagID);
                    cellText = (speechTag != null) ? speechTag.label : "";
                    break;

                case ColumnType.SpeechOrder:
                    cellText = speechLine.OrderIdentifier;
                    if (cellText == "-0001")
                    {
                        cellText = string.Empty;
                    }
                    break;

                case ColumnType.AudioFilePresence:
                    if (speechLine.textType == AC_TextType.Speech)
                    {
                        bool hasAllAudio = speechLine.HasAllAudio();
                        if (hasAllAudio)
                        {
                            cellText = "Has all audio";
                        }
                        else
                        {
                            if (speechLine.HasAudio(0))
                            {
                                string missingLabel = "Missing ";
                                for (int i = 1; i < KickStarter.speechManager.languages.Count; i++)
                                {
                                    if (!speechLine.HasAudio(i))
                                    {
                                        missingLabel += KickStarter.speechManager.languages[i] + ", ";
                                    }
                                }
                                if (missingLabel.EndsWith(", "))
                                {
                                    missingLabel = missingLabel.Substring(0, missingLabel.Length - 2);
                                }
                                cellText = missingLabel;
                            }
                            else
                            {
                                cellText = "Missing main audio";
                            }
                        }
                    }
                    break;
                }


                if (string.IsNullOrEmpty(cellText))
                {
                    cellText = " ";
                }
                return(RemoveLineBreaks(cellText));
            }
コード例 #30
0
        private void Import()
        {
                        #if UNITY_WEBPLAYER
            ACDebug.LogWarning("Game text cannot be exported in WebPlayer mode - please switch platform and try again.");
                        #else
            if (speechManager == null || importColumns == null || importColumns.Count == 0 || speechManager.lines == null || speechManager.lines.Count == 0)
            {
                return;
            }
            int lineID = -1;

            bool importingOverwrite = false;
            foreach (ImportColumn importColumn in importColumns)
            {
                if (importColumn.UpdatesOriginal())
                {
                    importingOverwrite = true;
                }
            }

            if (importingOverwrite)
            {
                speechManager.GetAllActionListAssets();
            }

            int numUpdated = 0;
            for (int row = 1; row < numRows; row++)
            {
                if (csvData [0, row] != null && csvData [0, row].Length > 0)
                {
                    lineID = -1;
                    if (int.TryParse(csvData [0, row], out lineID))
                    {
                        SpeechLine speechLine = speechManager.GetLine(lineID);

                        if (speechLine != null)
                        {
                            for (int col = 0; col < numCols; col++)
                            {
                                if (importColumns.Count > col)
                                {
                                    string cellData = csvData [col, row];
                                    if (importColumns[col].Process(speechManager, cellData, speechLine))
                                    {
                                        numUpdated++;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        ACDebug.LogWarning("Error importing translation (ID:" + csvData [0, row] + ") on row #" + row.ToString() + ".");
                    }
                }
            }

            if (importingOverwrite)
            {
                speechManager.ClearAllAssets();
            }

            speechManager.CacheDisplayLines();
            EditorUtility.SetDirty(speechManager);
            ACDebug.Log((numRows - 2).ToString() + " line(s) imported, " + numUpdated.ToString() + " line(s) updated.");


            this.Close();
                        #endif
        }
コード例 #31
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private void ExtractElement(MenuElement element, string elementLabel, bool onlySeekNew)
        {
            if (elementLabel == null || elementLabel.Length == 0)
            {
                element.lineID = -1;
                return;
            }

            if (onlySeekNew && element.lineID == -1)
            {
                // Assign a new ID on creation
                SpeechLine newLine = new SpeechLine (GetIDArray(), "", element.title, elementLabel, languages.Count - 1, AC_TextType.MenuElement);
                element.lineID = newLine.lineID;
                lines.Add (newLine);
            }

            else if (!onlySeekNew && element.lineID > -1)
            {
                // Already has an ID, so don't replace
                SpeechLine existingLine = new SpeechLine (element.lineID, "", element.title, elementLabel, languages.Count - 1, AC_TextType.MenuElement);

                int lineID = SmartAddLine (existingLine);
                if (lineID >= 0) element.lineID = lineID;
            }
        }
コード例 #32
0
ファイル: ActionsManager.cs プロジェクト: careybrenda/Dunedin
        public void ShowGUI()
        {
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showEditing = CustomGUILayout.ToggleHeader(showEditing, "ActionList editing settings");
            if (showEditing)
            {
                displayActionsInInspector   = CustomGUILayout.ToggleLeft("List Actions in Inspector window?", displayActionsInInspector, "AC.KickStarter.actionsManager.displayActionsInInspector");
                displayActionsInEditor      = (DisplayActionsInEditor)CustomGUILayout.EnumPopup("Actions in Editor are:", displayActionsInEditor, "AC.KickStarter.actionsManager.displayActionsInEditor");
                actionListEditorScrollWheel = (ActionListEditorScrollWheel)CustomGUILayout.EnumPopup("Using scroll-wheel:", actionListEditorScrollWheel, "AC.KickStarter.actionsManager.actionListEditorScrollWheel");

                if (actionListEditorScrollWheel == ActionListEditorScrollWheel.ZoomsWindow)
                {
                    EditorGUILayout.HelpBox("Panning is possible by holding down the middle-mouse button.", MessageType.Info);
                }

                panSpeed      = CustomGUILayout.FloatField((actionListEditorScrollWheel == ActionListEditorScrollWheel.PansWindow) ? "Panning speed:" : "Zoom speed:", panSpeed, "AC.KickStarter.actionsManager.panSpeed");
                invertPanning = CustomGUILayout.ToggleLeft("Invert panning in ActionList Editor?", invertPanning, "AC.KickStarter.actionsManager.invertPanning");
                allowMultipleActionListWindows = CustomGUILayout.ToggleLeft("Allow multiple ActionList Editor windows?", allowMultipleActionListWindows, "AC.KickStarter.actionsManager.allowMultipleActionListWindows");
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            showCustom = CustomGUILayout.ToggleHeader(showCustom, "Custom Action scripts");
            if (showCustom)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Folder to search:", GUILayout.Width(110f));
                GUILayout.Label(customFolderPath, EditorStyles.textField);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Set directory", EditorStyles.miniButtonLeft))
                {
                    string path     = EditorUtility.OpenFolderPanel("Set custom Actions directory", "Assets", "");
                    string dataPath = Application.dataPath;
                    if (path.Contains(dataPath))
                    {
                        if (path == dataPath)
                        {
                            customFolderPath = "";
                        }
                        else
                        {
                            customFolderPath = path.Replace(dataPath + "/", "");
                        }
                    }
                    else
                    {
                        ACDebug.LogError("Cannot set new directory - be sure to select within the Assets directory.");
                    }
                }
                if (GUILayout.Button("Clear", EditorStyles.miniButtonRight))
                {
                    customFolderPath = "";
                }
                GUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();

            if (AllActions.Count > 0)
            {
                GUILayout.Space(10);

                Upgrade();

                EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                showCategories = CustomGUILayout.ToggleHeader(showCategories, "Action categories");
                if (showCategories)
                {
                    ActionCategory[] categories = (ActionCategory[])System.Enum.GetValues(typeof(ActionCategory));

                    for (int i = 0; i < categories.Length; i++)
                    {
                        toggles[i] = GUILayout.Toggle(toggles[i], categories[i].ToString(), "Button");
                        if (toggles[i])
                        {
                            int j = -1;
                            foreach (ActionType subclass in AllActions)
                            {
                                if (subclass.category == categories[i])
                                {
                                    j++;
                                    int enabledIndex = -1;
                                    if (EnabledActions.Contains(subclass))
                                    {
                                        enabledIndex = EnabledActions.IndexOf(subclass);
                                    }

                                    if (selectedClass != null && subclass.category == selectedClass.category && subclass.title == selectedClass.title)
                                    {
                                        EditorGUILayout.BeginVertical("Button");
                                        SpeechLine.ShowField("Name:", subclass.GetFullTitle(), false);
                                        SpeechLine.ShowField("Filename:", subclass.fileName + ".cs", false);
                                        SpeechLine.ShowField("Description:", subclass.description, true);
                                        subclass.isEnabled = true;
                                        EditorGUILayout.BeginHorizontal();
                                        if (enabledIndex >= 0)
                                        {
                                            if (!string.IsNullOrEmpty(defaultClassName) && subclass.fileName == defaultClassName)
                                            {
                                                EditorGUILayout.LabelField("DEFAULT", CustomStyles.subHeader, GUILayout.Width(140f));
                                            }
                                            else if (subclass.isEnabled)
                                            {
                                                if (GUILayout.Button("Make default?", GUILayout.Width(140f)))
                                                {
                                                    if (EnabledActions.Contains(subclass))
                                                    {
                                                        defaultClassName = subclass.fileName;
                                                    }
                                                }
                                            }
                                        }
                                        subclass.color = EditorGUILayout.ColorField("Node colour:", subclass.color);

                                        EditorGUILayout.EndHorizontal();
                                        EditorGUILayout.BeginHorizontal();

                                        if (GUILayout.Button("Search local instances"))
                                        {
                                            SearchForInstances(true, subclass);
                                        }
                                        if (GUILayout.Button("Search all instances"))
                                        {
                                            if (UnityVersionHandler.SaveSceneIfUserWants())
                                            {
                                                SearchForInstances(false, subclass);
                                            }
                                        }

                                        EditorGUILayout.EndHorizontal();
                                        EditorGUILayout.EndVertical();
                                    }
                                    else
                                    {
                                        EditorGUILayout.BeginHorizontal();
                                        if (GUILayout.Button(j.ToString() + ": " + subclass.GetFullTitle(), EditorStyles.label, GUILayout.Width(200f)))
                                        {
                                            selectedClass = subclass;
                                        }
                                        if (!string.IsNullOrEmpty(defaultClassName) && subclass.fileName == defaultClassName)
                                        {
                                            EditorGUILayout.LabelField("DEFAULT", CustomStyles.subHeader, GUILayout.Width(60f));
                                        }
                                        EditorGUILayout.EndHorizontal();
                                        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                                    }
                                }
                            }
                            if (j < 0)
                            {
                                EditorGUILayout.HelpBox("There are no Actions of this category type present!", MessageType.Info);
                            }
                        }
                    }
                }
                EditorGUILayout.EndVertical();

                if (defaultClass > EnabledActions.Count - 1)
                {
                    defaultClass = EnabledActions.Count - 1;
                }
            }
            else
            {
                EditorGUILayout.HelpBox("No Action subclass files found.", MessageType.Warning);
            }

            if (GUI.changed)
            {
                SetEnabled();
                Upgrade();
                EditorUtility.SetDirty(this);
            }
        }
コード例 #33
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private void ExtractHotspotName(ActionRename action, bool onlySeekNew, bool isInScene)
        {
            if (action.newName != "")
            {
                string _scene = "";
                if (isInScene)
                {
                    _scene = UnityVersionHandler.GetCurrentSceneName ();
                }

                if (onlySeekNew && action.lineID == -1)
                {
                    // Assign a new ID on creation
                    SpeechLine newLine = new SpeechLine (GetIDArray(), _scene, action.newName, languages.Count - 1, AC_TextType.Hotspot);

                    action.lineID = newLine.lineID;
                    lines.Add (newLine);
                }

                else if (!onlySeekNew && action.lineID > -1)
                {
                    // Already has an ID, so don't replace
                    SpeechLine existingLine = new SpeechLine (action.lineID, _scene, action.newName, languages.Count - 1, AC_TextType.Hotspot);

                    int lineID = SmartAddLine (existingLine);
                    if (lineID >= 0) action.lineID = lineID;
                }
            }
            else
            {
                // Remove from SpeechManager
                action.lineID = -1;
            }
        }
コード例 #34
0
		private void ExtractElement (MenuElement element, string elementLabel, bool onlySeekNew)
		{
			if (onlySeekNew && element.lineID == -1)
			{
				// Assign a new ID on creation
				SpeechLine newLine;
				newLine = new SpeechLine (GetIDArray(), "", element.title, elementLabel, languages.Count - 1, AC_TextType.MenuElement);
				element.lineID = newLine.lineID;
				lines.Add (newLine);
			}
			
			else if (!onlySeekNew && element.lineID > -1)
			{
				// Already has an ID, so don't replace
				lines.Add (new SpeechLine (element.lineID, "", element.title, elementLabel, languages.Count - 1, AC_TextType.MenuElement));
			}
		}
コード例 #35
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private void ExtractIcon(CursorIcon icon, bool onlySeekNew)
        {
            if (onlySeekNew && icon.lineID == -1)
            {
                // Assign a new ID on creation
                SpeechLine newLine;
                newLine = new SpeechLine (GetIDArray(), "", icon.label, languages.Count - 1, AC_TextType.CursorIcon);
                icon.lineID = newLine.lineID;
                lines.Add (newLine);
            }

            else if (!onlySeekNew && icon.lineID > -1)
            {
                // Already has an ID, so don't replace
                SpeechLine existingLine = new SpeechLine (icon.lineID, "", icon.label, languages.Count - 1, AC_TextType.CursorIcon);

                int lineID = SmartAddLine (existingLine);
                if (lineID >= 0) icon.lineID = lineID;
            }
        }
コード例 #36
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private void ExtractPrefix(HotspotPrefix prefix, bool onlySeekNew)
        {
            if (onlySeekNew && prefix.lineID == -1)
            {
                // Assign a new ID on creation
                SpeechLine newLine;
                newLine = new SpeechLine (GetIDArray(), "", prefix.label, languages.Count - 1, AC_TextType.HotspotPrefix);
                prefix.lineID = newLine.lineID;
                lines.Add (newLine);
            }
            else if (!onlySeekNew && prefix.lineID > -1)
            {
                // Already has an ID, so don't replace
                SpeechLine existingLine = new SpeechLine (prefix.lineID, "", prefix.label, languages.Count - 1, AC_TextType.HotspotPrefix);

                int lineID = SmartAddLine (existingLine);
                if (lineID >= 0) prefix.lineID = lineID;
            }
        }
コード例 #37
0
		private void ExtractInventory (InvItem invItem, bool onlySeekNew)
		{
			if (onlySeekNew && invItem.lineID == -1)
			{
				// Assign a new ID on creation
				SpeechLine newLine;
				if (invItem.altLabel != "")
				{
					newLine = new SpeechLine (GetIDArray(), EditorApplication.currentScene, invItem.altLabel, languages.Count - 1, AC_TextType.InventoryItem);
				}
				else
				{
					newLine = new SpeechLine (GetIDArray(), EditorApplication.currentScene, invItem.label, languages.Count - 1, AC_TextType.InventoryItem);
				}
				invItem.lineID = newLine.lineID;
				lines.Add (newLine);
			}
			
			else if (!onlySeekNew && invItem.lineID > -1)
			{
				// Already has an ID, so don't replace
				if (invItem.altLabel != "")
				{
					lines.Add (new SpeechLine (invItem.lineID, EditorApplication.currentScene, invItem.altLabel, languages.Count - 1, AC_TextType.InventoryItem));
				}
				else
				{
					lines.Add (new SpeechLine (invItem.lineID, EditorApplication.currentScene, invItem.label, languages.Count - 1, AC_TextType.InventoryItem));
				}
			}
		}
コード例 #38
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private void ProcessInventoryProperties(List<InvItem> items, List<InvVar> vars, bool onlySeekNew)
        {
            foreach (InvItem item in items)
            {
                foreach (InvVar var in item.vars)
                {
                    if (var.type == VariableType.String)
                    {
                        if (onlySeekNew && var.textValLineID == -1)
                        {
                            // Assign a new ID on creation
                            SpeechLine newLine = new SpeechLine (GetIDArray(), "", var.textVal, languages.Count - 1, AC_TextType.InventoryItemProperty);

                            var.textValLineID = newLine.lineID;
                            lines.Add (newLine);
                        }
                        else if (!onlySeekNew && var.textValLineID > -1)
                        {
                            // Already has an ID, so don't replace
                            SpeechLine existingLine = new SpeechLine (var.textValLineID, "", var.textVal, languages.Count - 1, AC_TextType.InventoryItemProperty);

                            int lineID = SmartAddLine (existingLine);
                            if (lineID >= 0) var.textValLineID = lineID;
                        }
                    }
                }
            }

            foreach (InvVar var in vars)
            {
                if (onlySeekNew && var.popUpsLineID == -1)
                {
                    // Assign a new ID on creation
                    SpeechLine newLine = new SpeechLine (GetIDArray(), "", var.GetPopUpsString (), languages.Count - 1, AC_TextType.InventoryItemProperty);

                    var.popUpsLineID = newLine.lineID;
                    lines.Add (newLine);
                }
                else if (!onlySeekNew && var.popUpsLineID > -1)
                {
                    // Already has an ID, so don't replace
                    SpeechLine existingLine = new SpeechLine (var.popUpsLineID, "", var.GetPopUpsString (), languages.Count - 1, AC_TextType.InventoryItemProperty);

                    int lineID = SmartAddLine (existingLine);
                    if (lineID >= 0) var.popUpsLineID = lineID;
                }
            }
        }
コード例 #39
0
		private void ExtractDialogOption (ButtonDialog dialogOption, bool onlySeekNew)
		{
			if (dialogOption.assetFile != null)
			{
				ProcessActionList (dialogOption.assetFile.actions, onlySeekNew, true);
				EditorUtility.SetDirty (dialogOption.assetFile);
			}

			if (onlySeekNew && dialogOption.lineID < 1)
			{
				// Assign a new ID on creation
				SpeechLine newLine;
				newLine = new SpeechLine (GetIDArray(), EditorApplication.currentScene, dialogOption.label, languages.Count - 1, AC_TextType.DialogueOption);
				dialogOption.lineID = newLine.lineID;
				lines.Add (newLine);
			}
			
			else if (!onlySeekNew && dialogOption.lineID > 0)
			{
				// Already has an ID, so don't replace
				lines.Add (new SpeechLine (dialogOption.lineID, EditorApplication.currentScene, dialogOption.label, languages.Count - 1, AC_TextType.DialogueOption));
			}
		}
コード例 #40
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private int ProcessSpeechLine(bool onlySeekNew, bool isInScene, int lineID, string speaker, string messageText, bool isPlayer)
        {
            if (onlySeekNew && lineID == -1)
            {
                // Assign a new ID on creation
                string _scene = "";
                SpeechLine newLine;
                if (isInScene)
                {
                    _scene = UnityVersionHandler.GetCurrentSceneName ();
                }
                newLine = new SpeechLine (GetIDArray(), _scene, speaker, messageText, languages.Count - 1, AC_TextType.Speech, isPlayer);

                lineID = newLine.lineID;
                lines.Add (newLine);
            }
            else if (!onlySeekNew && lineID > -1)
            {
                // Already has an ID, so don't replace
                string _scene = "";
                SpeechLine existingLine;
                if (isInScene)
                {
                    _scene = UnityVersionHandler.GetCurrentSceneName ();
                }
                existingLine = new SpeechLine (lineID, _scene, speaker, messageText, languages.Count - 1, AC_TextType.Speech, isPlayer);

                int _lineID = SmartAddLine (existingLine);
                if (_lineID >= 0) lineID = _lineID;
            }
            return lineID;
        }
コード例 #41
0
ファイル: ActionSpeech.cs プロジェクト: Keraunic-Tonic/GJ2021
        public override float Run()
        {
            if (KickStarter.dialog && KickStarter.stateHandler)
            {
                if (KickStarter.speechManager.referenceSpeechFiles == ReferenceSpeechFiles.ByAddressable && lineID >= 0)
                {
                                        #if AddressableIsPresent
                    if (!isRunning && !isAwaitingAddressable)
                    {
                        SpeechLine speechLine = KickStarter.speechManager.GetLine(lineID);
                        string     filename   = speechLine.GetFilename();
                        Addressables.LoadAssetAsync <AudioClip>(filename).Completed += OnCompleteLoad;
                        isAwaitingAddressable = true;
                        isRunning             = true;

                        return(defaultPauseTime);
                    }

                    if (isAwaitingAddressable)
                    {
                        return(defaultPauseTime);
                    }

                    if (isBackground)
                    {
                        isRunning = false;
                        return(0f);
                    }
                                        #else
                    LogWarning("Cannot use addressables system for speech audio because 'AddressableIsPresent' has not been added as a Scripting Define Symbol.  This can be added in Unity's Player settings.");
                                        #endif
                }

                if (!isRunning)
                {
                    stopAction = false;
                    isRunning  = true;
                    splitDelay = false;
                    splitIndex = 0;

                    StartSpeech();

                    if (isBackground)
                    {
                        if (KickStarter.speechManager.separateLines)
                        {
                            string[] textArray = messageText.Split(stringSeparators, System.StringSplitOptions.None);
                            if (textArray != null && textArray.Length > 1)
                            {
                                LogWarning("Cannot separate multiple speech lines when 'Is Background?' is checked - will only play '" + textArray[0] + "'");
                            }
                        }

                        isRunning = false;
                        return(0f);
                    }
                    return(defaultPauseTime);
                }
                else
                {
                    if (stopAction || (speech != null && speech.continueFromSpeech))
                    {
                        if (speech != null)
                        {
                            speech.continueFromSpeech = false;
                        }
                        isRunning = false;

                        return(0);
                    }

                    if (speech == null || !speech.isAlive)
                    {
                        if (KickStarter.speechManager.separateLines)
                        {
                            if (!splitDelay)
                            {
                                // Begin pause if more lines are present
                                splitIndex++;
                                string[] textArray = messageText.Split(stringSeparators, System.StringSplitOptions.None);

                                if (textArray.Length > splitIndex)
                                {
                                    if (KickStarter.speechManager.separateLinePause > 0f)
                                    {
                                        // Still got more to go
                                        splitDelay = true;
                                        return(KickStarter.speechManager.separateLinePause);
                                    }
                                    else
                                    {
                                        // Show next line
                                        splitDelay = false;
                                        StartSpeech();
                                        return(defaultPauseTime);
                                    }
                                }
                                // else finished
                            }
                            else
                            {
                                // Show next line
                                splitDelay = false;
                                StartSpeech();
                                return(defaultPauseTime);
                            }
                        }

                        float totalWaitTimeOffset = waitTimeOffset + KickStarter.speechManager.waitTimeOffset;
                        if (totalWaitTimeOffset <= 0f)
                        {
                            isRunning = false;
                            return(0f);
                        }
                        else
                        {
                            stopAction = true;
                            return(totalWaitTimeOffset);
                        }
                    }
                    else
                    {
                        return(defaultPauseTime);
                    }
                }
            }

            return(0f);
        }
コード例 #42
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private int SmartAddLine(SpeechLine existingLine)
        {
            if (!DoLinesMatchText (existingLine))
            {
                if (DoLinesMatchID (existingLine.lineID))
                {
                    // Same ID, different text, so re-assign ID
                    int lineID = 0;

                    foreach (int _id in GetIDArray ())
                    {
                        if (lineID == _id)
                            lineID ++;
                    }

                    existingLine.lineID = lineID;
                    lines.Add (existingLine);
                    return lineID;
                }
                else
                {
                    lines.Add (existingLine);
                }
            }
            return -1;
        }
コード例 #43
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private bool DoLinesMatchText(SpeechLine newLine)
        {
            if (lines == null || lines.Count == 0)
            {
                return false;
            }

            foreach (SpeechLine line in lines)
            {
                if (line.IsMatch (newLine))
                {
                    return true;
                }
            }
            return false;
        }
コード例 #44
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private void ExtractDialogOption(ButtonDialog dialogOption, bool onlySeekNew)
        {
            ProcessActionListAsset (dialogOption.assetFile, onlySeekNew);

            if (onlySeekNew && dialogOption.lineID < 1)
            {
                // Assign a new ID on creation
                SpeechLine newLine;
                newLine = new SpeechLine (GetIDArray(), UnityVersionHandler.GetCurrentSceneName (), dialogOption.label, languages.Count - 1, AC_TextType.DialogueOption);
                dialogOption.lineID = newLine.lineID;
                lines.Add (newLine);
            }

            else if (!onlySeekNew && dialogOption.lineID > 0)
            {
                // Already has an ID, so don't replace
                SpeechLine existingLine = new SpeechLine (dialogOption.lineID, UnityVersionHandler.GetCurrentSceneName (), dialogOption.label, languages.Count - 1, AC_TextType.DialogueOption);

                int lineID = SmartAddLine (existingLine);
                if (lineID >= 0) dialogOption.lineID = lineID;
            }
        }
コード例 #45
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private void ExtractJournalElement(MenuJournal journal, List<JournalPage> pages, bool onlySeekNew)
        {
            foreach (JournalPage page in pages)
            {
                if (onlySeekNew && page.lineID == -1)
                {
                    // Assign a new ID on creation
                    SpeechLine newLine;
                    newLine = new SpeechLine (GetIDArray(), "", journal.title, page.text, languages.Count - 1, AC_TextType.JournalEntry);
                    page.lineID = newLine.lineID;
                    lines.Add (newLine);
                }

                else if (!onlySeekNew && page.lineID > -1)
                {
                    // Already has an ID, so don't replace
                    SpeechLine existingLine = new SpeechLine (page.lineID, "", journal.title, page.text, languages.Count - 1, AC_TextType.JournalEntry);

                    int lineID = SmartAddLine (existingLine);
                    if (lineID >= 0) page.lineID = lineID;
                }
            }
        }
コード例 #46
0
            public string GetCellText(SpeechLine speechLine)
            {
                string cellText = " ";

                if (columnType == ColumnType.DisplayText)
                {
                    if (language > 0)
                    {
                        int translation = language - 1;
                        if (speechLine.translationText != null && speechLine.translationText.Count > translation)
                        {
                            cellText = speechLine.translationText[translation];
                        }
                    }
                    else
                    {
                        cellText = speechLine.text;
                    }
                }
                else if (columnType == ColumnType.Type)
                {
                    cellText = speechLine.textType.ToString();
                }
                else if (columnType == ColumnType.AssociatedObject)
                {
                    if (speechLine.isPlayer && speechLine.owner == "" && speechLine.textType == AC_TextType.Speech)
                    {
                        cellText = "Player";
                    }
                    else
                    {
                        cellText = speechLine.owner;
                    }
                }
                else if (columnType == ColumnType.Scene)
                {
                    cellText = speechLine.scene;
                }
                else if (columnType == ColumnType.Description)
                {
                    cellText = speechLine.description;
                }
                else if (columnType == ColumnType.TagID)
                {
                    cellText = speechLine.tagID.ToString();
                }
                else if (columnType == ColumnType.TagName)
                {
                    SpeechTag speechTag = KickStarter.speechManager.GetSpeechTag(speechLine.tagID);
                    cellText = (speechTag != null) ? speechTag.label : "";
                }
                else if (columnType == ColumnType.SpeechOrder)
                {
                    cellText = speechLine.OrderIdentifier;
                    if (cellText == "-0001")
                    {
                        cellText = "";
                    }
                }

                if (cellText == "")
                {
                    cellText = " ";
                }
                return(RemoveLineBreaks(cellText));
            }
コード例 #47
0
ファイル: SpeechManager.cs プロジェクト: mcbodge/eidolon
        private void ExtractJournalEntry(ActionMenuState action, bool onlySeekNew, bool isInScene)
        {
            if (action.changeType == ActionMenuState.MenuChangeType.AddJournalPage && action.journalText != "")
            {
                if (onlySeekNew && action.lineID == -1)
                {
                    // Assign a new ID on creation
                    SpeechLine newLine;
                    if (isInScene)
                    {
                        newLine = new SpeechLine (GetIDArray(), UnityVersionHandler.GetCurrentSceneName (), action.journalText, languages.Count - 1, AC_TextType.JournalEntry);
                    }
                    else
                    {
                        newLine = new SpeechLine (GetIDArray(), "", action.journalText, languages.Count - 1, AC_TextType.JournalEntry);
                    }
                    action.lineID = newLine.lineID;
                    lines.Add (newLine);
                }

                else if (!onlySeekNew && action.lineID > -1)
                {
                    // Already has an ID, so don't replace
                    SpeechLine existingLine;
                    if (isInScene)
                    {
                        existingLine = new SpeechLine (action.lineID, UnityVersionHandler.GetCurrentSceneName (), action.journalText, languages.Count - 1, AC_TextType.JournalEntry);
                    }
                    else
                    {
                        existingLine = new SpeechLine (action.lineID, "", action.journalText, languages.Count - 1, AC_TextType.JournalEntry);
                    }

                    int lineID = SmartAddLine (existingLine);
                    if (lineID >= 0) action.lineID = lineID;
                }
            }
            else
            {
                // Remove from SpeechManager
                action.lineID = -1;
            }
        }
コード例 #48
0
 /**
  * A Constructor that copies all values from another SpeechLine.
  * This way ensures that no connection remains to the original class.
  */
 public SpeechLine(SpeechLine _speechLine)
 {
     isPlayer = _speechLine.isPlayer;
     lineID = _speechLine.lineID;
     scene = _speechLine.scene;
     owner = _speechLine.owner;
     text = _speechLine.text;
     description = _speechLine.description;
     textType = _speechLine.textType;
     translationText = _speechLine.translationText;
 }