private void OnUpdate(object obj) { DataManager.Instance.mapModel.CheckOpen(); for (int i = 0; i < mapCell.Length; i++) { MapVo mapVo = DataManager.Instance.mapModel.GetMapVo(mapCell[i].id); mapCell[i].Create(mapVo, MapSelect); } }
public void Load(string str) { string[] arr = str.Split('|'); nowMap = int.Parse(arr[0]); for (int i = 1; i < arr.Length; i++) { if (arr[i] != "") { MapVo mapVo = new MapVo(); mapVo.Update(arr[i]); _dataList.Add(mapVo); } } }
public void Add(StaticMapVo vo) { if (_dataList.Find(p => p.id == vo.id) != null) { return; } MapVo mapVo = new MapVo(); mapVo.id = vo.id; mapVo.opened = vo.id == 1 ? true : false; mapVo.clear = false; mapVo.show = false; mapVo.progress = 0; _dataList.Add(mapVo); }
private void OnLoadMap(object obj) { int mapId = (int)obj; nowMap = mapId; DataManager.Instance.mapModel.nowMap = nowMap; nowMapVo = DataManager.Instance.mapModel.GetMapVo(nowMap); StaticMapVo mapVo = StaticDataPool.Instance.staticMapPool.GetStaticDataVo(mapId); enemyList.Clear(); for (int i = 0; i < mapVo.enemyIdList.Count; i++) { enemyList.Add(StaticDataPool.Instance.staticUnitLevelPool.GetStaticDataVo(mapVo.enemyIdList[i])); } inBattle = false; }
private void OnUpdateCell(object obj) { StaticMapVo staticMapVo = StaticDataPool.Instance.staticMapPool.GetStaticDataVo(DataManager.Instance.mapModel.nowMap); MapVo nowMapVo = DataManager.Instance.mapModel.GetMapVo(DataManager.Instance.mapModel.nowMap); nowMap.text = staticMapVo.name; float showProgress = nowMapVo.progress < staticMapVo.progress ? nowMapVo.progress : staticMapVo.progress; progress.value = (showProgress / staticMapVo.progress); if (nowMapVo.progress >= staticMapVo.progress) { btnChallenge.gameObject.SetActive(true); } else { btnChallenge.gameObject.SetActive(false); } }
/// 菜单选择中执行 void OnTools_OptimizeSelected(object userData) { if (serverModel.mapList == null) { return; } MapVo mapVo = serverModel.mapList.data[(int)userData]; if (mapVo == null) { return; } serverModel.mapVo = mapVo; int curMapId = mapVo.map_id; InitMapInfos(curMapId); }
/// 创建下拉列表 private void createItems(GenericMenu toolsMenu) { if (serverModel.mapList == null || serverModel.mapList.data == null || serverModel.mapList.data.Count <= 0) { toolsMenu.AddDisabledItem(new GUIContent("场景数据为空")); return; } MapVo serverMapVo = null; for (int index = 0; index < serverModel.mapList.data.Count; index++) { serverMapVo = serverModel.mapList.data[index]; if (serverMapVo == null) { continue; } toolsMenu.AddItem(new GUIContent(serverMapVo.map_id.ToString() + "|" + serverMapVo.map_name), false, OnTools_OptimizeSelected, index); } }
public void Create(MapVo mapVo, CallBackFunctionWithObject callback) { this.mapVo = mapVo; if (mapVo.opened) { goTop.SetActive(true); } else { goTop.SetActive(false); } if (mapVo.show) { gameObject.SetActive(true); } else { gameObject.SetActive(false); } this.callback = callback; }
private void MapSelect(object obj) { MapVo mapVo = (MapVo)obj; StaticMapVo staticMapVo = StaticDataPool.Instance.staticMapPool.GetStaticDataVo(mapVo.id); nowVo = mapVo; tsMapInfo.SetActive(true); mapImage.sprite = ResourceManager.Instance.GetMapImage(staticMapVo.image); mapName.text = staticMapVo.name; desc.text = staticMapVo.desc; int i; btnShop.gameObject.SetActive(false); if (nowVo.id == 18) { enemyList.gameObject.SetActive(false); equipList.gameObject.SetActive(false); itemList.gameObject.SetActive(false); level.gameObject.SetActive(false); openCondition.text = "开启条件:"; for (i = 0; i < staticMapVo.openConditions.Count; i++) { for (int j = 1; j < staticMapVo.openConditions[i].Count; j++) { switch (staticMapVo.openConditions[i][0]) { case 0: if (staticMapVo.openConditions[i][j] == 0) { openCondition.text += "无"; continue; } StaticMapVo vo = StaticDataPool.Instance.staticMapPool.GetStaticDataVo(staticMapVo.openConditions[i][j]); openCondition.text += ("击败" + vo.name + "的BOSS "); break; case 1: StaticItemVo vo1 = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(staticMapVo.openConditions[i][j]); openCondition.text += ("获得道具" + vo1.name + " "); break; } } } if (DataManager.Instance.roleVo.ifShopOpen) { btnShop.gameObject.SetActive(true); } } else { enemyList.gameObject.SetActive(true); equipList.gameObject.SetActive(true); itemList.gameObject.SetActive(true); level.gameObject.SetActive(true); enemyList.text = "出现敌人:"; List <int> enemys = new List <int>(); for (i = 0; i < staticMapVo.enemyIdList.Count; i++) { if (!enemys.Contains(StaticDataPool.Instance.staticUnitLevelPool.GetStaticDataVo(staticMapVo.enemyIdList[i]).unitId)) { enemys.Add(StaticDataPool.Instance.staticUnitLevelPool.GetStaticDataVo(staticMapVo.enemyIdList[i]).unitId); enemyList.text += (StaticDataPool.Instance.staticUnitLevelPool.GetStaticDataVo(staticMapVo.enemyIdList[i]).name + " "); } } itemList.text = "掉落道具:"; for (i = 0; i < staticMapVo.dropItem.Count; i++) { itemList.text += (StaticDataPool.Instance.staticItemPool.GetStaticDataVo(staticMapVo.dropItem[i][0]).name + " "); } equipList.text = "掉落装备:"; for (i = 0; i < staticMapVo.dropEquip.Count; i++) { equipList.text += (StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(staticMapVo.dropEquip[i][0]).equipName + " "); } openCondition.text = "开启条件:"; for (i = 0; i < staticMapVo.openConditions.Count; i++) { for (int j = 1; j < staticMapVo.openConditions[i].Count; j++) { switch (staticMapVo.openConditions[i][0]) { case 0: if (staticMapVo.openConditions[i][j] == 0) { openCondition.text += "无"; continue; } StaticMapVo vo = StaticDataPool.Instance.staticMapPool.GetStaticDataVo(staticMapVo.openConditions[i][j]); openCondition.text += ("击败" + vo.name + "的BOSS "); break; case 1: StaticItemVo vo1 = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(staticMapVo.openConditions[i][j]); openCondition.text += ("获得道具" + vo1.name + " "); break; } } } level.text = "推荐等级:Lv." + staticMapVo.level; float showProgress = nowVo.progress < staticMapVo.progress ? nowVo.progress : staticMapVo.progress; progress.value = showProgress / staticMapVo.progress; if (nowVo.clear == true) { clear.SetActive(true); } else { clear.SetActive(false); } } }