Esempio n. 1
0
        public GameObject GetGuideItem()
        {
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(s_bagFormPath);

            if (form == null)
            {
                return(null);
            }
            CUseableContainer selectUseableContainer = this.m_selectUseableContainer;

            for (int i = 0; i < selectUseableContainer.GetCurUseableCount(); i++)
            {
                CUseable useableByIndex = selectUseableContainer.GetUseableByIndex(i);
                if (useableByIndex.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                {
                    CItem item = useableByIndex as CItem;
                    if ((item.m_itemData.bClass == 1) && (item.m_itemData.bType == 1))
                    {
                        CUIListScript component = form.gameObject.transform.Find("Panel_Right/List").gameObject.GetComponent <CUIListScript>();
                        if (component.GetElementAmount() > i)
                        {
                            return(component.GetElemenet(i).gameObject.transform.Find("itemCell").gameObject);
                        }
                    }
                }
            }
            return(null);
        }
Esempio n. 2
0
        private int GetNameChangeHaveItemCount(RES_CHANGE_NAME_TYPE changeType)
        {
            int       num            = 0;
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

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

            if (useableContainer != null)
            {
                int curUseableCount = useableContainer.GetCurUseableCount();
                for (int i = 0; i < curUseableCount; i++)
                {
                    CUseable useableByIndex = useableContainer.GetUseableByIndex(i);
                    if (useableByIndex != null && useableByIndex.m_type == 2)
                    {
                        if (changeType == 1 && CItem.IsPlayerNameChangeCard(useableByIndex.m_baseID))
                        {
                            num += useableByIndex.m_stackCount;
                        }
                        else if (changeType == 2 && CItem.IsGuildNameChangeCard(useableByIndex.m_baseID))
                        {
                            num += useableByIndex.m_stackCount;
                        }
                    }
                }
            }
            return(num);
        }
Esempio n. 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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        private bool CheckNameChangeCard(CItem item)
        {
            if (item.m_itemData.bType == 1)
            {
                if (CItem.IsPlayerNameChangeCard(item.m_baseID))
                {
                    Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.NameChange_OpenPlayerNameChangeForm);

                    return(true);
                }
                if (CItem.IsGuildNameChangeCard(item.m_baseID))
                {
                    if (CGuildSystem.HasGuildNameChangeAuthority())
                    {
                        Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.NameChange_OpenGuildNameChangeForm);
                    }
                    else
                    {
                        Singleton <CUIManager> .GetInstance().OpenTips("NameChange_GuildOnlyChairman", true, 1f, null, new object[0]);
                    }
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 6
0
        private void PlayItemUseAnimation(CUseable item, int itemCount)
        {
            if (item != null)
            {
                CItem item2 = (CItem)item;
                if (item2 != null)
                {
                    if ((item2.m_itemData.bType == 4) && (item2.m_itemData.EftParam[2] != 0f))
                    {
                        CUIFormScript script = Singleton <CUIManager> .GetInstance().OpenForm(s_openAwardpFormPath, false, true);

                        if (script != null)
                        {
                            CUITimerScript component = script.transform.Find("Timer").GetComponent <CUITimerScript>();
                            component.m_eventParams[1].iconUseable = item;
                            component.m_eventParams[1].tag         = itemCount;
                            component.EndTimer();
                            component.StartTimer();
                        }
                    }
                    else if (!this.CheckNameChangeCard(item2))
                    {
                        SendItemUseMsgToServer(item.m_objID, 0, itemCount);
                    }
                }
            }
        }
Esempio n. 7
0
 public static void Show(COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, OnConfirmBuyDelegate onClose, CMallFactoryShopController.ShopProduct callContext = null, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
 {
     if (s_theDlg == null)
     {
         if (type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
         {
             CItem item = new CItem(0L, id, 0, 0);
             if (item.m_itemData.bIsView != 0)
             {
                 s_theDlg = new BuyPickDialog(true, type, id, coinType, discount, maxCount, onClose, callContext, onConfirmCommon, uieventPars);
             }
             else
             {
                 s_theDlg = new BuyPickDialog(type, id, coinType, discount, maxCount, onClose, callContext, onConfirmCommon, uieventPars);
             }
         }
         else
         {
             s_theDlg = new BuyPickDialog(type, id, coinType, discount, maxCount, onClose, callContext, onConfirmCommon, uieventPars);
         }
         if (s_theDlg._root == null)
         {
             s_theDlg = null;
         }
     }
 }
Esempio n. 8
0
        private void OnBag_UseForm_CountMax(CUIEvent uiEvent)
        {
            Text  component     = uiEvent.m_srcFormScript.gameObject.transform.Find("Panel_Left/lblCount1").GetComponent <Text>();
            CItem selectUseable = this.m_selectUseable as CItem;
            int   wBatchUseCnt  = 1;

            if (((selectUseable != null) && (selectUseable.m_itemData != null)) && ((selectUseable.m_itemData.wBatchUseCnt > 0) && (selectUseable.m_itemData.wBatchUseCnt <= this.m_selectUseable.GetSalableCount())))
            {
                wBatchUseCnt = selectUseable.m_itemData.wBatchUseCnt;
            }
            else
            {
                wBatchUseCnt = this.m_selectUseable.GetSalableCount();
            }
            this.m_useCount = wBatchUseCnt;
            component.text  = this.m_useCount + "/" + wBatchUseCnt;
        }
Esempio n. 9
0
 private void ComputeSortItemValue()
 {
     for (int i = 0; i < this.m_useableList.get_Count(); i++)
     {
         if (this.m_useableList.get_Item(i) != null)
         {
             CUseable cUseable = this.m_useableList.get_Item(i);
             cUseable.m_itemSortNum  = 0uL;
             cUseable.m_itemSortNum += (ulong)((9 - cUseable.m_type) * 100000000000L);
             if (cUseable.m_type == 2)
             {
                 CItem cItem = cUseable as CItem;
                 cUseable.m_itemSortNum += (4uL - (ulong)cItem.m_itemData.bType) * 10000000000uL;
             }
             cUseable.m_itemSortNum += cUseable.m_getTime * 1uL;
             if (cUseable.m_itemSortNum >= 18446744073709551615uL || cUseable.m_itemSortNum <= 0uL)
             {
                 cUseable.m_itemSortNum = 0uL;
             }
         }
     }
 }
Esempio n. 10
0
 private void ComputeSortItemValue()
 {
     for (int i = 0; i < this.m_useableList.Count; i++)
     {
         if (this.m_useableList[i] != null)
         {
             CUseable cUseable = this.m_useableList[i];
             cUseable.m_itemSortNum  = 0uL;
             cUseable.m_itemSortNum += (ulong)((long)(COM_ITEM_TYPE.COM_OBJTYPE_MAX - cUseable.m_type) * 100000000000L);
             if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
             {
                 CItem cItem = cUseable as CItem;
                 cUseable.m_itemSortNum += (4uL - (ulong)cItem.m_itemData.bType) * 10000000000uL;
             }
             cUseable.m_itemSortNum += cUseable.m_getTime * 1uL;
             if (cUseable.m_itemSortNum >= 18446744073709551615uL || cUseable.m_itemSortNum <= 0uL)
             {
                 cUseable.m_itemSortNum = 0uL;
             }
         }
     }
 }
Esempio n. 11
0
 private void ComputeSortItemValue()
 {
     for (int i = 0; i < this.m_useableList.Count; i++)
     {
         if (this.m_useableList[i] != null)
         {
             CUseable useable = this.m_useableList[i];
             useable.m_itemSortNum  = 0L;
             useable.m_itemSortNum += (ulong)((9 - useable.m_type) * 0x174876e800L);
             if (useable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
             {
                 CItem item = useable as CItem;
                 useable.m_itemSortNum += (4L - item.m_itemData.bType) * ((ulong)0x2540be400L);
             }
             useable.m_itemSortNum += useable.m_getTime * ((ulong)1L);
             if ((useable.m_itemSortNum >= ulong.MaxValue) || (useable.m_itemSortNum <= 0L))
             {
                 useable.m_itemSortNum = 0L;
             }
         }
     }
 }
        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);
                }
            }
        }
Esempio n. 13
0
        private void SetItem(CUseable usable, GameObject uiNode, bool received, bool ready, uint vipLv)
        {
            SevenDayCheckHelper component = uiNode.GetComponent <SevenDayCheckHelper>();
            Image component2 = component.Icon.GetComponent <Image>();

            CUIUtility.SetImageSprite(component2, usable.GetIconPath(), this._form, true, false, false, false);
            component.ItemName.GetComponent <Text>().text = usable.m_name;
            if (vipLv > 0u)
            {
                component.NobeRoot.CustomSetActive(true);
                MonoSingleton <NobeSys> .GetInstance().SetNobeIcon(component.Nobe.GetComponent <Image>(), (int)vipLv, false);
            }
            else
            {
                component.NobeRoot.CustomSetActive(false);
            }
            if (usable.m_type == 4 || usable.m_type == 7 || (usable.m_type == 2 && CItem.IsHeroExperienceCard(usable.m_baseID)) || (usable.m_type == 2 && CItem.IsSkinExChangeCoupons(usable.m_baseID)))
            {
                component.IconBg.CustomSetActive(true);
            }
            else
            {
                component.IconBg.CustomSetActive(false);
            }
            Transform transform = component.Tiyan.transform;

            if (transform != null)
            {
                if (usable.m_type == 2 && CItem.IsHeroExperienceCard(usable.m_baseID))
                {
                    transform.gameObject.CustomSetActive(true);
                    transform.GetComponent <Image>().SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.HeroExperienceCardMarkPath, false, false), false);
                }
                else if (usable.m_type == 2 && CItem.IsSkinExperienceCard(usable.m_baseID))
                {
                    transform.gameObject.CustomSetActive(true);
                    transform.GetComponent <Image>().SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.SkinExperienceCardMarkPath, false, false), false);
                }
                else
                {
                    transform.gameObject.CustomSetActive(false);
                }
            }
            Transform transform2 = component.ItemNumText.transform;

            if (transform2 != null)
            {
                Text component3 = transform2.GetComponent <Text>();
                if (usable.m_stackCount < 10000)
                {
                    component3.text = usable.m_stackCount.ToString();
                }
                else
                {
                    component3.text = usable.m_stackCount / 10000 + "万";
                }
                CUICommonSystem.AppendMultipleText(component3, usable.m_stackMulti);
                if (usable.m_stackCount <= 1)
                {
                    component3.gameObject.CustomSetActive(false);
                    component.ItemNum.CustomSetActive(false);
                }
                else
                {
                    component.ItemNum.CustomSetActive(true);
                    component.ItemNumText.CustomSetActive(true);
                }
                if (usable.m_type == 5)
                {
                    if (((CSymbolItem)usable).IsGuildSymbol())
                    {
                        component3.text = string.Empty;
                    }
                    else
                    {
                        component3.text = usable.GetSalableCount().ToString();
                    }
                }
            }
            if (received)
            {
                component.GrayMask.CustomSetActive(true);
            }
            else
            {
                component.GrayMask.CustomSetActive(false);
            }
            if (ready)
            {
                component.Effect.CustomSetActive(true);
            }
            else
            {
                component.Effect.CustomSetActive(false);
            }
            CUIEventScript  component4  = uiNode.GetComponent <CUIEventScript>();
            stUIEventParams eventParams = new stUIEventParams
            {
                iconUseable = usable
            };

            component4.SetUIEvent(enUIEventType.Down, enUIEventID.Tips_ItemInfoOpen, eventParams);
            component4.SetUIEvent(enUIEventType.HoldEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
            component4.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemInfoClose, eventParams);
            component4.SetUIEvent(enUIEventType.DragEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
        }
            public void Validate()
            {
                if (this.actvPhase.Target > 0)
                {
                    this.tips.gameObject.SetActive(true);
                    this.tips.set_text(this.actvPhase.Tips);
                }
                else
                {
                    this.tips.gameObject.SetActive(false);
                }
                if (this.actvPhase.Marked)
                {
                    this.flag.gameObject.SetActive(true);
                    this.getBtn.SetActive(false);
                }
                else
                {
                    this.flag.gameObject.SetActive(false);
                    this.getBtn.SetActive(true);
                    if (this.actvPhase.ReadyForGet)
                    {
                        this.getBtn.GetComponent <CUIEventScript>().enabled = true;
                        this.getBtn.GetComponent <Button>().set_interactable(true);
                        this.getBtn.GetComponent <Image>().SetSprite((this.ownerWgt.view.form as CampaignForm).GetDynamicImage(CampaignForm.DynamicAssets.ButtonYellowImage));
                        this.getBtnTxt.set_text(Singleton <CTextManager> .GetInstance().GetText("get"));
                        this.getBtnTxt.set_color(Color.white);
                    }
                    else
                    {
                        this.getBtn.GetComponent <Image>().SetSprite((this.ownerWgt.view.form as CampaignForm).GetDynamicImage(CampaignForm.DynamicAssets.ButtonBlueImage));
                        if (this.actvPhase.AchieveStateValid)
                        {
                            this.getBtn.GetComponent <CUIEventScript>().enabled = true;
                            this.getBtn.GetComponent <Button>().set_interactable(true);
                            this.getBtnTxt.set_text(Singleton <CTextManager> .GetInstance().GetText("gotoFinish"));
                            this.getBtnTxt.set_color(Color.white);
                        }
                        else
                        {
                            this.getBtn.GetComponent <CUIEventScript>().enabled = false;
                            this.getBtn.GetComponent <Button>().set_interactable(false);
                            this.getBtnTxt.set_text(Singleton <CTextManager> .GetInstance().GetText((this.actvPhase.timeState == ActivityPhase.TimeState.Closed) ? "outOfTime" : "notInTime"));
                            this.getBtnTxt.set_color(Color.gray);
                        }
                    }
                }
                int num = 0;

                for (int i = 0; i < this.cellList.Length; i++)
                {
                    GameObject gameObject = this.cellList[i];
                    CUseable   cUseable   = this.actvPhase.GetUseable(i);
                    if (cUseable != null)
                    {
                        gameObject.CustomSetActive(true);
                        cUseable.m_stackMulti = (int)this.actvPhase.MultipleTimes;
                        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.ownerWgt.view.form.formScript, gameObject, cUseable, true, false, false, true);
                            }
                            else
                            {
                                CUICommonSystem.SetItemCell(this.ownerWgt.view.form.formScript, gameObject, cUseable, true, false, false, false);
                                if (gameObject != null)
                                {
                                    CUIEventScript component = gameObject.GetComponent <CUIEventScript>();
                                    if (component != null)
                                    {
                                        component.SetUIEvent(enUIEventType.Click, enUIEventID.None);
                                    }
                                }
                            }
                        }
                        else
                        {
                            CUICommonSystem.SetItemCell(this.ownerWgt.view.form.formScript, gameObject, cUseable, true, false, false, false);
                            if (gameObject != null)
                            {
                                CUIEventScript component2 = gameObject.GetComponent <CUIEventScript>();
                                if (component2 != null)
                                {
                                    component2.SetUIEvent(enUIEventType.Click, enUIEventID.None);
                                }
                            }
                        }
                        num++;
                    }
                    else
                    {
                        cUseable = this.actvPhase.GetExtraUseable(i - num);
                        if (cUseable != null)
                        {
                            gameObject.CustomSetActive(true);
                            CUICommonSystem.SetItemCell(this.ownerWgt.view.form.formScript, gameObject, cUseable, true, false, false, false);
                        }
                        else
                        {
                            gameObject.CustomSetActive(false);
                        }
                    }
                    if (cUseable != null)
                    {
                        GameObject gameObject2 = Utility.FindChild(gameObject, "flag");
                        if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                        {
                            gameObject2.CustomSetActive(true);
                            Utility.GetComponetInChild <Text>(gameObject2, "Text").set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Hero_Buy_Tab"));
                        }
                        else if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                        {
                            gameObject2.CustomSetActive(true);
                            Utility.GetComponetInChild <Text>(gameObject2, "Text").set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Skin_Buy_Tab"));
                        }
                        else
                        {
                            gameObject2.CustomSetActive(false);
                        }
                    }
                }
            }
        private void SetLeftItem(CUseable usable, Transform uiNode, bool received, bool ready, uint vipLv, int elemIdx)
        {
            Transform transform = uiNode.transform.FindChild("ItemIcon");

            if (transform != null)
            {
                CUIUtility.SetImageSprite(transform.GetComponent <Image>(), usable.GetIconPath(), this._form, true, false, false, false);
            }
            Transform transform2 = uiNode.transform.FindChild("GotCeck");

            if (transform2)
            {
                if (received)
                {
                    transform2.gameObject.CustomSetActive(true);
                }
                else
                {
                    transform2.gameObject.CustomSetActive(false);
                }
            }
            Transform transform3 = uiNode.transform.FindChild("TiyanMask");

            if (transform3 != null)
            {
                if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsHeroExperienceCard(usable.m_baseID))
                {
                    transform3.gameObject.CustomSetActive(true);
                    transform3.GetComponent <Image>().SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.HeroExperienceCardMarkPath, false, false), false);
                }
                else if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsSkinExperienceCard(usable.m_baseID))
                {
                    transform3.gameObject.CustomSetActive(true);
                    transform3.GetComponent <Image>().SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.SkinExperienceCardMarkPath, false, false), false);
                }
                else
                {
                    transform3.gameObject.CustomSetActive(false);
                }
            }
            Transform transform4 = uiNode.transform.FindChild("Bg");

            if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO || usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN || (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsHeroExperienceCard(usable.m_baseID)) || (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsSkinExChangeCoupons(usable.m_baseID)))
            {
                if (transform4)
                {
                    transform4.gameObject.CustomSetActive(true);
                }
            }
            else if (transform4)
            {
                transform4.gameObject.CustomSetActive(false);
            }
            Transform transform5 = uiNode.transform.FindChild("Name");

            if (transform5 != null)
            {
                transform5.GetComponent <Text>().set_text(usable.m_name);
            }
            Transform transform6 = uiNode.transform.FindChild("Num");

            if (transform6)
            {
                transform6.GetComponent <Text>().set_text((elemIdx + 1).ToString());
            }
            CUIEventScript  component   = uiNode.GetComponent <CUIEventScript>();
            stUIEventParams eventParams = new stUIEventParams
            {
                iconUseable = usable
            };

            component.SetUIEvent(enUIEventType.Down, enUIEventID.Tips_ItemInfoOpen, eventParams);
            component.SetUIEvent(enUIEventType.HoldEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
            component.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemInfoClose, eventParams);
            component.SetUIEvent(enUIEventType.DragEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
        }
Esempio n. 16
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();
            }
        }
Esempio n. 17
0
        private CUseableContainer GetContainerBySelectType(CUseableContainer allContainer)
        {
            CUseableContainer container = allContainer;
            int      curUseableCount    = allContainer.GetCurUseableCount();
            CUseable useableByIndex     = null;

            if (this.m_selectUseableType == enItemMenuType.All)
            {
                this.m_ContainerAll.Clear();
                for (int j = 0; j < curUseableCount; j++)
                {
                    useableByIndex = allContainer.GetUseableByIndex(j);
                    if ((useableByIndex.m_type != COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL) || (useableByIndex.GetSalableCount() > 0))
                    {
                        this.m_ContainerAll.Add(useableByIndex);
                    }
                }
                return(this.m_ContainerAll);
            }
            if (this.m_selectUseableType == enItemMenuType.Item)
            {
                this.m_ContainerItem.Clear();
                for (int k = 0; k < curUseableCount; k++)
                {
                    useableByIndex = allContainer.GetUseableByIndex(k);
                    if (useableByIndex.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem useable = (CItem)useableByIndex;
                        if ((useable.m_itemData.bClass == 1) && (useable.m_itemData.bType != 4))
                        {
                            this.m_ContainerItem.Add(useable);
                        }
                    }
                }
                return(this.m_ContainerItem);
            }
            if (this.m_selectUseableType == enItemMenuType.Gift)
            {
                this.m_ContainerGift.Clear();
                for (int m = 0; m < curUseableCount; m++)
                {
                    useableByIndex = allContainer.GetUseableByIndex(m);
                    if (useableByIndex.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem item2 = (CItem)useableByIndex;
                        if ((item2.m_itemData.bClass == 1) && (item2.m_itemData.bType == 4))
                        {
                            this.m_ContainerGift.Add(item2);
                        }
                    }
                }
                return(this.m_ContainerGift);
            }
            if (this.m_selectUseableType != enItemMenuType.Symbol)
            {
                return(container);
            }
            this.m_ContainerSymbol.Clear();
            for (int i = 0; i < curUseableCount; i++)
            {
                useableByIndex = allContainer.GetUseableByIndex(i);
                if ((useableByIndex.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL) && (useableByIndex.GetSalableCount() > 0))
                {
                    this.m_ContainerSymbol.Add(useableByIndex);
                }
            }
            return(this.m_ContainerSymbol);
        }
            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);
                }
            }
        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();
            }
        }
Esempio n. 20
0
        private void OnBag_OpenUseForm(CUIEvent uiEvent)
        {
            if (this.m_selectUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
            {
                CItem selectUseable = this.m_selectUseable as CItem;
                if ((selectUseable.m_itemData.bType == 4) && (selectUseable.m_itemData.EftParam[2] != 0f))
                {
                    this.PlayItemUseAnimation(this.m_selectUseable, 1);
                }
                else
                {
                    if (((selectUseable.m_itemData.bType == 1) || (selectUseable.m_itemData.bType == 7)) || (selectUseable.m_itemData.bType == 4))
                    {
                        if (this.CheckNameChangeCard(selectUseable))
                        {
                            return;
                        }
                        this.m_useCount = 1;
                        if (selectUseable.m_itemData.bIsBatchUse == 0)
                        {
                            SendItemUseMsgToServer(this.m_selectUseable.m_objID, 0, this.m_useCount);
                            return;
                        }
                        CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm(s_bagUseFormPath, false, true);

                        GameObject gameObject = formScript.gameObject;
                        GameObject itemCell   = gameObject.transform.Find("Panel_Left/itemCell").gameObject;
                        Text       component  = gameObject.transform.Find("Panel_Left/lblName").GetComponent <Text>();
                        Text       text2      = gameObject.transform.Find("Panel_Left/lblCount").GetComponent <Text>();
                        Text       text3      = gameObject.transform.Find("Panel_Left/lblCount1").GetComponent <Text>();
                        CUICommonSystem.SetItemCell(formScript, itemCell, this.m_selectUseable, true, false);
                        component.text = this.m_selectUseable.m_name;
                        text2.text     = this.m_selectUseable.GetSalableCount().ToString();
                        if ((selectUseable.m_itemData.wBatchUseCnt > 0) && (selectUseable.m_itemData.wBatchUseCnt <= this.m_selectUseable.GetSalableCount()))
                        {
                            text3.text = this.m_useCount + "/" + selectUseable.m_itemData.wBatchUseCnt;
                        }
                        else
                        {
                            text3.text = this.m_useCount + "/" + this.m_selectUseable.GetSalableCount();
                        }
                    }
                    if (CItem.IsHeroExChangeCoupons(selectUseable.m_baseID))
                    {
                        Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mall_GoToRecommendHeroTab);
                    }
                    else if (CItem.IsSkinExChangeCoupons(selectUseable.m_baseID))
                    {
                        Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mall_GoToRecommendSkinTab);
                    }
                    else if (selectUseable.m_itemData.bType == 8)
                    {
                        Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Union_Battle_ClickEntry);
                    }
                    else if (selectUseable.m_itemData.bType == 9)
                    {
                        stUIEventParams par = new stUIEventParams {
                            commonUInt32Param1 = selectUseable.m_itemData.dwID
                        };
                        Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Speaker_Form_Open, par);
                    }
                }
            }
            else if (this.m_selectUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL)
            {
                if (Singleton <CFunctionUnlockSys> .instance.FucIsUnlock(RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_SYMBOL))
                {
                    Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Symbol_OpenForm);
                }
                else
                {
                    Singleton <CUIManager> .GetInstance().OpenTips("Symbol_Lock_Tip", true, 1f, null, new object[0]);
                }
            }
        }
Esempio n. 21
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();
            }
        }
Esempio n. 22
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);
                        }
                    }
                }
            }
Esempio n. 23
0
        public BuyPickDialog(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 script = Singleton <CUIManager> .GetInstance().OpenForm(s_Form_Path, false, true);

            if (null != script)
            {
                this._root                 = script.gameObject;
                this._usb                  = CUseableManager.CreateUseable(type, id, 0);
                this._bHeroSkinGift        = false;
                this._bDynamicCorrectPrice = false;
                this._heroSkinGiftCost     = 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._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/Desc/Image/Text");
                    if (this._descText != null)
                    {
                        this._descText.text = this._usb.m_description;
                    }
                    Utility.GetComponetInChild <Image>(this._root, "Panel/Slot/Icon").SetSprite(CUIUtility.GetSpritePrefeb(this._usb.GetIconPath(), false, false));
                    Utility.GetComponetInChild <Text>(this._root, "Panel/Name").text = this._usb.m_name;
                    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));
                        Utility.GetComponetInChild <Text>(this._root, "Panel/Price").text = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(this._usb.GetBuyPrice(coinType), this._realDiscount).ToString();
                    }
                    Image componetInChild = Utility.GetComponetInChild <Image>(this._root, "Panel/Slot/imgExperienceMark");
                    if (componetInChild != null)
                    {
                        if ((this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) && CItem.IsHeroExperienceCard(this._usb.m_baseID))
                        {
                            componetInChild.gameObject.CustomSetActive(true);
                            componetInChild.SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.HeroExperienceCardMarkPath, false, false));
                        }
                        else if ((this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) && CItem.IsSkinExperienceCard(this._usb.m_baseID))
                        {
                            componetInChild.gameObject.CustomSetActive(true);
                            componetInChild.SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.SkinExperienceCardMarkPath, false, false));
                        }
                        else
                        {
                            componetInChild.gameObject.CustomSetActive(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();
            }
        }
        private void SetItem(CUseable usable, Transform uiNode, bool received, bool ready, uint vipLv, int elemIdx)
        {
            Transform transform = uiNode.transform.FindChild("DayBg/DayText");

            if (transform != null)
            {
                transform.GetComponent <Text>().set_text(string.Format("第{0}天", Day14CheckSystem.GetDay(elemIdx)));
            }
            Transform transform2 = uiNode.transform.FindChild("ItemIcon");

            if (transform2 != null)
            {
                CUIUtility.SetImageSprite(transform2.GetComponent <Image>(), usable.GetIconPath(), this._form, true, false, false, false);
            }
            Transform transform3 = uiNode.transform.FindChild("ItemName");

            if (transform3 != null)
            {
                transform3.GetComponent <Text>().set_text(usable.m_name);
            }
            Transform transform4 = uiNode.transform.FindChild("Bg");

            if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO || usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN || (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsHeroExperienceCard(usable.m_baseID)) || (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsSkinExChangeCoupons(usable.m_baseID)))
            {
                if (transform4)
                {
                    transform4.gameObject.CustomSetActive(true);
                }
            }
            else if (transform4)
            {
                transform4.gameObject.CustomSetActive(false);
            }
            Transform transform5 = uiNode.transform.FindChild("TiyanMask");

            if (transform5 != null)
            {
                if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsHeroExperienceCard(usable.m_baseID))
                {
                    transform5.gameObject.CustomSetActive(true);
                    transform5.GetComponent <Image>().SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.HeroExperienceCardMarkPath, false, false), false);
                }
                else if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsSkinExperienceCard(usable.m_baseID))
                {
                    transform5.gameObject.CustomSetActive(true);
                    transform5.GetComponent <Image>().SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.SkinExperienceCardMarkPath, false, false), false);
                }
                else
                {
                    transform5.gameObject.CustomSetActive(false);
                }
            }
            Transform transform6 = uiNode.transform.FindChild("ItemNum/ItemNumText");

            if (transform6 != null)
            {
                Text component = transform6.GetComponent <Text>();
                if (usable.m_stackCount < 10000)
                {
                    component.set_text(usable.m_stackCount.ToString());
                }
                else
                {
                    component.set_text(usable.m_stackCount / 10000 + "万");
                }
                CUICommonSystem.AppendMultipleText(component, usable.m_stackMulti);
                if (usable.m_stackCount <= 1)
                {
                    component.gameObject.CustomSetActive(false);
                    uiNode.transform.FindChild("ItemNum").gameObject.CustomSetActive(false);
                }
                else
                {
                    uiNode.transform.FindChild("ItemNum").gameObject.CustomSetActive(true);
                    transform6.gameObject.CustomSetActive(true);
                }
                if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL)
                {
                    if (((CSymbolItem)usable).IsGuildSymbol())
                    {
                        component.set_text(string.Empty);
                    }
                    else
                    {
                        component.set_text(usable.GetSalableCount().ToString());
                    }
                }
            }
            Transform transform7 = uiNode.transform.FindChild("LingQuGou");

            if (transform7)
            {
                if (received)
                {
                    transform7.gameObject.CustomSetActive(true);
                }
                else
                {
                    transform7.gameObject.CustomSetActive(false);
                }
            }
            Transform transform8 = uiNode.transform.FindChild("XiYou");

            if (transform8)
            {
                if (ready)
                {
                    transform8.gameObject.CustomSetActive(true);
                    Transform transform9 = transform8.transform.FindChild("Bg/Text");
                    if (transform9 != null)
                    {
                        transform9.GetComponent <Text>().set_text(string.Format("第{0}天", Day14CheckSystem.GetDay(elemIdx)));
                    }
                }
                else
                {
                    transform8.gameObject.CustomSetActive(false);
                }
            }
            CUIEventScript  component2  = uiNode.GetComponent <CUIEventScript>();
            stUIEventParams eventParams = new stUIEventParams
            {
                iconUseable = usable
            };

            component2.SetUIEvent(enUIEventType.Down, enUIEventID.Tips_ItemInfoOpen, eventParams);
            component2.SetUIEvent(enUIEventType.HoldEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
            component2.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemInfoClose, eventParams);
            component2.SetUIEvent(enUIEventType.DragEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
        }