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)); }
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); }
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 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 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)); }
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); } }
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); }
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); }
public static ResSkinPromotion GetSkinPromotion(uint heroId, uint skinId) { uint skinCfgId = CSkinInfo.GetSkinCfgId(heroId, skinId); return(CSkinInfo.GetSkinPromotion(skinCfgId)); }