Example #1
0
        public LuaMenu(FreelancerGame g) : base(g)
        {
            api        = new MenuAPI(this);
            ui         = Game.Ui;
            ui.GameApi = api;
            ui.Visible = true;
            ui.OpenScene("mainmenu");
            g.GameData.PopulateCursors();
            g.CursorKind = CursorKind.None;
            intro        = g.GameData.GetIntroScene();
            scene        = new Cutscene(new ThnScriptContext(null), Game.GameData, Game.RenderContext.CurrentViewport, Game);
            scene.BeginScene(intro.Scripts);
            FLLog.Info("Thn", "Playing " + intro.ThnName);
            cur = g.ResourceManager.GetCursor("arrow");
            GC.Collect(); //crap
            g.Sound.PlayMusic(intro.Music);
            g.Keyboard.KeyDown   += UiKeyDown;
            g.Keyboard.TextInput += UiTextInput;
#if DEBUG
            g.Keyboard.KeyDown += Keyboard_KeyDown;
#endif
            Game.Saves.Selected = -1;
            if (g.LoadTimer != null)
            {
                g.LoadTimer.Stop();
                FLLog.Info("Game", $"Initial load took {g.LoadTimer.Elapsed.TotalSeconds} seconds");
                g.LoadTimer = null;
            }
            FadeIn(0.1, 0.3);
        }
Example #2
0
 void LoadSpecific(int index)
 {
     intro = Game.GameData.GetIntroSceneSpecific(index);
     scene.Dispose();
     scene.BeginScene(intro.Scripts);
     scene.Update(1 / 60.0); //Do all the setup events - smoother entrance
     Game.Sound.PlayMusic(intro.Music);
 }
Example #3
0
 private bool firstFrame = false; //Stops a desync in scene starting
 void RoomDoSceneScript(ThnScript sc, ScriptState state)
 {
     hotspots     = new List <RTCHotspot>();
     firstFrame   = true;
     currentState = state;
     if (sc == null)
     {
         currentState = ScriptState.None;
     }
     waitingForFinish = sc;
     scene.BeginScene(Scripts(sceneScripts, new[] { sc }));
     string[] ships = Array.Empty <string>();
     if (session.Ships != null)
     {
         ships = session.Ships.Select(x => Game.GameData.GetShip(x.ShipCRC).Nickname).ToArray();
     }
     for (int i = 0; (i < ships.Length && i < currentRoom.ForSaleShipPlacements.Count); i++)
     {
         ThnObject marker = scene.GetObject(currentRoom.ForSaleShipPlacements[i]);
         if (marker == null)
         {
             FLLog.Error("Base", "Couldn't display " + ships[i] + " on " + currentRoom.ForSaleShipPlacements[i]);
             continue;
         }
         var toSellShip = Game.GameData.GetShip(ships[i]);
         //Set up object
         var obj = new GameObject(toSellShip.ModelFile.LoadFile(Game.ResourceManager), Game.ResourceManager)
         {
             Parent = marker.Object
         };
         obj.PhysicsComponent = null;
         marker.Object.Children.Add(obj);
         if (obj.HardpointExists("HpMount"))
         {
             Matrix4x4.Invert(obj.GetHardpoint("HpMount").Transform, out var tr);
             obj.SetLocalTransform(tr);
         }
     }
     if (sc == null)
     {
         SetRoomCameraAndShip();
         letterboxAmount = -1;
         ui.Visible      = true;
     }
     else
     {
         ui.Visible      = false;
         letterboxAmount = 1;
     }
     if (cState == CutsceneState.Decision)
     {
         letterboxAmount = -1;
     }
 }