private void RefreshPanel(int fashionid) { isDirty = false; FashionItemData itemdata; FashionTableItem res = DataManager.FashionTable[fashionid] as FashionTableItem; if (res == null) { return; } if (!mModule.GetFashionByID(fashionid, out itemdata)) { return; } FashionPropTableItem propRes = DataManager.FashionPropTable[res.propid + itemdata.starnum] as FashionPropTableItem; if (propRes == null) { return; } mFashionName2.text = res.name; mFlag.text = StringHelper.GetString(mModule.GetEquipId(res.bodypart) == fashionid ? "equiped" : "noequip"); mItemType.text = StringHelper.GetString("fashion_type"); int startLevel = Mathf.FloorToInt(itemdata.starnum / FashionDefine.Starnum_Per_Level) + 1; int startCount = (int)(itemdata.starnum % FashionDefine.Starnum_Per_Level); mStarNum.text = string.Format(StringHelper.GetString("startlevel"), StringHelper.GetString(startLevel.ToString())); SetStarBar(startCount); mCostTxt.text = StringHelper.GetString("fashioncost"); mCostNum.text = string.Format(StringHelper.GetString("costnum"), ItemManager.Instance.getItemName(res.costid), propRes.costnum); battleScore.text = propRes.battlescore.ToString(); mTip.text = res.desc2; mCurTxt.text = StringHelper.GetString("curprop"); mNextTxt.text = StringHelper.GetString("nextprop"); mTitle2.text = StringHelper.GetString("tiptitle"); mCurLife.text = StringHelper.GetString("life") + " " + propRes.life; mCurAttack.text = StringHelper.GetString("attack") + " " + propRes.fight; mCurDefence.text = StringHelper.GetString("defence") + " " + propRes.defence; mCurCritical.text = StringHelper.GetString("critical") + " " + propRes.critical; mCurPower.text = StringHelper.GetString("power") + " " + propRes.power; if (itemdata.starnum == res.max_stars) { mNexLife.gameObject.SetActive(false); mNextAttack.gameObject.SetActive(false); mNextDefence.gameObject.SetActive(false); mNextCritical.gameObject.SetActive(false); mNextPower.gameObject.SetActive(false); mCostTxt.gameObject.transform.localPosition = new Vector3(-7, 151, 0); mCostNum.gameObject.transform.localPosition = new Vector3(-7, 124, 0); } else { var nextProp = DataManager.FashionPropTable[res.propid + itemdata.starnum + 1] as FashionPropTableItem; if (nextProp == null) { return; } mNexLife.gameObject.SetActive(true); mNextAttack.gameObject.SetActive(true); mNextDefence.gameObject.SetActive(true); mNextCritical.gameObject.SetActive(true); mNextPower.gameObject.SetActive(true); mNexLife.text = StringHelper.GetString("life") + " " + nextProp.life; mNextAttack.text = StringHelper.GetString("attack") + " " + nextProp.fight; mNextDefence.text = StringHelper.GetString("defence") + " " + nextProp.defence; mNextCritical.text = StringHelper.GetString("critical") + " " + nextProp.critical; mNextPower.text = StringHelper.GetString("power") + " " + nextProp.power; mCostTxt.gameObject.transform.localPosition = new Vector3(-7, -21, 0); mCostNum.gameObject.transform.localPosition = new Vector3(-7, -61, 0); } }
private bool CheckCostEnough(int fashionid, bool is_addstar) { FashionTableItem res = DataManager.FashionTable[fashionid] as FashionTableItem; if (res == null) { GameDebug.LogError("无效的fashionid id= " + fashionid); return(false); } PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); uint itemNum; if (res.costtype == 1) { itemNum = pdm.GetProceeds(ProceedsType.Money_Game); } else if (res.costtype == 2) { itemNum = pdm.GetProceeds(ProceedsType.Money_RMB); } else { itemNum = pdm.GetItemNumByID(res.costid); } FashionPropTableItem propRes = null; if (is_addstar) { FashionItemData itemdata; ModuleManager.Instance.FindModule <FashionModule>().GetFashionByID(fashionid, out itemdata); if (itemdata == null) { return(false); } propRes = DataManager.FashionPropTable[res.propid + itemdata.starnum] as FashionPropTableItem; } else { propRes = DataManager.FashionPropTable[res.propid] as FashionPropTableItem; } if (propRes == null) { return(false); } if (itemNum >= propRes.costnum) { return(true); } string itemName = ""; if (res.costtype == 1) { itemName = StringHelper.GetString("money_game"); } else if (res.costtype == 2) { itemName = StringHelper.GetString("money_rmb"); } else { itemName = ItemManager.GetItemRes(res.costid).name; } PromptUIManager.Instance.AddNewPrompt(String.Format(StringHelper.GetString("not_much_money"), itemName)); return(false); }