示例#1
0
 public static void ShowUseableItem(CUseable item)
 {
     if (item != null)
     {
         if ((item.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) || (item.MapRewardType == COM_REWARDS_TYPE.COM_REWARDS_TYPE_ITEM))
         {
             if (item.ExtraFromType == 1)
             {
                 CUICommonSystem.ShowNewHeroOrSkin((uint)item.ExtraFromData, 0, enUIEventID.Activity_HeroShow_Back, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_HERO, true, null, enFormPriority.Priority1, (uint)item.m_stackCount, 0);
             }
             else if (item.ExtraFromType == 2)
             {
                 int extraFromData = item.ExtraFromData;
                 CUICommonSystem.ShowNewHeroOrSkin(0, (uint)extraFromData, enUIEventID.Activity_HeroShow_Back, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_SKIN, true, null, enFormPriority.Priority1, (uint)item.m_stackCount, 0);
             }
         }
         else if (item is CHeroSkin)
         {
             CHeroSkin skin = item as CHeroSkin;
             CUICommonSystem.ShowNewHeroOrSkin(skin.m_heroId, skin.m_skinId, enUIEventID.Activity_HeroShow_Back, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_SKIN, true, null, enFormPriority.Priority1, 0, 0);
         }
         else if (item is CHeroItem)
         {
             CUICommonSystem.ShowNewHeroOrSkin(item.m_baseID, 0, enUIEventID.Activity_HeroShow_Back, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_HERO, true, null, enFormPriority.Priority1, 0, 0);
         }
         else
         {
             CUseable[] items = new CUseable[] { item };
             Singleton <CUIManager> .GetInstance().OpenAwardTip(items, Singleton <CTextManager> .GetInstance().GetText("gotAward"), true, enUIEventID.None, false, true, "Form_Award");
         }
     }
 }
示例#2
0
        public static CUseable CreateUseable(COM_ITEM_TYPE useableType, uint baseID, int bCount = 0)
        {
            CUseable result = null;

            if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
            {
                result = new CItem(0uL, baseID, bCount, 0);
            }
            else if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMEQUIP)
            {
                result = new CEquip(0uL, baseID, bCount, 0);
            }
            else if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
            {
                result = new CHeroItem(0uL, baseID, bCount, 0);
            }
            else if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL)
            {
                result = new CSymbolItem(0uL, baseID, bCount, 0);
            }
            else if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
            {
                result = new CHeroSkin(0uL, baseID, bCount, 0);
            }
            else if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_HEADIMG)
            {
                result = new CHeadImg(0uL, baseID, 0);
            }
            return(result);
        }
示例#3
0
        public static CUseable CreateUseable(COM_ITEM_TYPE useableType, uint baseID, int bCount = 0)
        {
            CUseable result = null;

            if (useableType == 2)
            {
                result = new CItem(0uL, baseID, bCount, 0);
            }
            else if (useableType == 3)
            {
                result = new CEquip(0uL, baseID, bCount, 0);
            }
            else if (useableType == 4)
            {
                result = new CHeroItem(0uL, baseID, bCount, 0);
            }
            else if (useableType == 5)
            {
                result = new CSymbolItem(0uL, baseID, bCount, 0);
            }
            else if (useableType == 7)
            {
                result = new CHeroSkin(0uL, baseID, bCount, 0);
            }
            else if (useableType == 8)
            {
                result = new CHeadImg(0uL, baseID, 0);
            }
            return(result);
        }
示例#4
0
 public static void ShowUseableItem(CUseable item)
 {
     if (item == null)
     {
         return;
     }
     if (item.m_type == 2 || item.MapRewardType == 1)
     {
         if (item.ExtraFromType == 1)
         {
             int extraFromData = item.ExtraFromData;
             CUICommonSystem.ShowNewHeroOrSkin((uint)extraFromData, 0u, enUIEventID.Activity_HeroShow_Back, true, 5, true, null, enFormPriority.Priority1, (uint)item.m_stackCount, 0);
         }
         else if (item.ExtraFromType == 2)
         {
             int extraFromData2 = item.ExtraFromData;
             CUICommonSystem.ShowNewHeroOrSkin(0u, (uint)extraFromData2, enUIEventID.Activity_HeroShow_Back, true, 10, true, null, enFormPriority.Priority1, (uint)item.m_stackCount, 0);
         }
         else
         {
             CUseable[] items = new CUseable[]
             {
                 item
             };
             Singleton <CUIManager> .GetInstance().OpenAwardTip(items, Singleton <CTextManager> .GetInstance().GetText("gotAward"), true, enUIEventID.None, false, true, "Form_Award");
         }
     }
     else if (item is CHeroSkin)
     {
         CHeroSkin cHeroSkin = item as CHeroSkin;
         CUICommonSystem.ShowNewHeroOrSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, enUIEventID.Activity_HeroShow_Back, true, 10, true, null, enFormPriority.Priority1, 0u, 0);
     }
     else if (item is CHeroItem)
     {
         CUICommonSystem.ShowNewHeroOrSkin(item.m_baseID, 0u, enUIEventID.Activity_HeroShow_Back, true, 5, true, null, enFormPriority.Priority1, 0u, 0);
     }
     else
     {
         CUseable[] items2 = new CUseable[]
         {
             item
         };
         Singleton <CUIManager> .GetInstance().OpenAwardTip(items2, Singleton <CTextManager> .GetInstance().GetText("gotAward"), true, enUIEventID.None, false, true, "Form_Award");
     }
 }
示例#5
0
        public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
        {
            CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm(s_Gift_Form_Path, false, true);

            if (null != formScript)
            {
                this._root                 = formScript.gameObject;
                this._usb                  = CUseableManager.CreateUseable(type, id, 0);
                this._count                = 1;
                this._bHeroSkinGift        = false;
                this._bDynamicCorrectPrice = false;
                this._heroSkinGiftCost     = 0;
                this._maxCount             = maxCount;
                if (this._maxCount == 0)
                {
                    this._maxCount = 0x3e7;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._realDiscount     = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc");
                    CItem item = new CItem(0L, id, 0, 0);
                    uint  key  = (uint)item.m_itemData.EftParam[0];
                    ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(key);
                    ListView <CUseable>  view      = new ListView <CUseable>();
                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                    {
                        if (dataByKey.astRewardDetail[i].bItemType != 0)
                        {
                            CUseable useable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID);
                            if (useable != null)
                            {
                                view.Add(useable);
                            }
                        }
                    }
                    if (this._descText != null)
                    {
                        this._descText.text = item.m_description;
                    }
                    uint num3 = 0;
                    int  num4 = 0;
                    if (this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem item2 = (CItem)this._usb;
                        if (((item2 != null) && (item2.m_itemData != null)) && (item2.m_itemData.bType == 4))
                        {
                            this._bDynamicCorrectPrice = item2.m_itemData.EftParam[3] > 0f;
                        }
                    }
                    for (int j = 0; j < 10; j++)
                    {
                        GameObject gameObject = this._root.transform.Find("Panel/itemGroup/itemCell" + j).gameObject;
                        if (j < view.Count)
                        {
                            gameObject.CustomSetActive(true);
                            CUICommonSystem.SetItemCell(formScript, gameObject, view[j], true, false);
                            Transform transform = gameObject.transform.Find("HaveItemFlag");
                            transform.gameObject.CustomSetActive(false);
                            if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                            {
                                this._bHeroSkinGift = true;
                                CHeroItem item3          = view[j] as CHeroItem;
                                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((masterRoleInfo != null) && masterRoleInfo.IsOwnHero(item3.m_heroData.dwCfgID))
                                {
                                    num3 += CHeroInfo.GetHeroCost(item3.m_heroData.dwCfgID, coinType);
                                    num4++;
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                            else if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                            {
                                this._bHeroSkinGift = true;
                                CHeroSkin skin  = view[j] as CHeroSkin;
                                CRoleInfo info2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((info2 != null) && info2.IsHaveHeroSkin(skin.m_heroId, skin.m_skinId, false))
                                {
                                    num3 += CSkinInfo.GetHeroSkinCost(skin.m_heroId, skin.m_skinId, coinType);
                                    num4++;
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                        }
                        else
                        {
                            gameObject.CustomSetActive(false);
                        }
                    }
                    this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0);
                    if (this._coinUsb != null)
                    {
                        Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false));
                    }
                    Text componetInChild = Utility.GetComponetInChild <Text>(this._root, "Panel/costDescText");
                    componetInChild.text = string.Empty;
                    if (this._bHeroSkinGift && this._bDynamicCorrectPrice)
                    {
                        uint   buyPrice = this._usb.GetBuyPrice(coinType);
                        Button btn      = Utility.GetComponetInChild <Button>(this._root, "Panel/Button_Sale");
                        if (num4 >= view.Count)
                        {
                            CUICommonSystem.SetButtonEnableWithShader(btn, false, true);
                            componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("Gift_Can_Not_Buy_Tip");

                            this._heroSkinGiftCost = 0;
                        }
                        else
                        {
                            CUICommonSystem.SetButtonEnableWithShader(btn, true, true);
                            componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("Gift_Own_Hero_Skin_Tip");

                            uint num7 = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(buyPrice - num3, this._realDiscount);
                            if ((buyPrice >= num3) && (num7 >= (buyPrice / 10)))
                            {
                                this._heroSkinGiftCost = num7;
                            }
                            else
                            {
                                this._heroSkinGiftCost = buyPrice / 10;
                            }
                        }
                        if (this._callContext != null)
                        {
                            this._callContext.m_bChangeGiftPrice = true;
                            this._callContext.m_newGiftPrice     = this._heroSkinGiftCost;
                        }
                    }
                }
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel));

                this.ValidateDynamic();
            }
        }
示例#6
0
        private void ShowNextReward(CUIEvent firstIfNull)
        {
            if ((firstIfNull != null) || ((this._rewardShowList == null) && (this._rewardQueueIndex <= -1)))
            {
                if (this._rewardShowList == null)
                {
                    this._rewardQueueIndex++;
                    if (this._rewardQueueIndex >= this._rewardListQueue.Count)
                    {
                        Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Common_NewHeroOrSkinFormClose, new CUIEventManager.OnUIEventHandler(this.ShowNextReward));

                        Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Mall_Get_AWARD_CLOSE_FORM, new CUIEventManager.OnUIEventHandler(this.ShowNextReward));

                        this._rewardListQueue.Clear();
                        this._rewardQueueIndex = -1;
                        this._rewardShowIndex  = -1;
                        return;
                    }
                    this._rewardShowList   = this._rewardListQueue[this._rewardQueueIndex];
                    this._rewardShowIndex  = -1;
                    this._rewardHasSpecial = false;
                }
                while ((((++this._rewardShowIndex < this._rewardShowList.usabList.Count) && (this._rewardShowList.usabList[this._rewardShowIndex].MapRewardType != COM_REWARDS_TYPE.COM_REWARDS_TYPE_HERO)) && (this._rewardShowList.usabList[this._rewardShowIndex].MapRewardType != COM_REWARDS_TYPE.COM_REWARDS_TYPE_SKIN)) && ((this._rewardShowList.usabList[this._rewardShowIndex].MapRewardType != COM_REWARDS_TYPE.COM_REWARDS_TYPE_ITEM) || ((this._rewardShowList.usabList[this._rewardShowIndex].ExtraFromType != 1) && (this._rewardShowList.usabList[this._rewardShowIndex].ExtraFromType != 2))))
                {
                }
                if (this._rewardShowIndex < this._rewardShowList.usabList.Count)
                {
                    CUseable useable = this._rewardShowList.usabList[this._rewardShowIndex];
                    if (useable.MapRewardType == COM_REWARDS_TYPE.COM_REWARDS_TYPE_ITEM)
                    {
                        if (useable.ExtraFromType == 1)
                        {
                            CUICommonSystem.ShowNewHeroOrSkin((uint)useable.ExtraFromData, 0, enUIEventID.None, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_HERO, true, null, enFormPriority.Priority1, (uint)useable.m_stackCount, 0);
                        }
                        else if (useable.ExtraFromType == 2)
                        {
                            int extraFromData = useable.ExtraFromData;
                            CUICommonSystem.ShowNewHeroOrSkin(0, (uint)extraFromData, enUIEventID.None, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_SKIN, true, null, enFormPriority.Priority1, (uint)useable.m_stackCount, 0);
                        }
                    }
                    else if (useable is CHeroSkin)
                    {
                        CHeroSkin skin = useable as CHeroSkin;
                        CUICommonSystem.ShowNewHeroOrSkin(skin.m_heroId, skin.m_skinId, enUIEventID.None, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_SKIN, true, null, enFormPriority.Priority1, 0, 0);
                    }
                    else
                    {
                        CUICommonSystem.ShowNewHeroOrSkin(useable.m_baseID, 0, enUIEventID.None, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_HERO, true, null, enFormPriority.Priority1, 0, 0);
                    }
                    this._rewardHasSpecial = true;
                }
                else if ((this._rewardShowList.usabList.Count > 1) || !this._rewardHasSpecial)
                {
                    bool flag = (this._rewardShowList.flags & 2) > 0;
                    Singleton <CUIManager> .GetInstance().OpenAwardTip(LinqS.ToArray <CUseable>(this._rewardShowList.usabList), Singleton <CTextManager> .GetInstance().GetText(!flag ? "gotAward" : "gotExtraAward"), true, enUIEventID.None, false, false, "Form_Award");

                    this._rewardShowList = null;
                }
                else
                {
                    this._rewardShowList = null;
                    this.ShowNextReward(new CUIEvent());
                }
            }
        }
            public void Validate()
            {
                if (this.phase == null || this.uiItem == null)
                {
                    return;
                }
                this.uiItem.CustomSetActive(true);
                ResDT_PointExchange    config = this.phase.Config;
                PointsExchangeActivity pointsExchangeActivity = this.phase.Owner as PointsExchangeActivity;

                if (pointsExchangeActivity == null || pointsExchangeActivity.PointsConfig == null)
                {
                    return;
                }
                ResWealPointExchange pointsConfig = pointsExchangeActivity.PointsConfig;
                GameObject           gameObject   = this.uiItem.transform.FindChild("DuihuanBtn").gameObject;

                gameObject.GetComponent <CUIEventScript>().m_onClickEventParams.commonUInt32Param1 = (uint)this.index;
                uint      maxExchangeCount = pointsExchangeActivity.GetMaxExchangeCount(this.index);
                uint      exchangeCount    = pointsExchangeActivity.GetExchangeCount(this.index);
                uint      dwPointCnt       = config.dwPointCnt;
                CRoleInfo masterRoleInfo   = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                uint jiFen    = masterRoleInfo.JiFen;
                bool isEnable = jiFen >= dwPointCnt && (maxExchangeCount == 0u || exchangeCount < maxExchangeCount);

                if (this.owner.view.activity.timeState != Activity.TimeState.Going)
                {
                    CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), false, true);
                }
                else
                {
                    CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), isEnable, true);
                }
                CUseable   itemUseable = CUseableManager.CreateVirtualUseable(enVirtualItemType.enDianJuanJiFen, 1);
                GameObject gameObject2 = this.uiItem.transform.FindChild("Panel/PointsCell").gameObject;

                CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject2, itemUseable, true, false, false, false);
                CUseable   cUseable    = CUseableManager.CreateUseable((COM_ITEM_TYPE)config.wResItemType, config.dwResItemID, (int)config.wResItemCnt);
                GameObject gameObject3 = this.uiItem.transform.FindChild("Panel/GetItemCell").gameObject;

                if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                {
                    CItem cItem = cUseable as CItem;
                    if (cItem != null && cItem.m_itemData.bIsView > 0)
                    {
                        CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject3, cUseable, true, false, false, true);
                    }
                    else
                    {
                        CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject3, cUseable, true, false, false, false);
                        if (gameObject3 != null)
                        {
                            CUIEventScript component = gameObject3.GetComponent <CUIEventScript>();
                            if (component != null)
                            {
                                component.SetUIEvent(enUIEventType.Click, enUIEventID.None);
                            }
                        }
                    }
                }
                else
                {
                    CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject3, cUseable, true, false, false, false);
                    if (gameObject3 != null)
                    {
                        CUIEventScript component2 = gameObject3.GetComponent <CUIEventScript>();
                        if (component2 != null)
                        {
                            component2.SetUIEvent(enUIEventType.Click, enUIEventID.None);
                        }
                    }
                }
                bool bActive = false;

                if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                {
                    CHeroItem cHeroItem = (CHeroItem)cUseable;
                    if (cHeroItem != null)
                    {
                        CRoleInfo masterRoleInfo2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                        if (masterRoleInfo2 != null)
                        {
                            bActive = masterRoleInfo2.IsHaveHero(cHeroItem.m_baseID, true);
                        }
                    }
                }
                else if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                {
                    CHeroSkin cHeroSkin = (CHeroSkin)cUseable;
                    if (cHeroSkin != null)
                    {
                        CRoleInfo masterRoleInfo3 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                        if (masterRoleInfo3 != null)
                        {
                            bActive = masterRoleInfo3.IsHaveHeroSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, false);
                        }
                    }
                }
                Transform transform = this.uiItem.transform.FindChild("Panel/GetItemCell/HaveItemFlag");

                if (transform != null && transform.gameObject != null)
                {
                    transform.gameObject.CustomSetActive(bActive);
                }
                Text component3 = this.uiItem.transform.FindChild("Panel/PointsCell/ItemCount").gameObject.GetComponent <Text>();

                if (jiFen < config.dwPointCnt)
                {
                    component3.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemNotEnoughCount"), jiFen, dwPointCnt));
                    CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), false, true);
                }
                else
                {
                    component3.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemCount"), jiFen, dwPointCnt));
                }
                GameObject gameObject4 = this.uiItem.transform.FindChild("ExchangeCount").gameObject;

                if (maxExchangeCount > 0u)
                {
                    gameObject4.CustomSetActive(true);
                    gameObject4.GetComponent <Text>().set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_TimeLimit"), exchangeCount, maxExchangeCount));
                }
                else
                {
                    gameObject4.CustomSetActive(false);
                }
            }
        private void OnClickExchange(CUIEvent uiEvent)
        {
            if (this._elementList == null)
            {
                return;
            }
            int commonUInt32Param = (int)uiEvent.m_eventParams.commonUInt32Param1;

            if (commonUInt32Param >= 0 && commonUInt32Param < this._elementList.Count)
            {
                uint     dwResItemID = this._elementList[commonUInt32Param].phase.Config.dwResItemID;
                CUseable cUseable    = CUseableManager.CreateUseable((COM_ITEM_TYPE)this._elementList[commonUInt32Param].phase.Config.wResItemType, this._elementList[commonUInt32Param].phase.Config.dwResItemID, (int)this._elementList[commonUInt32Param].phase.Config.wResItemCnt);
                if (cUseable == null)
                {
                    return;
                }
                bool flag = false;
                int  num  = 0;
                if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                {
                    CHeroItem cHeroItem = (CHeroItem)cUseable;
                    if (cHeroItem != null)
                    {
                        CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                        if (masterRoleInfo != null)
                        {
                            flag = masterRoleInfo.IsHaveHero(cHeroItem.m_baseID, true);
                        }
                    }
                }
                else if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                {
                    CHeroSkin cHeroSkin = (CHeroSkin)cUseable;
                    if (cHeroSkin != null)
                    {
                        CRoleInfo masterRoleInfo2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                        if (masterRoleInfo2 != null)
                        {
                            flag = masterRoleInfo2.IsHaveHeroSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, false);
                        }
                    }
                }
                else if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                {
                    CItem cItem = (CItem)cUseable;
                    if (cItem != null)
                    {
                        CRoleInfo masterRoleInfo3 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                        if (cItem.m_itemData != null && masterRoleInfo3 != null && cItem.m_itemData.bType == 4)
                        {
                            int num2 = (int)cItem.m_itemData.EftParam[0];
                            if (num2 > 0)
                            {
                                ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey((long)num2);
                                if (dataByKey != null)
                                {
                                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                                    {
                                        if (dataByKey.astRewardDetail[i].bItemType == 0 || dataByKey.astRewardDetail[i].bItemType >= 18)
                                        {
                                            break;
                                        }
                                        if (dataByKey.astRewardDetail[i].bItemType == 4)
                                        {
                                            if (!masterRoleInfo3.IsHaveHero(dataByKey.astRewardDetail[i].dwItemID, true))
                                            {
                                                num = 0;
                                                break;
                                            }
                                            num = 1;
                                        }
                                        else if (dataByKey.astRewardDetail[i].bItemType == 11)
                                        {
                                            if (!masterRoleInfo3.IsHaveHeroSkin(dataByKey.astRewardDetail[i].dwItemID, true))
                                            {
                                                num = 0;
                                                break;
                                            }
                                            num = 1;
                                        }
                                        else if (dataByKey.astRewardDetail[i].bItemType > 0 && dataByKey.astRewardDetail[i].bItemType < 18)
                                        {
                                            num = 0;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (flag)
                {
                    string strContent = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExchangeWgt_Hero_Tips"), cUseable.m_name);
                    uiEvent.m_eventParams.taskId = 0u;
                    Singleton <CUIManager> .GetInstance().OpenMessageBoxWithCancel(strContent, enUIEventID.Activity_ExchangeHeroSkinConfirm, enUIEventID.None, uiEvent.m_eventParams, false);

                    return;
                }
                if (num == 1)
                {
                    string text = Singleton <CTextManager> .GetInstance().GetText("ExchangeWgt_Have_AllGift");

                    uiEvent.m_eventParams.taskId = 1u;
                    Singleton <CUIManager> .GetInstance().OpenMessageBoxWithCancel(text, enUIEventID.Activity_ExchangeHeroSkinConfirm, enUIEventID.None, uiEvent.m_eventParams, false);

                    return;
                }
                int maxExchangeCount = this._elementList[commonUInt32Param].phase.GetMaxExchangeCount();
                if (maxExchangeCount > 1)
                {
                    stUIEventParams par = default(stUIEventParams);
                    par.commonUInt16Param1 = (ushort)commonUInt32Param;
                    Singleton <CUIManager> .GetInstance().OpenExchangeCountSelectForm(cUseable, maxExchangeCount, enUIEventID.Activity_PtExchangeCountReady, par, this._elementList[commonUInt32Param].phase.Config.dwPointCnt, Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().JiFen);
                }
                else
                {
                    string          text2 = (cUseable == null) ? string.Empty : cUseable.m_name;
                    stUIEventParams par2  = default(stUIEventParams);
                    par2.commonUInt16Param1 = (ushort)commonUInt32Param;
                    this._elementList[commonUInt32Param].phase.SetExchangeCountOnce(1);
                    Singleton <CUIManager> .GetInstance().OpenMessageBoxWithCancel(string.Format(Singleton <CTextManager> .GetInstance().GetText("confirmExchange"), maxExchangeCount, text2), enUIEventID.Activity_PtExchangeConfirm, enUIEventID.None, par2, false);
                }
            }
        }
示例#9
0
        private void ShowNextReward(CUIEvent firstIfNull)
        {
            if (firstIfNull == null && (this._rewardShowList != null || this._rewardQueueIndex > -1))
            {
                return;
            }
            if (this._rewardShowList == null)
            {
                this._rewardQueueIndex++;
                if (this._rewardQueueIndex >= this._rewardListQueue.get_Count())
                {
                    Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Common_NewHeroOrSkinFormClose, new CUIEventManager.OnUIEventHandler(this.ShowNextReward));

                    Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Mall_Get_AWARD_CLOSE_FORM, new CUIEventManager.OnUIEventHandler(this.ShowNextReward));

                    this._rewardListQueue.Clear();
                    this._rewardQueueIndex = -1;
                    this._rewardShowIndex  = -1;
                    return;
                }
                this._rewardShowList   = this._rewardListQueue.get_Item(this._rewardQueueIndex);
                this._rewardShowIndex  = -1;
                this._rewardHasSpecial = false;
            }
            while (++this._rewardShowIndex < this._rewardShowList.usabList.get_Count() && this._rewardShowList.usabList.get_Item(this._rewardShowIndex).MapRewardType != 5 && this._rewardShowList.usabList.get_Item(this._rewardShowIndex).MapRewardType != 10 && (this._rewardShowList.usabList.get_Item(this._rewardShowIndex).MapRewardType != 1 || (this._rewardShowList.usabList.get_Item(this._rewardShowIndex).ExtraFromType != 1 && this._rewardShowList.usabList.get_Item(this._rewardShowIndex).ExtraFromType != 2)))
            {
            }
            if (this._rewardShowIndex < this._rewardShowList.usabList.get_Count())
            {
                CUseable cUseable = this._rewardShowList.usabList.get_Item(this._rewardShowIndex);
                if (cUseable.MapRewardType == 1)
                {
                    if (cUseable.ExtraFromType == 1)
                    {
                        int extraFromData = cUseable.ExtraFromData;
                        CUICommonSystem.ShowNewHeroOrSkin((uint)extraFromData, 0u, enUIEventID.None, true, 5, true, null, enFormPriority.Priority1, (uint)cUseable.m_stackCount, 0);
                    }
                    else if (cUseable.ExtraFromType == 2)
                    {
                        int extraFromData2 = cUseable.ExtraFromData;
                        CUICommonSystem.ShowNewHeroOrSkin(0u, (uint)extraFromData2, enUIEventID.None, true, 10, true, null, enFormPriority.Priority1, (uint)cUseable.m_stackCount, 0);
                    }
                }
                else if (cUseable is CHeroSkin)
                {
                    CHeroSkin cHeroSkin = cUseable as CHeroSkin;
                    CUICommonSystem.ShowNewHeroOrSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, enUIEventID.None, true, 10, true, null, enFormPriority.Priority1, 0u, 0);
                }
                else
                {
                    CUICommonSystem.ShowNewHeroOrSkin(cUseable.m_baseID, 0u, enUIEventID.None, true, 5, true, null, enFormPriority.Priority1, 0u, 0);
                }
                this._rewardHasSpecial = true;
            }
            else if (this._rewardShowList.usabList.get_Count() > 1 || !this._rewardHasSpecial)
            {
                bool flag = (this._rewardShowList.flags & 2) > 0;
                Singleton <CUIManager> .GetInstance().OpenAwardTip(LinqS.ToArray <CUseable>(this._rewardShowList.usabList), Singleton <CTextManager> .GetInstance().GetText((!flag) ? "gotAward" : "gotExtraAward"), true, enUIEventID.None, false, false, "Form_Award");

                this._rewardShowList = null;
            }
            else
            {
                this._rewardShowList = null;
                this.ShowNextReward(new CUIEvent());
            }
        }
示例#10
0
            public void Validate()
            {
                if (this.phase == null || this.uiItem == null)
                {
                    return;
                }
                this.uiItem.CustomSetActive(true);
                ResDT_Item_Info resDT_Item_Info  = null;
                ResDT_Item_Info resDT_Item_Info2 = null;
                ResDT_Item_Info stResItemInfo    = this.phase.Config.stResItemInfo;

                if (this.phase.Config.bColItemCnt > 0)
                {
                    resDT_Item_Info = this.phase.Config.astColItemInfo[0];
                }
                if (this.phase.Config.bColItemCnt > 1)
                {
                    resDT_Item_Info2 = this.phase.Config.astColItemInfo[1];
                }
                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo();

                CUseableContainer useableContainer = masterRoleInfo.GetUseableContainer(enCONTAINER_TYPE.ITEM);

                if (useableContainer == null)
                {
                    return;
                }
                int arg_CB_0 = (resDT_Item_Info == null) ? 0 : useableContainer.GetUseableStackCount((COM_ITEM_TYPE)resDT_Item_Info.wItemType, resDT_Item_Info.dwItemID);
                int arg_EC_0 = (resDT_Item_Info2 == null) ? 0 : useableContainer.GetUseableStackCount((COM_ITEM_TYPE)resDT_Item_Info2.wItemType, resDT_Item_Info2.dwItemID);

                if (stResItemInfo != null)
                {
                    GameObject gameObject = this.uiItem.transform.FindChild("DuihuanBtn").gameObject;
                    gameObject.GetComponent <CUIEventScript>().m_onClickEventParams.commonUInt32Param1 = (uint)this.index;
                    bool isEnable = this.owner.view.activity.timeState == Activity.TimeState.Going;
                    CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), isEnable, true);
                    if (resDT_Item_Info != null)
                    {
                        CUseable   itemUseable = CUseableManager.CreateUseable((COM_ITEM_TYPE)resDT_Item_Info.wItemType, resDT_Item_Info.dwItemID, 1);
                        GameObject gameObject2 = this.uiItem.transform.FindChild("Panel/ItemCell1").gameObject;
                        CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject2, itemUseable, true, false, false, false);
                        int    useableStackCount = useableContainer.GetUseableStackCount((COM_ITEM_TYPE)resDT_Item_Info.wItemType, resDT_Item_Info.dwItemID);
                        ushort wItemCnt          = resDT_Item_Info.wItemCnt;
                        Text   component         = this.uiItem.transform.FindChild("Panel/ItemCell1/ItemCount").gameObject.GetComponent <Text>();
                        if (useableStackCount < (int)wItemCnt)
                        {
                            component.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemNotEnoughCount"), useableStackCount, wItemCnt));
                            CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), false, true);
                        }
                        else
                        {
                            component.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemCount"), useableStackCount, wItemCnt));
                        }
                    }
                    if (resDT_Item_Info2 != null)
                    {
                        CUseable   itemUseable2 = CUseableManager.CreateUseable((COM_ITEM_TYPE)resDT_Item_Info2.wItemType, resDT_Item_Info2.dwItemID, 1);
                        GameObject gameObject3  = this.uiItem.transform.FindChild("Panel/ItemCell2").gameObject;
                        gameObject3.CustomSetActive(true);
                        CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject3, itemUseable2, true, false, false, false);
                        int    useableStackCount2 = useableContainer.GetUseableStackCount((COM_ITEM_TYPE)resDT_Item_Info2.wItemType, resDT_Item_Info2.dwItemID);
                        ushort wItemCnt2          = resDT_Item_Info2.wItemCnt;
                        Text   component2         = this.uiItem.transform.FindChild("Panel/ItemCell2/ItemCount").gameObject.GetComponent <Text>();
                        if (useableStackCount2 < (int)wItemCnt2)
                        {
                            component2.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemNotEnoughCount"), useableStackCount2, wItemCnt2));
                            CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), false, true);
                        }
                        else
                        {
                            component2.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemCount"), useableStackCount2, wItemCnt2));
                        }
                    }
                    else
                    {
                        GameObject gameObject4 = this.uiItem.transform.FindChild("Panel/ItemCell2").gameObject;
                        gameObject4.CustomSetActive(false);
                        GameObject gameObject5 = this.uiItem.transform.FindChild("Panel/Add").gameObject;
                        gameObject5.CustomSetActive(false);
                    }
                    CUseable   cUseable    = CUseableManager.CreateUseable((COM_ITEM_TYPE)stResItemInfo.wItemType, stResItemInfo.dwItemID, (int)stResItemInfo.wItemCnt);
                    GameObject gameObject6 = this.uiItem.transform.FindChild("Panel/GetItemCell").gameObject;
                    bool       bActive     = false;
                    if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                    {
                        CHeroItem cHeroItem = (CHeroItem)cUseable;
                        if (cHeroItem != null)
                        {
                            CRoleInfo masterRoleInfo2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo2 != null)
                            {
                                bActive = masterRoleInfo2.IsHaveHero(cHeroItem.m_baseID, true);
                            }
                        }
                    }
                    else if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                    {
                        CHeroSkin cHeroSkin = (CHeroSkin)cUseable;
                        if (cHeroSkin != null)
                        {
                            CRoleInfo masterRoleInfo3 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo3 != null)
                            {
                                bActive = masterRoleInfo3.IsHaveHeroSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, false);
                            }
                        }
                    }
                    Transform transform = this.uiItem.transform.FindChild("Panel/GetItemCell/HaveItemFlag");
                    if (transform != null && transform.gameObject != null)
                    {
                        transform.gameObject.CustomSetActive(bActive);
                    }
                    if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem cItem = cUseable as CItem;
                        if (cItem != null && cItem.m_itemData.bIsView > 0)
                        {
                            CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject6, cUseable, true, false, false, true);
                        }
                        else
                        {
                            CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject6, cUseable, true, false, false, false);
                            if (gameObject6 != null)
                            {
                                CUIEventScript component3 = gameObject6.GetComponent <CUIEventScript>();
                                if (component3 != null)
                                {
                                    component3.SetUIEvent(enUIEventType.Click, enUIEventID.None);
                                }
                            }
                        }
                    }
                    else
                    {
                        CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject6, cUseable, true, false, false, false);
                        if (gameObject6 != null)
                        {
                            CUIEventScript component4 = gameObject6.GetComponent <CUIEventScript>();
                            if (component4 != null)
                            {
                                component4.SetUIEvent(enUIEventType.Click, enUIEventID.None);
                            }
                        }
                    }
                    ExchangeActivity exchangeActivity = this.owner.view.activity as ExchangeActivity;
                    if (exchangeActivity != null)
                    {
                        GameObject gameObject7      = this.uiItem.transform.FindChild("ExchangeCount").gameObject;
                        uint       maxExchangeCount = exchangeActivity.GetMaxExchangeCount((int)this.phase.Config.bIdx);
                        uint       exchangeCount    = exchangeActivity.GetExchangeCount((int)this.phase.Config.bIdx);
                        if (maxExchangeCount > 0u)
                        {
                            gameObject7.CustomSetActive(true);
                            gameObject7.GetComponent <Text>().set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_TimeLimit"), exchangeCount, maxExchangeCount));
                            if (exchangeCount >= maxExchangeCount)
                            {
                                CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), false, true);
                            }
                        }
                        else
                        {
                            gameObject7.CustomSetActive(false);
                        }
                    }
                }
            }
        private void UpdateElement(CUIListElementScript elementScript, CUseable useable, bool isShowBigIcon)
        {
            CUIFormScript belongedFormScript = elementScript.m_belongedFormScript;
            GameObject    widget             = elementScript.GetWidget(0);
            GameObject    widget2            = elementScript.GetWidget(1);
            GameObject    widget3            = elementScript.GetWidget(2);

            if (useable.m_type != COM_ITEM_TYPE.COM_OBJTYPE_HERO && useable.m_type != COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
            {
                isShowBigIcon = false;
            }
            if (!isShowBigIcon)
            {
                widget.CustomSetActive(true);
                widget2.CustomSetActive(false);
                if (useable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                {
                    CHeroItem cHeroItem = useable as CHeroItem;
                    if (cHeroItem == null)
                    {
                        return;
                    }
                    CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                    if (masterRoleInfo != null && masterRoleInfo.IsOwnHero(cHeroItem.m_heroData.dwCfgID))
                    {
                        widget3.CustomSetActive(true);
                    }
                    else
                    {
                        widget3.CustomSetActive(false);
                    }
                }
                else if (useable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                {
                    CHeroSkin cHeroSkin = useable as CHeroSkin;
                    if (cHeroSkin == null)
                    {
                        return;
                    }
                    CRoleInfo masterRoleInfo2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                    if (masterRoleInfo2 != null && masterRoleInfo2.IsHaveHeroSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, false))
                    {
                        widget3.CustomSetActive(true);
                    }
                    else
                    {
                        widget3.CustomSetActive(false);
                    }
                }
                else
                {
                    widget3.CustomSetActive(false);
                }
                CUICommonSystem.SetItemCell(elementScript.m_belongedFormScript, elementScript.GetWidget(0), useable, true, false, false, false);
            }
            else
            {
                widget.CustomSetActive(false);
                widget2.CustomSetActive(true);
                Image      componetInChild = Utility.GetComponetInChild <Image>(widget2, "imageIcon");
                GameObject gameObject      = Utility.FindChild(widget2, "skinLabelImage");
                GameObject gameObject2     = Utility.FindChild(widget2, "nameContainer/heroNameText");
                Text       component       = gameObject2.GetComponent <Text>();
                GameObject gameObject3     = Utility.FindChild(widget2, "nameContainer/heroSkinText");
                Text       component2      = gameObject3.GetComponent <Text>();
                if (useable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                {
                    CHeroItem cHeroItem2 = useable as CHeroItem;
                    if (cHeroItem2 == null)
                    {
                        return;
                    }
                    CRoleInfo masterRoleInfo3 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                    if (masterRoleInfo3 != null && masterRoleInfo3.IsOwnHero(cHeroItem2.m_heroData.dwCfgID))
                    {
                        widget3.CustomSetActive(true);
                    }
                    else
                    {
                        widget3.CustomSetActive(false);
                    }
                    string prefabPath = CUIUtility.s_Sprite_Dynamic_BustHero_Dir + cHeroItem2.m_iconID;
                    componetInChild.SetSprite(prefabPath, belongedFormScript, false, true, true, true);
                    gameObject2.CustomSetActive(true);
                    component.set_text(useable.m_name);
                    gameObject.CustomSetActive(false);
                    gameObject3.CustomSetActive(false);
                }
                else if (useable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                {
                    CHeroSkin cHeroSkin2 = useable as CHeroSkin;
                    if (cHeroSkin2 == null)
                    {
                        return;
                    }
                    IHeroData heroData        = CHeroDataFactory.CreateHeroData(cHeroSkin2.m_heroId);
                    CRoleInfo masterRoleInfo4 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                    if (masterRoleInfo4 != null && masterRoleInfo4.IsHaveHeroSkin(cHeroSkin2.m_heroId, cHeroSkin2.m_skinId, false))
                    {
                        widget3.CustomSetActive(true);
                    }
                    else
                    {
                        widget3.CustomSetActive(false);
                    }
                    string prefabPath2 = CUIUtility.s_Sprite_Dynamic_BustHero_Dir + cHeroSkin2.m_iconID;
                    componetInChild.SetSprite(prefabPath2, belongedFormScript, false, true, true, true);
                    gameObject2.CustomSetActive(true);
                    component.set_text(heroData.heroName);
                    gameObject.CustomSetActive(true);
                    CUICommonSystem.SetHeroSkinLabelPic(belongedFormScript, gameObject, cHeroSkin2.m_heroId, cHeroSkin2.m_skinId);
                    gameObject3.CustomSetActive(true);
                    component2.set_text(useable.m_name);
                }
            }
        }
        public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, BuyPickDialog.OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, BuyPickDialog.OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null, bool bfromFactoyShop = false)
        {
            this.m_bShowBigIcon = (callContext != null && callContext.GetSpecialIconPath() != null);
            CUIFormScript cUIFormScript;

            if (this.m_bShowBigIcon)
            {
                cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(BuyPickDialog.s_Gift_Big_Icon_Form_Path, false, true);
            }
            else
            {
                cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(BuyPickDialog.s_Gift_Form_Path, false, true);
            }
            if (null != cUIFormScript)
            {
                this._root                 = cUIFormScript.gameObject;
                this._usb                  = CUseableManager.CreateUseable(type, id, 0);
                this._count                = 1u;
                this._bHeroSkinGift        = false;
                this._bDynamicCorrectPrice = false;
                this._heroSkinGiftCost     = 0u;
                this._maxCount             = maxCount;
                if (this._maxCount == 0u)
                {
                    this._maxCount = 999u;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._realDiscount     = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc");
                    CItem cItem = new CItem(0uL, id, 0, 0);
                    uint  key   = (uint)cItem.m_itemData.EftParam[0];
                    ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(key);
                    ListView <CUseable>  listView  = new ListView <CUseable>();
                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                    {
                        if (dataByKey.astRewardDetail[i].bItemType != 0)
                        {
                            CUseable cUseable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID);
                            if (cUseable != null)
                            {
                                listView.Add(cUseable);
                            }
                        }
                    }
                    if (this._descText != null)
                    {
                        this._descText.set_text(string.IsNullOrEmpty(cItem.m_mallDescription) ? cItem.m_description : cItem.m_mallDescription);
                    }
                    uint num  = 0u;
                    int  num2 = 0;
                    if (this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem cItem2 = (CItem)this._usb;
                        if (cItem2 != null && cItem2.m_itemData != null && cItem2.m_itemData.bType == 4)
                        {
                            this._bDynamicCorrectPrice = (cItem2.m_itemData.EftParam[3] > 0f);
                        }
                    }
                    CUIListScript componetInChild = Utility.GetComponetInChild <CUIListScript>(cUIFormScript.gameObject, "Panel/itemGroup");
                    componetInChild.SetElementAmount(listView.Count);
                    for (int j = 0; j < listView.Count; j++)
                    {
                        CUIListElementScript elemenet = componetInChild.GetElemenet(j);
                        this.UpdateElement(elemenet, listView[j], this.m_bShowBigIcon);
                        if (listView[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                        {
                            this._bHeroSkinGift = true;
                            CHeroItem cHeroItem      = listView[j] as CHeroItem;
                            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo != null && masterRoleInfo.IsOwnHero(cHeroItem.m_heroData.dwCfgID))
                            {
                                num += CHeroInfo.GetHeroCost(cHeroItem.m_heroData.dwCfgID, coinType);
                                num2++;
                            }
                        }
                        else if (listView[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                        {
                            this._bHeroSkinGift = true;
                            CHeroSkin cHeroSkin       = listView[j] as CHeroSkin;
                            CRoleInfo masterRoleInfo2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo2 != null && masterRoleInfo2.IsHaveHeroSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, false))
                            {
                                num += CSkinInfo.GetHeroSkinCost(cHeroSkin.m_heroId, cHeroSkin.m_skinId, coinType);
                                num2++;
                            }
                        }
                    }
                    this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0);
                    if (this._coinUsb != null)
                    {
                        Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false), false);
                    }
                    Text componetInChild2 = Utility.GetComponetInChild <Text>(this._root, "Panel/costDescText");
                    componetInChild2.set_text(string.Empty);
                    if (this._bHeroSkinGift && this._bDynamicCorrectPrice)
                    {
                        uint   buyPrice         = this._usb.GetBuyPrice(coinType);
                        Button componetInChild3 = Utility.GetComponetInChild <Button>(this._root, "Panel/Button_Sale");
                        if (num2 >= listView.Count)
                        {
                            CUICommonSystem.SetButtonEnableWithShader(componetInChild3, false, true);
                            componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Gift_Can_Not_Buy_Tip"));
                            this._heroSkinGiftCost = 0u;
                        }
                        else
                        {
                            CUICommonSystem.SetButtonEnableWithShader(componetInChild3, true, true);
                            componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Gift_Own_Hero_Skin_Tip"));
                            uint num3 = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(buyPrice - num, this._realDiscount);
                            if (buyPrice >= num && num3 >= buyPrice / 10u)
                            {
                                this._heroSkinGiftCost = num3;
                            }
                            else
                            {
                                this._heroSkinGiftCost = buyPrice / 10u;
                            }
                        }
                        if (this._callContext != null)
                        {
                            this._callContext.m_bChangeGiftPrice = true;
                            this._callContext.m_newGiftPrice     = this._heroSkinGiftCost;
                        }
                    }
                }
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_CloseForm, new CUIEventManager.OnUIEventHandler(this.OnCloseForm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_ConfirmFactoryShopBuy, new CUIEventManager.OnUIEventHandler(this.OnConfirmFactoryShopBuy));

                this.ValidateDynamic();
            }
        }
示例#13
0
        public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, uint discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
        {
            CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm(s_Gift_Form_Path, false, true);

            if (null != formScript)
            {
                this._root     = formScript.gameObject;
                this._usb      = CUseableManager.CreateUseable(type, id, 0);
                this._count    = 1;
                this._maxCount = maxCount;
                if (this._maxCount == 0)
                {
                    this._maxCount = 0x3e7;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._discount         = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc");
                    CItem item = new CItem(0L, id, 0, 0);
                    uint  key  = (uint)item.m_itemData.EftParam[0];
                    ResRandomRewardStore dataByKey = GameDataMgr.randowmRewardDB.GetDataByKey(key);
                    ListView <CUseable>  view      = new ListView <CUseable>();
                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                    {
                        if (dataByKey.astRewardDetail[i].bItemType != 0)
                        {
                            CUseable useable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID);
                            if (useable != null)
                            {
                                view.Add(useable);
                            }
                        }
                    }
                    if (this._descText != null)
                    {
                        this._descText.text = item.m_description;
                    }
                    for (int j = 0; j < 10; j++)
                    {
                        GameObject gameObject = this._root.transform.Find("Panel/itemGroup/itemCell" + j).gameObject;
                        if (j < view.Count)
                        {
                            gameObject.CustomSetActive(true);
                            CUICommonSystem.SetItemCell(formScript, gameObject, view[j], true, false);
                            Transform transform = gameObject.transform.Find("HaveItemFlag");
                            transform.gameObject.CustomSetActive(false);
                            if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                            {
                                CHeroItem item2          = view[j] as CHeroItem;
                                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((masterRoleInfo != null) && masterRoleInfo.IsOwnHero(item2.m_heroData.dwCfgID))
                                {
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                            else if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                            {
                                CHeroSkin skin  = view[j] as CHeroSkin;
                                CRoleInfo info2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((info2 != null) && info2.IsHaveHeroSkin(skin.m_heroId, skin.m_skinId, false))
                                {
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                        }
                        else
                        {
                            gameObject.CustomSetActive(false);
                        }
                    }
                    this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0);
                    if (this._coinUsb != null)
                    {
                        Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false));
                    }
                }
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel));

                this.ValidateDynamic();
            }
        }