Esempio n. 1
0
        protected override void LoadContent()
        {
            Console.Log("Loading Content...");

            try
            {
                // Create a new SpriteBatch, which can be used to draw textures.
                spriteBatch = new SpriteBatch(GraphicsDevice);

                // TODO: use this.Content to load your game content here

                // load the fonts
                FontManager.Load(Content);
                FontManager.DefaultSize = 16;
                CursorManager.Load(Content);
                CursorManager.Enabled = false;

                // load the UI Style
                bool   success;
                string errormsg;
                UIStyle = UIStyle.Load(DefaultUIStyleLocation, FontManager, out success, out errormsg);
                if (!success)
                {
                    UIStyle.Save(DefaultUIStyleLocation, UIStyle, out errormsg);
                }
                CursorManager.SetCursor(UIStyle.CursorStyle, UIStyle.CursorColor);

                // load the cursor, create the input manager
                InputManager  = new InputManager(CursorManager);
                HotkeyManager = new HotkeyManager((s) => { Console.Error(s); });
                List <HotkeySave> hotkeys = HotkeyManager.Load(DefaultHotkeysLocation);
                if (hotkeys == null)
                {
                    hotkeys = new List <HotkeySave>();
                }
                //Console.AddHandle("Hotkey", new ConsoleHandleHotkeyManager(HotkeyManager));

                // create the profile manager
                ProfileManager = new ProfileManager <SampleProfile>(DefaultProfilesLocation,
                                                                    MakeDefaultProfile, (s) => { Console.Error(s); });

                // load specific hotkeys
                List <HotkeySave> profHotkeys = ProfileManager.CurrentProfile.Hotkeys;
                HotkeyManager.LoadProfile(HotkeyManager.MergeHotkeySaves(hotkeys, profHotkeys));

                // Add the startup UI
                //UIBoss.Add(new TestUI(UIStyle));
                UIBoss = new UIBoss(UIStyle, HotkeyManager);
                TestUI testui = new TestUI(UIStyle, GraphicsDevice);
                UIBoss.Add(testui);
                UIBoss.Add(new ConsoleUI(UIBoss, UIStyle, GraphicsDevice, Console,
                                         GraphicsDevice.PresentationParameters.BackBufferWidth, 300));
                UIBoss.Add(new FrameRateUI(UIStyle, GraphicsDevice));
                //Console.AddHandle("UIStyle", new ConsoleHandleUIStyle(UIBoss));
            }
            catch (Exception e)
            {
                Console.Error("FAILED: " + e.Message);
                Console.Error("Could not load content. Aborting.");
                Crash(e);
                return;
            }

            Console.Log("Content Loaded.");
        }