//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Get Next Character //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private string GetNextCharacter() { // Check for Hex Command if ((GetCurrentWindowText().Length - m_iCurrentCharElement) > 2) { string HexCommandString = GetNextCharacters(3); if (IsHexCommand(HexCommandString)) { m_iCurrentCharElement += HexCommandString.Length; return(HexCommandString + GetCurrentWindowText()[m_iCurrentCharElement]); } } // Check for Colour Hex Command if ((GetCurrentWindowText().Length - m_iCurrentCharElement) > 9) { string HexValuePattern = GetNextCharacters(9); if (IsRGBHexValue(HexValuePattern)) { m_iCurrentCharElement += HexValuePattern.Length; return(HexValuePattern + GetCurrentWindowText()[m_iCurrentCharElement]); } } if ((GetCurrentWindowText().Length - m_iCurrentCharElement) > 8) { string StringPattern = GetNextCharacters(9); if (IsPauseCommand(StringPattern)) { m_iCurrentCharElement += StringPattern.Length; // If Pause Conditions Exist if (m_PauseTrigger.Keys != null || m_PauseTrigger.JoyAxis != null) { //GameHandler.SetPausedGame(true); //GameHandler.SetDialogueBoxPaused(true); //Time.timeScale = 0.0f; //m_PauseTrigger.Paused = true; } } } // Check for Speaker Command if ((GetCurrentWindowText().Length - m_iCurrentCharElement) > 17) { string NameRegexPattern = GetNextCharacters(17); SpokesPersonState eSpeaker = IsNewSpeakerCommand(NameRegexPattern); if (eSpeaker != m_eSpeaker) { m_eSpeaker = eSpeaker; GetSpeakerNameScript().text = GetSpeakerName(); } } return((GetCurrentWindowText().Length > m_iCurrentCharElement) ? GetCurrentWindowText()[m_iCurrentCharElement].ToString() : ""); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Set Text //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void SetText(string Text, SpokesPersonState Speaker = SpokesPersonState.GENERAL, float ScrollSpeed = 20.0f) { if (Text != "") { m_ScrollInfo.UpdateText = true; m_ScrollInfo.Scroll = true; m_ScrollInfo.Dir = ScrollDirection.UP; //Text = ReplaceRGBCommandsWithHex(Text); m_aTextArray = new ArrayElementTracker <string>(ReplaceENDL(Text)); m_eSpeaker = Speaker; m_fScrollSpeed = ScrollSpeed; if (m_SoundFiles.FlyInSource != null && m_SoundFiles.FlyInSource.Length > 0) { m_SoundFiles.FlyInSource[Random.Range(0, m_SoundFiles.FlyInSource.Length)].Play(); } } ResetTextDisplay(); }