Beispiel #1
0
        private void SetSkinItem(CMallItemWidget mallWidget, ResHeroSkin skinInfo, CUIFormScript form)
        {
            Image component = mallWidget.m_icon.GetComponent <Image>();

            component.color = CUIUtility.s_Color_White;
            string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_BustHero_Dir, skinInfo.szSkinPicID);

            component.SetSprite(prefabPath, form, false, true, true);
            mallWidget.m_skinLabel.CustomSetActive(true);
            CUICommonSystem.SetHeroSkinLabelPic(form, mallWidget.m_skinLabel, skinInfo.dwHeroID, skinInfo.dwSkinID);
            mallWidget.m_topNameLeftText.GetComponent <Text>().text = skinInfo.szHeroName;
            mallWidget.m_topNameRightText.CustomSetActive(true);
            mallWidget.m_topNameRightText.GetComponent <Text>().text = skinInfo.szSkinName;
            ResSkinPromotion skinPromotion = CSkinInfo.GetSkinPromotion(skinInfo.dwHeroID, skinInfo.dwSkinID);

            this._payInfoTemp = CMallSystem.GetPayInfoSetOfGood(skinInfo, skinPromotion);
            uint num = this.SetItemPriceInfo(mallWidget, ref this._payInfoTemp);

            this.SetItemTag(mallWidget, null, skinPromotion, form);
            stUIEventParams eventParams = new stUIEventParams();

            eventParams.openHeroFormPar.heroId = skinInfo.dwHeroID;
            eventParams.openHeroFormPar.skinId = skinInfo.dwSkinID;
            eventParams.commonUInt32Param1     = num;
            mallWidget.m_item.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.Mall_GiftShowDetail, eventParams);
            stUIEventParams params2 = new stUIEventParams();

            params2.heroSkinParam.heroId      = skinInfo.dwHeroID;
            params2.heroSkinParam.skinId      = skinInfo.dwSkinID;
            params2.heroSkinParam.isCanCharge = true;
            params2.commonUInt64Param1        = this._curFriendUid;
            params2.commonBool         = this._curFriendIsSns;
            params2.commonUInt32Param1 = this._curWorldId;
            mallWidget.m_buyBtn.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.HeroSkin_OpenBuyHeroSkinForFriend, params2);
        }
Beispiel #2
0
        private void SetHeroItem(CMallItemWidget mallWidget, ResHeroCfgInfo heroInfo, CUIFormScript form)
        {
            Image component = mallWidget.m_icon.GetComponent <Image>();

            component.color = CUIUtility.s_Color_White;
            string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_BustHero_Dir, heroInfo.szImagePath);

            component.SetSprite(prefabPath, form, false, true, true);
            mallWidget.m_skinLabel.CustomSetActive(false);
            mallWidget.m_topNameLeftText.GetComponent <Text>().text = heroInfo.szName;
            mallWidget.m_topNameRightText.CustomSetActive(false);
            IHeroData data = CHeroDataFactory.CreateHeroData(heroInfo.dwCfgID);

            if (data != null)
            {
                ResHeroPromotion resPromotion = data.promotion();
                this._payInfoTemp = CMallSystem.GetPayInfoSetOfGood(heroInfo, resPromotion);
                uint num = this.SetItemPriceInfo(mallWidget, ref this._payInfoTemp);
                this.SetItemTag(mallWidget, resPromotion, null, form);
                stUIEventParams eventParams = new stUIEventParams {
                    heroId             = heroInfo.dwCfgID,
                    commonUInt64Param1 = this._curFriendUid,
                    commonBool         = this._curFriendIsSns,
                    commonUInt32Param1 = this._curWorldId
                };
                mallWidget.m_buyBtn.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.HeroView_OpenBuyHeroForFriend, eventParams);
                mallWidget.m_item.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.None, eventParams);
            }
        }
    private void OnHotSaleEnable(CUIEvent uiEvent)
    {
        int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;

        if (srcWidgetIndexInBelongedList < 0 || srcWidgetIndexInBelongedList >= this.m_HotSaleListView.Count)
        {
            return;
        }
        GameObject srcWidget = uiEvent.m_srcWidget;

        if (srcWidget == null)
        {
            return;
        }
        CMallItemWidget component = srcWidget.GetComponent <CMallItemWidget>();

        if (component == null)
        {
            return;
        }
        ResBoutiqueConf resBoutiqueConf = this.m_HotSaleListView[srcWidgetIndexInBelongedList];

        DebugHelper.Assert(resBoutiqueConf != null, "hot sale cfg is null");
        if (resBoutiqueConf == null)
        {
            return;
        }
        switch (resBoutiqueConf.wItemType)
        {
        case 2:
        {
            CMallFactoryShopController.ShopProduct product = Singleton <CMallFactoryShopController> .GetInstance().GetProduct(resBoutiqueConf.dwItemID);

            CMallItem item = new CMallItem(product, CMallItem.IconType.Small);
            Singleton <CMallSystem> .GetInstance().SetMallItem(component, item);

            break;
        }

        case 4:
        {
            CMallItem item2 = new CMallItem(resBoutiqueConf.dwItemID, CMallItem.IconType.Small);
            Singleton <CMallSystem> .GetInstance().SetMallItem(component, item2);

            break;
        }

        case 7:
        {
            uint heroID = 0u;
            uint skinID = 0u;
            CSkinInfo.ResolveHeroSkin(resBoutiqueConf.dwItemID, out heroID, out skinID);
            CMallItem item3 = new CMallItem(heroID, skinID, CMallItem.IconType.Small);
            Singleton <CMallSystem> .GetInstance().SetMallItem(component, item3);

            break;
        }
        }
    }
        private void OnHeroItemEnable(CUIEvent uiEvent)
        {
            int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;

            if (((srcWidgetIndexInBelongedList >= 0) && (srcWidgetIndexInBelongedList < this.m_heroList.Count)) && (uiEvent.m_srcWidget != null))
            {
                CMallItemWidget component = uiEvent.m_srcWidget.GetComponent <CMallItemWidget>();
                if ((component != null) && (uiEvent.m_srcWidget != null))
                {
                    CMallItem item = new CMallItem(this.m_heroList[srcWidgetIndexInBelongedList].dwCfgID, CMallItem.IconType.Normal);
                    Singleton <CMallSystem> .GetInstance().SetMallItem(component, item);
                }
            }
        }
    private void OnNewArrivalEnable(CUIEvent uiEvent)
    {
        int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;

        if (srcWidgetIndexInBelongedList < 0 || srcWidgetIndexInBelongedList >= this.m_NewArrivalListView.Count)
        {
            return;
        }
        GameObject srcWidget = uiEvent.m_srcWidget;

        if (srcWidget == null)
        {
            return;
        }
        CMallItemWidget component = srcWidget.GetComponent <CMallItemWidget>();

        if (component == null)
        {
            return;
        }
        ResBoutiqueConf resBoutiqueConf = this.m_NewArrivalListView[srcWidgetIndexInBelongedList];

        DebugHelper.Assert(resBoutiqueConf != null, "new arrival cfg is null");
        if (resBoutiqueConf == null)
        {
            return;
        }
        switch (resBoutiqueConf.wItemType)
        {
        case 4:
        {
            CMallItem item = new CMallItem(resBoutiqueConf.dwItemID, CMallItem.IconType.Normal);
            Singleton <CMallSystem> .GetInstance().SetMallItem(component, item);

            break;
        }

        case 7:
        {
            uint heroID = 0u;
            uint skinID = 0u;
            CSkinInfo.ResolveHeroSkin(resBoutiqueConf.dwItemID, out heroID, out skinID);
            CMallItem item2 = new CMallItem(heroID, skinID, CMallItem.IconType.Normal);
            Singleton <CMallSystem> .GetInstance().SetMallItem(component, item2);

            break;
        }
        }
    }
Beispiel #6
0
        private void OnItemEnable(CUIEvent uiEvent)
        {
            int        srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;
            GameObject srcWidget = uiEvent.m_srcWidget;

            if ((this._curJobView != enHeroJobType.All) && (srcWidgetIndexInBelongedList < this._filterTempList.Count))
            {
                srcWidgetIndexInBelongedList = this._filterTempList[srcWidgetIndexInBelongedList];
            }
            if ((this._curMenuPage == MenuPage.Skin) && (srcWidgetIndexInBelongedList < this._skinList.Count))
            {
                ResHeroSkin     skinInfo  = this._skinList[srcWidgetIndexInBelongedList];
                CMallItemWidget component = srcWidget.GetComponent <CMallItemWidget>();
                this.SetSkinItem(component, skinInfo, uiEvent.m_srcFormScript);
            }
            else if (srcWidgetIndexInBelongedList < this._heroList.Count)
            {
                ResHeroCfgInfo  heroInfo   = this._heroList[srcWidgetIndexInBelongedList];
                CMallItemWidget mallWidget = srcWidget.GetComponent <CMallItemWidget>();
                this.SetHeroItem(mallWidget, heroInfo, uiEvent.m_srcFormScript);
            }
        }
Beispiel #7
0
        private void OnItemEnable(CUIEvent uiEvent)
        {
            int        num       = uiEvent.m_srcWidgetIndexInBelongedList;
            GameObject srcWidget = uiEvent.m_srcWidget;

            if (this._curJobView != enHeroJobType.All && num < this._filterTempList.get_Count())
            {
                num = this._filterTempList.get_Item(num);
            }
            if (this._curMenuPage == GiftCenter.MenuPage.Skin && num < this._skinList.Count)
            {
                ResHeroSkin     skinInfo  = this._skinList[num];
                CMallItemWidget component = srcWidget.GetComponent <CMallItemWidget>();
                this.SetSkinItem(component, skinInfo, uiEvent.m_srcFormScript);
            }
            else if (num < this._heroList.Count)
            {
                ResHeroCfgInfo  heroInfo   = this._heroList[num];
                CMallItemWidget component2 = srcWidget.GetComponent <CMallItemWidget>();
                this.SetHeroItem(component2, heroInfo, uiEvent.m_srcFormScript);
            }
        }
Beispiel #8
0
        private void OnSkinItemEnable(CUIEvent uiEvent)
        {
            int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;

            if (srcWidgetIndexInBelongedList < 0 || srcWidgetIndexInBelongedList >= this.m_skinList.get_Count())
            {
                return;
            }
            if (uiEvent.m_srcWidget == null)
            {
                return;
            }
            CMallItemWidget component = uiEvent.m_srcWidget.GetComponent <CMallItemWidget>();

            if (component == null)
            {
                return;
            }
            if (uiEvent.m_srcWidget != null)
            {
                CMallItem item = new CMallItem(this.m_skinList.get_Item(srcWidgetIndexInBelongedList).dwHeroID, this.m_skinList.get_Item(srcWidgetIndexInBelongedList).dwSkinID, CMallItem.IconType.Normal);
                Singleton <CMallSystem> .GetInstance().SetMallItem(component, item);
            }
        }
Beispiel #9
0
        private void SetItemTag(CMallItemWidget itemWidget, ResHeroPromotion heroPromotion, ResSkinPromotion skinPromotion, CUIFormScript form)
        {
            string str  = null;
            string text = null;
            int    num2;
            RES_LUCKYDRAW_ITEMTAG bTag = RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_NONE;

            if (heroPromotion != null)
            {
                bTag = (RES_LUCKYDRAW_ITEMTAG)heroPromotion.bTag;
            }
            else if (skinPromotion != null)
            {
                bTag = (RES_LUCKYDRAW_ITEMTAG)skinPromotion.bTag;
            }
            switch (bTag)
            {
            case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_UNUSUAL:
            {
                num2 = 0;
                uint currentUTCTime = (uint)CRoleInfo.GetCurrentUTCTime();
                if (heroPromotion == null)
                {
                    if (skinPromotion != null)
                    {
                        if (skinPromotion.dwOnTimeGen > currentUTCTime)
                        {
                            num2 = (int)(skinPromotion.dwOffTimeGen - skinPromotion.dwOnTimeGen);
                        }
                        else
                        {
                            num2 = (int)(skinPromotion.dwOffTimeGen - currentUTCTime);
                        }
                    }
                    break;
                }
                if (heroPromotion.dwOnTimeGen <= currentUTCTime)
                {
                    num2 = (int)(heroPromotion.dwOffTimeGen - currentUTCTime);
                    break;
                }
                num2 = (int)(heroPromotion.dwOffTimeGen - heroPromotion.dwOnTimeGen);
                break;
            }

            case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_NEW:
                str  = "UGUI/Sprite/Common/Product_New.prefab";
                text = Singleton <CTextManager> .GetInstance().GetText("Common_Tag_New");

                goto Label_01D8;

            case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_HOT:
                str  = "UGUI/Sprite/Common/Product_Hot.prefab";
                text = Singleton <CTextManager> .GetInstance().GetText("Common_Tag_Hot");

                goto Label_01D8;

            case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_DISCOUNT:
            {
                float num = 100f;
                if (heroPromotion != null)
                {
                    num = ((float)heroPromotion.dwDiscount) / 10f;
                }
                else if (skinPromotion != null)
                {
                    num = ((float)skinPromotion.dwDiscount) / 10f;
                }
                str = "UGUI/Sprite/Common/Product_Discount.prefab";
                if (Math.Abs((float)(num % 1f)) < float.Epsilon)
                {
                    text = string.Format("{0}折", ((int)num).ToString("D"));
                }
                else
                {
                    text = string.Format("{0}折", num.ToString("0.0"));
                }
                goto Label_01D8;
            }

            default:
                goto Label_01D8;
            }
            if (num2 > 0)
            {
                int num4 = (int)Math.Ceiling(((double)num2) / 86400.0);
                if (num4 > 0)
                {
                    str = "UGUI/Sprite/Common/Product_Unusual.prefab";
                    string[] args = new string[] { num4.ToString() };
                    text = Singleton <CTextManager> .GetInstance().GetText("Mall_Promotion_Tag_1", args);
                }
            }
Label_01D8:
            if ((itemWidget.m_tagContainer != null) && (!string.IsNullOrEmpty(str) || !string.IsNullOrEmpty(text)))
            {
                itemWidget.m_tagContainer.SetActive(true);
                itemWidget.m_tagContainer.GetComponent <Image>().SetSprite(str, form, false, true, true);
                if (itemWidget.m_tagText != null)
                {
                    itemWidget.m_tagText.GetComponent <Text>().text = text;
                }
            }
            else
            {
                itemWidget.m_tagContainer.CustomSetActive(false);
            }
        }
Beispiel #10
0
        public uint SetItemPriceInfo(CMallItemWidget itemWidget, ref stPayInfoSet payInfoSet)
        {
            uint payValue = 0;

            if (itemWidget.m_priceContainer != null)
            {
                itemWidget.m_priceContainer.SetActive(true);
                CMallItem.OldPriceType oldPriceType = this.GetOldPriceType();
                CUIListScript          component    = itemWidget.m_priceContainer.GetComponent <CUIListScript>();
                component.SetElementAmount(1);
                itemWidget.m_orTextContainer.CustomSetActive(false);
                CUIListElementScript elemenet = component.GetElemenet(0);
                if (elemenet == null)
                {
                    return(payValue);
                }
                GameObject widget = elemenet.GetWidget(0);
                GameObject obj3   = elemenet.GetWidget(1);
                GameObject obj4   = elemenet.GetWidget(2);
                GameObject obj5   = elemenet.GetWidget(4);
                GameObject obj6   = elemenet.GetWidget(3);
                GameObject obj7   = elemenet.GetWidget(5);
                if ((((widget == null) || (obj3 == null)) || ((obj4 == null) || (obj5 == null))) || ((obj6 == null) || (obj7 == null)))
                {
                    return(payValue);
                }
                for (int i = 0; i < payInfoSet.m_payInfoCount; i++)
                {
                    if ((payInfoSet.m_payInfos[i].m_payType == enPayType.Diamond) || (payInfoSet.m_payInfos[i].m_payType == enPayType.DiamondAndDianQuan))
                    {
                        payInfoSet.m_payInfos[i].m_payType = enPayType.DianQuan;
                    }
                }
                for (int j = 0; j < payInfoSet.m_payInfoCount; j++)
                {
                    if (((payInfoSet.m_payInfos[j].m_payType != enPayType.DianQuan) && (payInfoSet.m_payInfos[j].m_payType != enPayType.Diamond)) && (payInfoSet.m_payInfos[j].m_payType != enPayType.DiamondAndDianQuan))
                    {
                        continue;
                    }
                    payValue = payInfoSet.m_payInfos[j].m_payValue;
                    switch (oldPriceType)
                    {
                    case CMallItem.OldPriceType.None:
                        itemWidget.m_middleOrText.CustomSetActive(true);
                        itemWidget.m_bottomOrText.CustomSetActive(false);
                        widget.SetActive(false);
                        obj3.SetActive(false);
                        obj4.SetActive(false);
                        obj6.SetActive(true);
                        obj6.GetComponent <Text>().text = payInfoSet.m_payInfos[j].m_payValue.ToString();
                        obj7.GetComponent <Image>().SetSprite(CMallSystem.GetPayTypeIconPath(payInfoSet.m_payInfos[j].m_payType), this._giftCenterForm, true, false, false);
                        return(payValue);

                    case CMallItem.OldPriceType.FirstOne:
                        itemWidget.m_middleOrText.CustomSetActive(false);
                        itemWidget.m_bottomOrText.CustomSetActive(true);
                        if (j != 0)
                        {
                            break;
                        }
                        obj3.SetActive(false);
                        obj6.SetActive(false);
                        widget.SetActive(true);
                        obj4.SetActive(true);
                        widget.GetComponent <Text>().text = payInfoSet.m_payInfos[j].m_oriValue.ToString();
                        obj4.GetComponent <Text>().text   = payInfoSet.m_payInfos[j].m_payValue.ToString();
                        obj5.GetComponent <Image>().SetSprite(CMallSystem.GetPayTypeIconPath(payInfoSet.m_payInfos[j].m_payType), this._giftCenterForm, true, false, false);
                        return(payValue);

                    case CMallItem.OldPriceType.SecondOne:
                        itemWidget.m_middleOrText.CustomSetActive(false);
                        itemWidget.m_bottomOrText.CustomSetActive(true);
                        if (j != 1)
                        {
                            goto Label_045D;
                        }
                        obj3.SetActive(false);
                        obj6.SetActive(false);
                        widget.SetActive(true);
                        obj4.SetActive(true);
                        widget.GetComponent <Text>().text = payInfoSet.m_payInfos[j].m_oriValue.ToString();
                        obj4.GetComponent <Text>().text   = payInfoSet.m_payInfos[j].m_payValue.ToString();
                        obj5.GetComponent <Image>().SetSprite(CMallSystem.GetPayTypeIconPath(payInfoSet.m_payInfos[j].m_payType), this._giftCenterForm, true, false, false);
                        return(payValue);

                    case CMallItem.OldPriceType.Both:
                        itemWidget.m_middleOrText.CustomSetActive(true);
                        itemWidget.m_bottomOrText.CustomSetActive(false);
                        obj3.SetActive(false);
                        obj6.SetActive(false);
                        widget.SetActive(true);
                        obj4.SetActive(true);
                        widget.GetComponent <Text>().text = payInfoSet.m_payInfos[j].m_oriValue.ToString();
                        obj4.GetComponent <Text>().text   = payInfoSet.m_payInfos[j].m_payValue.ToString();
                        obj5.GetComponent <Image>().SetSprite(CMallSystem.GetPayTypeIconPath(payInfoSet.m_payInfos[j].m_payType), this._giftCenterForm, true, false, false);
                        return(payValue);

                    default:
                        return(payValue);
                    }
                    obj3.SetActive(false);
                    widget.SetActive(false);
                    obj6.SetActive(false);
                    obj4.SetActive(true);
                    obj4.GetComponent <Text>().text = payInfoSet.m_payInfos[j].m_payValue.ToString();
                    obj5.GetComponent <Image>().SetSprite(CMallSystem.GetPayTypeIconPath(payInfoSet.m_payInfos[j].m_payType), this._giftCenterForm, true, false, false);
                    return(payValue);

Label_045D:
                    obj3.SetActive(false);
                    widget.SetActive(false);
                    obj6.SetActive(false);
                    obj4.SetActive(true);
                    obj4.GetComponent <Text>().text = payInfoSet.m_payInfos[j].m_payValue.ToString();
                    obj5.GetComponent <Image>().SetSprite(CMallSystem.GetPayTypeIconPath(payInfoSet.m_payInfos[j].m_payType), this._giftCenterForm, true, false, false);
                    return(payValue);
                }
            }
            return(payValue);
        }
Beispiel #11
0
        private void SetItemTag(CMallItemWidget itemWidget, ResHeroPromotion heroPromotion, ResSkinPromotion skinPromotion, CUIFormScript form)
        {
            string text  = null;
            string text2 = null;
            RES_LUCKYDRAW_ITEMTAG rES_LUCKYDRAW_ITEMTAG = RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_NONE;

            if (heroPromotion != null)
            {
                rES_LUCKYDRAW_ITEMTAG = (RES_LUCKYDRAW_ITEMTAG)heroPromotion.bTag;
            }
            else if (skinPromotion != null)
            {
                rES_LUCKYDRAW_ITEMTAG = (RES_LUCKYDRAW_ITEMTAG)skinPromotion.bTag;
            }
            switch (rES_LUCKYDRAW_ITEMTAG)
            {
            case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_UNUSUAL:
            {
                int  num            = 0;
                uint currentUTCTime = (uint)CRoleInfo.GetCurrentUTCTime();
                if (heroPromotion != null)
                {
                    if (heroPromotion.dwOnTimeGen > currentUTCTime)
                    {
                        num = (int)(heroPromotion.dwOffTimeGen - heroPromotion.dwOnTimeGen);
                    }
                    else
                    {
                        num = (int)(heroPromotion.dwOffTimeGen - currentUTCTime);
                    }
                }
                else if (skinPromotion != null)
                {
                    if (skinPromotion.dwOnTimeGen > currentUTCTime)
                    {
                        num = (int)(skinPromotion.dwOffTimeGen - skinPromotion.dwOnTimeGen);
                    }
                    else
                    {
                        num = (int)(skinPromotion.dwOffTimeGen - currentUTCTime);
                    }
                }
                if (num > 0)
                {
                    int num2 = (int)Math.Ceiling((double)num / 86400.0);
                    if (num2 > 0)
                    {
                        text  = "UGUI/Sprite/Common/Product_Unusual.prefab";
                        text2 = Singleton <CTextManager> .GetInstance().GetText("Mall_Promotion_Tag_1", new string[]
                            {
                                num2.ToString()
                            });
                    }
                }
                break;
            }

            case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_NEW:
                text  = "UGUI/Sprite/Common/Product_New.prefab";
                text2 = Singleton <CTextManager> .GetInstance().GetText("Common_Tag_New");

                break;

            case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_HOT:
                text  = "UGUI/Sprite/Common/Product_Hot.prefab";
                text2 = Singleton <CTextManager> .GetInstance().GetText("Common_Tag_Hot");

                break;

            case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_DISCOUNT:
            {
                float num3 = 100f;
                if (heroPromotion != null)
                {
                    num3 = heroPromotion.dwDiscount / 10f;
                }
                else if (skinPromotion != null)
                {
                    num3 = skinPromotion.dwDiscount / 10f;
                }
                text = "UGUI/Sprite/Common/Product_Discount.prefab";
                if (Math.Abs(num3 % 1f) < 1.401298E-45f)
                {
                    text2 = string.Format("{0}折", ((int)num3).ToString("D"));
                }
                else
                {
                    text2 = string.Format("{0}折", num3.ToString("0.0"));
                }
                break;
            }
            }
            if (itemWidget.m_tagContainer != null && (!string.IsNullOrEmpty(text) || !string.IsNullOrEmpty(text2)))
            {
                itemWidget.m_tagContainer.SetActive(true);
                Image component = itemWidget.m_tagContainer.GetComponent <Image>();
                component.SetSprite(text, form, false, true, true, false);
                if (itemWidget.m_tagText != null)
                {
                    Text component2 = itemWidget.m_tagText.GetComponent <Text>();
                    component2.set_text(text2);
                }
            }
            else
            {
                itemWidget.m_tagContainer.CustomSetActive(false);
            }
        }
Beispiel #12
0
        public uint SetItemPriceInfo(CMallItemWidget itemWidget, ref stPayInfoSet payInfoSet)
        {
            uint result = 0u;

            if (itemWidget.m_priceContainer == null)
            {
                return(result);
            }
            itemWidget.m_priceContainer.SetActive(true);
            CMallItem.OldPriceType oldPriceType = this.GetOldPriceType();
            CUIListScript          component    = itemWidget.m_priceContainer.GetComponent <CUIListScript>();

            component.SetElementAmount(1);
            itemWidget.m_orTextContainer.CustomSetActive(false);
            CUIListElementScript elemenet = component.GetElemenet(0);

            if (elemenet == null)
            {
                return(result);
            }
            GameObject widget  = elemenet.GetWidget(0);
            GameObject widget2 = elemenet.GetWidget(1);
            GameObject widget3 = elemenet.GetWidget(2);
            GameObject widget4 = elemenet.GetWidget(4);
            GameObject widget5 = elemenet.GetWidget(3);
            GameObject widget6 = elemenet.GetWidget(5);

            if (widget == null || widget2 == null || widget3 == null || widget4 == null || widget5 == null || widget6 == null)
            {
                return(result);
            }
            for (int i = 0; i < payInfoSet.m_payInfoCount; i++)
            {
                if (payInfoSet.m_payInfos[i].m_payType == enPayType.Diamond || payInfoSet.m_payInfos[i].m_payType == enPayType.DiamondAndDianQuan)
                {
                    payInfoSet.m_payInfos[i].m_payType = enPayType.DianQuan;
                }
            }
            for (int j = 0; j < payInfoSet.m_payInfoCount; j++)
            {
                if (payInfoSet.m_payInfos[j].m_payType == enPayType.DianQuan || payInfoSet.m_payInfos[j].m_payType == enPayType.Diamond || payInfoSet.m_payInfos[j].m_payType == enPayType.DiamondAndDianQuan)
                {
                    result = payInfoSet.m_payInfos[j].m_payValue;
                    switch (oldPriceType)
                    {
                    case CMallItem.OldPriceType.None:
                    {
                        itemWidget.m_middleOrText.CustomSetActive(true);
                        itemWidget.m_bottomOrText.CustomSetActive(false);
                        widget.SetActive(false);
                        widget2.SetActive(false);
                        widget3.SetActive(false);
                        widget5.SetActive(true);
                        Text component2 = widget5.GetComponent <Text>();
                        component2.set_text(payInfoSet.m_payInfos[j].m_payValue.ToString());
                        Image component3 = widget6.GetComponent <Image>();
                        component3.SetSprite(CMallSystem.GetPayTypeIconPath(payInfoSet.m_payInfos[j].m_payType), this._giftCenterForm, true, false, false, false);
                        break;
                    }

                    case CMallItem.OldPriceType.FirstOne:
                        itemWidget.m_middleOrText.CustomSetActive(false);
                        itemWidget.m_bottomOrText.CustomSetActive(true);
                        if (j == 0)
                        {
                            widget2.SetActive(false);
                            widget5.SetActive(false);
                            widget.SetActive(true);
                            widget3.SetActive(true);
                            Text component4 = widget.GetComponent <Text>();
                            component4.set_text(payInfoSet.m_payInfos[j].m_oriValue.ToString());
                            Text component5 = widget3.GetComponent <Text>();
                            component5.set_text(payInfoSet.m_payInfos[j].m_payValue.ToString());
                            Image component6 = widget4.GetComponent <Image>();
                            component6.SetSprite(CMallSystem.GetPayTypeIconPath(payInfoSet.m_payInfos[j].m_payType), this._giftCenterForm, true, false, false, false);
                        }
                        else
                        {
                            widget2.SetActive(false);
                            widget.SetActive(false);
                            widget5.SetActive(false);
                            widget3.SetActive(true);
                            Text component7 = widget3.GetComponent <Text>();
                            component7.set_text(payInfoSet.m_payInfos[j].m_payValue.ToString());
                            Image component8 = widget4.GetComponent <Image>();
                            component8.SetSprite(CMallSystem.GetPayTypeIconPath(payInfoSet.m_payInfos[j].m_payType), this._giftCenterForm, true, false, false, false);
                        }
                        break;

                    case CMallItem.OldPriceType.SecondOne:
                        itemWidget.m_middleOrText.CustomSetActive(false);
                        itemWidget.m_bottomOrText.CustomSetActive(true);
                        if (j == 1)
                        {
                            widget2.SetActive(false);
                            widget5.SetActive(false);
                            widget.SetActive(true);
                            widget3.SetActive(true);
                            Text component9 = widget.GetComponent <Text>();
                            component9.set_text(payInfoSet.m_payInfos[j].m_oriValue.ToString());
                            Text component10 = widget3.GetComponent <Text>();
                            component10.set_text(payInfoSet.m_payInfos[j].m_payValue.ToString());
                            Image component11 = widget4.GetComponent <Image>();
                            component11.SetSprite(CMallSystem.GetPayTypeIconPath(payInfoSet.m_payInfos[j].m_payType), this._giftCenterForm, true, false, false, false);
                        }
                        else
                        {
                            widget2.SetActive(false);
                            widget.SetActive(false);
                            widget5.SetActive(false);
                            widget3.SetActive(true);
                            Text component12 = widget3.GetComponent <Text>();
                            component12.set_text(payInfoSet.m_payInfos[j].m_payValue.ToString());
                            Image component13 = widget4.GetComponent <Image>();
                            component13.SetSprite(CMallSystem.GetPayTypeIconPath(payInfoSet.m_payInfos[j].m_payType), this._giftCenterForm, true, false, false, false);
                        }
                        break;

                    case CMallItem.OldPriceType.Both:
                    {
                        itemWidget.m_middleOrText.CustomSetActive(true);
                        itemWidget.m_bottomOrText.CustomSetActive(false);
                        widget2.SetActive(false);
                        widget5.SetActive(false);
                        widget.SetActive(true);
                        widget3.SetActive(true);
                        Text component14 = widget.GetComponent <Text>();
                        component14.set_text(payInfoSet.m_payInfos[j].m_oriValue.ToString());
                        Text component15 = widget3.GetComponent <Text>();
                        component15.set_text(payInfoSet.m_payInfos[j].m_payValue.ToString());
                        Image component16 = widget4.GetComponent <Image>();
                        component16.SetSprite(CMallSystem.GetPayTypeIconPath(payInfoSet.m_payInfos[j].m_payType), this._giftCenterForm, true, false, false, false);
                        break;
                    }
                    }
                    break;
                }
            }
            return(result);
        }
Beispiel #13
0
        private void SetSkinItem(CMallItemWidget mallWidget, ResHeroSkin skinInfo, CUIFormScript form)
        {
            Image component = mallWidget.m_icon.GetComponent <Image>();

            component.set_color(CUIUtility.s_Color_White);
            string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_BustHero_Dir, skinInfo.szSkinPicID);

            component.SetSprite(prefabPath, form, false, true, true, true);
            mallWidget.m_skinLabel.CustomSetActive(true);
            CUICommonSystem.SetHeroSkinLabelPic(form, mallWidget.m_skinLabel, skinInfo.dwHeroID, skinInfo.dwSkinID);
            mallWidget.m_topNameLeftText.GetComponent <Text>().set_text(skinInfo.szHeroName);
            mallWidget.m_topNameRightText.CustomSetActive(true);
            mallWidget.m_topNameRightText.GetComponent <Text>().set_text(skinInfo.szSkinName);
            ResSkinPromotion skinPromotion = CSkinInfo.GetSkinPromotion(skinInfo.dwHeroID, skinInfo.dwSkinID);

            this._payInfoTemp = CMallSystem.GetPayInfoSetOfGood(skinInfo, skinPromotion);
            uint commonUInt32Param = this.SetItemPriceInfo(mallWidget, ref this._payInfoTemp);

            this.SetItemTag(mallWidget, null, skinPromotion, form);
            stUIEventParams eventParams = default(stUIEventParams);

            eventParams.openHeroFormPar.heroId = skinInfo.dwHeroID;
            eventParams.openHeroFormPar.skinId = skinInfo.dwSkinID;
            eventParams.commonUInt32Param1     = commonUInt32Param;
            mallWidget.m_item.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.Mall_GiftShowDetail, eventParams);
            stUIEventParams eventParams2 = default(stUIEventParams);

            eventParams2.heroSkinParam.heroId      = skinInfo.dwHeroID;
            eventParams2.heroSkinParam.skinId      = skinInfo.dwSkinID;
            eventParams2.heroSkinParam.isCanCharge = true;
            eventParams2.commonUInt64Param1        = this._curFriendUid;
            eventParams2.commonBool         = this._curFriendIsSns;
            eventParams2.commonUInt32Param1 = this._curWorldId;
            mallWidget.m_buyBtn.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.HeroSkin_OpenBuyHeroSkinForFriend, eventParams2);
            CMallItem      cMallItem       = new CMallItem(skinInfo.dwHeroID, skinInfo.dwSkinID, CMallItem.IconType.Normal);
            Text           componetInChild = Utility.GetComponetInChild <Text>(mallWidget.m_askForBtn, "Text");
            Button         component2      = mallWidget.m_askForBtn.GetComponent <Button>();
            CUIEventScript component3      = mallWidget.m_askForBtn.GetComponent <CUIEventScript>();

            if (!cMallItem.CanBeAskFor())
            {
                if (cMallItem.Owned(false) && componetInChild != null)
                {
                    componetInChild.set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Skin_State_Own"));
                }
                if (component2 != null)
                {
                    component2.enabled = false;
                }
                if (component3 != null)
                {
                    component3.enabled = false;
                }
            }
            else
            {
                if (componetInChild != null)
                {
                    componetInChild.set_text(Singleton <CTextManager> .GetInstance().GetText("Ask_For_Friend_Op"));
                }
                if (component2 != null)
                {
                    component2.enabled = true;
                }
                if (component3 != null)
                {
                    component3.enabled = true;
                }
                mallWidget.m_askForBtn.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.HeroSkin_OpenAskForFriend, eventParams2);
            }
        }
Beispiel #14
0
        private void SetHeroItem(CMallItemWidget mallWidget, ResHeroCfgInfo heroInfo, CUIFormScript form)
        {
            Image component = mallWidget.m_icon.GetComponent <Image>();

            component.set_color(CUIUtility.s_Color_White);
            string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_BustHero_Dir, heroInfo.szImagePath);

            component.SetSprite(prefabPath, form, false, true, true, true);
            mallWidget.m_skinLabel.CustomSetActive(false);
            mallWidget.m_topNameLeftText.GetComponent <Text>().set_text(heroInfo.szName);
            mallWidget.m_topNameRightText.CustomSetActive(false);
            IHeroData heroData = CHeroDataFactory.CreateHeroData(heroInfo.dwCfgID);

            if (heroData != null)
            {
                ResHeroPromotion resHeroPromotion = heroData.promotion();
                this._payInfoTemp = CMallSystem.GetPayInfoSetOfGood(heroInfo, resHeroPromotion);
                uint num = this.SetItemPriceInfo(mallWidget, ref this._payInfoTemp);
                this.SetItemTag(mallWidget, resHeroPromotion, null, form);
                stUIEventParams eventParams = default(stUIEventParams);
                eventParams.heroId             = heroInfo.dwCfgID;
                eventParams.commonUInt64Param1 = this._curFriendUid;
                eventParams.commonBool         = this._curFriendIsSns;
                eventParams.commonUInt32Param1 = this._curWorldId;
                mallWidget.m_buyBtn.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.HeroView_OpenBuyHeroForFriend, eventParams);
                mallWidget.m_item.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.None, eventParams);
                CMallItem      cMallItem       = new CMallItem(heroData.cfgID, CMallItem.IconType.Normal);
                Text           componetInChild = Utility.GetComponetInChild <Text>(mallWidget.m_askForBtn, "Text");
                Button         component2      = mallWidget.m_askForBtn.GetComponent <Button>();
                CUIEventScript component3      = mallWidget.m_askForBtn.GetComponent <CUIEventScript>();
                if (!cMallItem.CanBeAskFor())
                {
                    if (cMallItem.Owned(false) && componetInChild != null)
                    {
                        componetInChild.set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Hero_State_Own"));
                    }
                    if (component2 != null)
                    {
                        component2.enabled = false;
                    }
                    if (component3 != null)
                    {
                        component3.enabled = false;
                    }
                }
                else
                {
                    if (componetInChild != null)
                    {
                        componetInChild.set_text(Singleton <CTextManager> .GetInstance().GetText("Ask_For_Friend_Op"));
                    }
                    if (component2 != null)
                    {
                        component2.enabled = true;
                    }
                    if (component3 != null)
                    {
                        component3.enabled = true;
                    }
                    mallWidget.m_askForBtn.GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.HeroView_OpenAskForFriend, eventParams);
                }
            }
        }