public void InitCrtBattle(config_map_item config) { crtConfig = config; BattleInfo battleInfo = GetBattle(crtConfig.id); if (battleInfo == null) { battleInfo = new BattleInfo(); battleInfo.mapId = crtConfig.id; battles.Add(battleInfo); byte[] battleInfoBytes = ResModel.Instance.GetTextBytes("dat/map/" + battleInfo.mapId.ToString()); battleInfo.FillByte(battleInfoBytes); } else { if (battleInfo.clearCaching) { byte[] battleInfoBytes = ResModel.Instance.GetTextBytes("dat/map/" + battleInfo.mapId.ToString()); battleInfo.FillByte(battleInfoBytes); } } battleInfo.need_open_fill = true;//todo crtBattle = battleInfo; }
private IEnumerator LoadDats() { for (int i = 0; i < config_map.data.Count; i++) { config_map_item item = config_map.data[i]; BattleInfo battleInfo = new BattleInfo(); battleInfo.mapId = item.id; if (FileUtil.Instance().HasFile("dat/map/" + item.id, ".bytes")) { WWW www = new WWW(sourceArtPath + "dat/map/" + item.id + ".bytes"); yield return(www); battleInfo.FillByte(www.bytes); } else { battleInfo.FillNew(GridModel.Instance.set_start_x, GridModel.Instance.set_start_y, GridModel.Instance.set_end_x, GridModel.Instance.set_end_y, GridModel.Instance.set_battle_width, GridModel.Instance.set_battle_height); } BattleModel.Instance.battles.Add(battleInfo); } }