public Game1() { graphics = new GraphicsDeviceManager(this); graphics.IsFullScreen = false; OriginScreenSize = new Vector2(1024, 768); ScreenSize = new Vector2(768, 576); ScreenScaleFactor = new Vector2(); ScreenScaleFactor.X = ScreenSize.X / OriginScreenSize.X; ScreenScaleFactor.Y = ScreenSize.Y / OriginScreenSize.Y; graphics.PreferredBackBufferWidth = 768; graphics.PreferredBackBufferHeight = 576; Content.RootDirectory = "Content"; Global.thisGame = this; HexagonServer = IO.Socket(GameSettings.HexagonServer); HexagonServer.On(Socket.EVENT_CONNECT, () => { ServerReady = true; }); HexagonServer.On("sendMove", (data) => { if (hexMap != null) { int i, j; string[] d = ((string)data).Split(','); i = Convert.ToInt32(d[0]); j = Convert.ToInt32(d[1]); hexMap.SelectCell(i, j, true); } }); HexagonServer.On("registerResult", (data) => { var result = Convert.ToInt32(data); switch (result) { case -1: connectionState = ConnectionState.DuplicateID; break; case 0: connectionState = ConnectionState.RoomFull; break; case 1: connectionState = ConnectionState.Connected; playerState = PlayerState.Blue; turnState = TurnState.Waiting; break; case 2: connectionState = ConnectionState.Waiting; playerState = PlayerState.Red; turnState = TurnState.Ready; break; } }); HexagonServer.On("otherQuit", (data) => { var username = (string)data; connectionState = ConnectionState.OtherDisconnected; }); HexagonServer.On("otherJoin", (data) => { var username = (string)data; connectionState = ConnectionState.Connected; }); }