示例#1
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;

            ScreenRectangle = new Rectangle(
                0,
                0,
                screenWidth,
                screenHeight);

            Content.RootDirectory = "Content";

            Components.Add(new InputHandler(this));

            stateManager = new GameStateManager(this);
            Components.Add(stateManager);

            TitleScreen              = new TitleScreen(this, stateManager);
            StartMenuScreen          = new StartMenuScreen(this, stateManager);
            GamePlayScreen           = new GamePlayScreen(this, stateManager);
            AdminScreen              = new AdminScreen(this, stateManager);
            CharacterGeneratorScreen = new CharacterGeneratorScreen(this, stateManager);
            EndGameScreen            = new EndGameScreen(this, stateManager);
            BuyScreen       = new BuyScreen(this, stateManager);
            SellScreen      = new SellScreen(this, stateManager);
            SaveScreen      = new SaveScreen(this, stateManager);
            highscoreScreen = new HighscoreScreen(this, stateManager);
            upgradeScreen   = new UpgradeScreen(this, stateManager);


            stateManager.ChangeState(TitleScreen, null);
        }
示例#2
0
 protected override void Update(GameTime gameTime)
 {
     if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
     {
         this.Exit();
     }
     BuyScreen  = new BuyScreen(this, stateManager);
     SellScreen = new SellScreen(this, stateManager);
     base.Update(gameTime);
 }
示例#3
0
        public static void Main()
        {
            //Console.WriteLine("Good luck, you will need it.");
            string fontFileName = "terminal8x8.png";
            int    seed         = (int)DateTime.UtcNow.Ticks;
            string consoleTitle = $"RoguelikeGame - Level {MapLevel}";

            Random           = new DotNetRandom(seed);
            MessageLog       = new MessageLog();
            SchedulingSystem = new SchedulingSystem();
            MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7, MapLevel);

            DungeonMap = mapGenerator.CreateForrest();
            DungeonMaps.Add(DungeonMap);

            _rootConsole      = new RLRootConsole(fontFileName, _screenWidth, _screenHeight, 8, 8, 1f, consoleTitle);
            _mapConsole       = new RLConsole(_mapWidth, _mapHeight);
            _messageConsole   = new RLConsole(_messageWidth, _messageHeight);
            _statConsole      = new RLConsole(_statWidth, _statHeight);
            _inventoryConsole = new RLConsole(_inventoryWidth, _inventoryHeight);

            CommandSystem       = new CommandSystem();
            TargetingSystem     = new TargetingSystem();
            InputSystem         = new InputSystemPlaying();
            InventoryScreen     = new InventoryScreen(_popupWidth, _popupHeight);
            DialogScreen        = new DialogScreen(_popupWidth, _dialogHeight);
            ShopSelectionScreen = new ShopSelectionScreen(_popupWidth, _dialogHeight);
            BuyScreen           = new BuyScreen(_popupWidth, _popupHeight);
            SellScreen          = new SellScreen(_popupWidth, _popupHeight);

            if (Player.GreetMessages != null)
            {
                Random random = new Random();
                int    i      = random.Next(0, Player.GreetMessages.Length);
                MessageLog.Add($"{Player.GreetMessages[i]}", Colors.Gold);
            }
            else
            {
                MessageLog.Add("Good luck on your quest ", Colors.Gold);
            }
            // MessageLog.Add($"Level created with seed '{seed}'"); // debug

            _rootConsole.Update += OnIntroUpdate;
            _rootConsole.Render += OnIntroRender;

            Timer t = new Timer(UpdateColoredText, null, 0, 200);

            _rootConsole.Run();
        }
示例#4
0
        public void showScreen(BuyScreens screen)
        {
            VirtualFilesystemResourceProvider resourceProvider = new VirtualFilesystemResourceProvider("BuyScreens");

            String file = String.Format("{0}/Index.rml", screen);

            if (resourceProvider.exists(file))
            {
                BuyScreen buyScreen = new BuyScreen(resourceProvider, controller.GUIManager);
                buyScreen.setFile(file);
                buyScreen.Hidden += (sender, e) =>
                {
                    openScreens.Remove(buyScreen);
                    buyScreen.Dispose();
                };
                buyScreen.show(0, 0);
                openScreens.Add(buyScreen);
            }
            else
            {
                MessageBox.show(String.Format("Cannot find buy screen '{0}'", file), "Missing Buy Screen File", MessageBoxStyle.IconError | MessageBoxStyle.Ok);
            }
        }