public bool InitTemplateFromCache(GM.DataCache.Vip vip) { if (vip == null) { EB.Debug.LogError("can not find Vip Privilege data"); return(false); } PrivilegeList = new List <VIPPrivilege>(); MonthVIPList = new List <VIPPrivilege>(); var conditionSet = vip.GetArray(0); for (int i = 0; i < conditionSet.VipLength; ++i) { VIPPrivilege vipData = ParseTemplate(conditionSet.GetVip(i)); if (vipData.VipType == 2) { MonthVIPList.Add(vipData); } else { PrivilegeList.Add(vipData); } } return(true); }
public int GetLevelByCharge(int charge) { for (int i = 0; i < PrivilegeList.Count; i++) { VIPPrivilege vip = PrivilegeList[i]; if (vip.TotalHc > charge) { int index = i - 1; if (index >= 0) { return(PrivilegeList[index].Level); } } else if (vip.TotalHc == charge) { return(vip.Level); } } return(0); }
private VIPPrivilege ParseTemplate(GM.DataCache.VipInfo dict) { VIPPrivilege template = new VIPPrivilege(); template.VipType = dict.Type; template.AddNumTYpeDic(VIPPrivilegeKey.BuyVigorTimes, dict.BuyVigorTimes); template.AddNumTYpeDic(VIPPrivilegeKey.BuyExpTimes, dict.BuyBuddyExpTimes); template.AddNumTYpeDic(VIPPrivilegeKey.BuyGoldTimes, dict.BuyGoldTimes); // 新字段 template.AddNumTYpeDic(VIPPrivilegeKey.BountyDoubleTimes, dict.BountyDoubleTimes); template.AddNumTYpeDic(VIPPrivilegeKey.EscortDoubleTimes, dict.EscortDoubleTimes); template.AddNumTYpeDic(VIPPrivilegeKey.ArenaDoubleTimes, dict.ArenaDoubleTimes); template.AddNumTYpeDic(VIPPrivilegeKey.LuckyCat, dict.LuckyCat); template.AddNumTYpeDic(VIPPrivilegeKey.ActicketTimes, dict.ActicketTimes); template.AddNumTYpeDic(VIPPrivilegeKey.ArenaTimes, dict.ArenaTimes); template.AddNumTYpeDic(VIPPrivilegeKey.ResignInTimes, dict.ResignInTimes); template.AddNumTYpeDic(VIPPrivilegeKey.EscortTimes, dict.EscortTimes); template.AddNumTYpeDic(VIPPrivilegeKey.InfiniteChallengeTimes, dict.InfiniteChallengeTimes); template.AddNumTYpeDic(VIPPrivilegeKey.BountyTaskTimes, dict.BountyTaskTimes); template.AddPercentTypeDic(VIPPrivilegeKey.TreasureRating, dict.TreasureRating); template.AddPercentTypeDic(VIPPrivilegeKey.ExpSpringRating, dict.ExpSpringRating); template.AddPercentTypeDic(VIPPrivilegeKey.ShopDiscount, dict.ShopDiscount); template.AddNumTYpeDic(VIPPrivilegeKey.LostChallengeReviveTimes, dict.LostChallengeReviveTimes); template.AddNumTYpeDic(VIPPrivilegeKey.RobTimes, dict.RobTimes); template.AddNumTYpeDic(VIPPrivilegeKey.EscortRefreshTimes, dict.EscortRefreshTimes); template.AddNumTYpeDic(VIPPrivilegeKey.EscortHelpTimes, dict.EscortHelpTimes); template.AddNumTYpeDic(VIPPrivilegeKey.EscortReinforceTimes, dict.EscortReinforceTimes); template.AddNumTYpeDic(VIPPrivilegeKey.RedNameRemovalTimes, dict.RedNameRemovalTimes); //template.AddNumTYpeDic(VIPPrivilegeKey.CanBlitzChallCampaign, dict.RedNameAttackTimes); // 新字段 template.AddNumTYpeDic(VIPPrivilegeKey.InvEquipCount, dict.InvEquipCount); template.AddNumTYpeDic(VIPPrivilegeKey.CanBlitzChallCampaign, dict.CanBlitzChallCampaign ? 1 : 0); template.AddNumTYpeDic(VIPPrivilegeKey.CanBlitzAlliCampaign, dict.CanBlitzAlliCampaign ? 1 : 0); template.AddNumTYpeDic(VIPPrivilegeKey.BuyFreeVigorTimes, dict.BuyFreeVigorTimes); template.AddNumTYpeDic(VIPPrivilegeKey.InfiDiscountTimes, dict.InfiDiscountTimes); template.AddNumTYpeDic(VIPPrivilegeKey.AwakenCampDiscountTimes, dict.AwakenCampDiscountTimes); template.AddNumTYpeDic(VIPPrivilegeKey.HonorArenaIdleRewardLimit, dict.HonorArenaIdleRewardLimit); template.AddNumTYpeDic(VIPPrivilegeKey.AlliDonateTimes, dict.AlliDonateTimes); template.AddNumTYpeDic(VIPPrivilegeKey.FirstDonateDouble, dict.FirstDonateDouble ? 1 : 0); template.AddNumTYpeDic(VIPPrivilegeKey.DayBuyLimit, dict.DayBuyLimit); template.AddNumTYpeDic(VIPPrivilegeKey.WeeklyBuyLimit, dict.WeeklyBuyLimit); template.AddNumTYpeDic(VIPPrivilegeKey.MonthlyBuyLimit, dict.MonthlyBuyLimit); template.AddNumTYpeDic(VIPPrivilegeKey.FreeRefiningTimes, dict.FreeRefiningTimes); //template.AddNumTYpeDic(VIPPrivilegeKey.EscortAndRobTimes, dict.EscortAndRobTimes); template.AddNumTYpeDic(VIPPrivilegeKey.InfiniteChallengeResetTimes, dict.InfiniteChallengeResetTimes); //vip 奖励 template.AddNumTYpeDic(VIPPrivilegeKey.DailyVipReward, dict.DailyHcReward); //template.FuncUnlockTypeDic.Add(VIPPrivilegeKey.IsFreeRevive, dict.IsFreeRevive ? -1 : -10); //template.FuncUnlockTypeDic.Add(VIPPrivilegeKey.IsMysteryShopShow, dict.IsMysteryShopShow ? -1 : -10); //template.FuncUnlockTypeDic.Add(VIPPrivilegeKey.CanBlitzTenTimes, dict.CanBlitzTenTimes ? -1 : -10); //template.FuncUnlockTypeDic.Add(VIPPrivilegeKey.IsCanQuickRefining, dict.IsCanQuickRefining ? -1 : -10); //template.EarningAddTypeDic.Add(VIPPrivilegeKey.ExpeditionRating, dict.ExpeditionRating); template.GiftItemId = dict.GiftItemId; /*dict.EatEquipmentGift;*/ template.GiftPrice = dict.GiftPrice; template.Level = dict.Level; template.TotalHc = /*dict.Type*/ dict.TotalHc; template.EatEquipmentGift = dict.EatEquipmentGift; return(template); }