Example #1
0
 public AnimationManager(LoderGame game)
 {
     _game = game;
     _content = new ContentManager(game.Services);
     _content.RootDirectory = "Content";
     _default = _content.Load<Texture2D>("animations/no_texture");
     _animations = new Dictionary<string, Dictionary<string, List<Texture2D>>>();
     _offsets = new Dictionary<string, Dictionary<string, List<Vector2>>>();
     _fps = new Dictionary<string, Dictionary<string, float>>();
     loadAnimation("main_character", "walk_left", "0", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "1", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "2", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "3", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "4", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "5", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "6", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "7", new Vector2(0.5f, 0.65f));
     setFPS("main_character", "walk_left", 24);
     loadAnimation("main_character", "walk_right", "0", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "1", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "2", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "3", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "4", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "5", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "6", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "7", new Vector2(0.5f, 0.65f));
     setFPS("main_character", "walk_right", 24);
     loadAnimation("main_character", "idle", "0", new Vector2(0.5f, 0.65f));
     setFPS("main_character", "idle", 24);
 }
Example #2
0
 public AnimationManager(LoderGame game)
 {
     _game    = game;
     _content = new ContentManager(game.Services);
     _content.RootDirectory = "Content";
     _default    = _content.Load <Texture2D>("animations/no_texture");
     _animations = new Dictionary <string, Dictionary <string, List <Texture2D> > >();
     _offsets    = new Dictionary <string, Dictionary <string, List <Vector2> > >();
     _fps        = new Dictionary <string, Dictionary <string, float> >();
     loadAnimation("main_character", "walk_left", "0", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "1", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "2", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "3", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "4", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "5", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "6", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_left", "7", new Vector2(0.5f, 0.65f));
     setFPS("main_character", "walk_left", 24);
     loadAnimation("main_character", "walk_right", "0", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "1", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "2", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "3", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "4", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "5", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "6", new Vector2(0.5f, 0.65f));
     loadAnimation("main_character", "walk_right", "7", new Vector2(0.5f, 0.65f));
     setFPS("main_character", "walk_right", 24);
     loadAnimation("main_character", "idle", "0", new Vector2(0.5f, 0.65f));
     setFPS("main_character", "idle", 24);
 }
Example #3
0
        public LevelScreen(LoderGame game, SystemManager systemManager, EntityManager entityManager)
            : base(game.screenSystem, ScreenType.Level)
        {
            _game                  = game;
            _systemManager         = systemManager;
            _entityManager         = entityManager;
            _levelSystem           = (LevelSystem)_systemManager.getSystem(SystemType.Level);
            _content               = new ContentManager(_game.Services);
            _content.RootDirectory = "Content";
            _equipmentSystem       = (EquipmentSystem)_systemManager.getSystem(SystemType.Equipment);
            _playerId              = PlayerSystem.PLAYER_ID;
            _pixel                 = new Texture2D(_game.GraphicsDevice, 1, 1);
            _pixel.SetData <Color>(new[] { Color.White });
            _arial              = _content.Load <SpriteFont>("arial");
            _dialogePanes       = new List <InteractiveDialoguePane>();
            _dialogueFont       = _content.Load <SpriteFont>("shared_ui/dialogue_font");
            _dialogueOptionFont = _content.Load <SpriteFont>("shared_ui/dialogue_option_font");

            ToolbarComponent toolbarComponent = (ToolbarComponent)_entityManager.getComponent(LevelSystem.currentLevelUid, _playerId, ComponentType.Toolbar);

            _toolbarDisplay           = new ToolbarDisplay(_game.spriteBatch, _equipmentSystem, toolbarComponent);
            _inventoryDisplay         = new InventoryDisplay(_game.spriteBatch, _equipmentSystem, (InventoryComponent)_entityManager.getComponent(LevelSystem.currentLevelUid, _playerId, ComponentType.Inventory), toolbarComponent);
            _inventoryDisplay.inFocus = false;
            _toolbarDisplay.inFocus   = true;

            _healthBar = new LargeHealthBar(_game.spriteBatch);
        }
Example #4
0
        public WorldMapScreen(LoderGame game, SystemManager systemManager)
            : base(game.screenSystem, ScreenType.WorldMap)
        {
            _game = game;
            _systemManager = systemManager;
            _scale = 1f;

            _content = new ContentManager(game.Services);
            _content.RootDirectory = "Content";
            _fogEffect = _content.Load<Effect>("fog_effect");
            _pathTexture = _content.Load<Texture2D>("world_map/path");
            _pathTextureOrigin = new Vector2(_pathTexture.Width, _pathTexture.Height) / 2f;
            _antiFogBrush = _content.Load<Texture2D>("world_map/anti_fog_brush");
            _antiFogBrushOrigin = new Vector2(_antiFogBrush.Width, _antiFogBrush.Height) / 2f;
            _levelSelectIcon = _content.Load<Texture2D>("world_map/level_select_icon");
            _levelSelectIconHalfSize = new Vector2(_levelSelectIcon.Width, _levelSelectIcon.Height) / 2f;
            _levelSelectIconSelectedColor = Color.Yellow;
            _levelSelectIconDeselectedColor = Color.White * 0.8f;
            _levelSelectIconColor = _levelSelectIconDeselectedColor;
            _levelSelectTitleFont = _content.Load<SpriteFont>("world_map/level_select_title");
            _levelSelectDescriptionFont = _content.Load<SpriteFont>("world_map/level_select_description");
            _halfScreenSize = new Vector2(_spriteBatch.GraphicsDevice.Viewport.Width, _spriteBatch.GraphicsDevice.Viewport.Height) / 2f;
            _fogRT = new RenderTarget2D(_spriteBatch.GraphicsDevice, _spriteBatch.GraphicsDevice.Viewport.Width, _spriteBatch.GraphicsDevice.Viewport.Height);
            _antiFogRT = new RenderTarget2D(_spriteBatch.GraphicsDevice, _spriteBatch.GraphicsDevice.Viewport.Width, _spriteBatch.GraphicsDevice.Viewport.Height);
        }
Example #5
0
        public RenderSystem(LoderGame game, SystemManager systemManager, EntityManager entityManager)
        {
            _game = game;
            _systemManager = systemManager;
            _entityManager = entityManager;
            _animationManager = game.animationManager;
            //_sortedRenderablePrimitives = new SortedDictionary<float, List<IRenderablePrimitive>>();
            _cameraSystem = _systemManager.getSystem(SystemType.Camera) as CameraSystem;
            _graphicsDevice = game.GraphicsDevice;
            _spriteBatch = game.spriteBatch;
            _backgroundRenderer = new BackgroundRenderer(_spriteBatch);
            _fluidRenderTarget = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _renderedFluid = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _debugFluid = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _postSourceUnder = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _postSourceOver = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);

            _contentManager = new ContentManager(game.Services);
            _contentManager.RootDirectory = "Content";
            _fluidEffect = _contentManager.Load<Effect>("fluid_effect");
            _fluidParticleTexture = _contentManager.Load<Texture2D>("fluid_particle");
            _reticle = _contentManager.Load<Texture2D>("reticle");
            _materialRenderer = new MaterialRenderer(game.GraphicsDevice, _contentManager, game.spriteBatch);
            _primitivesEffect = _contentManager.Load<Effect>("effects/primitives");
            _pixel = new Texture2D(_graphicsDevice, 1, 1);
            _pixel.SetData<Color>(new [] { Color.White });
            _circle = _contentManager.Load<Texture2D>("circle");
            _tooltipFont = _contentManager.Load<SpriteFont>("shared_ui/tooltip_font");
        }
Example #6
0
        public WorldMapScreen(LoderGame game, SystemManager systemManager)
            : base(game.screenSystem, ScreenType.WorldMap)
        {
            _game          = game;
            _systemManager = systemManager;
            _scale         = 1f;

            _content = new ContentManager(game.Services);
            _content.RootDirectory          = "Content";
            _fogEffect                      = _content.Load <Effect>("fog_effect");
            _pathTexture                    = _content.Load <Texture2D>("world_map/path");
            _pathTextureOrigin              = new Vector2(_pathTexture.Width, _pathTexture.Height) / 2f;
            _antiFogBrush                   = _content.Load <Texture2D>("world_map/anti_fog_brush");
            _antiFogBrushOrigin             = new Vector2(_antiFogBrush.Width, _antiFogBrush.Height) / 2f;
            _levelSelectIcon                = _content.Load <Texture2D>("world_map/level_select_icon");
            _levelSelectIconHalfSize        = new Vector2(_levelSelectIcon.Width, _levelSelectIcon.Height) / 2f;
            _levelSelectIconSelectedColor   = Color.Yellow;
            _levelSelectIconDeselectedColor = Color.White * 0.8f;
            _levelSelectIconColor           = _levelSelectIconDeselectedColor;
            _levelSelectTitleFont           = _content.Load <SpriteFont>("world_map/level_select_title");
            _levelSelectDescriptionFont     = _content.Load <SpriteFont>("world_map/level_select_description");
            _halfScreenSize                 = new Vector2(_spriteBatch.GraphicsDevice.Viewport.Width, _spriteBatch.GraphicsDevice.Viewport.Height) / 2f;
            _fogRT     = new RenderTarget2D(_spriteBatch.GraphicsDevice, _spriteBatch.GraphicsDevice.Viewport.Width, _spriteBatch.GraphicsDevice.Viewport.Height);
            _antiFogRT = new RenderTarget2D(_spriteBatch.GraphicsDevice, _spriteBatch.GraphicsDevice.Viewport.Width, _spriteBatch.GraphicsDevice.Viewport.Height);
        }
Example #7
0
        public LoadGameScreen(LoderGame game)
            : base(game.screenSystem, ScreenType.LoadGameMenu)
        {
            _game = game;
            _content = new ContentManager(game.Services);
            _content.RootDirectory = "Content";
            _savedGameFont = _content.Load<SpriteFont>("load_game_menu/saved_game_font");
            _confirmationFont = _content.Load<SpriteFont>("shared_ui/confirmation_font");
            _savedGameButtons = new List<LabelTextureButton>();
            _deleteGameButtons = new List<TextureButton>();

            _container = new BluePane(
                this,
                UIAlignment.MiddleCenter,
                0,
                0,
                545,
                400);

            _cancelButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                135,
                180,
                _content.Load<Texture2D>("shared_ui/cancel_button_over"),
                _content.Load<Texture2D>("shared_ui/cancel_button"),
                new Rectangle(0, 0, 152, 33),
                () =>
                {
                    _game.closeLoadGameMenu();
                    _game.openMainMenu();
                });
        }
Example #8
0
        public LoadGameScreen(LoderGame game)
            : base(game.screenSystem, ScreenType.LoadGameMenu)
        {
            _game    = game;
            _content = new ContentManager(game.Services);
            _content.RootDirectory = "Content";
            _savedGameFont         = _content.Load <SpriteFont>("load_game_menu/saved_game_font");
            _confirmationFont      = _content.Load <SpriteFont>("shared_ui/confirmation_font");
            _savedGameButtons      = new List <LabelTextureButton>();
            _deleteGameButtons     = new List <TextureButton>();

            _container = new BluePane(
                this,
                UIAlignment.MiddleCenter,
                0,
                0,
                545,
                400);

            _cancelButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                135,
                180,
                _content.Load <Texture2D>("shared_ui/cancel_button_over"),
                _content.Load <Texture2D>("shared_ui/cancel_button"),
                new Rectangle(0, 0, 152, 33),
                () =>
            {
                _game.closeLoadGameMenu();
                _game.openMainMenu();
            });
        }
Example #9
0
        public LevelScreen(LoderGame game, SystemManager systemManager, EntityManager entityManager)
            : base(game.screenSystem, ScreenType.Level)
        {
            _game = game;
            _systemManager = systemManager;
            _entityManager = entityManager;
            _levelSystem = (LevelSystem)_systemManager.getSystem(SystemType.Level);
            _content = new ContentManager(_game.Services);
            _content.RootDirectory = "Content";
            _equipmentSystem = (EquipmentSystem)_systemManager.getSystem(SystemType.Equipment);
            _playerId = PlayerSystem.PLAYER_ID;
            _pixel = new Texture2D(_game.GraphicsDevice, 1, 1);
            _pixel.SetData<Color>(new[] { Color.White });
            _arial = _content.Load<SpriteFont>("arial");
            _dialogePanes = new List<InteractiveDialoguePane>();
            _dialogueFont = _content.Load<SpriteFont>("shared_ui/dialogue_font");
            _dialogueOptionFont = _content.Load<SpriteFont>("shared_ui/dialogue_option_font");

            ToolbarComponent toolbarComponent = (ToolbarComponent)_entityManager.getComponent(LevelSystem.currentLevelUid, _playerId, ComponentType.Toolbar);

            _toolbarDisplay = new ToolbarDisplay(_game.spriteBatch, _equipmentSystem, toolbarComponent);
            _inventoryDisplay = new InventoryDisplay(_game.spriteBatch, _equipmentSystem, (InventoryComponent)_entityManager.getComponent(LevelSystem.currentLevelUid, _playerId, ComponentType.Inventory), toolbarComponent);
            _inventoryDisplay.inFocus = false;
            _toolbarDisplay.inFocus = true;

            _healthBar = new LargeHealthBar(_game.spriteBatch);
        }
Example #10
0
        public RenderSystem(LoderGame game, SystemManager systemManager, EntityManager entityManager)
        {
            _game             = game;
            _systemManager    = systemManager;
            _entityManager    = entityManager;
            _animationManager = game.animationManager;
            //_sortedRenderablePrimitives = new SortedDictionary<float, List<IRenderablePrimitive>>();
            _cameraSystem       = _systemManager.getSystem(SystemType.Camera) as CameraSystem;
            _graphicsDevice     = game.GraphicsDevice;
            _spriteBatch        = game.spriteBatch;
            _backgroundRenderer = new BackgroundRenderer(_spriteBatch);
            _fluidRenderTarget  = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _renderedFluid      = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _debugFluid         = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _postSourceUnder    = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _postSourceOver     = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);

            _contentManager = new ContentManager(game.Services);
            _contentManager.RootDirectory = "Content";
            _fluidEffect          = _contentManager.Load <Effect>("fluid_effect");
            _fluidParticleTexture = _contentManager.Load <Texture2D>("fluid_particle");
            _reticle          = _contentManager.Load <Texture2D>("reticle");
            _materialRenderer = new MaterialRenderer(game.GraphicsDevice, _contentManager, game.spriteBatch);
            _primitivesEffect = _contentManager.Load <Effect>("effects/primitives");
            _pixel            = new Texture2D(_graphicsDevice, 1, 1);
            _pixel.SetData <Color>(new [] { Color.White });
            _circle      = _contentManager.Load <Texture2D>("circle");
            _tooltipFont = _contentManager.Load <SpriteFont>("shared_ui/tooltip_font");
        }
        public PlayerCreationScreen(LoderGame game)
            : base(game.screenSystem, ScreenType.PlayerCreation)
        {
            _game = game;
            _content = new ContentManager(game.Services, "Content");
            _titleFont = _content.Load<SpriteFont>("player_creation_screen/title_font");
            _letterFont = _content.Load<SpriteFont>("shared_ui/dialogue_font");
            _namePreview = new NamePreview(this, _letterFont, UIAlignment.MiddleCenter, -200, -122, _maxLetters);
            _nameInputPane = new NameInputPane(this, _letterFont, UIAlignment.MiddleCenter, 0, 98, 648, 320, _maxLetters);

            _title = new Label(
                this,
                _titleFont,
                UIAlignment.MiddleCenter,
                0,
                -180,
                TextAlignment.Center,
                "Please choose a name",
                2);

            _cancelButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                24,
                240,
                _content.Load<Texture2D>("shared_ui/cancel_button_over"),
                _content.Load<Texture2D>("shared_ui/cancel_button"),
                new Rectangle(0, 0, 152, 33),
                () =>
                {
                    _game.closePlayerCreationScreen();
                    _game.openMainMenu();
                });

            _createButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                184,
                240,
                _content.Load<Texture2D>("player_creation_screen/create_button_over"),
                _content.Load<Texture2D>("player_creation_screen/create_button"),
                new Rectangle(0, 0, 152, 33),
                () =>
                {
                    _game.closePlayerCreationScreen();
                    _screenSystem.addTransition(new ScreenFadeOutTransition(this, Color.Black, true, 0.05f, null, () =>
                    {
                        int playerSlot;
                        _game.startPersistentSystems();
                        _game.playerSystem.createPlayer();
                        playerSlot = DataManager.createPlayerData(_nameInputPane.name);
                        DataManager.loadPlayerData(playerSlot);
                        _game.loadLevel("dagny_house");
                        //_game.openWorldMap();
                    }));
                });
        }
Example #12
0
        public PlayerCreationScreen(LoderGame game) : base(game.screenSystem, ScreenType.PlayerCreation)
        {
            _game          = game;
            _content       = new ContentManager(game.Services, "Content");
            _titleFont     = _content.Load <SpriteFont>("player_creation_screen/title_font");
            _letterFont    = _content.Load <SpriteFont>("shared_ui/dialogue_font");
            _namePreview   = new NamePreview(this, _letterFont, UIAlignment.MiddleCenter, -200, -122, _maxLetters);
            _nameInputPane = new NameInputPane(this, _letterFont, UIAlignment.MiddleCenter, 0, 98, 648, 320, _maxLetters);

            _title = new Label(
                this,
                _titleFont,
                UIAlignment.MiddleCenter,
                0,
                -180,
                TextAlignment.Center,
                "Please choose a name",
                2);

            _cancelButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                24,
                240,
                _content.Load <Texture2D>("shared_ui/cancel_button_over"),
                _content.Load <Texture2D>("shared_ui/cancel_button"),
                new Rectangle(0, 0, 152, 33),
                () =>
            {
                _game.closePlayerCreationScreen();
                _game.openMainMenu();
            });

            _createButton = new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.MiddleCenter,
                184,
                240,
                _content.Load <Texture2D>("player_creation_screen/create_button_over"),
                _content.Load <Texture2D>("player_creation_screen/create_button"),
                new Rectangle(0, 0, 152, 33),
                () =>
            {
                _game.closePlayerCreationScreen();
                _screenSystem.addTransition(new ScreenFadeOutTransition(this, Color.Black, true, 0.05f, null, () =>
                {
                    int playerSlot;
                    _game.startPersistentSystems();
                    _game.playerSystem.createPlayer();
                    playerSlot = DataManager.createPlayerData(_nameInputPane.name);
                    DataManager.loadPlayerData(playerSlot);
                    _game.loadLevel("dagny_house");
                    //_game.openWorldMap();
                }));
            });
        }
Example #13
0
        public LoadingScreen(LoderGame game)
            : base(game.screenSystem, ScreenType.Loading)
        {
            _textures = new List<Texture2D>();
            _content = new ContentManager(game.Services);
            _content.RootDirectory = "Content";
            for (int i = 0; i < 10; i++)
            {
                _textures.Add(_content.Load<Texture2D>(string.Format("loading_screen/gear_{0}", i)));
            }
            _background = _content.Load<Texture2D>("loading_screen/background");
            _titleFont = _content.Load<SpriteFont>("loading_screen/title");
            _messageFont = _content.Load<SpriteFont>("loading_screen/message");

            _title = new Label(
                this,
                _titleFont,
                UIAlignment.TopLeft,
                32,
                32,
                TextAlignment.Left,
                "Loading",
                4);
            _title.layerDepth = 0.1f;

            _message = new Label(
                this,
                _messageFont,
                UIAlignment.BottomRight,
                -50,
                -90,
                TextAlignment.Right,
                "Loading level data...",
                2);
            _message.layerDepth = 0.1f;

            _progressBar = new ProgressBar(
                this,
                UIAlignment.BottomRight,
                -590,
                -64);
            _progressBar.layerDepth = 0.1f;
        }
Example #14
0
        public LoadingScreen(LoderGame game)
            : base(game.screenSystem, ScreenType.Loading)
        {
            _textures = new List <Texture2D>();
            _content  = new ContentManager(game.Services);
            _content.RootDirectory = "Content";
            for (int i = 0; i < 10; i++)
            {
                _textures.Add(_content.Load <Texture2D>(string.Format("loading_screen/gear_{0}", i)));
            }
            _background  = _content.Load <Texture2D>("loading_screen/background");
            _titleFont   = _content.Load <SpriteFont>("loading_screen/title");
            _messageFont = _content.Load <SpriteFont>("loading_screen/message");

            _title = new Label(
                this,
                _titleFont,
                UIAlignment.TopLeft,
                32,
                32,
                TextAlignment.Left,
                "Loading",
                4);
            _title.layerDepth = 0.1f;

            _message = new Label(
                this,
                _messageFont,
                UIAlignment.BottomRight,
                -50,
                -90,
                TextAlignment.Right,
                "Loading level data...",
                2);
            _message.layerDepth = 0.1f;

            _progressBar = new ProgressBar(
                this,
                UIAlignment.BottomRight,
                -590,
                -64);
            _progressBar.layerDepth = 0.1f;
        }
Example #15
0
        public OptionsMenuScreen(LoderGame game)
            : base(game.screenSystem, ScreenType.OptionsMenu)
        {
            _game    = game;
            _content = new ContentManager(game.Services);
            _content.RootDirectory = "Content";
            _categoryTitleFont     = _content.Load <SpriteFont>("options_menu/category_title_font");
            _optionsFont           = _content.Load <SpriteFont>("options_menu/options_font");
            _leftArrows            = _content.Load <Texture2D>("shared_ui/left_arrows");
            _leftArrowsOver        = _content.Load <Texture2D>("shared_ui/left_arrows_over");
            _rightArrows           = _content.Load <Texture2D>("shared_ui/right_arrows");
            _rightArrowsOver       = _content.Load <Texture2D>("shared_ui/right_arrows_over");
            _generalButtons        = new List <TextureButton>();
            _optionsColor          = new Color(0.8f, 0.8f, 0.8f);
            _availableResolutions  = new List <Resolution>();

            loadSettings();
            createInterfaceElements();
            createVideoElements();
            createAudioElements();
            createControlsElements();
        }
Example #16
0
        public OptionsMenuScreen(LoderGame game)
            : base(game.screenSystem, ScreenType.OptionsMenu)
        {
            _game = game;
            _content = new ContentManager(game.Services);
            _content.RootDirectory = "Content";
            _categoryTitleFont = _content.Load<SpriteFont>("options_menu/category_title_font");
            _optionsFont = _content.Load<SpriteFont>("options_menu/options_font");
            _leftArrows = _content.Load<Texture2D>("shared_ui/left_arrows");
            _leftArrowsOver = _content.Load<Texture2D>("shared_ui/left_arrows_over");
            _rightArrows = _content.Load<Texture2D>("shared_ui/right_arrows");
            _rightArrowsOver = _content.Load<Texture2D>("shared_ui/right_arrows_over");
            _generalButtons = new List<TextureButton>();
            _optionsColor = new Color(0.8f, 0.8f, 0.8f);
            _availableResolutions = new List<Resolution>();

            loadSettings();
            createInterfaceElements();
            createVideoElements();
            createAudioElements();
            createControlsElements();
        }
Example #17
0
        // Initialize
        public static void initialize(LoderGame game, SystemManager systemManager, EntityManager entityManager)
        {
            _game          = game;
            _systemManager = systemManager;
            _entityManager = entityManager;

            if (!Directory.Exists(_rootDirectory))
            {
                Directory.CreateDirectory(_rootDirectory);
            }
            if (!Directory.Exists(_settingsDirectory))
            {
                Directory.CreateDirectory(_settingsDirectory);
            }
            if (!Directory.Exists(_playersDirectory))
            {
                Directory.CreateDirectory(_playersDirectory);
            }

            _customFlags   = new Dictionary <string, bool>();
            _customValues  = new Dictionary <string, int>();
            _customStrings = new Dictionary <string, string>();
        }
Example #18
0
 public LevelSystem(LoderGame game, SystemManager systemManager, EntityManager entityManager)
 {
     _game          = game;
     _systemManager = systemManager;
     _entityManager = entityManager;
     _scriptManager = _game.scriptManager;
     //_regionGoals = new Dictionary<int, Goal>();
     //_eventGoals = new Dictionary<GameEventType, Dictionary<int, Goal>>();
     //_completedGoals = new Dictionary<int, Goal>();
     _levelBoundaries         = new Dictionary <string, AABB>();
     _fallbackLevelBoundaries = new Dictionary <string, AABB>();
     _boundaryMargin          = new Vector2(50f, 50f);
     _levelsData           = new Dictionary <string, XElement>();
     _firstPassEntities    = new Dictionary <string, List <XElement> >();
     _secondPassEntities   = new Dictionary <string, List <XElement> >();
     _thirdPassEntities    = new Dictionary <string, List <XElement> >();
     _numEntities          = new Dictionary <string, int>();
     _numEntitiesProcessed = new Dictionary <string, int>();
     _backgrounds          = new Dictionary <string, Background>();
     _finishedLoading      = new Dictionary <string, bool>();
     _spawnPositions       = new Dictionary <string, Vector2>();
     _loadedLevels         = new List <string>();
 }
Example #19
0
 public LevelSystem(LoderGame game, SystemManager systemManager, EntityManager entityManager)
 {
     _game = game;
     _systemManager = systemManager;
     _entityManager = entityManager;
     _scriptManager = _game.scriptManager;
     //_regionGoals = new Dictionary<int, Goal>();
     //_eventGoals = new Dictionary<GameEventType, Dictionary<int, Goal>>();
     //_completedGoals = new Dictionary<int, Goal>();
     _levelBoundaries = new Dictionary<string, AABB>();
     _fallbackLevelBoundaries = new Dictionary<string, AABB>();
     _boundaryMargin = new Vector2(50f, 50f);
     _levelsData = new Dictionary<string, XElement>();
     _firstPassEntities = new Dictionary<string, List<XElement>>();
     _secondPassEntities = new Dictionary<string, List<XElement>>();
     _thirdPassEntities = new Dictionary<string, List<XElement>>();
     _numEntities = new Dictionary<string, int>();
     _numEntitiesProcessed = new Dictionary<string, int>();
     _backgrounds = new Dictionary<string, Background>();
     _finishedLoading = new Dictionary<string, bool>();
     _spawnPositions = new Dictionary<string, Vector2>();
     _loadedLevels = new List<string>();
 }
Example #20
0
        // Initialize
        public static void initialize(LoderGame game, SystemManager systemManager, EntityManager entityManager)
        {
            _game = game;
            _systemManager = systemManager;
            _entityManager = entityManager;

            if (!Directory.Exists(_rootDirectory))
                Directory.CreateDirectory(_rootDirectory);
            if (!Directory.Exists(_settingsDirectory))
                Directory.CreateDirectory(_settingsDirectory);
            if (!Directory.Exists(_playersDirectory))
                Directory.CreateDirectory(_playersDirectory);

            _customFlags = new Dictionary<string, bool>();
            _customValues = new Dictionary<string, int>();
            _customStrings = new Dictionary<string, string>();
        }
Example #21
0
        public MainMenuScreen(LoderGame game) : base(game.screenSystem, ScreenType.MainMenu)
        {
            _game    = game;
            _content = new ContentManager(game.Services);
            _content.RootDirectory = "Content";
            _buttonsBackground     = _content.Load <Texture2D>("main_menu/buttons_background");
            _buttons = new List <TextureButton>();

            Func <int> yOffset     = () => { return(182 + 81 * _buttons.Count); };
            Rectangle  localHitBox = new Rectangle(20, 0, 198, 68);

            _buttons.Add(new TextureButton(
                             this,
                             _spriteBatch,
                             UIAlignment.TopLeft,
                             20,
                             yOffset(),
                             _content.Load <Texture2D>("main_menu/new_game_over"),
                             _content.Load <Texture2D>("main_menu/new_game"),
                             localHitBox,
                             () =>
            {
                Logger.log("New game button clicked.");
                _game.closeMainMenu();
                _game.openPlayerCreationScreen();
            }));

            _buttons.Add(new TextureButton(
                             this,
                             _spriteBatch,
                             UIAlignment.TopLeft,
                             20,
                             yOffset(),
                             _content.Load <Texture2D>("main_menu/load_game_over"),
                             _content.Load <Texture2D>("main_menu/load_game"),
                             localHitBox,
                             () =>
            {
                Logger.log("Load game button clicked.");
                _game.closeMainMenu();
                _game.openLoadGameMenu();
            }));

            _buttons.Add(new TextureButton(
                             this,
                             _spriteBatch,
                             UIAlignment.TopLeft,
                             20,
                             yOffset(),
                             _content.Load <Texture2D>("main_menu/options_over"),
                             _content.Load <Texture2D>("main_menu/options"),
                             localHitBox,
                             () =>
            {
                Logger.log("Options button clicked.");
                _game.closeMainMenu();
                _game.openOptionsMenu();
            }));

            _buttons.Add(new TextureButton(
                             this,
                             _spriteBatch,
                             UIAlignment.TopLeft,
                             20,
                             yOffset(),
                             _content.Load <Texture2D>("main_menu/quit_game_over"),
                             _content.Load <Texture2D>("main_menu/quit_game"),
                             localHitBox,
                             () => { _game.Exit(); }));
        }
Example #22
0
        public MainMenuScreen(LoderGame game)
            : base(game.screenSystem, ScreenType.MainMenu)
        {
            _game = game;
            _content = new ContentManager(game.Services);
            _content.RootDirectory = "Content";
            _buttonsBackground = _content.Load<Texture2D>("main_menu/buttons_background");
            _buttons = new List<TextureButton>();

            Func<int> yOffset = () => { return 182 + 81 * _buttons.Count; };
            Rectangle localHitBox = new Rectangle(20, 0, 198, 68);
            _buttons.Add(new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.TopLeft,
                20,
                yOffset(),
                _content.Load<Texture2D>("main_menu/new_game_over"),
                _content.Load<Texture2D>("main_menu/new_game"),
                localHitBox,
                () =>
                {
                    Logger.log("New game button clicked.");
                    _game.closeMainMenu();
                    _game.openPlayerCreationScreen();
                }));

            _buttons.Add(new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.TopLeft,
                20,
                yOffset(),
                _content.Load<Texture2D>("main_menu/load_game_over"),
                _content.Load<Texture2D>("main_menu/load_game"),
                localHitBox,
                () =>
                {
                    Logger.log("Load game button clicked.");
                    _game.closeMainMenu();
                    _game.openLoadGameMenu();
                }));

            _buttons.Add(new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.TopLeft,
                20,
                yOffset(),
                _content.Load<Texture2D>("main_menu/options_over"),
                _content.Load<Texture2D>("main_menu/options"),
                localHitBox,
                () =>
                {
                    Logger.log("Options button clicked.");
                    _game.closeMainMenu();
                    _game.openOptionsMenu();
                }));

            _buttons.Add(new TextureButton(
                this,
                _spriteBatch,
                UIAlignment.TopLeft,
                20,
                yOffset(),
                _content.Load<Texture2D>("main_menu/quit_game_over"),
                _content.Load<Texture2D>("main_menu/quit_game"),
                localHitBox,
                () => { _game.Exit(); }));
        }