Esempio n. 1
0
        public static uint GetHeroSkinCost(uint heroId, uint skinId, RES_SHOPBUY_COINTYPE costType)
        {
            ResHeroSkinShop resHeroSkinShop = null;
            uint            skinCfgId       = CSkinInfo.GetSkinCfgId(heroId, skinId);

            GameDataMgr.skinShopInfoDict.TryGetValue(skinCfgId, ref resHeroSkinShop);
            uint result = 0u;

            if (resHeroSkinShop != null)
            {
                switch (costType)
                {
                case 7:
                    result = resHeroSkinShop.dwBuySkinCoin;
                    return(result);

                case 8:
                case 9:
IL_3A:
                    if (costType != 2)
                    {
                        return(result);
                    }
                    result = resHeroSkinShop.dwBuyCoupons;
                    return(result);

                case 10:
                    result = resHeroSkinShop.dwBuyDiamond;
                    return(result);
                }
                goto IL_3A;
            }
            return(result);
        }
        public static uint GetHeroSkinCost(uint heroId, uint skinId, RES_SHOPBUY_COINTYPE costType)
        {
            ResHeroSkinShop resHeroSkinShop = null;
            uint            skinCfgId       = CSkinInfo.GetSkinCfgId(heroId, skinId);

            GameDataMgr.skinShopInfoDict.TryGetValue(skinCfgId, out resHeroSkinShop);
            uint result = 0u;

            if (resHeroSkinShop == null)
            {
                return(result);
            }
            switch (costType)
            {
            case RES_SHOPBUY_COINTYPE.RES_SHOPBUY_TYPE_SKINCOIN:
                return(resHeroSkinShop.dwBuySkinCoin);

            case RES_SHOPBUY_COINTYPE.RES_SHOPBUY_TYPE_DIAMOND:
                return(resHeroSkinShop.dwBuyDiamond);
            }
            if (costType != RES_SHOPBUY_COINTYPE.RES_SHOPBUY_TYPE_COUPONS)
            {
                return(result);
            }
            return(resHeroSkinShop.dwBuyCoupons);
        }
Esempio n. 3
0
        private void OnBuyItem(CUIEvent uiEvent)
        {
            enPayType     tag           = (enPayType)uiEvent.m_eventParams.tag;
            uint          payValue      = uiEvent.m_eventParams.commonUInt32Param1;
            string        goodName      = string.Empty;
            COM_ITEM_TYPE com_item_type = COM_ITEM_TYPE.COM_OBJTYPE_NULL;
            uint          uniSkinId     = 0;
            long          key           = 0L;

            if (uiEvent.m_eventParams.heroSkinParam.skinId != 0)
            {
                com_item_type = COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN;
                uniSkinId     = CSkinInfo.GetSkinCfgId(uiEvent.m_eventParams.heroSkinParam.heroId, uiEvent.m_eventParams.heroSkinParam.skinId);
                ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(uniSkinId);
                DebugHelper.Assert(heroSkin != null, string.Format("找不到皮肤{0}的配置信息", uniSkinId));
                if (heroSkin == null)
                {
                    return;
                }
                goodName = StringHelper.UTF8BytesToString(ref heroSkin.szSkinName);
            }
            else if (uiEvent.m_eventParams.heroId != 0)
            {
                com_item_type = COM_ITEM_TYPE.COM_OBJTYPE_HERO;
                uniSkinId     = uiEvent.m_eventParams.heroId;
                ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(uniSkinId);
                DebugHelper.Assert(dataByKey != null, string.Format("找不到英雄{0}的配置信息", uniSkinId));
                if (dataByKey == null)
                {
                    return;
                }
                goodName = StringHelper.UTF8BytesToString(ref dataByKey.szName);
            }
            else
            {
                DebugHelper.Assert(false, "神秘商店购买不支持该物品类型");
                return;
            }
            key = GameDataMgr.GetDoubleKey((uint)com_item_type, uniSkinId);
            CMallMysteryProduct product = new CMallMysteryProduct();

            if (!this.m_ProductDic.TryGetValue(key, out product))
            {
                DebugHelper.Assert(false, string.Format("神秘商店找不到该物品{0}/{1}", Enum.GetName(typeof(COM_ITEM_TYPE), com_item_type), uniSkinId));
            }
            else
            {
                CUIEvent uIEvent = Singleton <CUIEventManager> .GetInstance().GetUIEvent();

                uIEvent.m_eventID         = enUIEventID.Mall_Mystery_On_Confirm_Buy_Item;
                uIEvent.m_eventParams.tag = (int)product.ID;
                CMallSystem.TryToPay(enPayPurpose.Buy, goodName, tag, payValue, uIEvent.m_eventID, ref uIEvent.m_eventParams, enUIEventID.None, false, true);
            }
        }
Esempio n. 4
0
        private void OnBuyItem(CUIEvent uiEvent)
        {
            enPayType     tag = (enPayType)uiEvent.m_eventParams.tag;
            uint          commonUInt32Param = uiEvent.m_eventParams.commonUInt32Param1;
            string        goodName          = string.Empty;
            COM_ITEM_TYPE cOM_ITEM_TYPE;
            uint          num;

            if (uiEvent.m_eventParams.heroSkinParam.skinId != 0u)
            {
                cOM_ITEM_TYPE = COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN;
                num           = CSkinInfo.GetSkinCfgId(uiEvent.m_eventParams.heroSkinParam.heroId, uiEvent.m_eventParams.heroSkinParam.skinId);
                ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(num);
                DebugHelper.Assert(heroSkin != null, string.Format("找不到皮肤{0}的配置信息", num));
                if (heroSkin == null)
                {
                    return;
                }
                goodName = StringHelper.UTF8BytesToString(ref heroSkin.szSkinName);
            }
            else
            {
                if (uiEvent.m_eventParams.heroId == 0u)
                {
                    DebugHelper.Assert(false, "神秘商店购买不支持该物品类型");
                    return;
                }
                cOM_ITEM_TYPE = COM_ITEM_TYPE.COM_OBJTYPE_HERO;
                num           = uiEvent.m_eventParams.heroId;
                ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(num);
                DebugHelper.Assert(dataByKey != null, string.Format("找不到英雄{0}的配置信息", num));
                if (dataByKey == null)
                {
                    return;
                }
                goodName = StringHelper.UTF8BytesToString(ref dataByKey.szName);
            }
            int productID = this.GetProductID(num);

            if (productID < 0)
            {
                DebugHelper.Assert(false, string.Format("神秘商店找不到该物品{0}/{1}", Enum.GetName(typeof(COM_ITEM_TYPE), cOM_ITEM_TYPE), num));
                return;
            }
            CUIEvent uIEvent = Singleton <CUIEventManager> .GetInstance().GetUIEvent();

            uIEvent.m_eventID         = enUIEventID.Mall_Mystery_On_Confirm_Buy_Item;
            uIEvent.m_eventParams.tag = productID;
            CMallSystem.TryToPay(enPayPurpose.Buy, goodName, tag, commonUInt32Param, uIEvent.m_eventID, ref uIEvent.m_eventParams, enUIEventID.None, false, true, false);
        }
Esempio n. 5
0
        public static bool IsBuyForbiddenForRankBigGrade(uint heroId, uint skinId, out RES_RANK_LIMIT_TYPE rankLimitType, out byte rankLimitBigGrade, out ulong rankLimitParam, out bool isHaveRankBigGradeLimit)
        {
            uint            skinCfgId = CSkinInfo.GetSkinCfgId(heroId, skinId);
            ResHeroSkinShop resHeroSkinShop;

            if (GameDataMgr.skinShopInfoDict.TryGetValue(skinCfgId, ref resHeroSkinShop))
            {
                rankLimitType     = (int)resHeroSkinShop.bRankLimitType;
                rankLimitBigGrade = resHeroSkinShop.bRankLimitGrade;
                rankLimitParam    = resHeroSkinShop.ullRankLimitParam;
                switch (rankLimitType)
                {
                case 1:
                    isHaveRankBigGradeLimit = true;
                    return(CLadderSystem.GetRankBigGrade(Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().m_rankGrade) < rankLimitBigGrade);

                case 2:
                    isHaveRankBigGradeLimit = true;
                    return(CLadderSystem.GetRankBigGrade(Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().m_rankSeasonHighestGrade) < rankLimitBigGrade);

                case 3:
                    isHaveRankBigGradeLimit = true;
                    return(CLadderSystem.GetRankBigGrade(Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().m_rankHistoryHighestGrade) < rankLimitBigGrade);

                case 4:
                    isHaveRankBigGradeLimit = true;
                    if (Singleton <CLadderSystem> .GetInstance().IsCurSeason(rankLimitParam))
                    {
                        return(CLadderSystem.GetRankBigGrade(Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().m_rankGrade) < rankLimitBigGrade);
                    }
                    return(CLadderSystem.GetRankBigGrade(Singleton <CLadderSystem> .GetInstance().GetHistorySeasonGrade(rankLimitParam)) < rankLimitBigGrade);
                }
            }
            rankLimitType           = 0;
            rankLimitBigGrade       = 0;
            rankLimitParam          = 0uL;
            isHaveRankBigGradeLimit = false;
            return(false);
        }
Esempio n. 6
0
        public static ResSkinPromotion GetSkinPromotion(uint heroId, uint skinId)
        {
            uint skinCfgId = CSkinInfo.GetSkinCfgId(heroId, skinId);

            return(CSkinInfo.GetSkinPromotion(skinCfgId));
        }