Exemple #1
0
        public GameMenu(STGMain game)
        {
            this.stgGame        = game;
            game.IsMouseVisible = true;

            var startButton = new Button(font, "New Game", new Vector2(300, 240));

            startButton.Click += NewGameClick;

            var upgradeButton = new Button(font, "Upgrade", new Vector2(300, 300));

            upgradeButton.Click += UpgradeClick;

            var quitButton = new Button(font, "Quit", new Vector2(300, 360));

            quitButton.Click += QuitGameClick;

            Button = new List <Button>
            {
                startButton,
                upgradeButton,
                quitButton
            };
            quitButton.ChangeColor(Color.Red, null);
        }
Exemple #2
0
    /// <summary>
    /// 初始化STGMain
    /// </summary>
    private void OnStateInitSTGMainUpdate()
    {
        _stgMain = new STGMain();
        _stgMain.Init();
        // 加载各个stage.lua文件
        //List<string> stageLuaList = new List<string> { "stage1", "stage1sc" };
        List <string> stageLuaList = new List <string> {
            "TestEditorStage"
        };

#if DEBUG_GAMESTATE
        string fileListStr = "";
        for (int k = 0; k < stageLuaList.Count; k++)
        {
            fileListStr = k == 0 ? stageLuaList[k] + ".lua" : "\n" + stageLuaList[k] + ".lua";
        }
        Logger.Log(string.Format("Init STGMain,Start to load lua files\n{0}", fileListStr));
        TimeUtil.BeginSample("InitSTGMain");
#endif
        for (int i = 0; i < stageLuaList.Count; i++)
        {
            InterpreterManager.GetInstance().LoadLuaFile(stageLuaList[i]);
        }
#if DEBUG_GAMESTATE
        TimeUtil.EndSample("InitSTGMain");
        TimeUtil.LogSampleTick("InitSTGMain", "Load luafile(s) complete.Cost time {0}");
#endif
        _curState = eSTGMainState.StateInitSTGData;
    }
Exemple #3
0
        //private float upper = 2400;
        //private Rectangle resRect => new Rectangle((int)stgGame.Camera.LeftBound, (int)upper, 400, 600);
        //public int Coin {get; private set;}
        //public int Score {get; private set;}
        public GameOnGoing(STGMain game)
        {
            Score   = 0;
            stgGame = game;
            //background = game.Content.Load<Texture2D>("background");

            Reset();
        }
 //public int Coin {get; private set;}
 //public int Score {get; private set;}
 public GameBossEncounter(STGMain game, IEnemy boss, GameOnGoing ongoing)
 {
     stgGame          = game;
     this.boss        = boss; //if boss die, the game goes back to ongoing state. In boss state, no "normal" enemy will be created.
     this.ongoing     = ongoing;
     boss.DeathEvent += EnemyDie;
     game.Objects.AddEnemy(boss);
     //Reset();
 }
Exemple #5
0
 public ObjectsManager(STGMain mainGame)
 {
     EnemyBullets   = new List <IProjectile>();
     MyBullets      = new List <IProjectile>();
     Items          = new List <IItem>();
     Enemies        = new List <IEnemy>();
     NonCollidables = new List <IGameObject>();
     debugbox       = mainGame.Content.Load <Texture2D>("debugBox");
 }
Exemple #6
0
        public GamePause(STGMain game, IGameState ongoing)
        {
            stgGame             = game;
            game.IsMouseVisible = true;

            var resumeBotton = new Button(font, "Resume", new Vector2(Camera.RightBound + 20, 550), Camera);

            resumeBotton.Click += ResumeClick;

            var quitButton = new Button(font, "Quit", new Vector2(Camera.RightBound + 150, 550), Camera);

            quitButton.Click += QuitGameClick;

            Button = new List <Button>
            {
                resumeBotton,
                quitButton
            };
            lastState = ongoing;
        }
Exemple #7
0
        public GameUpgrade(STGMain game)
        {
            this.stgGame        = game;
            game.IsMouseVisible = true;

            var attack = new Button(Font, "Upgrade Attack to " + (Archive.Attack + 1), new Vector2(100, 240));

            attack.Click += AttackClick;

            var health = new Button(Font, "Upgrade Health to " + (Archive.Health + 10), new Vector2(100, 290));

            health.Click += HealthClick;

            var Defense = new Button(Font, "Upgrade Defense to " + (Archive.Defense + 1), new Vector2(100, 340));

            Defense.Click += DefenseClick;

            var FireRate = new Button(Font, "Upgrade FireRate to " + (Archive.FireRate + 1), new Vector2(100, 390));

            FireRate.Click += FireRateClick;

            var Weapon = new Button(Font, "Upgrade Weapon to " + (Archive.Weapon + 1), new Vector2(100, 440));

            Weapon.Click += WeaponClick;

            var back = new Button(Font, "Back to menu", new Vector2(300, 550));

            back.Click += BackClick;

            Button = new List <Button>
            {
                attack,
                health,
                Defense,
                FireRate,
                Weapon,
                back
            };
        }
 public GamepadController(STGMain stgGame, IPlayer player)
 {
     game        = stgGame;
     this.player = player;
 }
 public KeyboardController(STGMain game, params (Keys key, ICommand KeyDownCommand, ICommand KeyUpCommand, bool CanBeHeld)[] args)
Exemple #10
0
 public GameLeaving(STGMain game, IGameState ongoingOrBossState)
 {
     stgGame = game;
     state   = ongoingOrBossState;
     XMLUtils.WriteSav(stgGame.Archive);
 }