public override void EnterState(GameState preState, object param) { LogCtrl.Log(" 进入 更新配置 状态 。。"); ReadPrototypeManager.Instance.InitialPrototype(() => { GameStateManager.Instance.SetActiveState(GameStateManager.STATE_START); }); }
private void CheckIsFinish() { LogCtrl.Log(" 读取配置表,剩余表数量 " + listTableInfos.Count); if (listTableInfos.Count == 0) { ReadFinish(); } }
public void StartLoadRes(int count) { mRequest = Resources.LoadAsync(AssetName); dateTimeOut = DateTime.UtcNow.AddSeconds(TimeOut); curRetryCount = count; if (count == 0) { LogCtrl.Log(" 开始加载 资源 " + AssetName); } else { LogCtrl.Log(" 超时重试 加载 资源 " + AssetName + " 当前次数 " + count); } }
/// <summary> ///格式化失败,返回原字符串 /// </summary> public static string FormatFailReturnOrigin(string str, params object[] param) { if (CheckStringFormatParam(str, param)) { for (int cnt = 0; cnt < param.Length; cnt++) { str = str.Replace("{" + cnt + "}", param[cnt].ToString()); } } else { LogCtrl.Log(" FormatFailReturnOrigin " + str); } return(str); }
public override void LeaveState(GameState nextState) { LogCtrl.Log(" 离开 更新配置 状态 。。"); }
/// <summary> /// 读取xml /// </summary> /// <param name="name">Name.</param> public void LoadData(string content) { try { //从文件读取到xml XmlDocument xmlDoc = new XmlDocument(); //string xmlString = FileTools.GetResourcesFileToString(pathFile); string xmlString = content;//AssetBundleManager.Instance.LoadAsset<TextAsset>(ResourceAssetbundleDefine.PKG_CONFIG, name).text; if (xmlString == null || xmlString.Length == 0) { LogCtrl.Log("是不是版本表配置错误,没找到此表或文件格式不正确!"); return; } xmlDoc.LoadXml(xmlString); Type refType = null; XmlNode node = null; //取出表依赖的类 node = xmlDoc.FirstChild; node = node.NextSibling; string type = node.Attributes["type"].Value; System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); refType = assembly.GetType(type); if (refType == null) { LogCtrl.Log("name = " + typeof(T).ToString() + " 此表可能为新加表,请加入解析类!"); return; } //把同一张表所有数据记录 Dictionary <int, T> dicTempList = new Dictionary <int, T>(); //解析单条数据 XmlNodeList nodeList = node.ChildNodes; for (int i = 0; i < nodeList.Count; i++) { XmlNode childNode = nodeList[i]; T basePrototype = System.Activator.CreateInstance(refType) as T; basePrototype.LoadData(childNode); if (dicTempList.ContainsKey(basePrototype.PrototypeId)) { dicTempList[basePrototype.PrototypeId] = basePrototype; } else { dicTempList.Add(basePrototype.PrototypeId, basePrototype); } } //加入表集合中 if (dicTempList.Count != 0) { if (dicAllTableData.ContainsKey(refType)) { dicAllTableData[refType] = dicTempList; } else { dicAllTableData.Add(refType, dicTempList); } } } catch (Exception ex) { LogCtrl.Error("配置表文件格式错啦!!!!! name = " + typeof(T).ToString() + " " + ex.ToString()); } }
public override void EnterState(GameState preState, object param) { LogCtrl.Log(" 进入 开始游戏 状态 。。"); MakeEntityManager.Instance.InitialCastle(); }
public override void EnterState(GameState preState, object param) { LogCtrl.Log(" 进入 检查 状态 。。"); GameStateManager.Instance.SetActiveState(GameStateManager.STATE_INITIAL_CONFIG); }