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(); } }
public int compare(object a, object b) { GuildShakeRankItem itemA = a as GuildShakeRankItem; GuildShakeRankItem itemB = b as GuildShakeRankItem; if (itemA.integral > itemB.integral) { return(-1); } else if (itemA.integral < itemB.integral) { return(1); } else { return(0); } }
public void init(object data, int type, int index) { this.data = data; this.index = index; this.type = type; if (data == null) { setText(1, LanguageConfigManager.Instance.getLanguage("rankWindow_nodata")); return; } setSpriteBg(); setText(0, index + 1); switch (type) { case RankManagerment.TYPE_COMBAT: RankItemCombat rankItemCombat = data as RankItemCombat; setText(1, rankItemCombat.name, rankItemCombat.vipLevel, RankManagerment.TYPE_COMBAT); setText(2, rankItemCombat.combat); break; case RankManagerment.TYPE_PVP: RankItemPVP rankItemPVP = data as RankItemPVP; setText(1, rankItemPVP.name, rankItemPVP.vipLevel, RankManagerment.TYPE_PVP); setText(2, rankItemPVP.win); break; case RankManagerment.TYPE_LUCKY_CARD: RankItemLuckyCard rankItemLuckyCard = data as RankItemLuckyCard; setText(1, rankItemLuckyCard.name, rankItemLuckyCard.vipLevel, RankManagerment.TYPE_LUCKY_CARD); setText(2, rankItemLuckyCard.integral); break; case RankManagerment.TYPE_LUCKY_EQUIP: RankItemLuckyEquip rankItemLuckyEquip = data as RankItemLuckyEquip; setText(1, rankItemLuckyEquip.name, rankItemLuckyEquip.vipLevel, RankManagerment.TYPE_LUCKY_EQUIP); setText(2, rankItemLuckyEquip.integral); break; case RankManagerment.TYPE_LUCKY_LIEHUN: RankItemLuckyLiehun rankItemLuckyLiehun = data as RankItemLuckyLiehun; setText(1, rankItemLuckyLiehun.name, rankItemLuckyLiehun.vipLevel, RankManagerment.TYPE_LUCKY_LIEHUN); setText(2, rankItemLuckyLiehun.integral); break; case RankManagerment.TYPE_LUCKY_LIANJIN: RankItemLuckyLianjin rankItemLuckyLianjin = data as RankItemLuckyLianjin; setText(1, rankItemLuckyLianjin.name, rankItemLuckyLianjin.vipLevel, RankManagerment.TYPE_LUCKY_LIANJIN); setText(2, rankItemLuckyLianjin.integral); break; case RankManagerment.TYPE_MONEY: RankItemMoney rankItemMoney = data as RankItemMoney; setText(1, rankItemMoney.name, rankItemMoney.vipLevel, RankManagerment.TYPE_MONEY); setText(2, rankItemMoney.money); break; case RankManagerment.TYPE_BOSSDAMAGE: RankItemTotalDamage rankItemDamage = data as RankItemTotalDamage; setText(1, rankItemDamage.name, rankItemDamage.vipLevel, RankManagerment.TYPE_BOSSDAMAGE); setText(2, rankItemDamage.damage); break; case RankManagerment.TYPE_ROLE: RankItemRole rankItemRole = data as RankItemRole; setText(1, rankItemRole.name, rankItemRole.vipLevel, RankManagerment.TYPE_ROLE); setText(2, rankItemRole.cardName, RankManagerment.TYPE_ROLE_CARD); break; case RankManagerment.TYPE_GUILD: RankItemGuild rankItemGuild = data as RankItemGuild; setText(1, rankItemGuild.name, rankItemGuild.vipLevel, RankManagerment.TYPE_GUILD); setText(2, rankItemGuild.score); break; case RankManagerment.TYPE_ROLE_LV: RankItemRoleLv rankItemLevel = data as RankItemRoleLv; setText(1, rankItemLevel.name, rankItemLevel.vipLevel, RankManagerment.TYPE_ROLE_LV); setText(2, rankItemLevel.lv); break; case RankManagerment.TYPE_GODDESS: RankItemGoddess rankItemGoddess = data as RankItemGoddess; setText(1, rankItemGoddess.name, rankItemGoddess.vipLevel, RankManagerment.TYPE_GODDESS); setText(2, rankItemGoddess.addPer + "%"); break; case RankManagerment.TYPE_GUILD_SHAKE: GuildShakeRankItem guildShakeRankItem = data as GuildShakeRankItem; setText(1, guildShakeRankItem.name, RankManagerment.TYPE_GUILD_SHAKE); setText(2, guildShakeRankItem.integral); setText(3, guildShakeRankItem.contribution); break; case RankManagerment.TYPE_GUILD_AREA_CONTRIBUTION: GuildAreaHurtRankItem item = data as GuildAreaHurtRankItem; setText(1, item.name); setText(2, item.warNum); setText(3, item.hurtNum); break; case RankManagerment.TYPE_GUILD_FIGHT: RankItemGuildFight guild = data as RankItemGuildFight; setText(1, guild.name, RankManagerment.TYPE_GUILD_FIGHT); setText(2, guild.getJudgeString()); setText(3, guild.judgeScore); break; } //给前三名加金杯,银杯,铜杯 if (cup != null) { switch (index) { case 0: cup.spriteName = "rank_1"; cup.gameObject.SetActive(true); rankingNumber.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); texts[0].text = ""; break; case 1: cup.spriteName = "rank_2"; cup.gameObject.SetActive(true); rankingNumber.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); texts[0].text = ""; break; case 2: cup.spriteName = "rank_3"; cup.gameObject.SetActive(true); rankingNumber.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); texts[0].text = ""; break; default: cup.spriteName = null; cup.gameObject.SetActive(false); rankingNumber.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); break; } } }
void OnClickGuildShakeRank() { GuildShakeRankItem guildShakeRankItem = rankItemView.data as GuildShakeRankItem; openUserInfoWindow(guildShakeRankItem.uid); }
public override void read(ErlKVMessage message) { ErlType type = message.getValue("msg") as ErlType; if (type is ErlArray) { ErlArray array = type as ErlArray; int index = 0; //基础信息 int shakeCount = StringKit.toInt(array.Value [index++].getValueString()); int reShakeCount = StringKit.toInt(array.Value [index++].getValueString()); int selfIntegral = StringKit.toInt(array.Value [index++].getValueString()); int topIntegral = StringKit.toInt(array.Value [index++].getValueString()); int guildIntegral = StringKit.toInt(array.Value [index++].getValueString()); GuildManagerment.Instance.createGuildLuckyNvShenInfo(selfIntegral, guildIntegral, topIntegral, shakeCount, reShakeCount); //上次投掷结果,如果未领取状态 ErlType resultType = array.Value [index++] as ErlType; ErlArray resultArray = resultType as ErlArray; if (resultArray.Value.Length == 5) { string [] results = new string[5]; for (int i = 0; i < 5; ++i) { results [i] = resultArray.Value [i].getValueString(); } //生成结果缓存 GuildManagerment.Instance.createGuildShakeResult(results); } else { //清空结果 GuildManagerment.Instance.clearGuildShakeResult(); } //排行榜信息 RankManagerment.Instance.guildShakeList.Clear(); ErlType rankType = array.Value [index++] as ErlType; ErlArray rankArray = rankType as ErlArray; if (rankArray.Value.Length > 0) { for (int i = 0; i < rankArray.Value.Length; i++) { ErlArray temps = rankArray.Value [i] as ErlArray; if (temps != null && temps.Value.Length == 3) { string uid = temps.Value [0].getValueString(); string playerName = temps.Value [1].getValueString(); int integral = StringKit.toInt(temps.Value [2].getValueString()); GuildShakeRankItem temp = new GuildShakeRankItem(uid, playerName, integral); RankManagerment.Instance.guildShakeList.Add(temp); } } } if (callback != null) { callback(); } } }