public InfocardBrowserTab(string flini, MainWindow win)
        {
            this.win = win;
            var ini = new FreelancerIni(flini, null);

            fonts = new FontManager();
            var rootFolder = Path.Combine(Path.GetDirectoryName(flini), "../");
            var vfs        = FileSystem.FromFolder(rootFolder, true);

            fonts.LoadFontsFromIni(ini, vfs);
            if (ini.JsonResources != null)
            {
                manager = new InfocardManager(File.ReadAllText(ini.JsonResources.Item1), File.ReadAllText(ini.JsonResources.Item2));
            }
            else
            {
                manager = new InfocardManager(ini.Resources);
            }
            stringsIds      = manager.StringIds.ToArray();
            infocardsIds    = manager.InfocardIds.ToArray();
            txt             = new TextBuffer(8192);
            stringClipper   = new ListClipper(stringsIds.Length);
            infocardClipper = new ListClipper(infocardsIds.Length);
            Title           = "Infocard Browser";
        }
Ejemplo n.º 2
0
 public UiData(FreelancerGame game)
 {
     ResourceManager = game.ResourceManager;
     FileSystem      = game.GameData.VFS;
     Infocards       = game.GameData.Ini.Infocards;
     Fonts           = game.Fonts;
     NavbarIcons     = game.GameData.GetBaseNavbarIcons();
     Sounds          = game.Sound;
     DataPath        = game.GameData.Ini.Freelancer.DataPath;
     if (game.GameData.Ini.Navmap != null)
     {
         NavmapIcons = new IniNavmapIcons(game.GameData.Ini.Navmap);
     }
     else
     {
         NavmapIcons = new NavmapIcons();
     }
     if (!string.IsNullOrWhiteSpace(game.GameData.Ini.Freelancer.XInterfacePath))
     {
         OpenFolder(game.GameData.Ini.Freelancer.XInterfacePath);
     }
     else
     {
         OpenDefault();
     }
 }
Ejemplo n.º 3
0
        public InfocardBrowserTab(string flini, MainWindow win)
        {
            this.win = win;
            var ini = new FreelancerIni(flini);

            if (ini.JsonResources != null)
            {
                manager = new InfocardManager(File.ReadAllText(ini.JsonResources.Item1), File.ReadAllText(ini.JsonResources.Item2));
            }
            else
            {
                manager = new InfocardManager(ini.Resources);
            }
            stringsIds   = manager.StringIds.ToArray();
            infocardsIds = manager.InfocardIds.ToArray();
            txt          = new TextBuffer(8192);

            stringClipper   = new ListClipper(stringsIds.Length);
            infocardClipper = new ListClipper(infocardsIds.Length);
            Title           = "Infocard Browser##" + Unique;
        }
 public UiContext(FreelancerGame game)
 {
     Renderer2D      = game.Renderer2D;
     RenderState     = game.RenderState;
     ResourceManager = game.ResourceManager;
     FileSystem      = game.GameData.VFS;
     Infocards       = game.GameData.Ini.Infocards;
     Fonts           = game.Fonts;
     NavbarIcons     = game.GameData.GetBaseNavbarIcons();
     Sounds          = game.Sound;
     DataPath        = game.GameData.Ini.Freelancer.DataPath;
     if (!string.IsNullOrWhiteSpace(game.GameData.Ini.Freelancer.XInterfacePath))
     {
         OpenFolder(game.GameData.Ini.Freelancer.XInterfacePath);
     }
     else
     {
         OpenDefault();
     }
     this.game             = game;
     game.Mouse.MouseDown += MouseOnMouseDown;
     game.Mouse.MouseUp   += MouseOnMouseUp;
 }
Ejemplo n.º 5
0
        void Load()
        {
            UiData.FlDirectory     = FlFolder;
            UiData.ResourceManager = new GameResourceManager(window);
            UiData.FileSystem      = FileSystem.FromFolder(FlFolder);
            UiData.Fonts           = window.Fonts;
            var flIni    = new FreelancerIni(UiData.FileSystem);
            var dataPath = UiData.FileSystem.Resolve(flIni.DataPath) + "/";

            ResolvedDataDir = dataPath;
            UiData.DataPath = flIni.DataPath;
            //TODO: Fix to work with custom game
            UiData.NavmapIcons = new NavmapIcons();
            UiData.OpenFolder(XmlFolder);

            try
            {
                var navbarIni = new LibreLancer.Data.BaseNavBarIni(dataPath, UiData.FileSystem);
                UiData.NavbarIcons = navbarIni.Navbar;
            }
            catch (Exception)
            {
                UiData.NavbarIcons = null;
            }

            try
            {
                var hud = new HudIni();
                hud.AddIni(flIni.HudPath, UiData.FileSystem);
                var maneuvers = new List <Maneuver>();
                var p         = flIni.DataPath.Replace('\\', Path.DirectorySeparatorChar);
                foreach (var m in hud.Maneuvers)
                {
                    maneuvers.Add(new Maneuver()
                    {
                        Action        = m.Action,
                        ActiveModel   = Path.Combine(p, m.ActiveModel),
                        InactiveModel = Path.Combine(p, m.InactiveModel)
                    });
                }
                window.TestApi.ManeuverData = maneuvers.ToArray();
            }
            catch (Exception)
            {
                window.TestApi.ManeuverData = null;
            }

            if (flIni.JsonResources != null)
            {
                UiData.Infocards = new InfocardManager(flIni.JsonResources, UiData.FileSystem);
            }
            else if (flIni.Resources != null)
            {
                UiData.Infocards = new InfocardManager(flIni.Resources);
            }
            XmlLoader = new UiXmlLoader(UiData.Resources);
            try
            {
                UiData.Stylesheet = (Stylesheet)XmlLoader.FromString(UiData.ReadAllText("stylesheet.xml"), null);
            }
            catch (Exception)
            {
            }
            window.Fonts.LoadFontsFromIni(flIni, UiData.FileSystem);
            //unioners infocard
            var im = new InfocardManager(flIni.Resources);

            TestingInfocard = RDLParse.Parse(im.GetXmlResource(65546), window.Fonts);
        }