예제 #1
0
파일: Server.cs 프로젝트: PyrO70/hwkinect
 public void ChangeScreen(int BalloonID, Screen newScreen)
 {
     lock(m_bubbles)
     {
         ServerBalloon b = GetBubble(BalloonID);
         b.Screen = newScreen;
     }
 }
예제 #2
0
파일: Server.cs 프로젝트: PyrO70/hwkinect
 private int ScreenIndex(Screen s)
 {
     lock(m_screens) {
         int i = 0;
         foreach(Screen v in m_screens) {
             if(s.ID == v.ID) {
                 return i;
             }
             i++;
         }
         return -1;
     }
 }
예제 #3
0
파일: Server.cs 프로젝트: PyrO70/hwkinect
 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;
 }
예제 #4
0
파일: Server.cs 프로젝트: PyrO70/hwkinect
 private Screen GetPreviousScreen(Screen s)
 {
     int screen_idx = ScreenIndex(s);
     if(screen_idx == -1)
         return null;
     screen_idx = screen_idx != 0 ? screen_idx - 1 : m_screens.Count -1;
     return m_screens[screen_idx];
 }
예제 #5
0
파일: Server.cs 프로젝트: PyrO70/hwkinect
 private Screen GetNextScreen(Screen s)
 {
     int screen_idx = ScreenIndex(s);
     if(screen_idx == -1)
         return null;
     screen_idx = screen_idx != m_screens.Count - 1 ? screen_idx + 1 : 0;
     return m_screens[screen_idx];
 }
예제 #6
0
파일: Server.cs 프로젝트: PyrO70/hwkinect
 private Screen ChooseNewScreen(Screen oldScreen, Direction direction)
 {
     lock(m_screens) {
         if(direction == Direction.Left) {
             return GetPreviousScreen(oldScreen);
         } else if(direction == Direction.Right) {
             return GetNextScreen(oldScreen);
         } else {
             return null;
         }
     }
 }
예제 #7
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;
 }