コード例 #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
    public override void init() {
		sellScreen = transform.Find("SellScreen").GetComponent<SellScreen>();
		weaponBtn = transform.Find("WeaponBtn").GetComponent<Button>();
		armorBtn = transform.Find("ArmorBtn").GetComponent<Button>();
		sellBtn = transform.Find("SellBtn").GetComponent<Button>();
        shops.Add(transform.Find("WeaponShop").GetComponent<Shop>());
        shops.Add(transform.Find("ArmorShop").GetComponent<Shop>());
        base.init();
		sellScreen.init(this);
    }
コード例 #3
0
ファイル: Game1.cs プロジェクト: samsath/G64SWE_SpaceTrade
 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);
 }
コード例 #4
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();
        }