예제 #1
0
 /// <summary>
 /// Let a <see cref="Player"/> try to join the Hub.
 /// </summary>
 /// <param name="_player"></param>
 /// <returns></returns>
 public bool Join(Player _player)
 {
     if (Players.Count < PlayerAmount + 1)
     {
         Players.Add(_player);
         return true;
     }
     return false;
 }
 /// <summary>
 /// A Network message struct, for fast collection of the data.
 /// </summary>
 /// <param name="_lMessage">the data to be sent to the server</param>
 /// <param name="_iSequence">if the message is part of a sequence this should not be 0</param>
 public NetworkMessage(string _sMessage, Player _cPlayer, int _iSequence = 0)
 {
     Body = _sMessage;
     if (_iSequence != 0)
         Sequence = _iSequence;
     SendTime = new DateTime().Millisecond;
     GUID = Guid.NewGuid();
     Sender = _cPlayer;
 }
예제 #3
0
        public void PlayerJoined(Player _player)
        {
            foreach(Player _p in Players)
            {
                if(_player.GUID != _p.GUID)
                {

                }
            }
        }
예제 #4
0
 /// <summary>
 /// Let a <see cref="Player"/> leave the Hub.
 /// </summary>
 /// <param name="_player"></param>
 public void Leave(Player _player)
 {
     for (int i = 0; i < Players.Count; i++)
     {
         if (Players[i].GUID == _player.GUID)
         {
             Players.RemoveAt(i);
         }
     }
 }