public void RefreshRoomInfo(bool NoRoom = false /*int RoomID,int StageID*/) { if ((GameApp.Instance.CurRoomPlayerLst.Count > 0 && DefaultRule.PlayerIDToAccountID(GameApp.Instance.CurRoomPlayerLst[0].id) == GameApp.AccountID) || (GameApp.Instance.PlayerData == null) || NoRoom) { IsOwner = true; } GameApp.Instance.CurRoomPlayerLoadStateLst.Clear(); for (int i = 0; i < TeamMembers.Length; i++) { TeamMembers[i].Set("", 0, IsOwner ? ETeamMemberType.eInvite : ETeamMemberType.eWaitJoin); } for (int i = 0; i < GameApp.Instance.CurRoomPlayerLst.Count; i++) { PVE_Room_Player player = GameApp.Instance.CurRoomPlayerLst[i]; GameApp.Instance.CurRoomPlayerLoadStateLst.Add(player.id, 0); ETeamMemberType TMType = ETeamMemberType.eNull; if (i == 0) { RoomName.text = StringBuilderTool.ToInfoString(player.name, "的房间"); TMType = ETeamMemberType.eOwner; } else { if (player.ready) { TMType = ETeamMemberType.eBeReady; } else { TMType = ETeamMemberType.eNotReady; } } TeamMembers[i].Set(player.name, (int)player.icon, TMType); } BeginFightBtn.isEnabled = (IsOwner && (GameApp.Instance.CurRoomPlayerLst.Count > 1)); }
public void Set(string PlayerName, int RoleID, ETeamMemberType TMType) { IsValid = (PlayerName.Length > 0); Name.text = PlayerName; int _RoleID = Math.Max(RoleID, 1); RoleConfig rc = null; if (CsvConfigTables.Instance.RoleCsvDic.TryGetValue(_RoleID, out rc)) { Portrait.spriteName = rc.PortraitEx; } TeamMemberType = TMType; switch (TeamMemberType) { case ETeamMemberType.eOwner: Bg.spriteName = "bg_yeqian_1"; Portrait.gameObject.SetActive(true); PortraitBg.gameObject.SetActive(true); PortraitBg.spriteName = "bg_touxiang_zj"; break; case ETeamMemberType.eBeReady: Bg.spriteName = "bg_yeqian_2"; Portrait.gameObject.SetActive(true); PortraitBg.gameObject.SetActive(true); PortraitBg.spriteName = "bg_touxiang"; break; case ETeamMemberType.eNotReady: Bg.spriteName = "bg_yeqian_2"; Portrait.gameObject.SetActive(true); PortraitBg.gameObject.SetActive(true); PortraitBg.spriteName = "bg_touxiang"; break; case ETeamMemberType.eInvite: Bg.spriteName = "bg_yeqian_2"; Portrait.gameObject.SetActive(false); PortraitBg.gameObject.SetActive(true); Name.text = "等待玩家进入..."; PortraitBg.spriteName = "bg_touxiang"; break; case ETeamMemberType.eWaitJoin: Bg.spriteName = "bg_yeqian_2"; Portrait.gameObject.SetActive(false); PortraitBg.gameObject.SetActive(false); Name.text = "等待玩家进入..."; break; } for (int i = 0; i < TypeObjs.Length; i++) { TypeObjs[i].SetActive(i == (int)TeamMemberType); } gameObject.SetActive(true); }