//初始化玩家信息 public void InitPlayerInfo(ArenaTargetInfo playerInfo) { if (null == playerInfo) { return; } m_PlayerInfo = playerInfo; if (lblLevel != null) { lblLevel.text = playerInfo.Level.ToString(); } if (lblName != null) { lblName.text = playerInfo.Nickname; } if (lblRank != null) { lblRank.text = playerInfo.Rank.ToString(); } if (lblFighting != null) { lblFighting.text = playerInfo.FightingScore.ToString(); } //还差个战力 Data_PlayerConfig playerCfg = PlayerConfigProvider.Instance.GetPlayerConfigById(playerInfo.HeroId); if (playerCfg != null && spPortrait != null) { spPortrait.spriteName = playerCfg.m_Portrait; } }
void AddMyItem() { ArenaTargetInfo info = new ArenaTargetInfo(); info.Nickname = role.Nickname; info.Rank = role.ArenaStateInfo.Rank; info.Level = role.Level; info.HeroId = role.HeroId; info.Guid = role.Guid; info.FightingScore = (int)role.FightingScore; AddItem(info); InitUpAndDownItem(info); UIDataCache.Instance.curRank = role.ArenaStateInfo.Rank; }
//添加item void AddItem(ArenaTargetInfo info) { if (info == null) { return; } UnityEngine.GameObject item = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/PartnerPvp/RankingCell")); item = NGUITools.AddChild(masterGrid.gameObject, item); if (item != null) { RankingCell cell = item.GetComponent <RankingCell>(); if (cell != null) { cell.InitItemInfo(info); } } itemList.Add(item); }
//初始化 上下item void InitUpAndDownItem(ArenaTargetInfo info) { if (upItem != null) { RankingCell cell = upItem.GetComponent <RankingCell>(); if (cell != null) { cell.InitItemInfo(info); } } if (downItem != null) { RankingCell cell = downItem.GetComponent <RankingCell>(); if (cell != null) { cell.InitItemInfo(info); } } }
//对外接口,初始化信息 public void ShowIntro(ArenaTargetInfo info) { if (hasStart == false) { Start(); } if (info != null) { if (lblName != null) { lblName.text = info.Nickname; } if (lblFightScore != null) { lblFightScore.text = info.FightingScore.ToString(); } if (lblRank != null) { lblRank.text = info.Rank.ToString(); } if (spHead != null) { Data_PlayerConfig cg = PlayerConfigProvider.Instance.GetPlayerConfigById(info.HeroId); spHead.spriteName = cg.m_PortraitForCell; } //装备 for (int i = 0; i < equiparry.Length; i++) { equiparry[i].hasEquip = false; } for (int i = 0; i < info.Equips.Length; i++) { ItemDataInfo item = info.Equips[i]; if (item != null) { ItemConfig config = ItemConfigProvider.Instance.GetDataById(item.ItemId); if (config != null && config.m_WearParts < equiparry.Length) { equiparry[config.m_WearParts].SetEquipmentInfo(item.ItemId, item.Level, item.RandomProperty, 1); } } } for (int i = 0; i < equiparry.Length; i++) { if (equiparry[i].hasEquip == false) { equiparry[i].SetFrameAndIcon(defaultEquipSprite[i]);//无装备设为默认图标 } } //伙伴 int totalFightScore = info.FightingScore; for (int i = 0; i < partnerSlotList.Count; i++) { if (i < info.FightPartners.Count) { partnerSlotList[i].InitPartnerInfo(info.FightPartners[i]); totalFightScore += partnerSlotList[i].GetFighting(); NGUITools.SetActive(partnerSlotList[i].gameObject, true); } else { NGUITools.SetActive(partnerSlotList[i].gameObject, false); } } if (gridPartnersParent != null) { gridPartnersParent.repositionNow = true; } if (lblTotalFightScore != null) { lblTotalFightScore.text = totalFightScore.ToString();//所有伙伴战力 } UIManager.Instance.ShowWindowByName("PPVPFighterIntro"); } }
//初始化item信息 public void InitItemInfo(ArenaTargetInfo info) { if (info == null) { NGUITools.SetActive(sprite1, false); NGUITools.SetActive(sprite2, true); return; } NGUITools.SetActive(sprite2, false); NGUITools.SetActive(sprite1, true); RoleInfo role = LobbyClient.Instance.CurrentRole; if (info.Guid == role.Guid) { bg.color = color; } else { bg.color = color1; } if (playerName != null) { playerName.text = info.Nickname; } if (playerLevel != null) { playerLevel.text = "Lv." + info.Level.ToString(); } if (PlayerScore != null) { PlayerScore.text = info.FightingScore.ToString(); } unRank.text = ""; if (info.Rank < 4) { switch (info.Rank) { case 1: cup.spriteName = "no1"; number.text = "NODA"; NGUITools.SetActive(cup.gameObject, true); break; case 2: cup.spriteName = "no2"; number.text = "NODB"; NGUITools.SetActive(cup.gameObject, true); break; case 3: cup.spriteName = "no3"; number.text = "NODC"; NGUITools.SetActive(cup.gameObject, true); break; case -1: number.text = ""; unRank.text = "未排名"; NGUITools.SetActive(cup.gameObject, false); break; } } else { number.text = info.Rank + "ETH"; NGUITools.SetActive(cup.gameObject, false); } if (heroHead != null) { Data_PlayerConfig cg = PlayerConfigProvider.Instance.GetPlayerConfigById(info.HeroId); heroHead.spriteName = cg.m_PortraitForCell; } SetPartnerPortraitActive(); if (info.Guid == role.Guid) { // 自己 由于服务器发回来的列表里没有自己,所以自己要担架 for (int i = 0; i < role.ArenaStateInfo.FightPartners.Count; i++) { PartnerInfo partnerInfo = GetPartnerInfoById(role.ArenaStateInfo.FightPartners[i]); Data_NpcConfig npcCfg = NpcConfigProvider.Instance.GetNpcConfigById(partnerInfo.LinkId); if (npcCfg != null) { if (i <= arrNum) { SetPartnerIcon(portrait[i], portraitFrame[i], partnerInfo); NGUITools.SetActive(portrait[i].gameObject, true); } } } } else { // 列表其他人 for (int i = 0; i < info.FightPartners.Count; i++) { Data_NpcConfig npcCfg = NpcConfigProvider.Instance.GetNpcConfigById(info.FightPartners[i].LinkId); if (npcCfg != null) { if (i <= arrNum) { SetPartnerIcon(portrait[i], portraitFrame[i], info.FightPartners[i]); NGUITools.SetActive(portrait[i].gameObject, true); } } } } }