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); }
public static ResSkinPromotion GetSkinPromotion(uint uniSkinId) { ResHeroSkinShop resHeroSkinShop = null; GameDataMgr.skinShopInfoDict.TryGetValue(uniSkinId, ref resHeroSkinShop); if (resHeroSkinShop == null) { return(null); } for (int i = 0; i < 5; i++) { uint num = resHeroSkinShop.PromotionID[i]; if (num != 0u) { if (GameDataMgr.skinPromotionDict.ContainsKey(num)) { ResSkinPromotion resSkinPromotion = new ResSkinPromotion(); if (GameDataMgr.skinPromotionDict.TryGetValue(num, ref resSkinPromotion) && (ulong)resSkinPromotion.dwOnTimeGen <= (ulong)((long)CRoleInfo.GetCurrentUTCTime()) && (ulong)resSkinPromotion.dwOffTimeGen >= (ulong)((long)CRoleInfo.GetCurrentUTCTime())) { return(resSkinPromotion); } } } } return(null); }
private int CompareCoupons(ResHeroSkin l, ResHeroSkin r) { ResSkinPromotion skinPromotion = CSkinInfo.GetSkinPromotion(l.dwHeroID, l.dwSkinID); ResSkinPromotion skinPromotion2 = CSkinInfo.GetSkinPromotion(r.dwHeroID, r.dwSkinID); stPayInfoSet payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(l, skinPromotion); stPayInfoSet payInfoSetOfGood2 = CMallSystem.GetPayInfoSetOfGood(r, skinPromotion2); uint num = 4294967295u; uint num2 = 4294967295u; for (int i = 0; i < payInfoSetOfGood.m_payInfoCount; i++) { if ((payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.Diamond || payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DianQuan || payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DiamondAndDianQuan) && payInfoSetOfGood.m_payInfos[i].m_payValue < num) { num = payInfoSetOfGood.m_payInfos[i].m_payValue; } } for (int j = 0; j < payInfoSetOfGood2.m_payInfoCount; j++) { if ((payInfoSetOfGood2.m_payInfos[j].m_payType == enPayType.Diamond || payInfoSetOfGood2.m_payInfos[j].m_payType == enPayType.DianQuan || payInfoSetOfGood2.m_payInfos[j].m_payType == enPayType.DiamondAndDianQuan) && payInfoSetOfGood2.m_payInfos[j].m_payValue < num2) { num2 = payInfoSetOfGood2.m_payInfos[j].m_payValue; } } if (num == 4294967295u && this.IsDesc()) { num = 0u; } if (num2 == 4294967295u && this.IsDesc()) { num2 = 0u; } return(num.CompareTo(num2)); }
public RES_LUCKYDRAW_ITEMTAG TagType(ref ResHeroPromotion heroPromotion, ref ResSkinPromotion skinPromotion) { ItemType type = this.m_type; if (type != ItemType.Hero) { if ((type == ItemType.Skin) && (this.m_skinData != null)) { skinPromotion = CSkinInfo.GetSkinPromotion(this.m_skinData.dwID); if (skinPromotion == null) { return(RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_NONE); } return((RES_LUCKYDRAW_ITEMTAG)skinPromotion.bTag); } } else if (this.m_heroData != null) { heroPromotion = this.m_heroData.promotion(); if (heroPromotion == null) { return(RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_NONE); } return((RES_LUCKYDRAW_ITEMTAG)heroPromotion.bTag); } return(RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_NONE); }
public static bool IsCanBuy(uint heroId, uint skinId) { ResHeroSkin heroSkin = GetHeroSkin(heroId, skinId); if (heroSkin == null) { return(false); } if (!GameDataMgr.IsSkinAvailableAtShop(heroSkin.dwID)) { return(false); } ResSkinPromotion skinPromotion = new ResSkinPromotion(); stPayInfoSet payInfoSetOfGood = new stPayInfoSet(); skinPromotion = GetSkinPromotion(heroSkin.dwID); if (skinPromotion != null) { payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(false, 0, skinPromotion.bIsBuyCoupons > 0, skinPromotion.dwBuyCoupons, skinPromotion.bIsBuyDiamond > 0, skinPromotion.dwBuyDiamond, 0x2710); } else { payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(heroSkin); } return(payInfoSetOfGood.m_payInfoCount > 0); }
private int CompareCoupons(ResHeroSkin l, ResHeroSkin r) { ResSkinPromotion skinPromotion = CSkinInfo.GetSkinPromotion(l.dwHeroID, l.dwSkinID); ResSkinPromotion resPromotion = CSkinInfo.GetSkinPromotion(r.dwHeroID, r.dwSkinID); stPayInfoSet payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(l, skinPromotion); stPayInfoSet set2 = CMallSystem.GetPayInfoSetOfGood(r, resPromotion); uint maxValue = uint.MaxValue; uint payValue = uint.MaxValue; for (int i = 0; i < payInfoSetOfGood.m_payInfoCount; i++) { if ((((payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.Diamond) || (payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DianQuan)) || (payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.DiamondAndDianQuan)) && (payInfoSetOfGood.m_payInfos[i].m_payValue < maxValue)) { maxValue = payInfoSetOfGood.m_payInfos[i].m_payValue; } } for (int j = 0; j < set2.m_payInfoCount; j++) { if ((((set2.m_payInfos[j].m_payType == enPayType.Diamond) || (set2.m_payInfos[j].m_payType == enPayType.DianQuan)) || (set2.m_payInfos[j].m_payType == enPayType.DiamondAndDianQuan)) && (set2.m_payInfos[j].m_payValue < payValue)) { payValue = set2.m_payInfos[j].m_payValue; } } if ((maxValue == uint.MaxValue) && this.IsDesc()) { maxValue = 0; } if ((payValue == uint.MaxValue) && this.IsDesc()) { payValue = 0; } return(maxValue.CompareTo(payValue)); }
public static ResSkinPromotion GetSkinPromotion(uint uniSkinId) { ResHeroSkin heroSkin = GetHeroSkin(uniSkinId); if (heroSkin != null) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo == null) { return(null); } for (int i = 0; i < 5; i++) { uint key = heroSkin.PromotionID[i]; if ((key != 0) && GameDataMgr.skinPromotionDict.ContainsKey(key)) { ResSkinPromotion promotion = new ResSkinPromotion(); if ((GameDataMgr.skinPromotionDict.TryGetValue(key, out promotion) && (promotion.dwOnTimeGen <= masterRoleInfo.getCurrentTimeSinceLogin())) && (promotion.dwOffTimeGen >= masterRoleInfo.getCurrentTimeSinceLogin())) { return(promotion); } } } } return(null); }
public static bool IsCanBuy(uint heroId, uint skinId) { ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(heroId, skinId); if (heroSkin == null) { return(false); } if (!GameDataMgr.IsSkinAvailableAtShop(heroSkin.dwID)) { return(false); } ResSkinPromotion resSkinPromotion = new ResSkinPromotion(); stPayInfoSet stPayInfoSet = default(stPayInfoSet); resSkinPromotion = CSkinInfo.GetSkinPromotion(heroSkin.dwID); if (resSkinPromotion != null) { stPayInfoSet = CMallSystem.GetPayInfoSetOfGood(false, 0u, resSkinPromotion.bIsBuyCoupons > 0, resSkinPromotion.dwBuyCoupons, resSkinPromotion.bIsBuyDiamond > 0, resSkinPromotion.dwBuyDiamond, 10000u); } else { stPayInfoSet = CMallSystem.GetPayInfoSetOfGood(heroSkin); } return(stPayInfoSet.m_payInfoCount > 0); }
public RES_LUCKYDRAW_ITEMTAG TagType(ref ResHeroPromotion heroPromotion, ref ResSkinPromotion skinPromotion) { CMallItem.ItemType type = this.m_type; if (type != CMallItem.ItemType.Hero) { if (type == CMallItem.ItemType.Skin) { if (this.m_skinData != null) { skinPromotion = CSkinInfo.GetSkinPromotion(this.m_skinData.dwID); if (skinPromotion == null) { return(0); } return(skinPromotion.bTag); } } } else if (this.m_heroData != null) { heroPromotion = this.m_heroData.promotion(); if (heroPromotion == null) { return(0); } return(heroPromotion.bTag); } return(0); }
public static stPayInfoSet GetSkinPayInfoSet(uint heroId, uint skinId) { ResSkinPromotion resPromotion = new ResSkinPromotion(); stPayInfoSet set = new stPayInfoSet(); resPromotion = GetSkinPromotion(heroId, skinId); return(CMallSystem.GetPayInfoSetOfGood(GetHeroSkin(heroId, skinId), resPromotion)); }
public static stPayInfoSet GetSkinPayInfoSet(uint heroId, uint skinId) { ResSkinPromotion resPromotion = new ResSkinPromotion(); stPayInfoSet stPayInfoSet = default(stPayInfoSet); resPromotion = CSkinInfo.GetSkinPromotion(heroId, skinId); ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(heroId, skinId); return(CMallSystem.GetPayInfoSetOfGood(heroSkin, resPromotion)); }
public static ResSkinPromotion GetSkinPromotion(uint uniSkinId) { ResHeroSkinShop shop = null; GameDataMgr.skinShopInfoDict.TryGetValue(uniSkinId, out shop); if (shop != null) { for (int i = 0; i < 5; i++) { uint key = shop.PromotionID[i]; if ((key != 0) && GameDataMgr.skinPromotionDict.ContainsKey(key)) { ResSkinPromotion promotion = new ResSkinPromotion(); if ((GameDataMgr.skinPromotionDict.TryGetValue(key, out promotion) && (promotion.dwOnTimeGen <= CRoleInfo.GetCurrentUTCTime())) && (promotion.dwOffTimeGen >= CRoleInfo.GetCurrentUTCTime())) { return(promotion); } } } } return(null); }
public CMallItem(uint heroID, uint skinID, IconType iconType = 0) { this.m_type = ItemType.Skin; this.m_iconType = iconType; this.m_heroData = CHeroDataFactory.CreateHeroData(heroID); this.m_skinData = CSkinInfo.GetHeroSkin(heroID, skinID); if ((this.m_heroData != null) && (this.m_skinData != null)) { this.m_firstName = this.m_heroData.heroName; this.m_secondName = this.m_skinData.szSkinName; if (iconType == IconType.Small) { this.m_useable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN, this.m_skinData.dwID, 1); if (this.m_useable != null) { this.m_iconPath = this.m_useable.GetIconPath(); } else { this.m_iconPath = null; } } else { this.m_iconPath = CUIUtility.s_Sprite_Dynamic_BustHero_Dir + this.m_skinData.szSkinPicID; } ResSkinPromotion skinPromotion = CSkinInfo.GetSkinPromotion(heroID, skinID); this.m_payInfoSet = CMallSystem.GetPayInfoSetOfGood(this.m_skinData, skinPromotion); } else { this.m_useable = null; this.m_firstName = null; this.m_secondName = null; this.m_iconPath = null; this.m_payInfoSet = new stPayInfoSet(); } }
public CMallItem(uint heroID, uint skinID, CMallItem.IconType iconType = CMallItem.IconType.Normal) { this.m_type = CMallItem.ItemType.Skin; this.m_iconType = iconType; this.m_heroData = CHeroDataFactory.CreateHeroData(heroID); this.m_skinData = CSkinInfo.GetHeroSkin(heroID, skinID); if (this.m_heroData != null && this.m_skinData != null) { this.m_firstName = this.m_heroData.heroName; this.m_secondName = this.m_skinData.szSkinName; if (iconType == CMallItem.IconType.Small) { this.m_useable = CUseableManager.CreateUseable(7, this.m_skinData.dwID, 1); if (this.m_useable != null) { this.m_iconPath = this.m_useable.GetIconPath(); } else { this.m_iconPath = null; } } else { this.m_iconPath = CUIUtility.s_Sprite_Dynamic_BustHero_Dir + this.m_skinData.szSkinPicID; } ResSkinPromotion skinPromotion = CSkinInfo.GetSkinPromotion(heroID, skinID); this.m_payInfoSet = CMallSystem.GetPayInfoSetOfGood(this.m_skinData, skinPromotion); } else { this.m_useable = null; this.m_firstName = null; this.m_secondName = null; this.m_iconPath = null; this.m_payInfoSet = default(stPayInfoSet); } }
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); } }
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 int CompareDefault(ResHeroSkin l, ResHeroSkin r) { int result = 0; ResSkinPromotion skinPromotion = CSkinInfo.GetSkinPromotion(l.dwHeroID, l.dwSkinID); ResSkinPromotion skinPromotion2 = CSkinInfo.GetSkinPromotion(r.dwHeroID, r.dwSkinID); ResHeroSkinShop resHeroSkinShop = null; GameDataMgr.skinShopInfoDict.TryGetValue(l.dwID, ref resHeroSkinShop); ResHeroSkinShop resHeroSkinShop2 = null; GameDataMgr.skinShopInfoDict.TryGetValue(r.dwID, ref resHeroSkinShop2); uint num = (resHeroSkinShop == null) ? 4294967295u : resHeroSkinShop.dwSortId; uint num2 = (resHeroSkinShop2 == null) ? 4294967295u : resHeroSkinShop2.dwSortId; if (skinPromotion != null) { num = skinPromotion.dwSortIndex; } if (skinPromotion2 != null) { num2 = skinPromotion2.dwSortIndex; } if (resHeroSkinShop != null) { ResDT_RegisterSale_Info stRegisterSale = resHeroSkinShop.stRegisterSale; bool flag = CMallSystem.IsinRegisterSales(stRegisterSale); if (flag) { num = stRegisterSale.dwSortID; } } if (resHeroSkinShop2 != null) { ResDT_RegisterSale_Info stRegisterSale2 = resHeroSkinShop2.stRegisterSale; bool flag2 = CMallSystem.IsinRegisterSales(stRegisterSale2); if (flag2) { num2 = stRegisterSale2.dwSortID; } } if (num < num2) { result = 1; } if (num > num2) { result = -1; } bool flag3 = this.m_roleInfo.IsHaveHeroSkin(l.dwHeroID, l.dwSkinID, false); bool flag4 = this.m_roleInfo.IsHaveHeroSkin(r.dwHeroID, r.dwSkinID, false); if (flag3 && !flag4) { return(1); } if (!flag3 && flag4) { return(-1); } if ((skinPromotion != null && skinPromotion.bSortIndexOnly > 0) || (skinPromotion2 != null && skinPromotion2.bSortIndexOnly > 0)) { return(result); } if (CSkinInfo.IsCanBuy(l.dwHeroID, l.dwSkinID) && !CSkinInfo.IsCanBuy(r.dwHeroID, r.dwSkinID)) { return(-1); } if (!CSkinInfo.IsCanBuy(l.dwHeroID, l.dwSkinID) && CSkinInfo.IsCanBuy(r.dwHeroID, r.dwSkinID)) { return(1); } if (this.m_roleInfo.IsHaveHero(l.dwHeroID, false) && !this.m_roleInfo.IsHaveHero(r.dwHeroID, false)) { return(-1); } if (!this.m_roleInfo.IsHaveHero(l.dwHeroID, false) && this.m_roleInfo.IsHaveHero(r.dwHeroID, false)) { return(1); } return(result); }
private int CompareDefault(ResHeroSkin l, ResHeroSkin r) { int num = 0; ResSkinPromotion skinPromotion = CSkinInfo.GetSkinPromotion(l.dwHeroID, l.dwSkinID); ResSkinPromotion promotion2 = CSkinInfo.GetSkinPromotion(r.dwHeroID, r.dwSkinID); ResHeroSkinShop shop = null; GameDataMgr.skinShopInfoDict.TryGetValue(l.dwID, out shop); ResHeroSkinShop shop2 = null; GameDataMgr.skinShopInfoDict.TryGetValue(r.dwID, out shop2); uint dwSortIndex = (shop == null) ? uint.MaxValue : shop.dwSortId; uint num3 = (shop2 == null) ? uint.MaxValue : shop2.dwSortId; if (skinPromotion != null) { dwSortIndex = skinPromotion.dwSortIndex; } if (promotion2 != null) { num3 = promotion2.dwSortIndex; } if (dwSortIndex < num3) { num = 1; } if (dwSortIndex > num3) { num = -1; } bool flag = this.m_roleInfo.IsHaveHeroSkin(l.dwHeroID, l.dwSkinID, false); bool flag2 = this.m_roleInfo.IsHaveHeroSkin(r.dwHeroID, r.dwSkinID, false); if (flag && !flag2) { return(1); } if (!flag && flag2) { return(-1); } if ((skinPromotion == null) || (skinPromotion.bSortIndexOnly <= 0)) { if ((promotion2 != null) && (promotion2.bSortIndexOnly > 0)) { return(num); } if (CSkinInfo.IsCanBuy(l.dwHeroID, l.dwSkinID) && !CSkinInfo.IsCanBuy(r.dwHeroID, r.dwSkinID)) { return(-1); } if (!CSkinInfo.IsCanBuy(l.dwHeroID, l.dwSkinID) && CSkinInfo.IsCanBuy(r.dwHeroID, r.dwSkinID)) { return(1); } if (this.m_roleInfo.IsHaveHero(l.dwHeroID, false) && !this.m_roleInfo.IsHaveHero(r.dwHeroID, false)) { return(-1); } if (!this.m_roleInfo.IsHaveHero(l.dwHeroID, false) && this.m_roleInfo.IsHaveHero(r.dwHeroID, false)) { return(1); } } return(num); }
public bool TagInfo(ref string iconPath, ref string text, bool owned = false) { float num; CTextManager instance = Singleton <CTextManager> .GetInstance(); if (owned) { iconPath = "UGUI/Sprite/Common/Product_New.prefab"; text = instance.GetText("Mall_Hero_State_Own"); return(true); } CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); DebugHelper.Assert(masterRoleInfo != null, "Master RoleInfo is null"); if (masterRoleInfo == null) { return(false); } ResHeroPromotion heroPromotion = null; ResSkinPromotion skinPromotion = null; switch (this.TagType(ref heroPromotion, ref skinPromotion)) { case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_NONE: iconPath = null; text = null; return(false); case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_UNUSUAL: { int num2 = 0; uint num3 = (uint)masterRoleInfo.getCurrentTimeSinceLogin(); switch (this.m_type) { case ItemType.Hero: if (heroPromotion == null) { iconPath = null; text = null; return(false); } if (heroPromotion.dwOnTimeGen > num3) { num2 = (int)(heroPromotion.dwOffTimeGen - heroPromotion.dwOnTimeGen); } else { num2 = (int)(heroPromotion.dwOffTimeGen - num3); } break; case ItemType.Skin: if (skinPromotion == null) { iconPath = null; text = null; return(false); } if (skinPromotion.dwOnTimeGen > num3) { num2 = (int)(skinPromotion.dwOffTimeGen - skinPromotion.dwOnTimeGen); } else { num2 = (int)(skinPromotion.dwOffTimeGen - num3); } break; } if (num2 > 0) { int num4 = (int)Math.Ceiling(((double)num2) / 86400.0); if (num4 > 0) { iconPath = "UGUI/Sprite/Common/Product_Unusual.prefab"; string[] args = new string[] { num4.ToString() }; text = Singleton <CTextManager> .GetInstance().GetText("Mall_Promotion_Tag_1", args); return(true); } iconPath = null; text = null; return(false); } iconPath = null; text = null; return(false); } case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_NEW: iconPath = "UGUI/Sprite/Common/Product_New.prefab"; text = Singleton <CTextManager> .GetInstance().GetText("Common_Tag_New"); return(true); case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_HOT: iconPath = "UGUI/Sprite/Common/Product_Hot.prefab"; text = Singleton <CTextManager> .GetInstance().GetText("Common_Tag_Hot"); return(true); case RES_LUCKYDRAW_ITEMTAG.RES_LUCKYDRAW_ITEMTAG_DISCOUNT: num = 100f; switch (this.m_type) { case ItemType.Hero: if (heroPromotion == null) { iconPath = null; text = null; return(false); } num = ((float)heroPromotion.dwDiscount) / 10f; goto Label_00F4; case ItemType.Skin: if (skinPromotion == null) { iconPath = null; text = null; return(false); } num = ((float)skinPromotion.dwDiscount) / 10f; goto Label_00F4; } break; default: iconPath = null; text = null; return(false); } Label_00F4: iconPath = "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")); } return(true); }
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 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); } }