Beispiel #1
0
    void UpdateData(int ProceedsTypeIdx, int count, bool isBuy)
    {
        if (mitem == null)
        {
            GameDebug.LogError("请先初始化在进行刷新操作");
            return;
        }

        if (ProceedsTypeIdx < 0 || ProceedsTypeIdx > 2)
        {
            GameDebug.LogError("商店数据错误");
            return;
        }

        int proceedsType = ShopModule.GetShopItemProceedsType(mitem, ProceedsTypeIdx);
        int perPrice     = ShopModule.GetShopItemPerPrice(mitem, ProceedsTypeIdx);

        mPt = (ProceedsType)proceedsType;

        SetMoneyType(mPt);
        int itemNumber = (int)(count * mitem.multiple);

        countLb.text = "x" + itemNumber;

        mCost = (uint)(perPrice * itemNumber);

        if (isBuy)
        {
            moneyLb.text = "已售罄";
        }
        else
        {
            PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>();
            if (pdm == null)
            {
                return;
            }

            if (pdm.GetProceeds(mPt) >= mCost)
            {
                moneyLb.text = mCost + "";
            }
            else
            {
                moneyLb.text = StringHelper.StringWithColor(FontColor.Red, mCost.ToString());
            }
        }
        huiSp.gameObject.SetActive(isBuy);
        isScretItemBuyDone = isBuy;
    }