Exemplo n.º 1
0
        private void OnBuyHeroNotOwn(CUIEvent uiEvent)
        {
            uint heroId = uiEvent.m_eventParams.heroId;

            DebugHelper.Assert(heroId != 0, "未拥有的英雄ID不能为0");
            if (heroId != 0)
            {
                ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(heroId);
                DebugHelper.Assert(dataByKey != null, "神秘商店配置的英雄ID有错,英雄表里不存在");
                if (dataByKey != null)
                {
                    CMallMysteryProduct product = this.GetProduct(4, heroId);
                    if (product != null)
                    {
                        stPayInfoSet lowestPayInfoSetOfGood = CMallSystem.GetLowestPayInfoSetOfGood(dataByKey, CMallSystem.ResBuyTypeToPayType(product.Cfg.bMoneyType));
                        CHeroSkinBuyManager.OpenBuyHeroForm(uiEvent.m_srcFormScript, heroId, lowestPayInfoSetOfGood, enUIEventID.Mall_Mystery_On_Buy_Item);
                    }
                    else
                    {
                        CHeroSkinBuyManager.OpenBuyHeroForm(uiEvent.m_srcFormScript, heroId, new stPayInfoSet(), enUIEventID.None);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void OpenBuy(CUIFormScript form, ref COMDT_AKALISHOP_GOODS productInfo)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            DebugHelper.Assert(masterRoleInfo != null, "master roleInfo is null");
            if (masterRoleInfo == null)
            {
                return;
            }
            switch (productInfo.wItemType)
            {
            case 4:
            {
                ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(productInfo.dwItemID);
                DebugHelper.Assert(dataByKey != null, "神秘商店配置的英雄ID有错,英雄表里不存在");
                if (dataByKey == null)
                {
                    return;
                }
                if (masterRoleInfo.IsHaveHero(dataByKey.dwCfgID, false))
                {
                    stUIEventParams par = default(stUIEventParams);
                    par.openHeroFormPar.heroId = dataByKey.dwCfgID;
                    Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.HeroInfo_OpenForm, par);

                    return;
                }
                stPayInfoSet payInfoSet = default(stPayInfoSet);
                payInfoSet.m_payInfoCount = 1;
                payInfoSet.m_payInfos     = new stPayInfo[1];
                stPayInfo stPayInfo = default(stPayInfo);
                stPayInfo.m_oriValue     = productInfo.dwOrigPrice;
                stPayInfo.m_payValue     = productInfo.dwRealPrice;
                stPayInfo.m_payType      = enPayType.DianQuan;
                payInfoSet.m_payInfos[0] = stPayInfo;
                CHeroSkinBuyManager.OpenBuyHeroForm(form, dataByKey.dwCfgID, payInfoSet, enUIEventID.Mall_Mystery_On_Buy_Item);
                break;
            }

            case 7:
            {
                ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(productInfo.dwItemID);
                DebugHelper.Assert(heroSkin != null, "神秘商店配置的皮肤ID有错,皮肤表里不存在");
                if (heroSkin == null)
                {
                    return;
                }
                ResHeroCfgInfo dataByKey2 = GameDataMgr.heroDatabin.GetDataByKey(heroSkin.dwHeroID);
                DebugHelper.Assert(dataByKey2 != null, "神秘商店配置的皮肤ID有错,皮肤对应的英雄不存在");
                if (dataByKey2 == null)
                {
                    return;
                }
                if (masterRoleInfo.IsHaveHeroSkin(heroSkin.dwHeroID, heroSkin.dwSkinID, false))
                {
                    stUIEventParams par2 = default(stUIEventParams);
                    par2.openHeroFormPar.heroId  = heroSkin.dwHeroID;
                    par2.openHeroFormPar.skinId  = heroSkin.dwSkinID;
                    par2.openHeroFormPar.openSrc = enHeroFormOpenSrc.SkinBuyClick;
                    Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.HeroInfo_OpenForm, par2);

                    return;
                }
                if (masterRoleInfo.IsCanBuySkinButNotHaveHero(heroSkin.dwHeroID, heroSkin.dwSkinID))
                {
                    stUIEventParams par3 = default(stUIEventParams);
                    par3.heroId = heroSkin.dwHeroID;
                    Singleton <CUIManager> .GetInstance().OpenMessageBoxWithCancel(string.Format("暂未拥有英雄{0},是否购买", StringHelper.UTF8BytesToString(ref dataByKey2.szName)), enUIEventID.Mall_Mystery_On_Buy_Hero_Not_Own, enUIEventID.None, par3, false);

                    return;
                }
                stPayInfoSet payInfoSet2 = default(stPayInfoSet);
                payInfoSet2.m_payInfoCount = 1;
                payInfoSet2.m_payInfos     = new stPayInfo[1];
                stPayInfo stPayInfo2 = default(stPayInfo);
                stPayInfo2.m_oriValue     = productInfo.dwOrigPrice;
                stPayInfo2.m_payValue     = productInfo.dwRealPrice;
                stPayInfo2.m_payType      = enPayType.DianQuan;
                payInfoSet2.m_payInfos[0] = stPayInfo2;
                CHeroSkinBuyManager.OpenBuyHeroSkinForm(heroSkin.dwHeroID, heroSkin.dwSkinID, true, payInfoSet2, enUIEventID.Mall_Mystery_On_Buy_Item);
                break;
            }
            }
        }
Exemplo n.º 3
0
        public void OpenBuy(CUIFormScript form, Transform srcTrans)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            DebugHelper.Assert(masterRoleInfo != null, "master roleInfo is null");
            if (masterRoleInfo != null)
            {
                switch (this.m_ItemType)
                {
                case COM_ITEM_TYPE.COM_OBJTYPE_HERO:
                {
                    ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(this.m_itemID);
                    DebugHelper.Assert(dataByKey != null, "神秘商店配置的英雄ID有错,英雄表里不存在");
                    if (dataByKey != null)
                    {
                        if (masterRoleInfo.IsHaveHero(dataByKey.dwCfgID, false))
                        {
                            stUIEventParams par = new stUIEventParams();
                            par.openHeroFormPar.heroId = dataByKey.dwCfgID;
                            Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.HeroInfo_OpenForm, par);

                            return;
                        }
                        stPayInfoSet lowestPayInfoSetOfGood = CMallSystem.GetLowestPayInfoSetOfGood(dataByKey, CMallSystem.ResBuyTypeToPayType(this.Cfg.bMoneyType));
                        CHeroSkinBuyManager.OpenBuyHeroForm(form, dataByKey.dwCfgID, lowestPayInfoSetOfGood, enUIEventID.Mall_Mystery_On_Buy_Item);
                        break;
                    }
                    return;
                }

                case COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN:
                {
                    ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(this.m_itemID);
                    DebugHelper.Assert(heroSkin != null, "神秘商店配置的皮肤ID有错,皮肤表里不存在");
                    if (heroSkin != null)
                    {
                        ResHeroCfgInfo info3 = GameDataMgr.heroDatabin.GetDataByKey(heroSkin.dwHeroID);
                        DebugHelper.Assert(info3 != null, "神秘商店配置的皮肤ID有错,皮肤对应的英雄不存在");
                        if (info3 == null)
                        {
                            return;
                        }
                        if (masterRoleInfo.IsHaveHeroSkin(heroSkin.dwHeroID, heroSkin.dwSkinID, false))
                        {
                            stUIEventParams params2 = new stUIEventParams();
                            params2.openHeroFormPar.heroId  = heroSkin.dwHeroID;
                            params2.openHeroFormPar.skinId  = heroSkin.dwSkinID;
                            params2.openHeroFormPar.openSrc = enHeroFormOpenSrc.SkinBuyClick;
                            Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.HeroInfo_OpenForm, params2);

                            return;
                        }
                        if (masterRoleInfo.IsCanBuySkinButNotHaveHero(heroSkin.dwHeroID, heroSkin.dwSkinID))
                        {
                            stUIEventParams params3 = new stUIEventParams {
                                heroId = heroSkin.dwHeroID
                            };
                            Singleton <CUIManager> .GetInstance().OpenMessageBoxWithCancel(string.Format("暂未拥有英雄{0},是否购买", StringHelper.UTF8BytesToString(ref info3.szName)), enUIEventID.Mall_Mystery_On_Buy_Hero_Not_Own, enUIEventID.None, params3, false);

                            return;
                        }
                        stPayInfoSet payInfoSet = CMallSystem.GetLowestPayInfoSetOfGood(heroSkin, CMallSystem.ResBuyTypeToPayType(this.Cfg.bMoneyType));
                        CHeroSkinBuyManager.OpenBuyHeroSkinForm(heroSkin.dwHeroID, heroSkin.dwSkinID, true, payInfoSet, enUIEventID.Mall_Mystery_On_Buy_Item);
                        break;
                    }
                    return;
                }
                }
            }
        }