public Agent(string server, ushort port, string nickname, SharedGameState shared = null) : base(server, port, nickname) { Id = Guid.NewGuid(); SharedState = shared ?? new SharedGameState(); ConnectionListner = new ConnectionListner(); OnRecive += ConnectionListner.ReciveListner; OnSend += ConnectionListner.SendListner; Reset += (e, x) => ConnectionListner.Reset(); // clientbound ConnectionListner.Subscribe(new SpawnPlayerHandler(this)); ConnectionListner.Subscribe(new PlayerInfoHandler(this)); ConnectionListner.Subscribe(new BlockChangeHandler(this)); ConnectionListner.Subscribe(new ChunkDataHandler(this)); ConnectionListner.Subscribe(new PlayerPositionAndLookHandler(this)); ConnectionListner.Subscribe(new EntityTeleportHandler(this)); ConnectionListner.Subscribe(new EntityPositionHandler(this)); ConnectionListner.Subscribe(new EntityPositionAndRotationHandler(this)); ConnectionListner.Subscribe(new MultiBlockChangeHandler(this)); ConnectionListner.Subscribe(new UnloadChunkHandler(this)); ConnectionListner.Subscribe(new UpdateHealthHandler(this)); ConnectionListner.Subscribe(new KeepAliveHandler(this)); ConnectionListner.Subscribe(new ChatMessageHandler(this)); // serverbound ConnectionListner.Subscribe(new PlayerPositionPacketHandler(this)); AcceptMissions(); }
public GameClientService(SharedGameState gameState, IConfiguration configuration) { int port = configuration.GetValue <int>("Port"); string ipAddress = configuration.GetValue <string>("IpAddress"); this.Client = new GameClient(ipAddress, port, gameState); this.Client.ConnectAsync(); }
protected override void LoadContent() { // Global Content GlobalContent = new LockingContentManager(Services); GlobalContent.Locked = false; GlobalContent.RootDirectory = "Content"; ProcessManager.Attach(new AudioManager(GlobalContent)); LoadGameContent(GlobalContent); GlobalContent.Locked = true; FieldFont font = GlobalContent.Load <FieldFont>("font_msdf_hyperspace"); // Attach first game state last SharedGameState sharedState = (SharedGameState)ProcessManager.Attach(new SharedGameState(this)); ProcessManager.Attach(new UIMenuGameState(this, sharedState)); }
public ChessGameManagerService() { this.SharedGameState = SharedGameStateHelper.GetNewSharedGameState(); }
public CommonGameState(GameManager gameManager, SharedGameState sharedState) : base(gameManager) { SharedState = sharedState; }
public GameClient(string address, int port, SharedGameState gameState) : base(address, port) { _gameState = gameState; _protocol = new RemoteInstructionProtocol(gameState); }
public RemoteInstructionProtocol(SharedGameState gameState) { _gameState = gameState; }