private void OnBattleStart(object obj) { bool ifBoss = (bool)obj; this.ifBoss = ifBoss; player.Create(); servant.Create(); if (!ifBoss) { int enemyRandom = Random.Range(0, enemyList.Count); enemy.Create(enemyList[enemyRandom]); } else { StaticMapVo mapVo = StaticDataPool.Instance.staticMapPool.GetStaticDataVo(nowMap); enemy.Create(StaticDataPool.Instance.staticUnitLevelPool.GetStaticDataVo(mapVo.bossId), true); } ifEnd = false; pauseRound = 1; GameRoot.Instance.evt.CallEvent(GameEventDefine.UPDATE_UNIT_CELL, UnitState.None); battleList.Clear(); battleList.Add(player); battleList.Add(enemy); battleList.Add(servant); OnUpdateList(null); nowPos = 0; }
public void AddData(string[] lineArray) { for (int i = 1; i < lineArray.Length; i++) { lineArray[i] = lineArray[i].Replace("\r", ""); string[] strArray = lineArray[i].Split(","[0]); StaticMapVo vo = new StaticMapVo(strArray); _datapool.Add(vo); } }
protected override void Die() { BattleController.Instance.player.AddExp(staticUnitVo.dropExp); BattleController.Instance.servant.AddExp(staticUnitVo.dropExp); DataManager.Instance.mapModel.AddProgress(); float ifDropServant = Random.Range(0f, 1f); if (ifDropServant < DataManager.Instance.roleVo.dropServantRate) { bool result = DataManager.Instance.servantModel.Add(staticUnitVo); if (result == true) { UIManager.Instance.CreateTipPanel(staticUnitVo.name + "觉得你很有前途,成为了你的随从"); } } if (ifBoss) { BattleController.Instance.nowMapVo.clear = true; DataManager.Instance.mapModel.AddProgress(true); } base.Die(); //Todo GameRoot.Instance.evt.CallEvent(GameEventDefine.BATTLE_END, false); BattleController.Instance.pauseRound = 1; StaticMapVo nowMapVo = StaticDataPool.Instance.staticMapPool.GetStaticDataVo(BattleController.Instance.nowMap); int randomEquip = Random.Range(0, 10000); for (int i = 0; i < nowMapVo.dropEquip.Count; i++) { if (randomEquip > nowMapVo.dropEquip[i][1] && randomEquip < nowMapVo.dropEquip[i][2]) { StaticEquipLevelVo newVo = StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(nowMapVo.dropEquip[i][0]); DataManager.Instance.equipModel.Add(newVo); UIManager.Instance.CreateTipPanel("获得了" + newVo.equipName); break; } } int randomItem = Random.Range(0, 10000); for (int i = 0; i < nowMapVo.dropItem.Count; i++) { if (randomItem > nowMapVo.dropItem[i][1] && randomItem < nowMapVo.dropItem[i][2]) { StaticItemVo newVo = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(nowMapVo.dropItem[i][0]); DataManager.Instance.itemModel.Add(newVo); UIManager.Instance.CreateTipPanel("获得了" + newVo.name); break; } } DataManager.Instance.Save(DataManager.Instance.currentPlayer); }
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); } }
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); } } }
public void CheckOpen() { for (int i = 0; i < _dataList.Count; i++) { StaticMapVo staticVo = StaticDataPool.Instance.staticMapPool.GetStaticDataVo(_dataList[i].id); if (staticVo.id == 10 & _dataList[i].clear == true) { DataManager.Instance.roleVo.ifShopOpen = true; } for (int j = 0; j < staticVo.openConditions.Count; j++) { for (int k = 1; k < staticVo.openConditions[j].Count; k++) { switch (staticVo.openConditions[j][0]) { case 0: if (staticVo.openConditions[j][k] == 0) { _dataList[i].opened = true; _dataList[i].show = true; continue; } if (GetMapVo(staticVo.openConditions[j][k]).clear == true) { _dataList[i].opened = true; _dataList[i].show = true; } else { if (GetMapVo(staticVo.openConditions[j][k]).opened == true) { _dataList[i].show = true; } else { _dataList[i].show = false; } _dataList[i].opened = false; } break; case 1: if (DataManager.Instance.itemModel.GetItemVo(staticVo.openConditions[j][k]) != null) { _dataList[i].opened = true; _dataList[i].show = true; } else { _dataList[i].opened = false; if (GetMapVo(staticVo.openConditions[j][k]).opened == true) { _dataList[i].show = true; } else { _dataList[i].show = false; } } break; } } } } }