void Buy_Items() { int index = ((VillageMapPointController)StaticValues.points[StaticValues.currentLocate.GetIDViillage()]).id; while (StaticValues.Cities[index].Shop_Buy.Items.Count > 0) { SlotItem item = StaticValues.Cities[index].Shop_Buy.Items[StaticValues.Cities[index].Shop_Buy.Items.Count - 1]; if (item.item.Category != ItemCategory.Camp) { int rest = StaticValues.InvMagazine.AddItem(item.item, item.amount); if (rest > 0) { StaticValues.Money -= (item.amount - rest) * item.item.Value; item.amount = rest; } else { StaticValues.Money -= item.amount * item.item.Value; StaticValues.Cities[index].Shop_Buy.RemoveItem(item); } } else { ICamp.UpgradeCamp(item); StaticValues.Cities[index].Shop_Buy.RemoveItem(item); } } }
// 兵营升级按钮点击事件 private void OnCampUpgradeClick() { int energy = mCamp.EnergyCostCampUpgrade; if (energy < 0) { mFacade.ShowMsg("该兵营已升级到最大等级!"); return; } if (mFacade.TakeEnergy(energy)) { mCamp.UpgradeCamp(); ShowCampInfo(mCamp); } else { mFacade.ShowMsg("能量不足,兵营升级所需能量" + energy); } }
private void OnCampUpgradeClick() { int energy = mCamp.energyCostCampUpgrade; if (energy < 0) { mFacade.ShowMsg("兵营已到最大等级,无法再进行升级"); return; } if (mFacade.TakeEnergy(energy)) { mCamp.UpgradeCamp(); ShowCampInfo(mCamp); } else { mFacade.ShowMsg("升级兵营需要能量:" + energy + " 能量不足,请稍后再进行升级"); } }
private void OnCampUpgradeClick() { int energy = mCamp.energyCostUpgradeCamp; if (energy < 0) { mFacade.ShowMessage("兵营已到最高等级,无法进行升级"); } if (mFacade.TakeEnergy(energy)) { mCamp.UpgradeCamp(); ShowCampInfo(mCamp); } else { mFacade.ShowMessage("升级兵营需要能量:" + energy + " 能量不足,请稍后再进行升级。"); } }
private void OnCampUpgradeClick() { int energy = m_Camp.EnergyCostCampUpgrade; if (energy < 0) { m_Facade.ShowMsg("兵营已经最大等级,无法再升级"); return; } if (m_Facade.TakeEnergy(energy)) { m_Camp.UpgradeCamp(); ShowCampInfo(m_Camp); } else { m_Facade.ShowMsg("升级兵营需要能量:" + energy + "能量不足,请稍后升级"); } }
private void OnCampUpgradeClick() { int energyCost = mCurrentCamp.energyCostUpgradeCamp; if (energyCost < 0) { //提示信息:不能升级Camp TODO mFacade.ShowMsg("兵营已是最大等级,无法继续升级!"); return; } //能量消耗 TODO if (mFacade.TakeEnergy(energyCost)) { mCurrentCamp.UpgradeCamp(); //更新界面 ShowCampInfo(mCurrentCamp); } else { mFacade.ShowMsg("升级兵营需要能量:" + energyCost + ":能量不足,无法继续升级兵营!"); } }
void ShopFunction(bool isBuy, Slot slot, Slot destiny) { if (isBuy) { if ((slot.item.amount * slot.item.item.Value) <= StaticValues.Money) { if (Input.GetKey(KeyCode.LeftShift)) { GameObject split = GetComponentInParent <GUIControll>().GUIEnabled.Split; split.GetComponent <SplitPanel>().SetItem(slot.item); split.GetComponent <SplitPanel>().Button_Submit.onClick.RemoveAllListeners(); split.GetComponent <SplitPanel>().Button_Submit.onClick.AddListener(() => Buy(slot.item, split.GetComponent <SplitPanel>().Value)); split.GetComponent <SplitPanel>().Button_Submit.onClick.AddListener(() => split.GetComponent <SplitPanel>().Close()); split.GetComponent <SplitPanel>().Button_Submit.onClick.AddListener(() => destiny.GetComponentInParent <MagazinePanel>().UpdateSlot()); split.GetComponent <SplitPanel>().Button_Submit.onClick.AddListener(() => destiny.GetComponentInParent <MarketplacePanel>().UpdateGUI()); split.GetComponent <SplitPanel>().Button_Submit.onClick.AddListener(() => destiny.GetComponentInParent <MarketplacePanel>().SpawnSlots()); split.SetActive(true); } else { Buy(slot.item, slot.item.amount); } } } else { if (Input.GetKey(KeyCode.LeftShift)) { GameObject split = GetComponentInParent <GUIControll>().GUIEnabled.Split; split.GetComponent <SplitPanel>().SetItem(slot.item); split.GetComponent <SplitPanel>().Button_Submit.onClick.RemoveAllListeners(); split.GetComponent <SplitPanel>().Button_Submit.onClick.AddListener(() => Sell(slot.item, split.GetComponent <SplitPanel>().Value)); split.GetComponent <SplitPanel>().Button_Submit.onClick.AddListener(() => split.GetComponent <SplitPanel>().Close()); split.GetComponent <SplitPanel>().Button_Submit.onClick.AddListener(() => slot.GetComponentInParent <MarketplacePanel>().SpawnSlots()); split.GetComponent <SplitPanel>().Button_Submit.onClick.AddListener(() => slot.GetComponentInParent <MarketplacePanel>().UpdateGUI()); split.GetComponent <SplitPanel>().Button_Submit.onClick.AddListener(() => slot.GetComponentInParent <MagazinePanel>().UpdateSlot()); split.SetActive(true); } else { Sell(slot.item, slot.item.amount); } } void Buy(SlotItem item, int amount) { if (item.item.Category != ItemCategory.Camp) { var temp = item; int rest = StaticValues.InvMagazine.AddItem(temp.item, amount); StaticValues.Money -= ((amount - rest) * temp.item.Value); StaticValues.Cities[0].ShopItems.RemoveItem(item, amount - rest); } else { ICamp.UpgradeCamp(item); StaticValues.Cities[0].ShopItems.RemoveItem(item); } } void Sell(SlotItem item, int amount) { StaticValues.Money += (amount * item.item.Value); var temp = item; StaticValues.InvMagazine.RemoveItem(item, amount); temp = new SlotItem(temp.item, amount); StaticValues.Cities[0].ShopItems.AddItem(temp, true); } }
public void UpgradeField() { ICamp.UpgradeCamp(ICamp.Type_Camp.FieldHospital); }
public void UpgradeBlacksmith() { ICamp.UpgradeCamp(ICamp.Type_Camp.Workshop); }