public bool TagInfo(ref string iconPath, ref string text, bool owned = false) { CTextManager instance = Singleton <CTextManager> .GetInstance(); if (owned) { iconPath = "UGUI/Sprite/Common/Product_New.prefab"; text = instance.GetText("Mall_Hero_State_Own"); return(true); } if (this.Owned(false)) { iconPath = null; text = null; return(false); } ResHeroPromotion resHeroPromotion = null; ResSkinPromotion resSkinPromotion = null; RES_LUCKYDRAW_ITEMTAG rES_LUCKYDRAW_ITEMTAG = this.TagType(ref resHeroPromotion, ref resSkinPromotion); string text2 = null; if (this.m_type == CMallItem.ItemType.Hero) { ResHeroShop heroShop = null; GameDataMgr.heroShopInfoDict.TryGetValue(this.m_heroData.heroCfgInfo.dwCfgID, ref heroShop); text2 = CMallSystem.GetRegisterSalesHeroDay(ref resHeroPromotion, heroShop); } else if (this.m_type == CMallItem.ItemType.Skin) { ResHeroSkinShop heroShop2 = null; GameDataMgr.skinShopInfoDict.TryGetValue(this.m_skinData.dwID, ref heroShop2); text2 = CMallSystem.GetRegisterSalesSkinDay(ref resSkinPromotion, heroShop2); } if (text2 != null) { iconPath = "UGUI/Sprite/Common/Product_Unusual.prefab"; text = text2; return(true); } switch (rES_LUCKYDRAW_ITEMTAG) { case 0: if (this.m_type == CMallItem.ItemType.Hero && this.m_heroData.heroCfgInfo.bTag == 1) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo == null) { iconPath = null; text = null; return(false); } if (GameDataMgr.svr2CltCfgDict.ContainsKey(24u)) { ResGlobalInfo resGlobalInfo = new ResGlobalInfo(); if (GameDataMgr.svr2CltCfgDict.TryGetValue(24u, ref resGlobalInfo)) { uint dwConfValue = resGlobalInfo.dwConfValue; if (masterRoleInfo.PvpLevel < dwConfValue) { iconPath = "UGUI/Sprite/Common/Hero_Newbie.prefab"; text = Singleton <CTextManager> .GetInstance().GetText("Hero_Tag_Newbie"); return(true); } } } } iconPath = null; text = null; return(false); case 1: { int num = 0; uint currentUTCTime = (uint)CRoleInfo.GetCurrentUTCTime(); CMallItem.ItemType type = this.m_type; if (type != CMallItem.ItemType.Hero) { if (type == CMallItem.ItemType.Skin) { if (resSkinPromotion == null) { iconPath = null; text = null; return(false); } if (resSkinPromotion.dwOnTimeGen > currentUTCTime) { num = (int)(resSkinPromotion.dwOffTimeGen - resSkinPromotion.dwOnTimeGen); } else { num = (int)(resSkinPromotion.dwOffTimeGen - currentUTCTime); } } } else { if (resHeroPromotion == null) { iconPath = null; text = null; return(false); } if (resHeroPromotion.dwOnTimeGen > currentUTCTime) { num = (int)(resHeroPromotion.dwOffTimeGen - resHeroPromotion.dwOnTimeGen); } else { num = (int)(resHeroPromotion.dwOffTimeGen - currentUTCTime); } } if (num <= 0) { iconPath = null; text = null; return(false); } int num2 = (int)Math.Ceiling((double)num / 86400.0); if (num2 > 0) { iconPath = "UGUI/Sprite/Common/Product_Unusual.prefab"; text = Singleton <CTextManager> .GetInstance().GetText("Mall_Promotion_Tag_1", new string[] { num2.ToString() }); return(true); } iconPath = null; text = null; return(false); } case 2: iconPath = "UGUI/Sprite/Common/Product_New.prefab"; text = Singleton <CTextManager> .GetInstance().GetText("Common_Tag_New"); return(true); case 3: iconPath = "UGUI/Sprite/Common/Product_Hot.prefab"; text = Singleton <CTextManager> .GetInstance().GetText("Common_Tag_Hot"); return(true); case 4: { float num3 = 100f; switch (this.m_type) { case CMallItem.ItemType.Hero: if (resHeroPromotion == null) { iconPath = null; text = null; return(false); } num3 = resHeroPromotion.dwDiscount / 10f; break; case CMallItem.ItemType.Skin: if (resSkinPromotion == null) { iconPath = null; text = null; return(false); } num3 = resSkinPromotion.dwDiscount / 10f; break; } iconPath = "UGUI/Sprite/Common/Product_Discount.prefab"; if (Math.Abs(num3 % 1f) < 1.401298E-45f) { text = string.Format("{0}折", ((int)num3).ToString("D")); } else { text = string.Format("{0}折", num3.ToString("0.0")); } return(true); } default: iconPath = null; text = null; return(false); } }
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); } }
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); } }