コード例 #1
0
        private void UpdateItemPricePnl(CUIFormScript form, Transform pricePnlTrans, Transform tagTrans, ref stPayInfoSet payInfoSet)
        {
            GameObject obj2            = Utility.FindChild(pricePnlTrans.gameObject, "oldPricePanel");
            Text       componetInChild = Utility.GetComponetInChild <Text>(pricePnlTrans.gameObject, "oldPricePanel/oldPriceText");
            Image      image           = Utility.GetComponetInChild <Image>(pricePnlTrans.gameObject, "newPricePanel/costImage");
            Text       text2           = Utility.GetComponetInChild <Text>(pricePnlTrans.gameObject, "newPricePanel/newCostText");
            Text       text3           = Utility.GetComponetInChild <Text>(tagTrans.gameObject, "Text");

            tagTrans.gameObject.CustomSetActive(false);
            obj2.CustomSetActive(false);
            for (int i = 0; i < payInfoSet.m_payInfoCount; i++)
            {
                stPayInfo info = payInfoSet.m_payInfos[i];
                if (!Singleton <CMallMysteryShop> .GetInstance().HasGotDiscount)
                {
                    tagTrans.gameObject.CustomSetActive(true);
                    text3.text = "?折";
                    text2.text = info.m_payValue.ToString();
                    image.SetSprite(CMallSystem.GetPayTypeIconPath(info.m_payType), form, true, false, false);
                }
                else if (Singleton <CMallMysteryShop> .GetInstance().HasGotDiscount&& ((info.m_discountForDisplay == 0x2710) || (info.m_oriValue == info.m_payValue)))
                {
                    text2.text = info.m_payValue.ToString();
                    image.SetSprite(CMallSystem.GetPayTypeIconPath(info.m_payType), form, true, false, false);
                }
                else
                {
                    tagTrans.gameObject.CustomSetActive(true);
                    float num2 = ((float)info.m_discountForDisplay) / 1000f;
                    if (Math.Abs((float)(num2 % 1f)) < float.Epsilon)
                    {
                        text3.text = string.Format("{0}折", ((int)num2).ToString("D"));
                    }
                    else
                    {
                        text3.text = string.Format("{0}折", num2.ToString("0.0"));
                    }
                    obj2.CustomSetActive(true);
                    componetInChild.text = info.m_oriValue.ToString();
                    text2.text           = info.m_payValue.ToString();
                    image.SetSprite(CMallSystem.GetPayTypeIconPath(info.m_payType), form, true, false, false);
                }
            }
        }
コード例 #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;
            }
            }
        }
コード例 #3
0
        public static stPayInfoSet GetPayInfoSetOfGood(COM_ITEM_TYPE itemType, uint itemID)
        {
            CMallMysteryShop instance = Singleton <CMallMysteryShop> .GetInstance();

            stPayInfoSet        set       = new stPayInfoSet(2);
            long                doubleKey = GameDataMgr.GetDoubleKey((uint)itemType, itemID);
            CMallMysteryProduct product   = new CMallMysteryProduct();

            if (!instance.m_ProductDic.TryGetValue(doubleKey, out product))
            {
                return(set);
            }
            uint      index = (instance.Discount / 10) - 1;
            stPayInfo info  = new stPayInfo();

            switch (product.ItemType)
            {
            case COM_ITEM_TYPE.COM_OBJTYPE_HERO:
            {
                ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(itemID);
                DebugHelper.Assert(dataByKey != null, "神秘商店配置的英雄ID有错,英雄表里不存在");
                if (dataByKey != null)
                {
                    info.m_payType = CMallSystem.ResBuyTypeToPayType(product.Cfg.bMoneyType);
                    switch (info.m_payType)
                    {
                    case enPayType.GoldCoin:
                        info.m_oriValue = (uint)dataByKey.dwBuyCoin;
                        goto Label_01A7;

                    case enPayType.DianQuan:
                        info.m_oriValue = (uint)dataByKey.dwBuyCoupons;
                        goto Label_01A7;

                    case enPayType.Diamond:
                    case enPayType.DiamondAndDianQuan:
                        info.m_oriValue = (uint)dataByKey.dwBuyDiamond;
                        goto Label_01A7;
                    }
                    break;
                }
                return(set);
            }

            case COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN:
            {
                ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(itemID);
                DebugHelper.Assert(heroSkin != null, "神秘商店配置的皮肤ID有错,皮肤表里不存在");
                if (heroSkin != null)
                {
                    info.m_payType = CMallSystem.ResBuyTypeToPayType(product.Cfg.bMoneyType);
                    switch (info.m_payType)
                    {
                    case enPayType.DianQuan:
                        info.m_oriValue = heroSkin.dwBuyCoupons;
                        goto Label_01A7;

                    case enPayType.Diamond:
                    case enPayType.DiamondAndDianQuan:
                        info.m_oriValue = heroSkin.dwBuyDiamond;
                        goto Label_01A7;
                    }
                    break;
                }
                return(set);
            }
            }
Label_01A7:
            if (info.m_oriValue == 0)
            {
                info.m_oriValue = (uint)product.Cfg.RouZheKou[product.Cfg.RouZheKou.Length - 1];
            }
            if ((index < 0) || (index >= product.Cfg.RouZheKou.Length))
            {
                info.m_payValue           = info.m_oriValue;
                info.m_discountForDisplay = 0x2710;
            }
            else if (instance.IsRandomDiscount)
            {
                info.m_payValue           = (uint)product.Cfg.RouZheKou[index];
                info.m_discountForDisplay = instance.Discount * 100;
            }
            else
            {
                info.m_payValue           = (uint)product.Cfg.iConfirmZheKou;
                info.m_discountForDisplay = instance.Discount * 100;
            }
            set.m_payInfos[set.m_payInfoCount] = info;
            set.m_payInfoCount++;
            return(set);
        }