少年修仙传客户端代码仓库
hch
2024-12-19 a39a4d876bb4b688b7377a0022a8b38e7f311f4d
System/HappyXB/HappyXBModel.cs
@@ -616,25 +616,30 @@
                if (IsHaveOneXBTool(xbType))
                {
                    SendXBQuest(xbType, 0, 2);
                    return;
                }
                int moneyType = XBCostTypeDict[xbType];
                int xbOneMoney = funcSet.xbPrices[0];
                if (UIHelper.GetMoneyCnt(moneyType) >= (ulong)xbOneMoney)
                {
                    m_storeModel.UseMoneyCheck(xbOneMoney, () =>
                    {
                        SendXBQuest(xbType, 0, 0);
                    }, xbType == 1 ? 5 : 6, fullTip: Language.Get("TreasurePavilion08", xbOneMoney, moneyType, funcSet.costToolIds[0], 1));
                }
                else
                {
                    int xbOneMoney = funcSet.xbPrices[0];
                    int moneyType = XBCostTypeDict[xbType];
                    if (UIHelper.GetMoneyCnt(moneyType) >= (ulong)xbOneMoney)
                    {
                        SendXBQuest(xbType, 0, 0);
                    }
                    else
                    {
                        //WindowCenter.Instance.Open<RechargeTipWin>();
                        SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType);
                    SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType);
                    }
                }
            }
        }
        public void SendXBManyQuest(PackType type, int xbType)
        {
            var funcSet = GetXBFuncSet(xbType);
@@ -642,39 +647,32 @@
            {
                int toolCnt = 0;
                int needToolCnt = 0;
                if (IsHaveManyXBTool(xbType, out toolCnt, out needToolCnt))
                int needMoney = 0;
                if (IsHaveManyXBToolEx(xbType, out toolCnt, out needToolCnt,  out needMoney))
                {
                    if (toolCnt >= needToolCnt)
                    {
                        CheckXBManyLimit(0, xbType, 2);
                    }
                    else
                    {
                        CheckXBManyLimit(funcSet.xbPrices[1], xbType, 0);
                    }
                    //needToolCnt = needToolCnt - toolCnt;
                    //int needMoney = needToolCnt * funcSet.xbPrices[0];
                    //if (needMoney > 0)
                    //{
                    //    ItemConfig itemConfig = ItemConfig.Get(funcSet.costToolIds[1]);
                    //    ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("HappyXBCostTools", funcSet.costToolNums[1], itemConfig.ItemName, needMoney, needToolCnt), (bool isOk) =>
                    //    {
                    //        if (isOk)
                    //        {
                    //            CheckXBManyLimit(needMoney, xbType,0);
                    //        }
                    //        return;
                    //    });
                    //}
                    //else
                    //{
                    //    CheckXBManyLimit(0, xbType,2);
                    //}
                        return;
                    }
                }
                int moneyType = XBCostTypeDict[xbType];
                int xbManyMoney = needMoney == 0 ? funcSet.xbPrices[1] : needMoney;
                if (UIHelper.GetMoneyCnt(moneyType) >= (ulong)xbManyMoney)
                {
                    m_storeModel.UseMoneyCheck(xbManyMoney, () =>
                    {
                        SendXBQuest(xbType, 1, toolCnt > 0 ? 2 : 0);
                    }, xbType == 1 ? 5:6, fullTip: Language.Get("TreasurePavilion08", xbManyMoney, moneyType, funcSet.costToolIds[1], needToolCnt - toolCnt));
                }
                else
                {
                    CheckXBManyLimit(funcSet.xbPrices[1], xbType, 0);
                    SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType);
                }
            }
@@ -740,6 +738,7 @@
            return false;
        }
        //needToolCnt 为配表中需要的道具数量
        public bool IsHaveManyXBTool(int type, out int toolCnt, out int needToolCnt)
        {
            toolCnt = 0;
@@ -756,6 +755,30 @@
            return false;
        }
        //needToolCnt 为配表中需要的道具数量
        // 可获得真正需要补足购买道具的金额
        public bool IsHaveManyXBToolEx(int type, out int toolCnt, out int needToolCnt, out int needMoney)
        {
            toolCnt = 0;
            needToolCnt = 0;    //配置中需要的道具数量
            needMoney = 0;  //真正需要补足购买道具的金额
            XBFuncSet funcSet = GetXBFuncSet(type);
            if (funcSet == null) return false;
            toolCnt = playerPack.GetItemCountByID(PackType.Item, funcSet.costToolIds[1]);
            needToolCnt = funcSet.costToolNums[1];
            if (toolCnt > 0)
            {
                if (toolCnt < needToolCnt)
                {
                    needMoney = funcSet.xbPrices[1] / needToolCnt * (needToolCnt - toolCnt);
                }
                return true;
            }
            return false;
        }