void updateEggCostInfo() { PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (pdm == null) { return; } for (int i = 0; i < EggModule.EGG_COUNT; i++) { EggType et = (EggType)(i + 1); int num = EggModule.getCostProcNum(et); ProceedsType pt = EggModule.getCostProcType(et); if (pt == ProceedsType.Invalid || num <= 0) { costLb[i].transform.parent.gameObject.SetActive(false); } else { if (pdm.GetProceeds(pt) < num) { costLb[i].text = StringHelper.StringWithColor(FontColor.Red, num.ToString()); } else { costLb[i].text = num.ToString(); } UIAtlasHelper.SetSpriteByMoneyType(costSp[i], pt, false); costLb[i].transform.parent.gameObject.SetActive(true); } } }
void OpenBuyForm(int resId) { PlayerDataModule playerModule = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (playerModule == null) { GameDebug.LogError("player data is null!"); return; } if (!Module.MallTable.ContainsKey(resId)) { return; } MallTableItem item = Module.MallTable[resId] as MallTableItem; //EventDelegate.Add(gBuyBtn.onClick, OnBuyClick); ItemTableItem tableItem = ItemManager.GetItemRes(item.itemId); if (tableItem == null) { #if UNITY_EDITOR GameDebug.LogError("物品表中缺少ID为" + item.itemId + "的物品"); #endif return; } if (!mAllItemsLists.ContainsKey(resId)) { return; } MallItemUI itemUI = mAllItemsLists[resId] as MallItemUI; if (itemUI == null || !itemUI.MallCanOpenBuyForm) { return; } //gNameLb.text = tableItem.name; gNameLb.text = ItemManager.getItemNameWithColor(item.itemId); gItemDetailLb.text = tableItem.desc; gGetDetailLb.text = tableItem.desc0; UIAtlasHelper.SetSpriteImage(gIconSp, tableItem.picname, true); UIAtlasHelper.SetSpriteByMoneyType(gMoneySp, (ProceedsType)item.processType); gMoneySp.transform.localScale = new Vector3(0.5f, 0.5f, 1f); uint moneyNum = item.mallItems[0].processNow; if (playerModule.GetProceeds((ProceedsType)item.processType) < moneyNum) { gMoneyLb.text = StringHelper.StringWithColor(FontColor.Red, moneyNum.ToString()); } else { gMoneyLb.text = moneyNum.ToString(); } gItemTypeLb.text = ItemManager.GetItemTypeStr(item.itemId); gBuyObj.SetActive(true); }
void SetMoneyType(ProceedsType type) { mPt = type; UIAtlasHelper.SetSpriteByMoneyType(moneySp, type, true); moneySp.transform.localScale = new Vector3(0.5f, 0.5f, 1f); }
void OpenBuyForm(int resId) { if (!DataManager.ShopTable.ContainsKey(resId)) { return; } if (!mAllItemsLists.ContainsKey(resId)) { return; } ShopItemUI itemUi = mAllItemsLists[resId]; if (itemUi == null || itemUi.IsScretItemBuyDone) { return; } ShopTableItem item = DataManager.ShopTable[resId] as ShopTableItem; ItemTableItem tableItem = ItemManager.GetItemRes(item.itemId); if (tableItem == null) { #if UNITY_EDITOR GameDebug.LogError("物品表中缺少ID为" + item.itemId + "的物品"); #endif return; } //gNameLb.text = tableItem.name; gNameLb.text = ItemManager.getItemNameWithColor(item.itemId); gItemDetailLb.text = tableItem.desc; gGetDetailLb.text = tableItem.desc0; UIAtlasHelper.SetSpriteImage(gIconSp, tableItem.picname, true); gItemTypeLb.text = ItemManager.GetItemTypeStr(item.itemId); ProceedsType pt = ProceedsType.Invalid; int cost = 0; if (!itemUi.GetProcTypeAndCost(ref pt, ref cost)) { return; } UIAtlasHelper.SetSpriteByMoneyType(gMoneySp, pt); gMoneySp.transform.localScale = new Vector3(0.5f, 0.5f, 1f); PlayerDataModule playerModule = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (playerModule == null) { GameDebug.LogError("player data is null!"); return; } if (playerModule.GetProceeds(pt) < cost) { gMoneyLb.text = StringHelper.StringWithColor(FontColor.Red, cost.ToString()); } else { gMoneyLb.text = cost.ToString(); } gBuyObj.SetActive(true); }
/// <summary> /// 刷新技能升级消耗显示、按钮内容显示 /// </summary> void UpdateUpgradeAndCost() { int lv = MySkillModule.GetSkillLvBySkillID(CurSkillId); //非法数据; if (lv < 0) { return; } //锁定状态; if (lv == 0 && !MySkillModule.canOpen(CurSkillId)) { int unlockLv = MySkillModule.GetSkillUnlockLvByID(CurSkillId); if (unlockLv < 1) { return; } // costLb.gameObject.SetActive(false); fullLvSp.gameObject.SetActive(false); costLb.transform.parent.gameObject.SetActive(false); upgradeBtn.gameObject.SetActive(false); equipRoot.SetActive(false); unlockBtn.gameObject.SetActive(true); // unlockBtn.isEnabled = false; openSp.gameObject.SetActive(true); openLvLb.gameObject.SetActive(true); openLvLb.text = StringHelper.StringWithColor(FontColor.Red, "LV" + unlockLv.ToString()) + "才可以解锁此技能!"; return; } //可解锁状态; else if (0 == lv && MySkillModule.canOpen(CurSkillId)) { // costLb.gameObject.SetActive(false); fullLvSp.gameObject.SetActive(false); costLb.transform.parent.gameObject.SetActive(false); upgradeBtn.gameObject.SetActive(false); equipRoot.SetActive(false); unlockBtn.gameObject.SetActive(true); // unlockBtn.isEnabled = true; openSp.gameObject.SetActive(true); openLvLb.gameObject.SetActive(true); openLvLb.text = "可以解锁此技能!"; } //有等级状态; else { equipRoot.SetActive(true); openSp.gameObject.SetActive(false); openLvLb.gameObject.SetActive(false); unlockBtn.gameObject.SetActive(false); //满级了; if (MySkillModule.IsFullLv(CurSkillId)) { // costLb.gameObject.SetActive(false); costLb.transform.parent.gameObject.SetActive(false); upgradeBtn.gameObject.SetActive(false); fullLvSp.gameObject.SetActive(true); } else { fullLvSp.gameObject.SetActive(false); // costLb.gameObject.SetActive(true); costLb.transform.parent.gameObject.SetActive(true); upgradeBtn.gameObject.SetActive(true); SkillLevelTableItem slti = MySkillModule.GetDetailByCurLvSkillID(CurSkillId); if (slti == null) { return; } UIAtlasHelper.SetSpriteByMoneyType(costTypeSp, (ProceedsType)slti.money_type, false); //if (slti.money_type == 0) //{ // //costTypeSp.spriteName = "jinbi"; //} //else if (slti.money_type == 1) // costTypeSp.spriteName = "zuanshi"; // costTypeSp.MakePixelPerfect(); PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (pdm == null) { GameDebug.LogError(@"PlayerData没了"); } uint curMoney = pdm.GetProceeds((ProceedsType)slti.money_type); FontColor color = curMoney < slti.money_num ? FontColor.Red : FontColor.Green; costLb.text = StringHelper.StringWithColor(color, slti.money_num.ToString()); } } }