StopTurn() public method

public StopTurn ( byte player ) : void
player byte
return void
Ejemplo n.º 1
0
        //public void CreateAlias(int[] id, ulong[] type)
        //{
        //    short s = _clients[_sender].Id;
        //    for (int i = 0; i < id.Length; i++)
        //        id[i] = s << 16 | (id[i] & 0xffff);
        //    _broadcaster.CreateAlias(id, type);
        //}

        public void NextTurn(byte nextPlayer, bool setActive, bool force)
        {
            if (!force)
            {
                // find the first phase that a player has stopped
                var firstStop = _phaseStops.Where(x => x.Item1 > _phaseNumber).OrderBy(x => x.Item1).FirstOrDefault();
                if (firstStop != null) //if there's a phase stop set
                {
                    var stopPlayers = _phaseStops.Where(x => x.Item1 == firstStop.Item1).Select(x => x.Item2);
                    _phaseNumber = firstStop.Item1;
                    _broadcaster.SetPhase(_phaseNumber, stopPlayers.ToArray(), force);
                    return;
                }
                // check if a player has the end of turn stopped
                if (_turnStopPlayers.Count > 0)
                {
                    byte stopPlayerId = _turnStopPlayers.First();
                    _turnStopPlayers.Remove(stopPlayerId);
                    _broadcaster.StopTurn(stopPlayerId);
                    return;
                }
            }
            _turnNumber++;
            _phaseNumber = 0;
            _broadcaster.NextTurn(nextPlayer, setActive, force);
        }
Ejemplo n.º 2
0
 public void NextTurn(byte nextPlayer)
 {
     if (_turnStopPlayers.Count > 0)
     {
         byte stopPlayerId = _turnStopPlayers.First();
         _turnStopPlayers.Remove(stopPlayerId);
         _broadcaster.StopTurn(stopPlayerId);
         return;
     }
     _turnNumber++;
     _broadcaster.NextTurn(nextPlayer);
 }
Ejemplo n.º 3
0
        //public void CreateAlias(int[] id, ulong[] type)
        //{
        //    short s = _clients[_sender].Id;
        //    for (int i = 0; i < id.Length; i++)
        //        id[i] = s << 16 | (id[i] & 0xffff);
        //    _broadcaster.CreateAlias(id, type);
        //}

        public void NextTurn(byte nextPlayer, bool force)
        {
            if (_turnStopPlayers.Count > 0 && force == false)
            {
                byte stopPlayerId = _turnStopPlayers.First();
                _turnStopPlayers.Remove(stopPlayerId);
                _broadcaster.StopTurn(stopPlayerId);
                return;
            }
            _turnNumber++;
            _phaseStopPlayers.Clear();
            _broadcaster.NextTurn(nextPlayer, force);
        }