// @Brief : Compile script private void Compile() { StreamReader pReader = KrResources.LoadText(m_pFilePath); KrCharagekiScript pScript = new KrCharagekiScript(); try { pScript.LoadScript(pReader); } finally { if (pReader != null) { pReader.Close(); } } }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // PRIVATE FUNCTION //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // @Brief : Load script // @Return : KrCharagekiScript instance private KrCharagekiScript LoadScript() { KrCharagekiScript pScript = new KrCharagekiScript(); for (int sIndex = 0; sIndex < m_pScriptPaths.Length; sIndex++) { StreamReader pReader = KrResources.LoadText(KrCharagekiDef.s_pASSET_BASE_PATH + m_pScriptPaths[sIndex], KrCharagekiDef.IsLoadingFromResources()); try { pScript.LoadScript(pReader); } finally { if (pReader != null) { pReader.Close(); } } } return(pScript); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // 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); }