private void FightMap(int mapId) { config_map_item config = (config_map_item)ResModel.Instance.config_map.GetItem(mapId); if (config != null) { int endlevel = (int)GameModel.Instance.GetGameConfig(1007); if (config.id > endlevel) { config_item_base mapconfigitem = ResModel.Instance.config_map.GetItem(endlevel); PromptModel.Instance.Pop(string.Format(LanguageUtil.GetTxt(11101), Convert.ToInt32(mapconfigitem.name))); return; } BattleModel.Instance.InitCrtBattle(config); BattleModel.Instance.InitFight(); SkillTempletModel.Instance.UpdataTemplet(); FillModel.Instance.InitFillInfo(); ModuleModel.Instance.AddUIModule((int)ModuleEnum.PREPARE); } else { Debug.Log(LanguageUtil.GetTxt(11102)); } }
private void SetMapInfo(GameObject item, MapInfo mapInfo, config_map_item config = null) { if (item == null) { return; } MapItem itemCtr = item.GetComponent <MapItem>(); itemCtr.config = config; if (mapInfo == null) { if (config != null && config.id < MapModel.Instance.TestMapEnd) { itemCtr.SetView(true, 0); EventTriggerListener.Get(item).onClick = OnMapClick; } else { itemCtr.SetView(false, 0); EventTriggerListener.Get(item).onClick = OnMapClick; } } else { itemCtr.SetView(true, mapInfo.star, mapInfo.UseOldStar()); EventTriggerListener.Get(item).onClick = OnMapClick; } }
private void OnNew(GameObject go) { config_map_item config_map_item = new config_map_item(); config_map_item.id = resourceMgr.config_map.data[resourceMgr.config_map.GetDataCount() - 1].id + 1; config_map_item.icon = config_map_item.id; config_map_item.name = "" + (config_map_item.id % 10000); config_map_item.desc = ""; config_map_item.pre_id = (config_map_item.id - 1); config_map_item.task = "10101|20,10102|20,10103|20,10104|20,10105|20"; config_map_item.step = 32; config_map_item.build = 10000; config_map_item.fill = 10000; config_map_item.judge = "1800,3500,5200"; config_map_item.forbid_skill = ""; resourceMgr.config_map.data.Add(config_map_item); BattleInfo battleInfo = new BattleInfo(); battleInfo.mapId = config_map_item.id; 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); ToggleList toggleList = togglePart.UpDateList(FightLayerType.map); GameObject toggleItem = toggleList.list.GetItemByName("item_" + config_map_item.id); Toggle toggle = toggleItem.GetComponent <Toggle> (); toggle.isOn = true; }
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; }
public void PassLevel(MapInfo passMap) { if (passMap.configId <= TestMapEnd) { return; } int i; for (i = 0; i < passMaps.Count; i++) { MapInfo mapInfo = passMaps[i]; if (mapInfo.configId == passMap.configId) { if (mapInfo.star < passMap.star) { mapInfo.oldStar = mapInfo.star; mapInfo.star = passMap.star; } if (mapInfo.score < passMap.score) { mapInfo.score = passMap.score; } changeMaps.Add(mapInfo); SaveMap(); UpdateStarInfo(); return; } } for (i = 0; i < newMaps.Count; i++) { MapInfo mapInfo = newMaps[i]; if (mapInfo.configId == passMap.configId) { newMaps.RemoveAt(i); passMaps.Add(passMap); changeMaps.Add(passMap); passMap.oldStar = 0; for (int j = 0; j < GameMgr.resourceMgr.config_map.data.Count; j++) { config_map_item config_map_item = GameMgr.resourceMgr.config_map.data[j]; if (config_map_item.pre_id == passMap.configId && config_map_item.pre_id != config_map_item.id) { MapInfo newMap = OpenLevel(config_map_item.id); changeMaps.Add(newMap); break; } } SaveMap(); UpdateStarInfo(); return; } } }
private void CreateMapItem(config_map_item config_map, int index) { GameObject item = mapList.NewItem(); RectTransform rectTransform = (RectTransform)item.transform; int offX = index % 3 - 1; float offY = 2.5f - (int)Mathf.Ceil((index + 1) / 3.0f); rectTransform.anchoredPosition = new Vector2(offX * 260, offY * 270 + 30); item.name = "" + config_map.id; MapInfo mapInfo = MapModel.Instance.GetMapInfo(config_map.id); SetMapInfo(item, mapInfo, config_map); }
private void ShowStar() { StarInfo starInfo = MapModel.Instance.starInfo; starButton.GetComponentInChildren <Text>().text = starInfo.crtStar + "/" + starInfo.openMapFullStar; starTipAnim.Stop(); List <config_chapter_item> datas = ResModel.Instance.config_chapter.data; int totalChapterCount = datas.Count; int i; for (i = 0; i < totalChapterCount; i++) { config_chapter_item config_chapter = datas[i]; List <int> mapIds = config_chapter.GetMapIds(); if (mapIds.Count > 0) { int allStars = 0; int fullStar = 0; int j; for (j = 0; j < mapIds.Count; j++) { config_map_item config_map = (config_map_item)ResModel.Instance.config_map.GetItem(mapIds[j]); MapInfo mapInfo = MapModel.Instance.GetMapInfo(config_map.id); if (mapInfo != null) { allStars += mapInfo.star; } fullStar += 3; } if (allStars >= fullStar) { ChapterInfo chapter = MapModel.Instance.GetChapterInfo(config_chapter.id); if (chapter == null || chapter.reward == false) { starTipAnim.Play(); return; } } } } }
private void ShowMap() { ShowBase(10000, 29999); config_map_item config_map_item = (config_map_item)CellWars_Editor.crt_item; config_map_item.step = (int)EditorGUILayout.Slider("step " + CellWars_Editor.config_map.template.step, config_map_item.step, 1, 200); config_map_item.pre_id = (int)EditorGUILayout.Slider("pre_id " + CellWars_Editor.config_map.template.pre_id, config_map_item.pre_id, 10000, 29999); config_map_item.task = EditorGUILayout.TextField("task " + CellWars_Editor.config_map.template.task, config_map_item.task); config_map_item.build = (int)EditorGUILayout.Slider("build " + CellWars_Editor.config_map.template.build, config_map_item.build, 10000, 29999); config_map_item.fill = (int)EditorGUILayout.Slider("fill " + CellWars_Editor.config_map.template.fill, config_map_item.fill, 10000, 29999); config_map_item.judge = EditorGUILayout.TextField("judge " + CellWars_Editor.config_map.template.judge, config_map_item.judge); config_map_item.forbid_skill = EditorGUILayout.TextField("forbid_skill " + CellWars_Editor.config_map.template.forbid_skill, config_map_item.forbid_skill); config_map_item.forbid_prop = EditorGUILayout.TextField("forbid_prop " + CellWars_Editor.config_map.template.forbid_prop, config_map_item.forbid_prop); config_map_item.starLimit = EditorGUILayout.TextField("starLimit ", config_map_item.starLimit); }
private void OnClickBuy(GameObject go) { config_map_item mapConfig = BattleModel.Instance.crtConfig; IVInfo starLimit = mapConfig.GetStarLimit(); WealthInfo infoGem = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem); if (infoGem.count < starLimit.value) { PromptModel.Instance.Pop(LanguageUtil.GetTxt(11901), false, (int)WealthTypeEnum.Gem); ModuleModel.Instance.AddUIModule((int)ModuleEnum.WEALTH); } else { OnBuy(); } }
private void OnOkClick(GameObject go) { config_map_item mapConfig = BattleModel.Instance.crtConfig; IVInfo starLimit = mapConfig.GetStarLimit(); if (starLimit.id > 0) { StarInfo starInfo = MapModel.Instance.starInfo; if (starLimit.id > starInfo.crtStar) // star short { MapInfo mapInfo = MapModel.Instance.GetMapInfo(mapConfig.id); if (mapInfo.buyPassed == false) // no buy { ModuleModel.Instance.AddUIModule((int)ModuleEnum.MAPLOCK); return; } } } WealthInfo energyInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Energy); if (energyInfo.count >= GameModel.Instance.GetGameConfig(1001)) { PlayerModel.Instance.updateWealthsEvent -= UpdateView; energyInfo.count -= (int)GameModel.Instance.GetGameConfig(1001); PlayerModel.Instance.SaveWealths(); PlayerModel.Instance.CheckEnergyRecover(false); SkillModel.Instance.InitSeeds(); SkillModel.Instance.InitFightingEntitys(); SkillModel.Instance.crt_entity = null; PropModel.Instance.InitProps(); CollectModel.Instance.Clear(); BattleModel.Instance.play_mapId = BattleModel.Instance.crtBattle.mapId; BattleModel.Instance.ready_map = 0; ModuleModel.Instance.AddUIModule((int)ModuleEnum.FIGHT); } else { PlayerModel.Instance.ExchangeWealth((int)WealthTypeEnum.Energy, (int)GameModel.Instance.GetGameConfig(1001) - energyInfo.count, GotoFight); PromptModel.Instance.Pop(LanguageUtil.GetTxt(11901), false, (int)WealthTypeEnum.Energy); } }
private void OnBuy() { config_map_item mapConfig = BattleModel.Instance.crtConfig; IVInfo starLimit = mapConfig.GetStarLimit(); WealthInfo infoGem = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem); infoGem.count -= (int)starLimit.value; PlayerModel.Instance.SaveWealths(); MapInfo mapInfo = MapModel.Instance.GetMapInfo(mapConfig.id); mapInfo.buyPassed = true; MapModel.Instance.SaveMap(); ModuleModel.Instance.RemoveUIModule((int)ModuleEnum.MAPLOCK); }
public void InitFillInfo() { config_map_item map_item = BattleModel.Instance.crtConfig; FillInfo fillInfo = GetFillInfo(map_item.fill); if (fillInfo == null) { fillInfo = new FillInfo(); fillInfo.id = map_item.fill; string content = GameMgr.resourceMgr.GetTextString("txt/fill.ab", fillInfo.id.ToString()); fillInfo.FillTxt(content); fillInfos.Add(fillInfo); } crtFillInfo = fillInfo; FillInfo.FILL_COUNT = 0; }
private void OnClickRestart(GameObject go) { BattleModel.Instance.lose_map = 0; GameMgr.moduleMgr.AddUIModule(ModuleEnum.MAP); int mapId = BattleModel.Instance.crtConfig.id; config_map_item config = (config_map_item)GameMgr.resourceMgr.config_map.GetItem(mapId); BattleModel.Instance.InitCrtBattle(config); BattleModel.Instance.InitFight(); SkillTempletModel.Instance.UpdataTemplet(); FillModel.Instance.InitFillInfo(); GameMgr.moduleMgr.AddUIModule(ModuleEnum.PREPARE); }
private void UpdateView(int type) { config_map_item mapConfig = BattleModel.Instance.crtConfig; IVInfo starLimit = mapConfig.GetStarLimit(); StarInfo starInfo = MapModel.Instance.starInfo; text1.text = LanguageUtil.GetTxt(16002) + " " + ColorUtil.GetColorStr(ColorUtil.COLOR_RED, "" + starInfo.crtStar) + "/" + starLimit.id; WealthInfo infoGem = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem); if (infoGem.count < starLimit.value) { text5.color = Color.red; } else { text5.color = Color.green; } text5.text = "" + starLimit.value; }
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); } }
private void InitMapList() { mapList.ClearList(); List <int> mapIds = MapModel.Instance.selectChapter.GetMapIds(); AudioModel.Instance.PlayeSound("click"); if (mapIds.Count < 1) { comingTrans.gameObject.SetActive(true); } else { comingTrans.gameObject.SetActive(false); //string[] mapIndexs = MapModel.Instance.selectChapter.GetMapIndexs(); int i; for (i = 0; i < mapIds.Count; i++) { config_map_item config_map = (config_map_item)ResModel.Instance.config_map.GetItem(mapIds[i]); CreateMapItem(config_map, i); } } }
private void OnMapClick(GameObject go) { MapItem itemCtr = go.GetComponent <MapItem>(); config_map_item config = itemCtr.config; if (config != null) { int endlevel = (int)GameModel.Instance.GetGameConfig(1007); if (config.id > endlevel) { config_item_base mapconfigitem = ResModel.Instance.config_map.GetItem(endlevel); PromptModel.Instance.Pop(string.Format(LanguageUtil.GetTxt(11101), Convert.ToInt32(mapconfigitem.name))); return; } if (itemCtr.btn.interactable == false) { PromptModel.Instance.Pop(LanguageUtil.GetTxt(11103)); return; } BattleModel.Instance.InitCrtBattle(config); BattleModel.Instance.InitFight(); SkillTempletModel.Instance.UpdataTemplet(); FillModel.Instance.InitFillInfo(); ModuleModel.Instance.AddUIModule((int)ModuleEnum.PREPARE); } else { Debug.Log(LanguageUtil.GetTxt(11102)); } }
private void OnUpLvClick(GameObject go) { if (skillTempletInfo == null) { return; } if (!skillTempletInfo.IsUnlock()) { config_map_item map_item = (config_map_item)ResModel.Instance.config_map.GetItem(skillTempletInfo.config.unlockId); PromptModel.Instance.Pop(LanguageUtil.GetTxt(11303) + ":" + map_item.name); return; } int leftStar = MapModel.Instance.starInfo.GetSkillCanUseStar(); if (leftStar >= skillTempletInfo.LevelUpCostStar()) { WealthInfo bottleInfo = PlayerModel.Instance.GetWealth(skillGroupInfo.GetGroupId()); if (bottleInfo.count < skillTempletInfo.LevelUpCostBottle()) { PromptModel.Instance.Pop(LanguageUtil.GetTxt(11901), false, bottleInfo.type); } else { bottleInfo.count -= skillTempletInfo.LevelUpCostBottle(); PlayerModel.Instance.SaveWealths(); SkillTempletModel.Instance.UpLevel(skillTempletInfo, 1); //PromptModel.Instance.Pop(LanguageUtil.GetTxt(11305)); } } else { PromptModel.Instance.Pop(LanguageUtil.GetTxt(11901), false, (int)WealthTypeEnum.Star); } }
public static void EditConfigItem(int id = 0) { if (id > 0) { crt_item = crt_config.GetItem(id); } else { switch (crt_config.name) { case CellWars_Editor.config_cell_name: crt_item = new config_cell_item(); config_cell_item config_cell_item = (config_cell_item)crt_item; config_cell_item.Clear(); config_cell_item.id = config_cell.data[config_cell.GetDataCount() - 1].id + 1; config_cell_item.hide_id = config_cell_item.id; config_cell_item.icon = config_cell_item.id; break; case CellWars_Editor.config_wall_name: crt_item = new config_wall_item(); config_wall_item config_wall_item = (config_wall_item)crt_item; config_wall_item.Clear(); config_wall_item.id = config_wall.data[config_wall.GetDataCount() - 1].id + 1; break; case CellWars_Editor.config_map_name: crt_item = new config_map_item(); config_map_item config_map_item = (config_map_item)crt_item; config_map_item.Clear(); config_map_item.id = config_map.data[config_map.GetDataCount() - 1].id + 1; config_map_item.name = "" + (config_map_item.id % 10000); config_map_item.icon = config_map_item.id; config_map_item.step = 20; config_map_item.pre_id = (config_map_item.id - 1); config_map_item.task = "10101|20,10102|21,10103|22,10104|23,10105|24"; config_map_item.build = 10000; config_map_item.fill = 10000; config_map_item.judge = "1000,2000,3000"; config_map_item.forbid_skill = "10106,10112,10108,10114,10110"; config_map_item.forbid_prop = ""; break; case CellWars_Editor.config_cover_name: crt_item = new config_cover_item(); config_cover_item config_cover_item = (config_cover_item)crt_item; config_cover_item.Clear(); config_cover_item.id = config_cover.data[config_cover.GetDataCount() - 1].id + 1; break; case CellWars_Editor.config_monster_name: crt_item = new config_monster_item(); config_monster_item config_monster_item = (config_monster_item)crt_item; config_monster_item.Clear(); config_monster_item.id = config_monster.data[config_monster.GetDataCount() - 1].id + 1; break; case CellWars_Editor.config_prop_name: crt_item = new config_prop_item(); config_prop_item config_prop_item = (config_prop_item)crt_item; config_prop_item.Clear(); config_prop_item.id = config_prop.data[config_prop.GetDataCount() - 1].id + 1; break; case CellWars_Editor.config_module_name: crt_item = new config_module_item(); config_module_item config_module_item = (config_module_item)crt_item; config_module_item.Clear(); config_module_item.id = config_module.data[config_module.GetDataCount() - 1].id + 1; break; case CellWars_Editor.config_guild_name: crt_item = new config_guild_item(); config_guild_item config_guild_item = (config_guild_item)crt_item; config_guild_item.Clear(); config_guild_item.id = config_guild.data[config_guild.GetDataCount() - 1].id + 1; break; case CellWars_Editor.config_chapter_name: crt_item = new config_chapter_item(); config_chapter_item config_chapter_item = (config_chapter_item)crt_item; config_chapter_item.Clear(); config_chapter_item.id = config_chapter.data[config_chapter.GetDataCount() - 1].id + 1; break; case CellWars_Editor.config_wealth_name: crt_item = new config_wealth_item(); config_wealth_item config_wealth_item = (config_wealth_item)crt_item; config_wealth_item.Clear(); config_wealth_item.id = config_wealth.data[config_wealth.GetDataCount() - 1].id + 1; break; case CellWars_Editor.config_skill_name: crt_item = new config_skill_item(); config_skill_item config_skill_item = (config_skill_item)crt_item; config_skill_item.Clear(); config_skill_item.id = config_skill.data[config_skill.GetDataCount() - 1].id + 1; break; case CellWars_Editor.config_sort_name: crt_item = new config_sort_item(); config_sort_item config_sort_item = (config_sort_item)crt_item; config_sort_item.Clear(); config_sort_item.id = config_sort.data[config_sort.GetDataCount() - 1].id + 1; break; } } }
public void SetConfig(config_chapter_item config) { itemConfig = config; nameText.text = itemConfig.name; nameText.color = ColorUtil.GetColor(ColorUtil.COLOR_FISHSTAR); haveImage.gameObject.SetActive(false); addImage.gameObject.SetActive(false); List <int> mapIds = itemConfig.GetMapIds(); if (mapIds.Count < 1) { starText.text = "?"; rewardText.text = "?"; nameText.text = "?"; chapterIsFull = false; starText.color = Color.gray; rewardText.color = Color.gray; } else { bool hasOpen = false; int allStars = 0; int fullStar = 0; int i; for (i = 0; i < mapIds.Count; i++) { config_map_item config_map = (config_map_item)ResModel.Instance.config_map.GetItem(mapIds[i]); MapInfo mapInfo = MapModel.Instance.GetMapInfo(config_map.id); if (mapInfo != null) { hasOpen = true; allStars += mapInfo.star; } fullStar += 3; } if (hasOpen == false) { starText.color = Color.gray; rewardText.color = Color.gray; } starText.text = allStars + "/" + fullStar; rewardText.text = "+" + itemConfig.GetRewardList()[0].value; if (allStars < fullStar) { rewardText.color = Color.gray; chapterIsFull = false; } else { chapterIsFull = true; } ChapterInfo chapter = MapModel.Instance.GetChapterInfo(itemConfig.id); if (chapter != null && chapter.reward == true) { haveImage.gameObject.SetActive(true); } } }
public static void SaveCrtItem(bool isDelete = false) { if (crt_item != null) { switch (crt_config.name) { case CellWars_Editor.config_cell_name: config_cell_item config_cell_item = (config_cell_item)config_cell.GetItem(crt_item.id); if (config_cell_item == null) { config_cell.data.Add((config_cell_item)crt_item); } break; case CellWars_Editor.config_wall_name: config_wall_item config_wall_item = (config_wall_item)config_wall.GetItem(crt_item.id); if (config_wall_item == null) { config_wall.data.Add((config_wall_item)crt_item); } break; case CellWars_Editor.config_map_name: config_map_item config_map_item = (config_map_item)config_map.GetItem(crt_item.id); if (config_map_item == null) { config_map.data.Add((config_map_item)crt_item); } // int cellCount = config_cell.data.Count; // int coverCount = config_cover.data.Count; // int monsterCount = config_monster.data.Count; // int allCount = cellCount + coverCount + monsterCount; // // int dataCount = config_map.GetDataCount(); // for (int i = 0; i < dataCount; i++) // { // config_map_item = (config_map_item)config_map.GetItemAt(i); // if(config_map_item.id > 20010) // { // config_map_item.special = ""; // int randomIndex = Random.Range(0,allCount); // if(randomIndex < cellCount) // { // config_map_item.special = "cell_" + config_cell.GetItemAt(randomIndex).icon; // }else if(randomIndex < (cellCount + coverCount)) // { // config_map_item.special = "cover_" + config_cover.GetItemAt(randomIndex - cellCount).icon; // }else // { // config_map_item.special = "monster_" + config_monster.GetItemAt(randomIndex - cellCount - coverCount).icon; // } // } // } break; case CellWars_Editor.config_cover_name: config_cover_item config_cover_item = (config_cover_item)config_cover.GetItem(crt_item.id); if (config_cover_item == null) { config_cover.data.Add((config_cover_item)crt_item); } break; case CellWars_Editor.config_monster_name: config_monster_item config_monster_item = (config_monster_item)config_monster.GetItem(crt_item.id); if (config_monster_item == null) { config_monster.data.Add((config_monster_item)crt_item); } break; case CellWars_Editor.config_prop_name: config_prop_item config_prop_item = (config_prop_item)config_prop.GetItem(crt_item.id); if (config_prop_item == null) { config_prop.data.Add((config_prop_item)crt_item); } break; case CellWars_Editor.config_module_name: config_module_item config_module_item = (config_module_item)config_module.GetItem(crt_item.id); if (config_module_item == null) { config_module.data.Add((config_module_item)crt_item); } break; case CellWars_Editor.config_guild_name: config_guild_item config_guild_item = (config_guild_item)config_guild.GetItem(crt_item.id); if (config_guild_item == null) { config_guild.data.Add((config_guild_item)crt_item); } break; case CellWars_Editor.config_chapter_name: config_chapter_item config_chapter_item = (config_chapter_item)config_chapter.GetItem(crt_item.id); if (config_chapter_item == null) { config_chapter.data.Add((config_chapter_item)crt_item); } break; case CellWars_Editor.config_wealth_name: config_wealth_item config_wealth_item = (config_wealth_item)config_wealth.GetItem(crt_item.id); if (config_wealth_item == null) { config_wealth.data.Add((config_wealth_item)crt_item); } break; case CellWars_Editor.config_skill_name: config_skill_item config_skill_item = (config_skill_item)config_skill.GetItem(crt_item.id); if (config_skill_item == null) { config_skill.data.Add((config_skill_item)crt_item); } break; case CellWars_Editor.config_sort_name: config_sort_item config_sort_item = (config_sort_item)config_sort.GetItem(crt_item.id); if (config_sort_item == null) { config_sort.data.Add((config_sort_item)crt_item); } break; } } switch (crt_config.name) { case CellWars_Editor.config_cell_name: config_cell.data.Sort(); FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_cell), true); break; case CellWars_Editor.config_wall_name: config_wall.data.Sort(); FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_wall), true); break; case CellWars_Editor.config_map_name: config_map.data.Sort(); FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_map), true); break; case CellWars_Editor.config_cover_name: config_cover.data.Sort(); FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_cover), true); break; case CellWars_Editor.config_monster_name: config_monster.data.Sort(); FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_monster), true); break; case CellWars_Editor.config_prop_name: config_prop.data.Sort(); FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_prop), true); break; case CellWars_Editor.config_module_name: config_module.data.Sort(); FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_module), true); break; case CellWars_Editor.config_guild_name: config_guild.data.Sort(); FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_guild), true); break; case CellWars_Editor.config_chapter_name: config_chapter.data.Sort(); FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_chapter), true); break; case CellWars_Editor.config_wealth_name: config_wealth.data.Sort(); FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_wealth), true); break; case CellWars_Editor.config_skill_name: config_skill.data.Sort(); FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_skill), true); break; case CellWars_Editor.config_sort_name: config_sort.data.Sort(); FileUtil.Instance().WriteFile(crt_config.name, JsonMapper.ToJson(config_sort), true); break; } }
public void LoadMaps(int maxId = 0) { if (PlayerModel.CLEAR_ALL) { PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.CHAPTER); PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.PASS_MAP); PlayerPrefsUtil.RemoveData(PlayerPrefsUtil.NEW_MAP); } string CHAPTER = PlayerPrefsUtil.GetString(PlayerPrefsUtil.CHAPTER); chapters = JsonMapper.ToObject <List <ChapterInfo> >(CHAPTER); if (chapters == null) { chapters = new List <ChapterInfo>(); } string PASS_MAP = PlayerPrefsUtil.GetString(PlayerPrefsUtil.PASS_MAP); passMaps = JsonMapper.ToObject <List <MapInfo> >(PASS_MAP); if (passMaps == null) { passMaps = new List <MapInfo>(); } string NEW_MAP = PlayerPrefsUtil.GetString(PlayerPrefsUtil.NEW_MAP); newMaps = JsonMapper.ToObject <List <MapInfo> >(NEW_MAP); if (newMaps == null) { newMaps = new List <MapInfo>(); OpenLevel(20001); } else { if (newMaps.Count == 0) { MapInfo mapInfo = passMaps[passMaps.Count - 1]; selectChapter = GameMgr.resourceMgr.config_chapter.GetChapterByMap(mapInfo); } else { MapInfo mapInfo = newMaps[newMaps.Count - 1]; selectChapter = GameMgr.resourceMgr.config_chapter.GetChapterByMap(mapInfo); } if (selectChapter == null) { selectChapter = (config_chapter_item)GameMgr.resourceMgr.config_chapter.data[GameMgr.resourceMgr.config_chapter.data.Count - 1]; } } if (maxId > 0) { WealthInfo coinInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Coin); WealthInfo gemInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem); newMaps = new List <MapInfo>(); passMaps = new List <MapInfo>(); int openId = 0; for (int j = 0; j < GameMgr.resourceMgr.config_map.data.Count; j++) { config_map_item config_map_item = GameMgr.resourceMgr.config_map.data[j]; if (config_map_item.id <= maxId) { MapInfo mapInfo = new MapInfo(); mapInfo.configId = config_map_item.id; mapInfo.star = 2; mapInfo.score = config_map_item.GetJudgeScores()[mapInfo.star - 1]; passMaps.Add(mapInfo); coinInfo.count += (int)GameModel.Instance.GetGameConfig(1005); gemInfo.count += (int)GameModel.Instance.GetGameConfig(1006);; for (int i = 0; i < SkillTempletModel.Instance.skillGroups.Count; i++) { SkillGroupInfo skillTempletGroupInfo = SkillTempletModel.Instance.skillGroups[i]; int groupId = skillTempletGroupInfo.GetGroupId(); WealthInfo bottleInfo = PlayerModel.Instance.GetWealth(groupId); bottleInfo.count += 60; } openId = config_map_item.id + 1; } } OpenLevel(openId); PlayerModel.Instance.SaveWealths(); SaveMap(); } UpdateStarInfo(); }