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); } }
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); }
private int CompareCoupons(ResHeroCfgInfo l, ResHeroCfgInfo r) { ResHeroPromotion resPromotion = CHeroDataFactory.CreateHeroData(l.dwCfgID).promotion(); ResHeroPromotion promotion2 = CHeroDataFactory.CreateHeroData(r.dwCfgID).promotion(); stPayInfoSet payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(l, resPromotion); stPayInfoSet set2 = CMallSystem.GetPayInfoSetOfGood(r, promotion2); 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)); }
private int CompareCoupons(ResHeroCfgInfo l, ResHeroCfgInfo r) { ResHeroPromotion resPromotion = CHeroDataFactory.CreateHeroData(l.dwCfgID).promotion(); ResHeroPromotion resPromotion2 = CHeroDataFactory.CreateHeroData(r.dwCfgID).promotion(); stPayInfoSet payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(l, resPromotion); stPayInfoSet payInfoSetOfGood2 = CMallSystem.GetPayInfoSetOfGood(r, resPromotion2); 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) { 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 ResHeroPromotion promotion() { if (this.m_info.shopCfgInfo == null) { GameDataMgr.heroShopInfoDict.TryGetValue(this.m_info.cfgInfo.dwCfgID, ref this.m_info.shopCfgInfo); if (this.m_info.shopCfgInfo == null) { return(null); } } for (int i = 0; i < (int)this.m_info.shopCfgInfo.bPromotionCnt; i++) { uint num = this.m_info.shopCfgInfo.PromotionID[i]; if (num != 0u) { if (GameDataMgr.heroPromotionDict.ContainsKey(num)) { ResHeroPromotion resHeroPromotion = new ResHeroPromotion(); if (GameDataMgr.heroPromotionDict.TryGetValue(num, ref resHeroPromotion) && (ulong)resHeroPromotion.dwOnTimeGen <= (ulong)((long)CRoleInfo.GetCurrentUTCTime()) && (ulong)resHeroPromotion.dwOffTimeGen >= (ulong)((long)CRoleInfo.GetCurrentUTCTime())) { return(resHeroPromotion); } } } } return(null); }
private int CompareDefault(ResHeroCfgInfo l, ResHeroCfgInfo r) { bool flag = this.m_roleInfo.IsHaveHero(l.dwCfgID, false); bool flag2 = this.m_roleInfo.IsHaveHero(r.dwCfgID, false); if (flag && !flag2) { return(1); } if (!flag && flag2) { return(-1); } ResHeroPromotion promotion = CHeroDataFactory.CreateHeroData(l.dwCfgID).promotion(); ResHeroPromotion promotion2 = CHeroDataFactory.CreateHeroData(r.dwCfgID).promotion(); ResHeroShop shop = null; ResHeroShop shop2 = null; GameDataMgr.heroShopInfoDict.TryGetValue(l.dwCfgID, out shop); GameDataMgr.heroShopInfoDict.TryGetValue(r.dwCfgID, out shop2); uint dwSortIndex = (shop == null) ? uint.MaxValue : shop.dwSortId; uint num2 = (shop2 == null) ? uint.MaxValue : shop2.dwSortId; if (promotion != null) { dwSortIndex = promotion.dwSortIndex; } if (promotion2 != null) { num2 = promotion2.dwSortIndex; } if (dwSortIndex < num2) { return(1); } if (dwSortIndex > num2) { return(-1); } if (l.dwCfgID < r.dwCfgID) { return(-1); } if (l.dwCfgID > r.dwCfgID) { return(1); } return(0); }
public ResHeroPromotion promotion() { if (this._heroShopInfo != null) { for (int i = 0; i < this._heroShopInfo.bPromotionCnt; i++) { uint key = this._heroShopInfo.PromotionID[i]; if ((key != 0) && GameDataMgr.heroPromotionDict.ContainsKey(key)) { ResHeroPromotion promotion = new ResHeroPromotion(); if ((GameDataMgr.heroPromotionDict.TryGetValue(key, out promotion) && (promotion.dwOnTimeGen <= CRoleInfo.GetCurrentUTCTime())) && (promotion.dwOffTimeGen >= CRoleInfo.GetCurrentUTCTime())) { return(promotion); } } } } return(null); }
public CMallItem(uint heroID, CMallItem.IconType iconType = CMallItem.IconType.Normal) { this.m_type = CMallItem.ItemType.Hero; this.m_iconType = iconType; this.m_heroData = CHeroDataFactory.CreateHeroData(heroID); if (this.m_heroData != null) { this.m_firstName = this.m_heroData.heroName; this.m_secondName = null; string s_Sprite_Dynamic_Icon_Dir = CUIUtility.s_Sprite_Dynamic_Icon_Dir; if (iconType == CMallItem.IconType.Small) { this.m_useable = CUseableManager.CreateUseable(4, heroID, 1); if (this.m_useable != null) { this.m_iconPath = this.m_useable.GetIconPath(); } else { this.m_iconPath = null; } } else if (this.m_heroData.heroCfgInfo != null) { this.m_iconPath = CUIUtility.s_Sprite_Dynamic_BustHero_Dir + this.m_heroData.heroCfgInfo.szImagePath; } else { this.m_iconPath = null; } ResHeroPromotion resPromotion = this.m_heroData.promotion(); this.m_payInfoSet = CMallSystem.GetPayInfoSetOfGood(this.m_heroData.heroCfgInfo, resPromotion); } else { this.m_useable = null; this.m_firstName = null; this.m_secondName = null; this.m_iconPath = null; this.m_payInfoSet = default(stPayInfoSet); } }
public ResHeroPromotion promotion() { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null) { for (int i = 0; i < 5; i++) { uint key = this.m_cfgInfo.PromotionID[i]; if ((key != 0) && GameDataMgr.heroPromotionDict.ContainsKey(key)) { ResHeroPromotion promotion = new ResHeroPromotion(); if ((GameDataMgr.heroPromotionDict.TryGetValue(key, out promotion) && (promotion.dwOnTimeGen <= masterRoleInfo.getCurrentTimeSinceLogin())) && (promotion.dwOffTimeGen >= masterRoleInfo.getCurrentTimeSinceLogin())) { return(promotion); } } } } return(null); }
private int CompareCoin(ResHeroCfgInfo l, ResHeroCfgInfo r) { ResHeroPromotion resPromotion = CHeroDataFactory.CreateHeroData(l.dwCfgID).promotion(); ResHeroPromotion promotion2 = CHeroDataFactory.CreateHeroData(r.dwCfgID).promotion(); ResHeroShop shop = null; ResHeroShop shop2 = null; GameDataMgr.heroShopInfoDict.TryGetValue(l.dwCfgID, out shop); GameDataMgr.heroShopInfoDict.TryGetValue(r.dwCfgID, out shop2); stPayInfoSet payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(l, resPromotion); stPayInfoSet set2 = CMallSystem.GetPayInfoSetOfGood(r, promotion2); 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.GoldCoin) && (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.GoldCoin) && (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)); }
private int CompareCoin(ResHeroCfgInfo l, ResHeroCfgInfo r) { ResHeroPromotion resPromotion = CHeroDataFactory.CreateHeroData(l.dwCfgID).promotion(); ResHeroPromotion resPromotion2 = CHeroDataFactory.CreateHeroData(r.dwCfgID).promotion(); ResHeroShop resHeroShop = null; ResHeroShop resHeroShop2 = null; GameDataMgr.heroShopInfoDict.TryGetValue(l.dwCfgID, out resHeroShop); GameDataMgr.heroShopInfoDict.TryGetValue(r.dwCfgID, out resHeroShop2); stPayInfoSet payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(l, resPromotion); stPayInfoSet payInfoSetOfGood2 = CMallSystem.GetPayInfoSetOfGood(r, resPromotion2); uint num = 4294967295u; uint num2 = 4294967295u; for (int i = 0; i < payInfoSetOfGood.m_payInfoCount; i++) { if (payInfoSetOfGood.m_payInfos[i].m_payType == enPayType.GoldCoin && 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.GoldCoin && 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 CMallItem(uint heroID, IconType iconType = 0) { this.m_type = ItemType.Hero; this.m_iconType = iconType; this.m_heroData = CHeroDataFactory.CreateHeroData(heroID); if (this.m_heroData != null) { this.m_firstName = this.m_heroData.heroName; this.m_secondName = null; string str = CUIUtility.s_Sprite_Dynamic_Icon_Dir; if (iconType == IconType.Small) { this.m_useable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_HERO, heroID, 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_heroData.imagePath; } ResHeroPromotion resPromotion = this.m_heroData.promotion(); this.m_payInfoSet = CMallSystem.GetPayInfoSetOfGood(this.m_heroData.heroCfgInfo, resPromotion); } else { this.m_useable = null; this.m_firstName = null; this.m_secondName = null; this.m_iconPath = null; this.m_payInfoSet = new stPayInfoSet(); } }
private int CompareDefault(ResHeroCfgInfo l, ResHeroCfgInfo r) { bool flag = this.m_roleInfo.IsHaveHero(l.dwCfgID, false); bool flag2 = this.m_roleInfo.IsHaveHero(r.dwCfgID, false); if (flag && !flag2) { return(1); } if (!flag && flag2) { return(-1); } ResHeroPromotion resHeroPromotion = CHeroDataFactory.CreateHeroData(l.dwCfgID).promotion(); ResHeroPromotion resHeroPromotion2 = CHeroDataFactory.CreateHeroData(r.dwCfgID).promotion(); ResHeroShop resHeroShop = null; ResHeroShop resHeroShop2 = null; GameDataMgr.heroShopInfoDict.TryGetValue(l.dwCfgID, out resHeroShop); GameDataMgr.heroShopInfoDict.TryGetValue(r.dwCfgID, out resHeroShop2); uint num = (resHeroShop != null) ? resHeroShop.dwSortId : 4294967295u; uint num2 = (resHeroShop2 != null) ? resHeroShop2.dwSortId : 4294967295u; if (resHeroPromotion != null) { num = resHeroPromotion.dwSortIndex; } if (resHeroPromotion2 != null) { num2 = resHeroPromotion2.dwSortIndex; } if (resHeroShop != null) { ResDT_RegisterSale_Info stRegisterSale = resHeroShop.stRegisterSale; bool flag3 = CMallSystem.IsinRegisterSales(stRegisterSale); if (flag3) { num = stRegisterSale.dwSortID; } } if (resHeroShop2 != null) { ResDT_RegisterSale_Info stRegisterSale2 = resHeroShop2.stRegisterSale; bool flag4 = CMallSystem.IsinRegisterSales(stRegisterSale2); if (flag4) { num2 = stRegisterSale2.dwSortID; } } if (num < num2) { return(1); } if (num > num2) { return(-1); } if (l.dwCfgID < r.dwCfgID) { return(-1); } if (l.dwCfgID > r.dwCfgID) { return(1); } return(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); } }
private void Draw(CMail mail) { if (this.form != null) { Text componetInChild = Utility.GetComponetInChild <Text>(this.form.gameObject, "Panel/msgContainer/name"); Text componetInChild2 = Utility.GetComponetInChild <Text>(this.form.gameObject, "Panel/msgContainer/msg"); Text componetInChild3 = Utility.GetComponetInChild <Text>(this.form.gameObject, "Panel/msgContainer/from"); if (componetInChild == null || componetInChild2 == null || componetInChild3 == null) { return; } CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo == null) { DebugHelper.Assert(false, "Master Role Info is null"); return; } componetInChild.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Mail_Ask_For_Myself"), masterRoleInfo.Name)); componetInChild2.set_text(mail.mailContent); componetInChild3.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Mail_Ask_For_From", new string[] { mail.from }), new object[0])); if (mail.accessUseable == null || mail.accessUseable.Count == 0) { return; } CUseable cUseable = mail.accessUseable[0]; switch (cUseable.m_type) { case COM_ITEM_TYPE.COM_OBJTYPE_HERO: { ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(cUseable.m_baseID); DebugHelper.Assert(dataByKey != null); if (dataByKey != null) { Text component = this.form.transform.Find("Panel/Title/titleText").GetComponent <Text>(); component.set_text(Singleton <CTextManager> .GetInstance().GetText("Ask_For_Hero_Friend_Title")); Text component2 = this.form.transform.Find("Panel/skinBgImage/skinNameText").GetComponent <Text>(); component2.set_text(StringHelper.UTF8BytesToString(ref dataByKey.szName)); Image component3 = this.form.transform.Find("Panel/skinBgImage/skinIconImage").GetComponent <Image>(); component3.SetSprite(CUIUtility.s_Sprite_Dynamic_BustHero_Dir + StringHelper.UTF8BytesToString(ref dataByKey.szImagePath), this.form, false, true, true, true); this.form.transform.Find("Panel/Panel_Prop").gameObject.CustomSetActive(false); Transform transform = this.form.transform.Find("Panel/skinPricePanel"); Transform costIcon = transform.Find("costImage"); CHeroSkinBuyManager.SetPayCostIcon(this.form, costIcon, enPayType.DianQuan); Transform costTypeText = transform.Find("costTypeText"); CHeroSkinBuyManager.SetPayCostTypeText(costTypeText, enPayType.DianQuan); uint payValue = 0u; IHeroData heroData = CHeroDataFactory.CreateHeroData(cUseable.m_baseID); ResHeroPromotion resPromotion = heroData.promotion(); stPayInfoSet payInfoSetOfGood = CMallSystem.GetPayInfoSetOfGood(dataByKey, resPromotion); 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) { payValue = payInfoSetOfGood.m_payInfos[i].m_payValue; break; } } Transform transform2 = transform.Find("costPanel"); if (transform2) { Transform currentPrice = transform2.Find("costText"); CHeroSkinBuyManager.SetPayCurrentPrice(currentPrice, payValue); } } break; } case COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN: { uint heroId = 0u; uint skinId = 0u; CSkinInfo.ResolveHeroSkin(cUseable.m_baseID, out heroId, out skinId); ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(cUseable.m_baseID); DebugHelper.Assert(heroSkin != null, "heroSkin is null"); if (heroSkin != null) { Text component4 = this.form.transform.Find("Panel/Title/titleText").GetComponent <Text>(); component4.set_text(Singleton <CTextManager> .GetInstance().GetText("Ask_For_Skin_Friend_Title")); Image component5 = this.form.transform.Find("Panel/skinBgImage/skinIconImage").GetComponent <Image>(); string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_BustHero_Dir, StringHelper.UTF8BytesToString(ref heroSkin.szSkinPicID)); component5.SetSprite(prefabPath, this.form, false, true, true, true); Text component6 = this.form.transform.Find("Panel/skinBgImage/skinNameText").GetComponent <Text>(); component6.set_text(StringHelper.UTF8BytesToString(ref heroSkin.szSkinName)); this.form.transform.Find("Panel/Panel_Prop").gameObject.CustomSetActive(true); GameObject gameObject = this.form.transform.Find("Panel/Panel_Prop/List_Prop").gameObject; CSkinInfo.GetHeroSkinProp(heroId, skinId, ref CHeroInfoSystem2.s_propArr, ref CHeroInfoSystem2.s_propPctArr, ref CHeroInfoSystem2.s_propImgArr); CUICommonSystem.SetListProp(gameObject, ref CHeroInfoSystem2.s_propArr, ref CHeroInfoSystem2.s_propPctArr); Transform transform3 = this.form.transform.Find("Panel/skinPricePanel"); Transform costIcon2 = transform3.Find("costImage"); CHeroSkinBuyManager.SetPayCostIcon(this.form, costIcon2, enPayType.DianQuan); Transform costTypeText2 = transform3.Find("costTypeText"); CHeroSkinBuyManager.SetPayCostTypeText(costTypeText2, enPayType.DianQuan); uint payValue2 = 0u; stPayInfoSet skinPayInfoSet = CSkinInfo.GetSkinPayInfoSet(heroId, skinId); for (int j = 0; j < skinPayInfoSet.m_payInfoCount; j++) { if (skinPayInfoSet.m_payInfos[j].m_payType == enPayType.Diamond || skinPayInfoSet.m_payInfos[j].m_payType == enPayType.DianQuan || skinPayInfoSet.m_payInfos[j].m_payType == enPayType.DiamondAndDianQuan) { payValue2 = skinPayInfoSet.m_payInfos[j].m_payValue; break; } } Transform transform4 = transform3.Find("costPanel"); if (transform4 != null) { Transform currentPrice2 = transform4.Find("costText"); CHeroSkinBuyManager.SetPayCurrentPrice(currentPrice2, payValue2); } } break; } } } }
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); } } }
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); }
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); } }
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); } }