// @Brief : Start void Start() { m_pLogContainer = new KrCharagekiLogContainer(); m_pScenarioContainer = new KrCharagekiScenarioContainer(); KrCharagekiScript pScript = LoadScript(); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // RESOURCE DOWNLOAD List <string> pResourcePaths = pScript.GetResourcesPaths(); for (int sIndex = 0; sIndex < pResourcePaths.Count; sIndex++) { // TODO : Add asset download KrDebug.Log("Download => " + pResourcePaths[sIndex], typeof(KrCharagekiManager)); } //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // INITILIZE COMMAND List <KrCharagekiCommand> pInitializeCommands = pScript.GetInitializeCommands(); KrDebug.Log("Initialize charageki", typeof(KrCharagekiManager)); for (int sIndex = 0; sIndex < pInitializeCommands.Count; sIndex++) { pInitializeCommands[sIndex].Exec(this); } //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // SET MAIN SECTION m_pMainCharagekiSections = pScript.GetMainSections(); KrDebug.Log("Get main sections : count = " + m_pMainCharagekiSections.Count, typeof(KrCharagekiManager)); m_sSectionIndex = 0; ScriptUpdate(); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PROTECTED FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution with option // @Param : uId => Value of "No" column of csv // : pManager => Charageki manager protected override void Exec(uint uId, KrCharagekiManager pManager) { KrCharagekiScenarioContainer pScenarioContainer = pManager.GetScenarioContainer(); // Get row data of csv KrCsvDataRow pCsvDataRow = pScenarioContainer.GetScenario(uId.ToString(), "No"); uint uCharaId = 0; bool bIsSuccess = uint.TryParse(pCsvDataRow.GetValue("CharaId"), out uCharaId); KrDebug.Assert(bIsSuccess, "Parsing failed to type int = " + pCsvDataRow.GetValue("CharaId"), typeof(KrCharagekiCommandSetText)); KrDebug.Assert(KrCharagekiDef.s_pCHARA_DIC.ContainsKey(uCharaId), "Invalid KrCharagekiDef.s_CHARA_NAME key = " + uCharaId, typeof(KrCharagekiCommandSetText)); string pCharaName = KrCharagekiDef.s_pCHARA_DIC[uCharaId].GetCharacterName(); string pComment = pCsvDataRow.GetValue("Comment"); KrDebug.Log("Play Text : " + "CharaId" + " = " + pCharaName + ", " + "Comment" + " = " + pComment, typeof(KrCharagekiCommandSetText)); KrCharagekiUIController pUIController = pManager.GetUIController(); // Set text float fReadingTime = pUIController.SetText(pCharaName, pComment); // Play voice string pVoiceName = pCsvDataRow.GetValue("VoiceId"); KrDebug.Log("Play Voice: " + "CharaId" + " = " + pCharaName + ", " + "VoiceId" + " = " + pVoiceName, typeof(KrCharagekiCommandSetText)); KrAudioSource pAudioSource = pUIController.PlayVoice(uCharaId, pVoiceName, pManager); if (pAudioSource == null) { // If there is no voice data, set the lip sync time from the length of the text pUIController.PlayLipSync(uCharaId, fReadingTime, pComment); } // Set log KrCharagekiLog pLog = new KrCharagekiLog(pCharaName, pComment); KrCharagekiLogContainer pLogContainer = pManager.GetLogContainer(); pLogContainer.AddLog(pLog); }