예제 #1
0
 public override void Update(double delta)
 {
     session.Update();
     ProcessCutscenes();
     if (scene != null)
     {
         scene.UpdateViewport(Game.RenderContext.CurrentViewport);
         if (paused)
         {
             scene.Update(0);
         }
         else
         {
             scene.Update(firstFrame ? 0 : delta);
         }
     }
     firstFrame = false;
     if (!firstFrame)
     {
         if (session.Popups.Count > 0 && session.Popups.TryDequeue(out var popup))
         {
             FLLog.Debug("Room", "Displaying popup");
             ui.Event("Popup", popup.Title, popup.Contents, popup.ID);
         }
     }
     ui.Update(Game);
     if (ui.KeyboardGrabbed)
     {
         Game.EnableTextInput();
     }
     else
     {
         Game.DisableTextInput();
     }
 }
예제 #2
0
 public override void Update(double delta)
 {
     ui.Update(Game);
     Game.TextInputEnabled = ui.KeyboardGrabbed;
     scene.UpdateViewport(Game.RenderContext.CurrentViewport);
     scene.Update(delta);
     api._Update();
 }
예제 #3
0
        public MainMenu(FreelancerGame g) : base(g)
        {
            g.GameData.LoadHardcodedFiles();
            g.GameData.PopulateCursors();
            g.MouseVisible = false;

            logoOverlay = g.GameData.GetFreelancerLogo();

            g.WillClose       += G_WillClose;
            manager            = new UIManager(g);
            manager.MenuButton = g.GameData.GetMenuButton();
            manager.Clicked   += (tag) => lastTag = tag;
            ConstructMainMenu();

            intro = g.GameData.GetIntroScene();
            scene = new Cutscene(intro.Scripts, Game);
            scene.Update(TimeSpan.FromSeconds(1f / 60f)); //Do all the setup events - smoother entrance
            GC.Collect();                                 //crap
            g.Sound.PlayMusic(intro.Music);

#if DEBUG
            g.Keyboard.KeyDown += Keyboard_KeyDown;
#endif
            cur = g.ResourceManager.GetCursor("arrow");
            GC.Collect();             //GC before showing
        }
예제 #4
0
 public override void Update(TimeSpan delta)
 {
     if (scene != null)
     {
         scene.Update(delta);
     }
     hud.Update(delta, IdentityCamera.Instance);
 }
예제 #5
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);
     lastTag = null;
 }
예제 #6
0
 void Keyboard_KeyDown(KeyEventArgs e)
 {
     if (e.Key >= Keys.D1 && e.Key <= Keys.D9)
     {
         var i = (int)e.Key - (int)Keys.D1;
         var r = Game.GameData.GetIntroSceneSpecific(i);
         if (r == null)
         {
             return;
         }
         intro = r;
         scene = new Cutscene(intro.Scripts, Game);
         scene.Update(TimeSpan.FromSeconds(1f / 60f)); //Do all the setup events - smoother entrance
         Game.Sound.PlayMusic(intro.Music);
         GC.Collect();                                 //crap
     }
 }
예제 #7
0
        public LuaMenu(FreelancerGame g) : base(g)
        {
            api = new LuaAPI(this);
            ui  = new XmlUIManager(g, "menu", api, g.GameData.GetInterfaceXml("mainmenu"));
            ui.OnConstruct();
            ui.Enter();
            g.GameData.PopulateCursors();
            g.CursorKind = CursorKind.None;
            intro        = g.GameData.GetIntroScene();
            scene        = new Cutscene(intro.Scripts, Game);
            scene.Update(TimeSpan.FromSeconds(1f / 60f)); //Do all the setup events - smoother entrance
            cur = g.ResourceManager.GetCursor("arrow");
            GC.Collect();                                 //crap
            g.Sound.PlayMusic(intro.Music);
#if DEBUG
            g.Keyboard.KeyDown += Keyboard_KeyDown;
#endif
            FadeIn(0.1, 0.3);
        }
예제 #8
0
 void World_PhysicsUpdate(double delta)
 {
     if (Thn == null || !Thn.Running)
     {
         ProcessInput(delta);
     }
     //Has to be here or glitches
     camera.ChasePosition    = player.PhysicsComponent.Body.Position;
     camera.ChaseOrientation = player.PhysicsComponent.Body.Transform.ClearTranslation();
     camera.Update(delta);
     if ((Thn == null || !Thn.Running)) //HACK: Cutscene also updates the listener so we don't do it if one is running
     {
         Game.Sound.UpdateListener(delta, camera.Position, camera.CameraForward, camera.CameraUp);
     }
     else
     {
         Thn.Update(paused ? 0 : delta);
         ((ThnCamera)Thn.CameraHandle).DefaultZ(); //using Thn Z here is just asking for trouble
     }
 }
        public LuaMenu(FreelancerGame g) : base(g)
        {
            api        = new MenuAPI(this);
            ui         = new UiContext(g);
            ui.GameApi = new MenuAPI(this);
            widget     = ui.CreateAll("mainmenu.xml");
            g.GameData.PopulateCursors();
            g.CursorKind = CursorKind.None;
            intro        = g.GameData.GetIntroScene();
            scene        = new Cutscene(new ThnScriptContext(intro.Scripts), Game.GameData, Game.Viewport, Game);
            scene.Update(TimeSpan.FromSeconds(1f / 60f)); //Do all the setup events - smoother entrance
            FLLog.Info("Thn", "Playing " + intro.ThnName);
            cur = g.ResourceManager.GetCursor("arrow");
            GC.Collect(); //crap
            g.Sound.PlayMusic(intro.Music);
#if DEBUG
            g.Keyboard.KeyDown += Keyboard_KeyDown;
#endif
            FadeIn(0.1, 0.3);
        }
예제 #10
0
 public override void Update(TimeSpan delta)
 {
     if (loading)
     {
         if (loader.Update(delta))
         {
             loading = false;
             loader  = null;
             FinishLoad();
         }
         return;
     }
     session.GameplayUpdate(this);
     if (session.Update())
     {
         return;
     }
     if (ShowHud && (Thn == null || !Thn.Running))
     {
         ui.Update(Game);
     }
     if (ui.KeyboardGrabbed)
     {
         Game.EnableTextInput();
     }
     else
     {
         Game.DisableTextInput();
     }
     if (Thn != null && Thn.Running)
     {
         Thn.Update(delta);
         sysrender.Camera = Thn.CameraHandle;
     }
     else
     {
         sysrender.Camera = camera;
     }
     world.Update(delta);
 }
예제 #11
0
 public override void Update(TimeSpan delta)
 {
     if (loading)
     {
         if (loader.Update(delta))
         {
             loading = false;
             loader  = null;
             FinishLoad();
         }
         return;
     }
     if (session.Update(this, delta))
     {
         return;
     }
     if (newHud)
     {
         hud.Dispose();
         ConstructHud();
         newHud = false;
     }
     if (ShowHud && (Thn == null || !Thn.Running))
     {
         hud.Update(delta);
     }
     if (Thn != null && Thn.Running)
     {
         Thn.Update(delta);
         sysrender.Camera = Thn.CameraHandle;
     }
     else
     {
         sysrender.Camera = camera;
     }
     world.Update(delta);
 }
예제 #12
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;
 }