Beispiel #1
0
        private void OnOpenBuyItem(CUIEvent uiEvent)
        {
            if (!this.IsShopAvailable())
            {
                return;
            }
            if (this.m_AkaliShopDetail == null || this.m_AkaliShopInfoSvr == null)
            {
                return;
            }
            int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;

            if (srcWidgetIndexInBelongedList > (int)this.m_AkaliShopDetail.bGoodsCnt)
            {
                return;
            }
            COMDT_AKALISHOP_GOODS cOMDT_AKALISHOP_GOODS = this.m_AkaliShopDetail.astGoodsList[srcWidgetIndexInBelongedList];

            if (cOMDT_AKALISHOP_GOODS != null)
            {
                this.OpenBuy(uiEvent.m_srcFormScript, ref cOMDT_AKALISHOP_GOODS);
            }
        }
Beispiel #2
0
        private void OnElementEnable(CUIEvent uiEvent)
        {
            if (this.m_AkaliShopDetail == null)
            {
                return;
            }
            if (!this.IsGetDisCount())
            {
                this.OnDefaultItem(uiEvent);
                return;
            }
            int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;

            if (srcWidgetIndexInBelongedList > (int)this.m_AkaliShopDetail.bGoodsCnt)
            {
                return;
            }
            COMDT_AKALISHOP_GOODS cOMDT_AKALISHOP_GOODS = this.m_AkaliShopDetail.astGoodsList[srcWidgetIndexInBelongedList];

            if (cOMDT_AKALISHOP_GOODS != null)
            {
                this.UpdateItem(uiEvent, cOMDT_AKALISHOP_GOODS);
            }
        }
Beispiel #3
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;
            }
            }
        }
Beispiel #4
0
        private void UpdateItemPricePnl(CUIFormScript form, Transform pricePnlTrans, Transform tagTrans, COMDT_AKALISHOP_GOODS productInfo)
        {
            GameObject obj              = Utility.FindChild(pricePnlTrans.gameObject, "oldPricePanel");
            Text       componetInChild  = Utility.GetComponetInChild <Text>(pricePnlTrans.gameObject, "oldPricePanel/oldPriceText");
            Image      componetInChild2 = Utility.GetComponetInChild <Image>(pricePnlTrans.gameObject, "newPricePanel/costImage");
            Text       componetInChild3 = Utility.GetComponetInChild <Text>(pricePnlTrans.gameObject, "newPricePanel/newCostText");
            Text       componetInChild4 = Utility.GetComponetInChild <Text>(tagTrans.gameObject, "Text");

            tagTrans.gameObject.CustomSetActive(false);
            obj.CustomSetActive(false);
            tagTrans.gameObject.CustomSetActive(true);
            float num = productInfo.dwItemDiscount / 10u;

            if (Math.Abs(num % 1f) < 1.401298E-45f)
            {
                componetInChild4.set_text(string.Format("{0}折", ((int)num).ToString("D")));
            }
            else
            {
                componetInChild4.set_text(string.Format("{0}折", num.ToString("0.0")));
            }
            obj.CustomSetActive(true);
            componetInChild.set_text(productInfo.dwOrigPrice.ToString());
            componetInChild3.set_text(productInfo.dwRealPrice.ToString());
            componetInChild2.SetSprite(CMallSystem.GetPayTypeIconPath(enPayType.DianQuan), form, true, false, false, false);
        }
Beispiel #5
0
        private void UpdateItem(CUIEvent uiEvent, COMDT_AKALISHOP_GOODS productInfo)
        {
            if (productInfo == null)
            {
                return;
            }
            CUIFormScript srcFormScript = uiEvent.m_srcFormScript;
            GameObject    srcWidget     = uiEvent.m_srcWidget;

            if (srcFormScript == null || srcWidget == null)
            {
                return;
            }
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            DebugHelper.Assert(masterRoleInfo != null, "master roleInfo is null");
            if (masterRoleInfo == null)
            {
                return;
            }
            GameObject gameObject = Utility.FindChild(srcWidget, "heroItem");

            if (gameObject == null)
            {
                DebugHelper.Assert(gameObject != null, "hero item is null");
                return;
            }
            GameObject gameObject2 = Utility.FindChild(srcWidget, "defualtItem");

            if (gameObject2 != null)
            {
                gameObject2.CustomSetActive(false);
            }
            if (gameObject != null)
            {
                gameObject.CustomSetActive(true);
            }
            Text       componetInChild = Utility.GetComponetInChild <Text>(gameObject, "heroDataPanel/heroNamePanel/heroNameText");
            GameObject gameObject3     = Utility.FindChild(gameObject, "heroDataPanel/heroNamePanel/heroSkinText");

            if (gameObject3 == null)
            {
                return;
            }
            Text       component   = gameObject3.GetComponent <Text>();
            GameObject gameObject4 = Utility.FindChild(gameObject, "tag");

            if (gameObject4 == null)
            {
                return;
            }
            GameObject gameObject5 = Utility.FindChild(gameObject, "profession");

            if (gameObject5 == null)
            {
                return;
            }
            GameObject gameObject6 = Utility.FindChild(srcWidget, "imgExperienceMark");

            if (gameObject6 == null)
            {
                return;
            }
            if (gameObject6)
            {
                gameObject6.CustomSetActive(true);
            }
            GameObject gameObject7 = Utility.FindChild(gameObject, "skinLabelImage");

            if (gameObject7 == null)
            {
                return;
            }
            GameObject gameObject8 = Utility.FindChild(gameObject, "heroDataPanel/heroPricePanel");

            if (gameObject8 == null)
            {
                return;
            }
            gameObject8.CustomSetActive(false);
            GameObject gameObject9 = Utility.FindChild(srcWidget, "ButtonGroup/BuyBtn");

            if (gameObject9 == null)
            {
                return;
            }
            gameObject9.CustomSetActive(false);
            Text   componetInChild2 = Utility.GetComponetInChild <Text>(gameObject9, "Text");
            Button component2       = gameObject9.GetComponent <Button>();

            if (component2 == null)
            {
                return;
            }
            CUIEventScript component3 = gameObject9.GetComponent <CUIEventScript>();

            if (component3 == null)
            {
                return;
            }
            component3.enabled = false;
            component2.enabled = false;
            GameObject gameObject10 = Utility.FindChild(srcWidget, "ButtonGroup/LinkBtn");

            if (gameObject10 == null)
            {
                return;
            }
            gameObject10.CustomSetActive(false);
            Text   componetInChild3 = Utility.GetComponetInChild <Text>(gameObject10, "Text");
            Button component4       = gameObject10.GetComponent <Button>();

            if (component4 == null)
            {
                return;
            }
            CUIEventScript component5 = gameObject10.GetComponent <CUIEventScript>();

            if (component5 == null)
            {
                return;
            }
            component5.enabled = false;
            component4.enabled = false;
            COM_ITEM_TYPE wItemType = (COM_ITEM_TYPE)productInfo.wItemType;
            uint          dwItemID  = productInfo.dwItemID;

            switch (wItemType)
            {
            case COM_ITEM_TYPE.COM_OBJTYPE_HERO:
            {
                ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(dwItemID);
                DebugHelper.Assert(dataByKey != null, "神秘商店配置的英雄ID有错,英雄表里不存在");
                if (dataByKey == null)
                {
                    return;
                }
                ResHeroShop resHeroShop = null;
                GameDataMgr.heroShopInfoDict.TryGetValue(dataByKey.dwCfgID, out resHeroShop);
                CUICommonSystem.SetHeroItemImage(uiEvent.m_srcFormScript, gameObject, StringHelper.UTF8BytesToString(ref dataByKey.szImagePath), enHeroHeadType.enBust, false, true);
                gameObject5.CustomSetActive(false);
                gameObject7.CustomSetActive(false);
                gameObject3.CustomSetActive(false);
                if (componetInChild != null)
                {
                    componetInChild.set_text(StringHelper.UTF8BytesToString(ref dataByKey.szName));
                }
                if (masterRoleInfo.IsHaveHero(dataByKey.dwCfgID, false))
                {
                    gameObject9.CustomSetActive(true);
                    componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Hero_State_Own"));
                    gameObject4.CustomSetActive(false);
                    gameObject6.CustomSetActive(false);
                }
                else
                {
                    gameObject6.CustomSetActive(masterRoleInfo.IsValidExperienceHero(dataByKey.dwCfgID));
                    gameObject8.CustomSetActive(true);
                    gameObject9.CustomSetActive(true);
                    componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Buy"));
                    component3.enabled = true;
                    component2.enabled = true;
                    this.UpdateItemPricePnl(srcFormScript, gameObject8.transform, gameObject4.transform, productInfo);
                    component3.SetUIEvent(enUIEventType.Click, enUIEventID.Mall_Mystery_On_Open_Buy_Form, new stUIEventParams
                        {
                            tag = uiEvent.m_srcWidgetIndexInBelongedList
                        });
                }
                break;
            }

            case COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN:
            {
                ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(dwItemID);
                DebugHelper.Assert(heroSkin != null, "神秘商店配置的皮肤ID有错,皮肤表里不存在");
                if (heroSkin == null)
                {
                    return;
                }
                ResHeroSkinShop resHeroSkinShop = null;
                GameDataMgr.skinShopInfoDict.TryGetValue(heroSkin.dwSkinID, out resHeroSkinShop);
                ResHeroCfgInfo dataByKey2 = GameDataMgr.heroDatabin.GetDataByKey(heroSkin.dwHeroID);
                DebugHelper.Assert(dataByKey2 != null, "神秘商店配置的皮肤ID有错,皮肤对应的英雄不存在");
                if (dataByKey2 == null)
                {
                    return;
                }
                CUICommonSystem.SetHeroItemImage(uiEvent.m_srcFormScript, gameObject.gameObject, heroSkin.szSkinPicID, enHeroHeadType.enBust, false, true);
                gameObject5.CustomSetActive(false);
                CUICommonSystem.SetHeroSkinLabelPic(uiEvent.m_srcFormScript, gameObject7, heroSkin.dwHeroID, heroSkin.dwSkinID);
                gameObject3.CustomSetActive(true);
                if (componetInChild != null)
                {
                    componetInChild.set_text(StringHelper.UTF8BytesToString(ref dataByKey2.szName));
                }
                if (component != null)
                {
                    component.set_text(StringHelper.UTF8BytesToString(ref heroSkin.szSkinName));
                }
                if (masterRoleInfo.IsHaveHeroSkin(heroSkin.dwHeroID, heroSkin.dwSkinID, false))
                {
                    gameObject9.CustomSetActive(true);
                    componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Skin_State_Own"));
                    gameObject4.CustomSetActive(false);
                    gameObject6.CustomSetActive(false);
                }
                else
                {
                    gameObject6.CustomSetActive(masterRoleInfo.IsValidExperienceSkin(heroSkin.dwHeroID, heroSkin.dwSkinID));
                    gameObject8.CustomSetActive(true);
                    gameObject10.CustomSetActive(false);
                    this.UpdateItemPricePnl(srcFormScript, gameObject8.transform, gameObject4.transform, productInfo);
                    if (masterRoleInfo.IsCanBuySkinButNotHaveHero(heroSkin.dwHeroID, heroSkin.dwSkinID))
                    {
                        gameObject9.CustomSetActive(true);
                        component3.enabled = true;
                        componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Skin_State_Buy_hero"));
                        component2.enabled = true;
                        stUIEventParams eventParams = default(stUIEventParams);
                        eventParams.openHeroFormPar.heroId  = heroSkin.dwHeroID;
                        eventParams.openHeroFormPar.skinId  = heroSkin.dwSkinID;
                        eventParams.openHeroFormPar.openSrc = enHeroFormOpenSrc.SkinBuyClick;
                        component3.SetUIEvent(enUIEventType.Click, enUIEventID.HeroInfo_OpenForm, eventParams);
                        this.UpdateItemPricePnl(srcFormScript, gameObject8.transform, gameObject4.transform, productInfo);
                    }
                    else
                    {
                        gameObject10.CustomSetActive(false);
                        gameObject9.CustomSetActive(true);
                        componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Buy"));
                        component3.enabled = true;
                        component2.enabled = true;
                        component3.SetUIEvent(enUIEventType.Click, enUIEventID.Mall_Mystery_On_Open_Buy_Form, new stUIEventParams
                            {
                                tag = uiEvent.m_srcWidgetIndexInBelongedList
                            });
                    }
                }
                break;
            }
            }
        }