Ejemplo n.º 1
0
 public Game()
 {
     Graphics = new GraphicsDeviceManager(this);
     Content  = new SmartContentManager(Content.ServiceProvider);
     Content.RootDirectory = "Content";
     instance = this;
 }
Ejemplo n.º 2
0
        internal static void LoadCurrentTheme()
        {
            if (first)
            {
                first = false;
            }
            else if (loadedtheme == Manager.GameSettings.CurrentTheme)
            {
                return;
            }

            if (UIContent != null)
            {
                UIContent.Unload();
                UIContent.Dispose();
                GC.Collect();
            }
            UIContent = new SmartContentManager(Manager.RandomAccessContentManager.ServiceProvider);
            UIContent.RootDirectory = Manager.RandomAccessContentManager.RootDirectory;
            string d = GetCurrentThemeDirectory();

            TextureFiles = new Dictionary <PrimaryTexture, string>();
            foreach (PrimaryTexture t in PrimaryTexture.GetValues(typeof(PrimaryTexture)))
            {
                TextureFiles.Add(t, "Textures\\" + d + "\\" + t.ToString());
            }
            LoadTextures();

            SoundFiles.Clear();
            foreach (SoundType s in SoundType.GetValues(typeof(SoundType)))
            {
                SoundFiles.Add(s, "Sounds\\" + d + "\\" + s.ToString());
            }
            LoadSounds();

            FontFiles.Clear();
            foreach (FontType f in FontType.GetValues(typeof(FontType)))
            {
                FontFiles.Add(f, "Fonts\\" + d + "\\" + f.ToString());
            }
            LoadFonts();
            loadedtheme = Manager.GameSettings.CurrentTheme;
            SoundManager.StopAllLoops();
            //SoundManager.PlaySound(DataHandler.Sounds[SoundType.Background], SoundCategory.Music, true);
            Manager.SaveUserDataLocal();

            GC.Collect();
        }
Ejemplo n.º 3
0
        internal static void init()
        {
            LoadUserDataLocal();
            contentManager = Game.Content as SmartContentManager;
            LoadSettings();
            DataHandler.LoadCurrentTheme();
            stateManager = new StateManager();

            stateManager.AddGameState(GameState.MainMenu, MainMenuCont.GetInstance());
            stateManager.AddGameState(GameState.OnStage, StageCont.GetInstance());

            initInput();

            stateManager.SwitchTo(GameState.MainMenu);

            Game.OnUpdate += Update;
            Game.OnDraw   += Draw;
            initd          = true;
        }