示例#1
0
        public override void Initialize()
        {
            btnClose = new TSButton("Đóng");
            btnClose.Width = 100;
            btnClose.Height = 30;
            btnClose.MarginRight = 1;
            btnClose.MarginTop = 1;
            btnClose.MouseClick += btnClose_Click;
            this.Add(btnClose);

            map = new TSMap(this.Width, this.Height);

            blue = new BlueWarrior();
            blue.Initialize();
        }
示例#2
0
        public override void Initialize()
        {
            // pauseGameLayout
            _pauseGameLayout = new TSLayout();
            _pauseGameLayout.Width = 200;
            _pauseGameLayout.Height = 150;
            _pauseGameLayout.ParentControlManager = this.ControlManager;
            _pauseGameLayout.MarginLeft = TSMarginType.CENTER;
            _pauseGameLayout.MarginTop = TSMarginType.CENTER;
            _pauseGameLayout.Visibled = false;
            _pauseGameLayout.Enabled = false;

            _btnContinueGame = new TSButton("Tiếp tục");
            _btnContinueGame.Width = 150;
            _btnContinueGame.Height = 50;
            _btnContinueGame.MarginTop = 10;
            _btnContinueGame.MarginLeft = TSMarginType.CENTER;
            _btnContinueGame.MouseClick += btnContinueGame_MouseClick;
            _pauseGameLayout.Add(_btnContinueGame);

            _btnSaveAndExitGame = new TSButton("Lưu và thoát game");
            _btnSaveAndExitGame.Width = 150;
            _btnSaveAndExitGame.Height = 50;
            _btnSaveAndExitGame.MarginTop = 70;
            _btnSaveAndExitGame.MarginLeft = TSMarginType.CENTER;
            _btnSaveAndExitGame.MouseClick += btnSaveAndExitGame_MouseClick;
            _pauseGameLayout.Add(_btnSaveAndExitGame);

            // gameEntities
            _gameEntities = new List<TSGameEntity>();
            Random random = new Random();
            int numEntities = 500;//random.Next(900, 2000);

            for (int idx = 0; idx < numEntities; idx++)
                _gameEntities.Add(new Tree());

            // map
            _map = new TSMap(Width, Height);

            // mainWarrior
            mainWarrior = new SilverWarrior();
            mainWarrior.Map = _map;

            base.Initialize();
        }