예제 #1
0
        void ConstructLanInternetDialog()
        {
            var dlg = new List <UIElement>();

            dlg.Add(new UIBackgroundElement(manager)
            {
                FillColor = new Color4(0, 0, 0, 0.25f)
            });
            dlg.Add(new UIMessageBox(manager, LANORINTERNET_INFOCARD));
            var x = new UIXButton(manager, 0.64f, 0.26f, 2, 2.9f);

            x.Clicked += () =>
            {
                manager.Dialog = null;
                manager.PlaySound("ui_motion_swish");
                manager.FlyOutAll(FLYIN_LENGTH, 0.05);
                manager.AnimationComplete += ConstructServerList;
            };
            dlg.Add(x);

            manager.Dialog = dlg;
        }
예제 #2
0
 public override void Update(TimeSpan delta)
 {
     //Don't want the big lag at the start
     if (frames == 0)
     {
         frames = 1;
         return;
     }
     scene.Update(delta);
     manager.Update(delta);
     if (lastTag == "gameplay")
     {
         manager.PlaySound("ui_motion_swish");
         manager.FlyOutAll(FLYIN_LENGTH, 0.05);
         manager.AnimationComplete += () =>
         {
             manager.Dispose();
             Game.ChangeState(new SpaceGameplay(Game, new GameSession(Game)));
         };
     }
     if (lastTag == "multiplayer")
     {
         ConstructLanInternetDialog();                 //Don't bother with ESRB notice just skip to LAN/INTERNET
     }
     if (lastTag == "dlg_cancel")
     {
         manager.Dialog = null;
     }
     if (lastTag == "system")
     {
         manager.PlaySound("ui_motion_swish");
         manager.FlyOutAll(FLYIN_LENGTH, 0.05);
         manager.AnimationComplete += () =>
         {
             manager.Dispose();
             Game.ChangeState(new DemoSystemView(Game));
         };
     }
     if (lastTag == "options")
     {
         manager.PlaySound("ui_motion_swish");
         manager.FlyOutAll(FLYIN_LENGTH, 0.05);
         manager.AnimationComplete += ConstructOptions;
     }
     if (lastTag == "opt_mainmenu")
     {
         manager.PlaySound("ui_motion_swish");
         manager.FlyOutAll(FLYIN_LENGTH, 0.05);
         manager.AnimationComplete += ConstructMainMenu;
     }
     if (lastTag == "srvlst_refresh")
     {
         connectButton.Tag = null;
         serverList.Servers.Clear();
         netClient.DiscoverLocalPeers();
         if (internetServers)
         {
             netClient.DiscoverGlobalPeers();
         }
     }
     if (lastTag == "srvlst_connect")
     {
         netClient.Connect(selectedInfo.EndPoint);
     }
     if (lastTag == "srvlst_mainmenu")
     {
         netClient.Disconnected -= ServerList_Disconnected;
         netClient.Dispose();
         netClient = null;
         manager.PlaySound("ui_motion_swish");
         manager.FlyOutAll(FLYIN_LENGTH, 0.05);
         manager.AnimationComplete += ConstructMainMenu;
     }
     if (lastTag == "csel_mainmenu")
     {
         netClient.Disconnected -= CharSelect_Disconnected;
         netClient.Dispose();
         netClient = null;
         manager.PlaySound("ui_motion_swish");
         manager.FlyOutAll(FLYIN_LENGTH, 0.05);
         manager.AnimationComplete += ConstructMainMenu;
     }
     if (lastTag == "csel_servlist")
     {
         netClient.Disconnected -= CharSelect_Disconnected;
         netClient.Stop();
         netClient.Start();
         manager.PlaySound("ui_motion_swish");
         manager.FlyOutAll(FLYIN_LENGTH, 0.05);
         manager.AnimationComplete += ConstructServerList;
     }
     if (lastTag == "exit")
     {
         manager.PlaySound("ui_motion_swish");
         manager.FlyOutAll(FLYIN_LENGTH, 0.05);
         manager.AnimationComplete += () =>
         {
             manager.Dispose();
             if (netClient != null)
             {
                 netClient.Dispose();
             }
             Game.Exit();
         };
     }
     lastTag = null;
 }