private async void Form1_Load(object sender, EventArgs e) { OutputBox.Text += "Starting connection..\n"; await connection.StartAsync(); OutputBox.Text += "Connection started!\n"; connection.On <string>("ReceiveUser", (user) => { this.BeginInvoke((Action)(() => { CreatePlayer(user); })); }); connection.On <string, int, int>("ReceiveCoordinate", (user, x, y) => { this.BeginInvoke((Action)(() => { if (!tanks.ContainsKey(user)) { CreatePlayer(user); } tanks[user].Location = new Point(x, y); })); }); connection.On <string>("PlayerExists", (user) => { this.BeginInvoke((Action)(() => { OutputBox.Text += $"Name {user} is currently taken!\n"; })); }); connection.On <string>("TerminatePlayer", (user) => { this.BeginInvoke((Action)(() => { OutputBox.Text += $"{user} disconnected!\n"; Button tank = tanks[user]; this.Controls.Remove(tank); tanks.Remove(user); })); }); connection.On <string>("ReceiveMaze", (maze) => { Graphics graphics = this.CreateGraphics(); TileDrawer tileDrawer = new TileDrawer(graphics, new Point(450, 30), new Size(50, 50)); WallDrawer wallDrawer = new WallDrawer(graphics, new Point(450, 30), new Size(50, 50)); List <List <MazeCellDTO> > cells = JsonSerializer.Deserialize <List <List <MazeCellDTO> > >(maze); tileDrawer.DrawTiles(cells); wallDrawer.DrawWalls(cells); }); }
public Receiver(ViewModel viewModel) { this.ViewModel = viewModel; this._doorAvailablePoints = new List <Point>(); this._windowAvailableWalls = new List <Rect>(); this._areaDrawer = new AreaDrawer(this); this._cameraDrawer = new CameraDrawer(this); this._doorDrawer = new DoorDrawer(this, ref _doorAvailablePoints); this._windowAvailableWalls = new List <Rect>(); this._wallDrawer = new WallDrawer(this, ref _doorAvailablePoints, ref _windowAvailableWalls); this._windowDrawer = new WindowDrawer(this, ref _windowAvailableWalls); }
protected override void DrawPropertyLayout(IPropertyValueEntry <BuildingInfo> entry, GUIContent label) { EditorGUI.BeginChangeCheck(); WallDrawer wallDrawer = new WallDrawer(); //wallDrawer.DrawProperty(entry.SmartValue.North); if (EditorGUI.EndChangeCheck()) { } }