private void GMAddPlayer(object[] args) { Log.Debug("NOTIFY_JOIN<<<<<"); int pId = 88; byte pos = 5; int score = 20000; //通过PID获取玩家的基本信息 NetWorkManager.Instance.Send(Protocal.PLAYER_INFO, pId); { var player = RoomManager.Instance.rData.GetPlayer(pId) as PlayerOther; if (player == null) { player = new PlayerOther(); player.id.Value = pId; player.name.Value = "测试1"; player.SetPos(pos); player.state = EPlayerState.Seat; player.score.Value = score; RoomManager.Instance.rData.roomPlayers.Add(player); } } }
private void RecvNotifyJoin(byte[] args) { int gId = MsgParse.PopInt(ref args); if (gId != RoomManager.Instance.rData.gId.Value) { return; } int pId = MsgParse.PopInt(ref args); byte pos = MsgParse.PopByte(ref args); int score = MsgParse.PopInt(ref args); //通过PID获取玩家的基本信息 NetWorkManager.Instance.Send(Protocal.PLAYER_INFO, pId); if (pId == GameManager.Instance.GetRoleData().pId.Value) { RoomManager.Instance.Self.Value.SetPos(pos); RoomManager.Instance.Self.Value.state = EPlayerState.Seat; RoomManager.Instance.Self.Value.score.Value = score; } else { var player = RoomManager.Instance.rData.GetPlayer(pId) as PlayerOther; if (player == null) { player = new PlayerOther(); player.id.Value = pId; player.InitData(); player.SetPos(pos); player.state = EPlayerState.Seat; player.score.Value = score; RoomManager.Instance.rData.roomPlayers.Add(player); } } }