Пример #1
0
            public void Update( Plane plane )
            {
                if (!_state.workSocket.Connected && _serverIP != "")
                {
                    try
                    {
                        _state.workSocket.Connect(_serverIP, 5447);
                        _state.workSocket.GetStream().BeginRead(_state.buffer, 0, StateObject.BufferSize, new AsyncCallback(ReadCallback), _state);
                        _init = true;
                        Console.WriteLine("Connection success");
                    }
                    catch (SocketException)
                    {
                        Console.WriteLine("Connection faillure");
                    }
                }
                  
                        if (_init)
                        {
                            Write(plane.Name + ":{X:" + (int)((plane.Position.X / _screenWidth) * 1000) + " " +
                                "Y:" + (int)(((plane.Position.Y - _screenHeight / 2) / _screenHeight) * 1000) + " " +
                                "a:" + (int)(plane.Rotation) + "}");
                            Console.WriteLine(plane.Name + ":{X:" + (int)((plane.Position.X / _screenWidth) * 1000) + " " +
                                "Y:" + (int)(((plane.Position.Y - _screenHeight / 2) / _screenHeight) * 1000) + " " +
                                "a:" + (int)(plane.Rotation) + "}");
                        }

            }
Пример #2
0
 public void Remove(Plane plane)
 {
     if (_init)
     {
         Write(plane.Name + ":Remove");
         Console.WriteLine(plane.Name + ":Remove");
     }
 }