private void OnLoadTableComplete(LoadResult result) { if (result.isSuccess) { bool isSuccess = true; string content = ""; string relativePath = result.assetNames[0]; try { TextAsset asset = result.assets[0] as TextAsset; if (asset == null) { GameLogger.Error(LOG_CHANNEL.ASSET, relativePath + " ERROR! load table asset is NULL,暂时跳过"); return; } content = asset.text; if (string.IsNullOrEmpty(content)) { GameLogger.Error(LOG_CHANNEL.ASSET, relativePath + " ERROR! load table content is NULL or empty,暂时跳过"); return; } ResourcesProxy.DestroyAsset(relativePath); } catch (Exception e) { isSuccess = false; GameLogger.Error(LOG_CHANNEL.ASSET, relativePath + " Parse Failed : " + e.ToString()); } finally { if (isSuccess) { string name = relativePathToNameDict[relativePath]; ConfigData data = m_TableDefine[name]; string tableName = data.GetString("tableName"); string tablePath = data.GetString("tablePath"); string tablePK2 = data.GetString("extKey"); ConfigDataTableManager.Instance.LoadTable(tableName, content, tablePK2); } else { //TODO 留给之后对应加载的job使用 } } } else { //TODO 留给之后对应加载的job使用 GameLogger.Error(LOG_CHANNEL.ASSET, result.assetNames[0] + " Load Failed!"); } }
private void OnLoadDefineTableComplete(LoadResult result) { if (result.isSuccess) { bool isSuccess = true; string relativePath = result.assetNames[0]; string content = ""; try { TextAsset asset = result.assets[0] as TextAsset; if (asset == null) { GameLogger.Error(LOG_CHANNEL.ASSET, relativePath + " ERROR! load table asset is NULL,暂时跳过"); return; } content = asset.text; if (string.IsNullOrEmpty(content)) { GameLogger.Error(LOG_CHANNEL.ASSET, relativePath + " ERROR! load table content is NULL or empty,暂时跳过"); return; } ResourcesProxy.DestroyAsset(relativePath); } catch (Exception e) { isSuccess = false; GameLogger.Error(LOG_CHANNEL.ASSET, relativePath + " Parse Failed : " + e.ToString()); } finally { if (isSuccess) { InitConfigData(content); LoadAllTable(); } else { //TODO 留给之后对应加载的job使用 } } } else { //TODO 留给之后对应加载的job使用 GameLogger.Error(LOG_CHANNEL.ASSET, result.assetNames[0] + " Load Failed!"); } }
protected void OnEngineObjectLoadEnd(LoadResult result) { if (!result.isSuccess) { GameLogger.Error(LOG_CHANNEL.ERROR, "Load Engine Object Failed! modelName : " + m_strName); return; } m_ModelResObj = result.assets[0] as GameObject; m_EngineObj = GameObject.Instantiate(result.assets[0] as GameObject); //GameLogger.LogFormat(Galaxy.LOG_CHANNEL.LOGIC, "actor name = " + result.assetNames[0]); if (m_EngineObj == null) { GameLogger.Error(LOG_CHANNEL.ERROR, "Create Engine Object Failed! modelName : " + m_strName); return; } ClientID = m_EngineObj.gameObject.GetInstanceID(); AfterCreateEngineObj(); SetOwner(this); }