Exemplo n.º 1
0
        void OnLoadComplete()
        {
            systemMap.CreateContext(this);
            fontMan.LoadFontsFromGameData(GameData);
            camera      = new DebugCamera(new Rectangle(0, 0, Width, Height));
            camera.Zoom = 5000;
            camera.UpdateProjection();
            var renderer = new SystemRenderer(camera, GameData, Resources, this);

            world   = new GameWorld(renderer);
            systems = GameData.ListSystems().OrderBy(x => x).ToArray();
            Resources.ClearTextures();
            string navPrettyMap;

            if ((navPrettyMap = GameData.VFS.Resolve(GameData.Ini.Freelancer.DataPath + "INTERFACE/NEURONET/NAVMAP/NEWNAVMAP/nav_prettymap.3db", false)) !=
                null)
            {
                Resources.LoadResourceFile(navPrettyMap);
            }
            universeBackgroundTex = (Resources.FindTexture("fancymap.tga") as Texture2D);
            if (universeBackgroundTex != null)
            {
                universeBackgroundRegistered = ImGuiHelper.RegisterTexture(universeBackgroundTex);
            }
            else
            {
                universeBackgroundRegistered = -1;
            }
            curSystem      = GameData.GetSystem(systems[0]);
            systemInfocard = GameData.GetInfocard(curSystem.Infocard, fontMan);
            GameData.LoadAllSystem(curSystem);
            world.LoadSystem(curSystem, Resources, false);
            systemMap.SetObjects(curSystem);
        }
        void OnLoadComplete()
        {
            fontMan.LoadFontsFromGameData(GameData);
            camera      = new DebugCamera(new Viewport(0, 0, Width, Height));
            camera.Zoom = 5000;
            camera.UpdateProjection();
            var renderer = new SystemRenderer(camera, GameData, Resources, this);

            world   = new GameWorld(renderer);
            systems = GameData.ListSystems().OrderBy(x => x).ToArray();
            Resources.ClearTextures();
            Resources.LoadResourceFile(GameData.ResolveDataPath("INTERFACE/NEURONET/NAVMAP/NEWNAVMAP/nav_prettymap.3db"));
            universeBackgroundTex = (Resources.FindTexture("fancymap.tga") as Texture2D);
            if (universeBackgroundTex != null)
            {
                universeBackgroundRegistered = ImGuiHelper.RegisterTexture(universeBackgroundTex);
            }
            else
            {
                universeBackgroundRegistered = -1;
            }
            curSystem      = GameData.GetSystem(systems[0]);
            systemInfocard = GameData.GetInfocard(curSystem.Infocard, fontMan);
            GameData.LoadAllSystem(curSystem);
            world.LoadSystem(curSystem, Resources);
        }
Exemplo n.º 3
0
        void OnLoadComplete()
        {
            camera      = new DebugCamera(new Viewport(0, 0, Width, Height));
            camera.Zoom = 5000;
            camera.UpdateProjection();
            var renderer = new SystemRenderer(camera, GameData, Resources, this);

            world   = new GameWorld(renderer);
            systems = GameData.ListSystems().OrderBy(x => x).ToArray();
            Resources.ClearTextures();
            curSystem = GameData.GetSystem(systems[0]);
            world.LoadSystem(curSystem, Resources);
        }
Exemplo n.º 4
0
        private void restartRenderers()
        {
            if (this.galaxyRenderer != null)
            {
                this.galaxyRenderer.Deactivate();
            }

            this.galaxyRenderer = new GalaxyRenderer(this);
            this.galaxyRenderer.SwitchPlayer(this.currentPlayer);

            this.bombardRenderer  = new BombardmentRenderer();
            this.systemRenderer   = new SystemRenderer(switchToGalaxyView, constructionManagement, empyPlanetView);
            this.combatRenderer   = new SpaceCombatRenderer();
            this.gameOverRenderer = new GameOverRenderer();

            switchToGalaxyView();
        }
Exemplo n.º 5
0
 void ChangeSystem()
 {
     if (sysIndex != sysIndexLoaded)
     {
         if (world != null)
         {
             world.Renderer.Dispose();
             world.Dispose();
             var renderer = new SystemRenderer(camera, GameData, Resources, this);
             world = new GameWorld(renderer);
         }
         camera.UpdateProjection();
         camera.Free = false;
         camera.Zoom = 5000;
         Resources.ClearTextures();
         if (universeBackgroundTex != null)
         {
             ImGuiHelper.DeregisterTexture(universeBackgroundTex);
         }
         universeBackgroundTex = (Resources.FindTexture("fancymap.tga") as Texture2D);
         if (universeBackgroundTex != null)
         {
             universeBackgroundRegistered = ImGuiHelper.RegisterTexture(universeBackgroundTex);
         }
         else
         {
             universeBackgroundRegistered = -1;
         }
         curSystem      = GameData.GetSystem(systems[sysIndex]);
         systemInfocard = GameData.GetInfocard(curSystem.Infocard, fontMan);
         if (icard != null)
         {
             icard.SetInfocard(systemInfocard);
         }
         GameData.LoadAllSystem(curSystem);
         world.LoadSystem(curSystem, Resources, false);
         systemMap.SetObjects(curSystem);
         sysIndexLoaded = sysIndex;
     }
 }
Exemplo n.º 6
0
        public MainState(FreelancerGame game) : base(game)
        {
            manager = new UIManager(game);
            uiFont  = game.Fonts.GetSystemFont("Arial");
            //Construct Menu
            menuBackground           = new PanelElement2D(manager);
            menuBackground.FillColor = new Color4(0, 0, 0, 0.25f);
            manager.Elements.Add(menuBackground);
            var btnOpen = new ButtonElement2D(manager, uiFont)
            {
                Label = "Open"
            };

            btnOpen.AutoSize(Game.Renderer2D);
            btnOpen.Position2D    = new Vector2(10, 10);
            btnOpen.Clicked      += OpenFxDialog;
            menuBackground.Height = 20 + btnOpen.Height;
            manager.Elements.Add(btnOpen);

            var btnRefresh = new ButtonElement2D(manager, uiFont)
            {
                Label = "Refresh"
            };

            btnRefresh.AutoSize(Game.Renderer2D);
            btnRefresh.Position2D = new Vector2(10 + btnOpen.Position2D.X + btnOpen.Width, 10);
            btnRefresh.Clicked   += () => {
                if (currentOpen != null)
                {
                    DoOpenFx(currentOpen);
                }
            };
            manager.Elements.Add(btnRefresh);

            var btnOptions = new ButtonElement2D(manager, uiFont)
            {
                Label = "Options"
            };

            btnOptions.AutoSize(Game.Renderer2D);
            btnOptions.Position2D = new Vector2(10 + btnRefresh.Position2D.X + btnRefresh.Width, 10);
            btnOptions.Clicked   += OptionsDialog;
            manager.Elements.Add(btnOptions);

            var btnExit = new ButtonElement2D(manager, uiFont)
            {
                Label = "Exit"
            };

            btnExit.AutoSize(Game.Renderer2D);
            btnExit.Position2D = new Vector2(10 + btnOptions.Position2D.X + btnOptions.Width, 10);
            btnExit.Clicked   += () => MessageDialog("Are you sure you want to exit?", Game.Exit);
            manager.Elements.Add(btnExit);

            zoomSlider = new SliderElement2D(manager, uiFont)
            {
                Label = "Zoom:"
            };
            zoomSlider.AutoSize(Game.Renderer2D);
            zoomSlider.Position2D = new Vector2(10 + btnExit.Position2D.X + btnExit.Width, 10);
            manager.Elements.Add(zoomSlider);

            //Setup input and rendering
            Game.Keyboard.TextInput += Keyboard_TextInput;
            Game.Keyboard.KeyDown   += Keyboard_KeyDown;
            cam                = new ChaseCamera(Game.Viewport);
            renderer           = new SystemRenderer(cam, Game.GameData, Game.ResourceManager);
            renderer.NullColor = new Color4(0.1072961f, 0.1587983f, 0.1845494f, 1);
        }