yyl
3 小时以前 71365e5c15d81759c04d7aab953fa757fb183f9b
Main/System/Store/BuyItemWin.cs
@@ -17,7 +17,6 @@
    [SerializeField] Button buyButton;
    int itemCount;
    int useCnt;
    int maxCnt;
    protected override void InitComponent()
@@ -38,10 +37,10 @@
        var shopConfig = StoreConfig.Get(StoreModel.Instance.buyShopID);
        var itemID = shopConfig.ItemID;
        var itemCount = shopConfig.ItemCnt;
        itemCell.Init(new ItemCellModel(itemID, false, itemCount));
        itemCell.Init(new ItemCellModel(itemID, false, itemCount*useCnt));
        var itemConfig = ItemConfig.Get(itemID);
        nameText.text = itemConfig.ItemName;
        countText.text = Language.Get("storename12", PackManager.Instance.GetItemCountByID(PackType.Item, itemID));
        countText.text = Language.Get("storename12", GetItemCount(itemID));
        descText.text = itemConfig.Description;
        var buyCnt = StoreModel.Instance.GetShopLimitBuyCount(StoreModel.Instance.buyShopID);
@@ -60,7 +59,7 @@
    {
        var shopConfig = StoreConfig.Get(StoreModel.Instance.buyShopID);
        useCnt = value;
        itemCell.countText.text = value.ToString();
        itemCell.countText.text = UIHelper.ReplaceLargeNum(value*shopConfig.ItemCnt);
        string limitStr = "";
        if (shopConfig.LimitCnt == 0)
@@ -85,7 +84,7 @@
        limitText.text = limitStr;
        moneyIcon.SetIconWithMoneyType(shopConfig.MoneyType);
        moneyText.text = UIHelper.ShowUseMoney(shopConfig.MoneyType, shopConfig.MoneyNum * useCnt);
        moneyText.text = UIHelper.ShowUseMoney(shopConfig.MoneyType, shopConfig.MoneyNum * useCnt, false);
    }
@@ -94,4 +93,22 @@
        CloseWindow();
        StoreModel.Instance.SendBuyShopItem(StoreConfig.Get(StoreModel.Instance.buyShopID), useCnt);
    }
    //如果物品是自动转换货币类型的,则返回货币数量,否则返回物品数量
    long GetItemCount(int id)
    {
        var config = ItemConfig.Get(id);
        if (config.Effect1 == 264)
        {
            return UIHelper.GetMoneyCnt(config.EffectValueB1);
        }
        var count = PackManager.Instance.GetItemCountByID(GeneralDefine.GetPackTypeByItemType(config.Type), id);
        if (config.Type == 150)
        {
            count = Math.Max(0, count - 1);
        }
        return count;
    }
}