public void Create(StaticShopVo staticShopVo) { this.staticShopVo = staticShopVo; switch (staticShopVo.type) { case 1: StaticItemVo staticItemVo = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(staticShopVo.itemId); icon.sprite = ResourceManager.Instance.GetItemIcon(staticItemVo.icon); itemName.text = staticItemVo.name; desc.text = staticItemVo.desc; break; case 2: StaticEquipVo staticEquipVo = StaticDataPool.Instance.staticEquipPool.GetStaticDataVo(staticShopVo.itemId); icon.sprite = ResourceManager.Instance.GetEquipIcon(staticEquipVo.icon); itemName.text = staticEquipVo.equipName; desc.text = staticEquipVo.desc; break; case 3: StaticUnitVo staticUnitVo = StaticDataPool.Instance.staticUnitPool.GetStaticDataVo(staticShopVo.itemId); icon.sprite = ResourceManager.Instance.GetCharactorIcon(staticUnitVo.icon); itemName.text = staticUnitVo.name; desc.text = staticUnitVo.desc; break; } if (staticShopVo.priceType == 1) { price.text = "灵魂:" + staticShopVo.price; } else if (staticShopVo.priceType == 2) { price.text = "金币:" + staticShopVo.price; } }
public void Sell(ItemVo vo) { StaticItemVo staticVo = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(vo.id); Remove(vo); DataManager.Instance.roleVo.exp += staticVo.price; GameRoot.Instance.evt.CallEvent(GameEventDefine.ROLE_INFO, null); }
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]); StaticItemVo vo = new StaticItemVo(strArray); _datapool.Add(vo); } }
protected void ShowItem() { if (enemyVo.item != 0) { StaticItemVo itemVo = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(enemyVo.item); GameObject itemObj = Tools.CreateGameObject("Models/Items/" + itemVo.path, transform.parent, transform.position, Vector3.one); itemObj.GetComponent <Item>().Create(itemVo); } }
private void BtnClick() { UIManager.Instance.CreateConfirmPanel("确定购买这个商品?", delegate(object obj) { bool enough = false; if (staticShopVo.priceType == 1) { enough = DataManager.Instance.roleVo.exp >= staticShopVo.price; } else if (staticShopVo.priceType == 2) { enough = DataManager.Instance.roleVo.exp >= staticShopVo.price; } if (enough) { switch (staticShopVo.type) { case 1: StaticItemVo staticItemVo = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(staticShopVo.itemId); DataManager.Instance.itemModel.Add(staticItemVo); UIManager.Instance.CreateTipPanel("购买了" + staticItemVo.name); break; case 2: StaticEquipVo staticEquipVo = StaticDataPool.Instance.staticEquipPool.GetStaticDataVo(staticShopVo.itemId); StaticEquipLevelVo staticEquipLevelVo = StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(staticEquipVo.equipId, 1); DataManager.Instance.equipModel.Add(staticEquipLevelVo); UIManager.Instance.CreateTipPanel("购买了" + staticEquipVo.equipName); break; case 3: StaticUnitVo staticUnitVo = StaticDataPool.Instance.staticUnitPool.GetStaticDataVo(staticShopVo.itemId); StaticUnitLevelVo staticUnitLevelVo = StaticDataPool.Instance.staticUnitLevelPool.GetStaticDataVo(staticUnitVo.unitId, 1); DataManager.Instance.servantModel.Add(staticUnitLevelVo); UIManager.Instance.CreateTipPanel("购买了" + staticUnitVo.name); break; } } else { if (staticShopVo.priceType == 1) { UIManager.Instance.CreateTipPanel("灵魂不足"); } else if (staticShopVo.priceType == 2) { UIManager.Instance.CreateTipPanel("灵魂不足"); } } }); }
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 Create(ItemVo itemVo, CallBackFunctionWithInt callback) { if (itemVo.num <= 0) { Destroy(gameObject); } this.callback = callback; this.itemVo = itemVo; staticItemVo = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(itemVo.id); textName.text = staticItemVo.name; textDesc.text = staticItemVo.desc; textNum.text = "X" + itemVo.num; icon.sprite = ResourceManager.Instance.GetItemIcon(staticItemVo.icon); }
public void Add(StaticItemVo vo) { if (_dataList.Count >= DataManager.Instance.roleVo.maxItemNum) { return; } ItemVo itemVo = _dataList.Find(p => p.id == vo.id); if (itemVo != null) { itemVo.num++; } else { ItemVo newItem = new ItemVo(); newItem.id = vo.id; newItem.num = 1; _dataList.Add(newItem); } }
public void Use(ItemVo itemVo) { StaticItemVo staticVo = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(itemVo.id); switch (staticVo.type) { case 0: break; case 1: break; case 2: if (DataManager.Instance.skillModel._dataList.Find(p => p.id == itemVo.id) == null) { DataManager.Instance.skillModel.Add(StaticDataPool.Instance.staticSkillPool.GetStaticDataVo(int.Parse(staticVo.param1))); Remove(itemVo); } break; } }
public void Create(StaticItemVo staticVo) { this.staticVo = staticVo; player = GameRoot.Instance.GetNowPlayer(); }
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); } } }