コード例 #1
0
        private void RefreshRewardList(CUIFormScript form, CUIListScript listScript, ref ResDT_RandomRewardInfo[] rewardInfoArr, int index = 0)
        {
            if (form == null || listScript == null)
            {
                return;
            }
            int num = 0;

            for (int i = index; i < rewardInfoArr.Length; i++)
            {
                if (rewardInfoArr[i].bItemType == 0)
                {
                    break;
                }
                num++;
            }
            listScript.SetElementAmount(num);
            for (int j = 0; j < num; j++)
            {
                CUIListElementScript elemenet    = listScript.GetElemenet(j);
                CUseable             itemUseable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)rewardInfoArr[j + index].bItemType, (int)rewardInfoArr[j + index].dwLowCnt, rewardInfoArr[j + index].dwItemID);
                GameObject           gameObject  = elemenet.transform.Find("itemCell").gameObject;
                CUICommonSystem.SetItemCell(form, gameObject, itemUseable, true, false, false, false);
            }
        }
コード例 #2
0
        public static ListView <CUseable> CreateUsableListByRandowReward(RES_RANDOM_REWARD_TYPE type, int cnt, uint baseId)
        {
            ListView <CUseable>  listView = new ListView <CUseable>();
            ResRandomRewardStore dataByKey;

            if (type != RES_RANDOM_REWARD_TYPE.RES_RANDOM_REWARD_TYPE_NEST)
            {
                CUseable cUseable = CUseableManager.CreateUsableByRandowReward(type, cnt, baseId);
                if (cUseable != null)
                {
                    listView.Add(cUseable);
                }
            }
            else if ((dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(baseId)) != null)
            {
                for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                {
                    if (dataByKey.astRewardDetail[i].bItemType == 0 || dataByKey.astRewardDetail[i].bItemType >= 18)
                    {
                        break;
                    }
                    listView.AddRange(CUseableManager.CreateUsableListByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID));
                }
            }
            return(listView);
        }
コード例 #3
0
        private void RefreshRenewalPanel()
        {
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CPaySystem.s_renewalDianQuanFormPath);

            if (form == null)
            {
                return;
            }
            uint dwConfValue = GameDataMgr.globalInfoDatabin.GetDataByKey(61u).dwConfValue;
            ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(dwConfValue);
            Transform            transform = form.transform.Find("Panel_Renewal/bodyPanel");
            Text component = transform.Find("rewardDescText").GetComponent <Text>();

            component.set_text(StringHelper.UTF8BytesToString(ref dataByKey.szRewardDesc));
            GameObject gameObject  = transform.Find("itemCellFirst").gameObject;
            CUseable   itemUseable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[0].bItemType, (int)dataByKey.astRewardDetail[0].dwLowCnt, dataByKey.astRewardDetail[0].dwItemID);

            CUICommonSystem.SetItemCell(form, gameObject, itemUseable, true, false, false, false);
            CUIListScript component2 = transform.Find("List").GetComponent <CUIListScript>();

            this.RefreshRewardList(form, component2, ref dataByKey.astRewardDetail, 1);
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            bool       flag        = masterRoleInfo.IsGuidedStateSet(24);
            bool       flag2       = masterRoleInfo.IsGuidedStateSet(25);
            GameObject gameObject2 = transform.Find("payButton").gameObject;
            GameObject gameObject3 = transform.Find("getButton").gameObject;

            CUICommonSystem.SetButtonName(gameObject2, Singleton <CTextManager> .GetInstance().GetText("Pay_Btn_Top_Up"));
            gameObject2.CustomSetActive(!flag);
            CUICommonSystem.SetButtonName(gameObject3, Singleton <CTextManager> .GetInstance().GetText("Pay_Btn_Get_Reward"));
            gameObject3.CustomSetActive(flag && !flag2);
        }
コード例 #4
0
 public CUseable GetUseable(int index)
 {
     if ((this.RewardDrop != null) && (index < this.RewardCount))
     {
         ResDT_WealRewardItem item = this.RewardDrop.astRewardDetail[index];
         return(CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)item.bItemType, (int)item.dwLowCnt, item.dwItemID));
     }
     return(null);
 }
コード例 #5
0
 public CUseable GetExtraUseable(int index)
 {
     if (this.ExtraRewardDrop != null && index < this.ExtraRewardCount)
     {
         ResDT_RandomRewardInfo resDT_RandomRewardInfo = this.ExtraRewardDrop.astRewardDetail[index];
         return(CUseableManager.CreateUsableByRandowReward(resDT_RandomRewardInfo.bItemType, (int)resDT_RandomRewardInfo.dwLowCnt, resDT_RandomRewardInfo.dwItemID));
     }
     return(null);
 }
コード例 #6
0
 public CUseable GetExtraUseable(int index)
 {
     if ((this.ExtraRewardDrop != null) && (index < this.ExtraRewardCount))
     {
         ResDT_RandomRewardInfo info = this.ExtraRewardDrop.astRewardDetail[index];
         return(CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)info.bItemType, (int)info.dwLowCnt, info.dwItemID));
     }
     return(null);
 }
コード例 #7
0
ファイル: BuyPickDialog.cs プロジェクト: isoundy000/wzry-1
        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();
            }
        }
コード例 #8
0
ファイル: QQVipWidget.cs プロジェクト: wujiangu/wanshiwu0.1
        public void SetData(GameObject root, CUIFormScript formScript)
        {
            ResRandomRewardStore dataByKey = GameDataMgr.randowmRewardDB.GetDataByKey(0xa029);

            for (int i = 0; i < 3; i++)
            {
                string                 name        = string.Format("Panel/QQVip/AwardGrid/QQ/ListElement{0}/ItemCell", i);
                GameObject             gameObject  = root.transform.FindChild(name).gameObject;
                ResDT_RandomRewardInfo info        = dataByKey.astRewardDetail[i];
                CUseable               itemUseable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)info.bItemType, (int)info.dwLowCnt, info.dwItemID);
                if (itemUseable != null)
                {
                    if (gameObject.GetComponent <CUIEventScript>() == null)
                    {
                        gameObject.AddComponent <CUIEventScript>();
                    }
                    CUICommonSystem.SetItemCell(formScript, gameObject, itemUseable, true, false);
                }
            }
            ResRandomRewardStore store2 = GameDataMgr.randowmRewardDB.GetDataByKey(0xa02a);

            for (int j = 0; j < 3; j++)
            {
                string                 str2     = string.Format("Panel/QQVip/AwardGrid/QQVip/ListElement{0}/ItemCell", j);
                GameObject             itemCell = root.transform.FindChild(str2).gameObject;
                ResDT_RandomRewardInfo info2    = store2.astRewardDetail[j];
                CUseable               useable2 = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)info2.bItemType, (int)info2.dwLowCnt, info2.dwItemID);
                if (useable2 != null)
                {
                    if (itemCell.GetComponent <CUIEventScript>() == null)
                    {
                        itemCell.AddComponent <CUIEventScript>();
                    }
                    CUICommonSystem.SetItemCell(formScript, itemCell, useable2, true, false);
                }
            }
            this.m_BtnQQ = root.transform.FindChild("Panel/QQVip/AwardGrid/QQ/Button/").gameObject;
            Text      componentInChildren = root.transform.FindChild("Panel/QQVip/AwardGrid/QQVip/Button/").gameObject.GetComponentInChildren <Text>();
            CRoleInfo masterRoleInfo      = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo != null)
            {
                if (masterRoleInfo.HasVip(0x10))
                {
                    if (this.m_BtnQQ.activeInHierarchy)
                    {
                        this.m_BtnQQ.GetComponentInChildren <Text>().text = "续费QQ会员";
                    }
                    componentInChildren.text = "续费超级会员";
                }
                else if (masterRoleInfo.HasVip(1))
                {
                    if (this.m_BtnQQ.activeInHierarchy)
                    {
                        this.m_BtnQQ.GetComponentInChildren <Text>().text = "续费QQ会员";
                    }
                    componentInChildren.text = "开通超级会员";
                }
                else if (!masterRoleInfo.HasVip(1))
                {
                    if (this.m_BtnQQ.activeInHierarchy)
                    {
                        this.m_BtnQQ.GetComponentInChildren <Text>().text = "开通QQ会员";
                    }
                    componentInChildren.text = "开通超级会员";
                }
            }
        }
コード例 #9
0
        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();
            }
        }
コード例 #10
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();
            }
        }