public CommunicationHandler(int port, IPlayerContainer container, INotifiable notify, IRequestable request) { // TODO: Interface ILobby _playerContainer = container; _tcpListener = new TcpListener(port); _tcpListener.SocketAccepted += SocketAccepted; _tcpListener.Start(); _udpClient = new UdpClient(port); _udpClient.DataReceived += UdpClient_DataReceived; _udpClient.Start(); _processor = new DataProcessor(notify, request); Console.WriteLine("Server started listening on port : {0}", ((IPEndPoint)_tcpListener.Socket.LocalEndPoint).Port); }
private IViewFrame GetFrame(IPlayerContainer playerContainer) { //Get new frame var newframe = MechanicEngine.ViewPort.GetFrame(playerContainer.Player.Id, playerContainer.PreviousTile); if (newframe != null) { //Update currrent tile var currentTile = MechanicEngine.ViewPort.GetPlayerCurrentTile(playerContainer.Player.Id); _logger.Info(string.Format("Current player tile X: {0}, Y: {1}", currentTile.Position.X, currentTile.Position.Y)); if (playerContainer.PreviousTile == null || (currentTile != null && playerContainer.PreviousTile.Position != currentTile.Position)) { playerContainer.PreviousTile = currentTile; } return(newframe); } return(null); }
public DomainPlayerIdentityModel(IPlayerContainer container) { Id = container.PlayerId != null ? (int)container.PlayerId : -1; }
public void Awake() { this.playerContainer = ContainerInstaller.diContainer.Resolve <IPlayerContainer>(); // Debug.Log(playerContainer.Player.Name); }
public PlayerService() { _playerContainer = new PlayerContainer(); }