Пример #1
0
 private bool HandleScreenConnected(ConnectedMessage msg)
 {
     int screenID = m_nextScreenID++;
     Screen screen = new Screen("Screen-" + screenID, screenID, msg.Connection, this);
     m_screens.Add( screen);
     lock(m_bubbles)
     {
         for(int i = 0; i < ServerBalloon.NewBalloonsForScreen; i++)
         {
             // Create a new balloon for the screen
             ServerBalloon b = CreateBalloon();
             Direction dir;
             float y;
             Vector2D velocity;
             if((b.ID % 2) == 0)
             {
                 dir = Direction.Left;
                 velocity = ServerBalloon.VelocityRight;
                 y = 0.2f;
             }
             else
             {
                 dir = Direction.Right;
                 velocity = ServerBalloon.VelocityLeft;
                 y = 0.1f;
             }
             screen.EnqueueMessage(new NewBalloonMessage(b.ID, dir, y, velocity), this);
         }
     }
     return true;
 }
Пример #2
0
 private bool HandleScreenConnected(ConnectedMessage msg)
 {
     int screenID = m_nextScreenID++;
     ScreenConnection conn = new ScreenConnection(m_queue, msg.Connection);
     Screen screen = new Screen(screenID, conn);
     conn.Sender = screen;
     conn.StartReceivingMessages();
     m_screens.Add(screen);
     Trace.WriteLine(String.Format("Screen connected: {0}", screenID));
     m_feed.Refresh();
     return true;
 }