private void UpdateBrowsedPrivilege(int curLev) { vipData.BrowsedPrivileges.Clear(); VIPPrivilege oldPrivilege = VIPTemplateManager.Instance.GetTemplate(curLev - 1); VIPPrivilege privilege = VIPTemplateManager.Instance.GetTemplate(curLev); Dictionary <string, int> .Enumerator numEnumerator = privilege.GetNumEnumerator(); Dictionary <string, float> .Enumerator percentEnumerator = privilege.GetPercentEnumerator(); while (numEnumerator.MoveNext()) { string key = numEnumerator.Current.Key; if (vipData.VipCertificates.Contains(key)) { int value = privilege.GetTotalNum(key); // + VIPTemplateManager.Instance.GetMonthVIPNum(key); //if (value > 0) AppendPrivilegeItem(key, value, curLev); AppendOrUpdatePrivilegeItem(ref vipData.BrowsedPrivileges, key, value, value > 0, oldPrivilege); } } while (percentEnumerator.MoveNext()) { string key = percentEnumerator.Current.Key; if (vipData.VipCertificates.Contains(key)) { float value = privilege.GetPercent(key); bool valid = key.Equals(VIPPrivilegeKey.ShopDiscount) ? value > 0 && value < 1 : value > 0; //if (value > 0) AppendPrivilegeItem(key, value, curLev); AppendOrUpdatePrivilegeItem(ref vipData.BrowsedPrivileges, key, value, valid, oldPrivilege); } } OnEquipmentGift(ref vipData.BrowsedPrivileges, privilege, oldPrivilege); vipData.CheckedLevel = curLev; }
private Dictionary <string, VIPPrivilegeItem> GetPrivilegeDict(VIPPrivilege profile) { Dictionary <string, VIPPrivilegeItem> privileges = new Dictionary <string, VIPPrivilegeItem>(); if (profile == null) { return(privileges); } Dictionary <string, int> .Enumerator numEnumerator = profile.GetNumEnumerator(); Dictionary <string, float> .Enumerator percentEnumerator = profile.GetPercentEnumerator(); while (numEnumerator.MoveNext()) { string key = numEnumerator.Current.Key; if (vipData.VipCertificates.Contains(key)) { int value = profile.GetTotalNum(key); // + VIPTemplateManager.Instance.GetMonthVIPNum(key); if (value > 0) { VIPPrivilegeItem item = new VIPPrivilegeItem(); item.Value = value; privileges.Add(key, item); } } } while (percentEnumerator.MoveNext()) { string key = percentEnumerator.Current.Key; if (vipData.VipCertificates.Contains(key)) { float value = profile.GetPercent(key); bool valid = key.Equals(VIPPrivilegeKey.ShopDiscount) ? value > 0 && value < 1 : value > 0; if (valid) { VIPPrivilegeItem item = new VIPPrivilegeItem(); item.Percent = value; privileges.Add(key, item); } } } return(privileges); }