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; } } }
/// <summary> /// 添加限时猎魂排行榜 /// </summary> public void addLuckyLiehunRanking(RankItemLuckyLiehun rankLuckLiehun) { RankManagerment.Instance.luckyLiehunList.Add(rankLuckLiehun); }
/** 读取数据 */ public override void read(ErlKVMessage message) { ErlList tmp = message.getValue("msg") as ErlList; //ErlType erlType = message.getValue ("base") as ErlType; ErlType baseErlType = tmp.Value[0] as ErlType; int integral = 0; int rank = -1; if (baseErlType is ErlArray) { ErlArray arr = (baseErlType as ErlArray).Value[1] as ErlArray; // 活动积分 integral = StringKit.toInt(arr.Value [0].getValueString()); // 活动排名 rank = StringKit.toInt(arr.Value [1].getValueString()); } if (clearType == 3) { RadioManager.Instance.clearByType(clearType); } ErlType radioErlType = tmp.Value[1] as ErlType;; //message.getValue ("radio") as ErlType; if (radioErlType is ErlArray) { ErlArray arr = (radioErlType as ErlArray).Value[1] as ErlArray; if (arr.Value.Length > 0 && clearType == 3) { for (int m = 0, count = arr.Value.Length; m < count; m++) { ErlArray radioArray = arr.Value [m] as ErlArray; if (radioArray.Value.Length == 3) { string name = radioArray.Value[0].getValueString(); int vipLevel = StringKit.toInt(radioArray.Value [1].getValueString()); int soulSid = StringKit.toInt(radioArray.Value [2].getValueString()); addMessageRadio(name, vipLevel, soulSid); } else { string serverName = radioArray.Value[0].getValueString(); string name = radioArray.Value[1].getValueString(); int vipLevel = StringKit.toInt(radioArray.Value [2].getValueString()); int soulSid = StringKit.toInt(radioArray.Value [3].getValueString()); addMessageRadio("【" + serverName + "】" + name, vipLevel, soulSid); } } } } if (clearType == 3) { RankManagerment.Instance.luckyLiehunList.Clear(); } else if (clearType == 4) { RankManagerment.Instance.luckyLianjinList.Clear(); } ErlType rankErlType = tmp.Value[2] as ErlType; //message.getValue ("rank") as ErlType; if (rankErlType is ErlArray) { ErlArray arr = (rankErlType as ErlArray).Value [1] as ErlArray; if (clearType == 3) { if (arr.Value.Length > 0) { for (int m = 0, count = arr.Value.Length; m < count; m++) { RankItemLuckyLiehun rankLuckyLiehun = new RankItemLuckyLiehun(); rankLuckyLiehun.bytesRead(0, arr.Value [m] as ErlArray, m + 1); addLuckyLiehunRanking(rankLuckyLiehun); } } } else if (clearType == 4) { if (arr.Value.Length > 0) { for (int m = 0, count = arr.Value.Length; m < count; m++) { RankItemLuckyLianjin rankLuckLianjin = new RankItemLuckyLianjin(); rankLuckLianjin.bytesRead(0, arr.Value [m] as ErlArray, m + 1); addLuckyLianjinRanking(rankLuckLianjin); } } } } if (callback != null) { callback(integral, rank); } }
void OnClickLuckyLiehun() { RankItemLuckyLiehun rankItemLuckyLiehun = rankItemView.data as RankItemLuckyLiehun; openUserInfoWindow(rankItemLuckyLiehun.uid); }