//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution command // @Param : pManager => Charageki manager public override void Exec(KrCharagekiManager pManager) { uint uCharaId = 0; string pPositionKey = ""; for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++) { //::::::::::::::::::::::::::::::::::::::::::::::::::: // CHARA ID if (m_pOptions[sIndex].m_pKey == "chara") { bool bIsSuccess = uint.TryParse(m_pOptions[sIndex].m_pValue, out uCharaId); KrDebug.Assert(bIsSuccess, "Parsing failed to type unsigned int = " + m_pOptions[sIndex].m_pValue, typeof(KrCharagekiCommandCharacterAction)); } //::::::::::::::::::::::::::::::::::::::::::::::::::: // ACTION ID else if (m_pOptions[sIndex].m_pKey == "position") { pPositionKey = m_pOptions[sIndex].m_pValue; } } KrDebug.Assert(uCharaId > 0, "there is no chara id!!", typeof(KrCharagekiCommandSetCharacterPosition)); KrDebug.Assert(!string.IsNullOrEmpty(pPositionKey), "there is no position!!", typeof(KrCharagekiCommandSetCharacterPosition)); KrCharagekiUIController pUIController = pManager.GetUIController(); KrDebug.Log("Chara action : chara = " + uCharaId + ", position = " + pPositionKey, typeof(KrCharagekiCommandSetCharacterPosition)); KrDebug.Assert(KrCharagekiDef.s_pPOSITION_DIC.ContainsKey(pPositionKey), "Key not found from KrCharagekiDef.s_pPOSITION_DIC. key = " + pPositionKey, typeof(KrCharagekiCommandSetCharacterPosition)); Vector3 vPosition = KrCharagekiDef.s_pPOSITION_DIC[pPositionKey]; pUIController.SetPosition(uCharaId, vPosition); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution command // @Param : pManager => Charageki manager public override void Exec(KrCharagekiManager pManager) { string pKey = ""; string pPath = ""; for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++) { //::::::::::::::::::::::::::::::::::::::::::::::::::: // KEY if (m_pOptions[sIndex].m_pKey == "key") { // Keys for using csv pKey = m_pOptions[sIndex].m_pValue; } //::::::::::::::::::::::::::::::::::::::::::::::::::: // RESOURCE PATH else if (m_pOptions[sIndex].m_pKey == "path") { pPath = m_pOptions[sIndex].m_pValue; } } KrDebug.Assert(!string.IsNullOrEmpty(pKey), "there is no key!!", typeof(KrCharagekiCommandLoad)); KrDebug.Assert(!string.IsNullOrEmpty(pPath), "there is no path!!", typeof(KrCharagekiCommandLoad)); Exec(pKey, pPath, pManager); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PROTECTED FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution with option // @Param : sId => Character id // : pManager => Charageki manager protected override void Exec(uint sId, KrCharagekiManager pManager) { KrCharagekiUIController pUIController = pManager.GetUIController(); KrDebug.Log("Show character : id = " + sId, typeof(KrCharagekiCommandShowCharacter)); pUIController.ShowCharacter(sId); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution command // @Param : pManager => Charageki manager public override void Exec(KrCharagekiManager pManager) { uint uCharaId = 0; uint uActionId = 0; for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++) { //::::::::::::::::::::::::::::::::::::::::::::::::::: // CHARA ID if (m_pOptions[sIndex].m_pKey == "chara") { bool bIsSuccess = uint.TryParse(m_pOptions[sIndex].m_pValue, out uCharaId); KrDebug.Assert(bIsSuccess, "Parsing failed to type unsigned int = " + m_pOptions[sIndex].m_pValue, typeof(KrCharagekiCommandCharacterAction)); } //::::::::::::::::::::::::::::::::::::::::::::::::::: // ACTION ID else if (m_pOptions[sIndex].m_pKey == "action") { bool bIsSuccess = uint.TryParse(m_pOptions[sIndex].m_pValue, out uActionId); KrDebug.Assert(bIsSuccess, "Parsing failed to type unsigned int = " + m_pOptions[sIndex].m_pValue, typeof(KrCharagekiCommandCharacterAction)); } } KrDebug.Assert(uCharaId > 0, "there is no chara id!!", typeof(KrCharagekiCommandSetText)); KrDebug.Assert(uActionId > 0, "there is no action id!!", typeof(KrCharagekiCommandSetText)); KrCharagekiUIController pUIController = pManager.GetUIController(); KrDebug.Log("chara action : chara = " + uCharaId + ", action = " + uActionId, typeof(KrCharagekiCommandCharacterAction)); pUIController.SetAction(uCharaId, uActionId); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PROTECTED FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution with option // @Param : uId => Background id // : pManager => Charageki manager protected override void Exec(uint uId, KrCharagekiManager pManager) { KrDebug.Log("Set bg : sId = " + uId, typeof(KrCharagekiCommandSetSpriteBg)); KrCharagekiUIController pUIController = pManager.GetUIController(); pUIController.SetBg(uId); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PROTECTED FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution with option // @Param : uId => Character id // : pManager => Charageki manager protected override void Exec(uint uId, KrCharagekiManager pManager) { KrDebug.Log("Load character : id = " + uId, typeof(KrCharagekiCommandLoadCharacter)); KrCharagekiUIController pUIController = pManager.GetUIController(); pUIController.LoadCharacter(uId); }
// @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 key & path // @Param : pKey => Key name // : pPath => Asset path of csv // : pManager => Charageki manager protected override void Exec(string pKey, string pPath, KrCharagekiManager pManager) { KrCharagekiScenarioContainer pScenarioContainer = pManager.GetScenarioContainer(); KrDebug.Log("Load scenario : key = " + pKey + ", path = " + pPath, typeof(KrCharagekiCommandLoadScenario)); // Load scenario csv data pScenarioContainer.LoadScenario(pKey, pPath); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution command // @Param : pManager => Charageki manager public override void Exec(KrCharagekiManager pManager) { KrDebug.Log("Fade in : ", typeof(KrCharagekiCommandFadeIn)); KrCharagekiUIController pUIController = pManager.GetUIController(); // MEMO : Non option pUIController.FadeIn(); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution command // @Param : pManager => Charageki manager public override void Exec(KrCharagekiManager pManager) { KrDebug.Log("Show text : ", typeof(KrCharagekiCommandShowText)); KrCharagekiUIController pUIController = pManager.GetUIController(); // MEMO : Non option pUIController.ShowText(); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution command // @Param : pManager => Charageki manager public override void Exec(KrCharagekiManager pManager) { KrDebug.Log("Show title : ", typeof(KrCharagekiCommandSetSpriteBg)); KrCharagekiUIController pUIController = pManager.GetUIController(); // MEMO : Non option pUIController.ShowTitle(); }
// @Brief : Set motion // @Param : pMotionName => Motion name // : bIsLoop => Is loop motion public void SetMotion(string pMotionName, bool bIsLoop) { KrDebug.Assert(m_pMotionDatas.ContainsKey(pMotionName), "Motion is not registered. key = " + pMotionName, typeof(KrLive2DModel)); byte[] pMotionData = m_pMotionDatas[pMotionName]; m_pMotion = Live2DMotion.loadMotion(pMotionData); m_pMotion.setLoop(bIsLoop); m_pMotionManager.startMotion(m_pMotion, false); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PRIVATE //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Getcolumn index // @Param : pColumnName => Column name // @Return : Index of column private int GetColumnIndex(string pColumnName) { int sColumn = -1; sColumn = System.Array.FindIndex <string>(m_pColumnNames, (pStr) => { return(pStr == pColumnName); }); KrDebug.Assert(sColumn >= 0, "Column name does not exist = " + pColumnName, typeof(KrCsvDataRow)); return(sColumn); }
// @Brief : Set sprite // @Param : uId => Background id public void SetSprite(uint uId) { KrDebug.Assert(m_pBackgroundDic.ContainsKey(uId), "background master is not found key = " + uId, typeof(KrCharagekiUIBackground)); m_pCurrentBackground = m_pBackgroundDic[uId]; if (m_cbSetBackground != null) { m_cbSetBackground(m_pCurrentBackground.GetSprite()); } }
// @Brief : Request dialog // @Param : eDialogType => Dialog type // : pParam => Initialization parameters public void RequestDialog(eDIALOG_TYPE eDialogType, KrUIArgumentParameter pParam) { Transform pBarrier = Create <Transform>(barrierToClone, dialogBase); KrDebug.Assert(s_pDIALOG_PATH_DIC.ContainsKey(eDialogType), "The path of the corresponding dialog is not set. eDialogType = " + eDialogType.ToString(), typeof(KrUIManager)); KrDialog pDialog = Create <KrDialog>(s_pDIALOG_PATH_DIC[eDialogType], pBarrier); pDialog.Initialize(pParam); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PROTECTED FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Add initialize command // @Param : pReader => Stream reader // : pScript => Script container // : pStr => String of one line protected override void Add(StreamReader pReader, KrCharagekiScript pScript, string pStr) { if (pStr.Equals(c_pSECTION + ":")) { KrDebug.Log("New section", typeof(KrCharagekiMain)); KrCharagekiSection pSection = new KrCharagekiSection(); pSection.Add(pReader, pScript); c_pSectionScripts.Add(pSection); } }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Load // @Param : uId => Background id public void Load(uint uId) { Dictionary <uint, BgData> pMasterDic = KrCharagekiDef.s_pBACK_GROUNDS; KrDebug.Assert(pMasterDic.ContainsKey(uId), "background master is not found key = " + uId, typeof(KrCharagekiUIBackground)); BgData pData = pMasterDic[uId]; pData.LoadSprite(); m_pBackgroundDic.Add(uId, pData); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Request screen // @Param : eScreenType => Screen type // : pParam => Initialization parameters public void RequestScreen(eSCREEN_TYPE eScreenType, KrUIArgumentParameter pParam) { KrDebug.Assert(s_pSCREEN_PATH_DIC.ContainsKey(eScreenType), "The path of the corresponding dialog is not set. eScreenType = " + eScreenType.ToString(), typeof(KrUIManager)); KrScreen pScreen = Create <KrScreen>(s_pSCREEN_PATH_DIC[eScreenType], screenBase); pScreen.Initialize(pParam); // Cache screen data CacheScreen(eScreenType, pParam); }
// @Breif : Save script // @param : pSourceCode => Charageki script private void Save(string pSourceCode) { if (string.IsNullOrEmpty(m_pFilePath)) { return; } File.WriteAllText(m_pFilePath, pSourceCode); KrDebug.Log("Save : " + m_pFilePath, typeof(KrCharagekiEditorWindow)); AssetDatabase.Refresh(); Compile(); }
// @Brief : Update for main script private void ScriptUpdate() { //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // UPDATE CHARAGEKI KrDebug.Log("Play section. No." + m_sSectionIndex, typeof(KrCharagekiManager)); KrCharagekiSection pSection = m_pMainCharagekiSections[m_sSectionIndex]; List <KrCharagekiCommand> pCommands = pSection.GetCommands(); for (int sIndex = 0; sIndex < pCommands.Count; sIndex++) { pCommands[sIndex].Exec(this); } m_sSectionIndex++; }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PROTECTED FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Add const // @Param : pReader => Stream reader // : pScript => Script container // : pStr => String of one line protected override void Add(StreamReader pReader, KrCharagekiScript pScript, string pStr) { string[] pSplit = pStr.Split(new char[] { '=', ' ' }, System.StringSplitOptions.RemoveEmptyEntries); KrDebug.Log("Add const variable => " + pSplit[0] + " : " + pSplit[1], typeof(KrCharagekiConst)); if (!m_pConstDic.ContainsKey(pSplit[0])) { m_pConstDic.Add(pSplit[0], pSplit[1]); } else { KrDebug.Warning(false, "Duplicate key defined by Const. " + pSplit[0] + " = " + pSplit[1], typeof(KrCharagekiConst)); } }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Load command // @Param : pScript => Script container // : pCommand => String of command public void Load(KrCharagekiScript pScript, string pCommand) { string[] pSplit = pCommand.Split(new char[] { ' ' }, System.StringSplitOptions.RemoveEmptyEntries); KrDebug.Log("Add command => " + pSplit[0], typeof(KrCharagekiCommand)); // Since array 0 is the command name, it starts from the first for (int sIndex = 1; sIndex < pSplit.Length; sIndex++) { KrDebug.Log(" option => " + pSplit[sIndex], typeof(KrCharagekiCommand)); string[] pKeyValue = pSplit[sIndex].Split(new char[] { '=' }); KrCharagekiCommandOption pOption = new KrCharagekiCommandOption(pKeyValue[0], pScript.ConvertConstVariable(pKeyValue[1])); m_pOptions.Add(pOption); } }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution command // @Param : pManager => Charageki manager public override void Exec(KrCharagekiManager pManager) { string pPath = ""; for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++) { //::::::::::::::::::::::::::::::::::::::::::::::::::: // PATH if (m_pOptions[sIndex].m_pKey == "path") { pPath = m_pOptions[sIndex].m_pValue; } } KrDebug.Assert(!string.IsNullOrEmpty(pPath), "there is no path!!", typeof(KrCharagekiCommandPathOption)); Exec(pPath, pManager); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution command // @Param : pManager => Charageki manager public override void Exec(KrCharagekiManager pManager) { uint sId = 0; for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++) { //::::::::::::::::::::::::::::::::::::::::::::::::::: // ID if (m_pOptions[sIndex].m_pKey == "id") { bool bIsSuccess = uint.TryParse(m_pOptions[sIndex].m_pValue, out sId); KrDebug.Assert(bIsSuccess, "Parsing failed to type unsigned int = " + m_pOptions[sIndex].m_pValue, typeof(KrCharagekiCommandSetText)); } } KrDebug.Assert(sId > 0, "there is no id!!", typeof(KrCharagekiCommandSetText)); Exec(sId, pManager); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PROTECTED FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Add initialize command // @Param : pReader => Stream reader // : pScript => Script container // : pStr => String of one line protected override void Add(StreamReader pReader, KrCharagekiScript pScript, string pStr) { KrCharagekiCommand pCommand = null; // Create initialize comannd //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // LOAD SCENARIO if (pStr.IndexOf("load_scenario") == 0) { pCommand = new KrCharagekiCommandLoadScenario(); } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // LOAD BGM else if (pStr.IndexOf("load_bgm") == 0) { pCommand = null; } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // LOAD SPRITE else if (pStr.IndexOf("load_bg") == 0) { pCommand = new KrCharagekiCommandLoadBg(); } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // LOAD CHARACTER else if (pStr.IndexOf("load_chara") == 0) { pCommand = new KrCharagekiCommandLoadCharacter(); } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // NOT SUPPORTED else { KrDebug.Assert(false, "Not Supported initialize command => " + pStr, typeof(KrCharagekiInitialize)); } if (pCommand != null) { KrDebug.Log("Add initialize command => " + pStr, typeof(KrCharagekiInitialize)); pCommand.Load(pScript, pStr); m_pCommands.Add(pCommand); } }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution command // @Param : pManager => Charageki manager public override void Exec(KrCharagekiManager pManager) { bool bWait = false; for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++) { //::::::::::::::::::::::::::::::::::::::::::::::::::: // KEY if (m_pOptions[sIndex].m_pKey == "wait") { bool bIsSuccess = bool.TryParse(m_pOptions[sIndex].m_pValue, out bWait); KrDebug.Assert(bIsSuccess, "Parsing failed to type bool = " + m_pOptions[sIndex].m_pValue, typeof(KrCharagekiCommandWaitInput)); } } KrCharagekiUIController pUIController = pManager.GetUIController(); KrDebug.Log("Set wait input = " + bWait, typeof(KrCharagekiCommandWaitInput)); pUIController.SetWaitInput(bWait); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution command // @Param : pManager => Charageki manager public override void Exec(KrCharagekiManager pManager) { float fWaitTime = 0.0f; for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++) { //::::::::::::::::::::::::::::::::::::::::::::::::::: // KEY if (m_pOptions[sIndex].m_pKey == "time") { bool bIsSuccess = float.TryParse(m_pOptions[sIndex].m_pValue, out fWaitTime); KrDebug.Assert(bIsSuccess, "Parsing failed to type float = " + m_pOptions[sIndex].m_pValue, typeof(KrCharagekiCommandWaitTime)); } } KrCharagekiUIController pUIController = pManager.GetUIController(); KrDebug.Log("Set wait time = " + fWaitTime, typeof(KrCharagekiCommandWaitTime)); pUIController.SetWaitTime(fWaitTime); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Load // @Param : uCharaId => character id public void Load(uint uCharaId) { KrDebug.Assert(KrCharagekiDef.s_pCHARA_DIC.ContainsKey(uCharaId), "Invalid KrCharagekiDef.s_CHARA_DIC key = " + uCharaId, typeof(KrCharagekiUICharacterContainer)); KrCharagekiUICharacterData pData = KrCharagekiDef.s_pCHARA_DIC[uCharaId]; KrDebug.Assert(!m_pCharaContainer.ContainsKey(uCharaId), "It is already registered key = " + uCharaId, typeof(KrCharagekiUICharacterContainer)); KrCharagekiUICharacter pChara = null; // 2D SPRITE if (m_eMode == eVIEW_MODE.SPRITE) { pChara = KrCharagekiUI2DCharacter.Create(m_pCharaParent, pData); } // LIVE 2D else if (m_eMode == eVIEW_MODE.LIVE2D) { pChara = KrCharagekiUILive2DCharacter.Create(m_pCharaParent, pData); } m_pCharaContainer.Add(uCharaId, pChara); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Execution command // @Param : pManager => Charageki manager public override void Exec(KrCharagekiManager pManager) { string pKey = ""; for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++) { //::::::::::::::::::::::::::::::::::::::::::::::::::: // KEY if (m_pOptions[sIndex].m_pKey == "key") { pKey = m_pOptions[sIndex].m_pValue; } } KrDebug.Assert(!string.IsNullOrEmpty(pKey), "there is no key!!", typeof(KrCharagekiCommandLoadScenario)); KrCharagekiScenarioContainer pScenarioContainer = pManager.GetScenarioContainer(); KrDebug.Log("Set scenario = " + pKey, typeof(KrCharagekiCommandLoadScenario)); // set the current scenario pScenarioContainer.SettingScenario(pKey); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PUBLIC //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Csv Load // @Param : pPath => Asset path // : bFromResources => From resources file public static KrCsvData Load(string pPath, bool bFromResources) { KrCsvData pCsvData = new KrCsvData(); StreamReader pStreamReader = KrResources.LoadText(pPath, bFromResources); KrDebug.Log("Load csv. path = " + pPath, typeof(KrCsvData)); if (pStreamReader.Peek() > -1) { string pOneLineColumnNames = pStreamReader.ReadLine(); KrDebug.Log("ColumnName = " + pOneLineColumnNames, typeof(KrCsvData)); // Setting column names string[] pColmnNames = pOneLineColumnNames.Split(new char[] { ',' }); pCsvData.SetColumnNames(pColmnNames); } string pOneLineValues = ""; while (pStreamReader.Peek() > -1) { pOneLineValues += pStreamReader.ReadLine(); // Setting values string[] pSplit = pOneLineValues.Split(new char[] { ',' }); if (pSplit.Length >= pCsvData.GetColumnNum()) { //Csv treats " as two minutes pOneLineValues = pOneLineValues.Replace("\"\"", "\""); KrDebug.Log(pOneLineValues, typeof(KrCsvData)); pCsvData.SetRow(pSplit); pOneLineValues = ""; } else { pOneLineValues += System.Environment.NewLine; } } pStreamReader.Close(); return(pCsvData); }