public override void Start() { m_Instance = this; m_Address.SetAddress("::0", m_Port); m_ListenSocket = m_Server.CreateListenSocket(ref m_Address); SetupStatusDelegate(); PlayerAttackedPlayerMessage msg = new PlayerAttackedPlayerMessage("help", "me"); Message nMsg = Message.decipherMessage(msg.toBuffer()); base.Start(); }
public override void Start() { m_Instance = this; m_Status = (info, context) => { switch (info.connectionInfo.state) { case ConnectionState.None: print("no connection exist, reset?"); m_Connection = uint.MaxValue; m_ConnectionApproved = false; break; case ConnectionState.Connected: Debug.Log("I, the Client, connected to server - ID: " + info.connection); m_Connection = info.connection; m_ConnectionApproved = true; m_Server.SendMessageToConnection(m_Connection, new PlayerConnectedMessage(GameManager.Instance.m_PlayerUsername).toBuffer(), SendType.Reliable); break; case ConnectionState.ClosedByPeer: m_Server.CloseConnection(m_Connection); m_Connection = uint.MaxValue; Debug.Log("I, the Client, disconnected from server"); break; case ConnectionState.ProblemDetectedLocally: m_Server.CloseConnection(m_Connection); m_Connection = uint.MaxValue; Debug.Log("I, the Client, unable to connect"); break; } }; PlayerAttackedPlayerMessage msg = new PlayerAttackedPlayerMessage("bunny", "rabbit"); Message nMsg = Message.decipherMessage(msg.toBuffer()); base.Start(); }