private void updateRankInfo(int integral) { bool isExist = false; foreach (GuildShakeRankItem item in RankManagerment.Instance.guildShakeList) { if (item.uid == UserManager.Instance.self.uid) { item.integral = integral; isExist = true; break; } } if (!isExist) { GuildShakeRankItem item = new GuildShakeRankItem(UserManager.Instance.self.uid, UserManager.Instance.self.nickname, integral); RankManagerment.Instance.guildShakeList.Add(item); } GuildShakeRankItem [] rankArray = RankManagerment.Instance.guildShakeList.ToArray(); SetKit.sort(rankArray, new ShakeRankInfoCompare()); RankManagerment.Instance.guildShakeList.Clear(); RankManagerment.Instance.guildShakeList.AddRange(rankArray); if (index == 0) { showIntegralRankContent(); } }
/* methods */ /** 初始化 */ public void init(WindowBase win, int type, bool showUseMount) { this.fatherWindow = win; bl = showUseMount; if (type == MountStoreContent.TAP_AGENRAL_CONTENT) { exlist = ExchangeManagerment.Instance.getAllExchangesMount(ExchangeType.MOUNT); if (showUseMount) { updateMountList(exlist); } exchangeList = exlist.ToArray(); (fatherWindow as MountsWindow).setButtonState(MountStoreContent.SHOW_RIDE_MOUNT); SetKit.sort(exchangeList, comp); cleanAll(); updateUI(); } else if (type == MountStoreContent.TAP_BACTICE_CONTENT) { if (GuildManagerment.Instance.getGuild() != null) { MountsHaveGuildFPort fport = FPortManager.Instance.getFPort <MountsHaveGuildFPort> (); fport.initGuildIinfo(initConetnt); } else { initConetnt(); } } }
/** 排序 */ public void sort(Comparator comparator, bool descending) { if (comparator == null) { return; } object[] array = this.array; object[] temp = new object[array.Length]; Array.Copy(array, 0, temp, 0, array.Length); SetKit.sort(temp, comparator, descending); this.array = temp; }
void initConetnt() { exlist = ExchangeManagerment.Instance.getAllExchangesMount(ExchangeType.BACTICMOUNT); if (bl) { updateMountList(exlist); } exchangeList = exlist.ToArray(); (fatherWindow as MountsWindow).setButtonState(MountStoreContent.SHOW_RIDE_MOUNT); SetKit.sort(exchangeList, comp); cleanAll(); updateUI(); }
/** 奖励条目排序 */ void SortAwardItem(List <GameObject> awardItem) { if (awardItem.Count <= 1) { return; } GameObject[] objs = awardItem.ToArray(); SetKit.sort(objs, comp); awardItem.Clear(); foreach (GameObject obj in objs) { awardItem.Add(obj); } }
/** 奖励条目排序 */ void SortAwardItem() { if (awardList == null || awardList.Count <= 1) { return; } GameObject[] objs = awardList.ToArray(); SetKit.sort(objs, comp); awardList.Clear(); foreach (GameObject obj in objs) { awardList.Add(obj); } }
/** 竞猜集合排序 */ public void SortFocusCuess() { if (focusCuessList.Count <= 1) { return; } FocusPointInfo[] infos = focusCuessList.ToArray(); SetKit.sort(infos, comp); focusCuessList.Clear(); foreach (FocusPointInfo info in infos) { focusCuessList.Add(info); } }
/** 添加指定的对象 */ public bool add(object obj) { object[] array = this.array; int i = array.Length; object[] temp = new object[i + 1]; if (i > 0) { Array.Copy(array, 0, temp, 0, i); } temp[i] = obj; if (comparator != null) { SetKit.sort(temp, comparator, descending); } this.array = temp; return(true); }
/** 添加指定的对象数组 */ public void add(object[] objs, int index, int length) { if (objs == null || index < 0 || length <= 0 || objs.Length < index + length) { return; } object[] array = this.array; int i = array.Length; object[] temp = new object[i + length]; if (i > 0) { Array.Copy(array, 0, temp, 0, i); } Array.Copy(objs, index, temp, i, length); if (comparator != null) { SetKit.sort(temp, comparator, descending); } this.array = temp; }
/** 获取所有的模版 */ public List <GuildFightAwardSample> getAllSample() { if (list.Count != 0) { return(list); } GuildFightAwardSample [] sampleArray = new GuildFightAwardSample[data.Count]; int i = 0; foreach (DictionaryEntry entry in data) { GuildFightAwardSample sample = new GuildFightAwardSample(); int sid = int.Parse(entry.Key.ToString()); string dataStr = getSampleDataBySid(sid); sample.parse(sid, dataStr); sampleArray[i] = sample; ++i; } SetKit.sort(sampleArray, new GuildFightAwardSampleCompare()); list.AddRange(sampleArray); return(list); }