Ejemplo n.º 1
0
        public void ResetControl()
        {
            layout = new TSLayout();
            control = new TSControlConcreteClass();
            layout.ControlManager.Add(control);

            layout.Width = 800;
            layout.Height = 600;
            layout.Position = new Vector2(0, 0);

            control.MarginBottom = TSMarginType.NONE;
            control.MarginLeft = TSMarginType.NONE;
            control.MarginRight = TSMarginType.NONE;
            control.MarginTop = TSMarginType.NONE;

            control.Width = 100;
            control.Height = 20;

            control.Position = new Vector2(0, 0);
        }
Ejemplo n.º 2
0
        public void TestPositionOnScreenWhenAddToLayout()
        {
            TSLayout layout = new TSLayout();
            layout.Position = new Vector2(1, 2);

            TSControlConcreteClass c = new TSControlConcreteClass();
            layout.ControlManager.Add(c);

            Assert.AreEqual(c.PositionOnScreenX, 1);
            Assert.AreEqual(c.PositionOnScreenY, 2);
        }
Ejemplo n.º 3
0
        public override void Initialize()
        {
            lblMessage = new TSLabel();
            lblMessage.Width = 300;
            lblMessage.Height = 60;
            lblMessage.MarginLeft = 50;
            lblMessage.MarginTop = 80;
            lblMessage.TextColor = Color.White;
            this.Add(lblMessage);

            menuLayout = new TSLayout();
            menuLayout.MarginLeft = TSMarginType.CENTER; //-200;
            menuLayout.MarginBottom = TSMarginType.CENTER; //= 0;
            menuLayout.Width = 180;
            menuLayout.Height = 230;
            this.Add(menuLayout);

            btnStartGame = new TSButton("Bắt đầu");
            btnStartGame.Width = 180;
            btnStartGame.Height = 40;
            btnStartGame.MarginLeft = 0;
            btnStartGame.MarginTop = 0;
            btnStartGame.MouseClick += btnStartGame_Click;
            menuLayout.Add(btnStartGame);

            btnIntroduction = new TSButton("Giới thiệu");
            btnIntroduction.Width = 180;
            btnIntroduction.Height = 40;
            btnIntroduction.MarginLeft = 0;
            btnIntroduction.MarginTop = 45;
            btnIntroduction.MouseClick += btnIntroduction_Click;
            menuLayout.Add(btnIntroduction);

            btnSettings = new TSButton("Cài đặt");
            btnSettings.Width = 180;
            btnSettings.Height = 40;
            btnSettings.MarginLeft = 0;
            btnSettings.MarginTop = 90;
            btnSettings.MouseClick += btnSettings_Click;
            menuLayout.Add(btnSettings);

            btnAbout = new TSButton("Về trò chơi");
            btnAbout.Width = 180;
            btnAbout.Height = 40;
            btnAbout.MarginLeft = 0;
            btnAbout.MarginTop = 135;
            btnAbout.MouseClick += btnAbout_Click;
            menuLayout.Add(btnAbout);

            btnExitGame = new TSButton("Thoát");
            btnExitGame.Width = 180;
            btnExitGame.Height = 40;
            btnExitGame.MarginLeft = 0;
            btnExitGame.MarginTop = 180;
            btnExitGame.MouseClick += btnExitGame_Click;
            menuLayout.Add(btnExitGame);
        }
Ejemplo n.º 4
0
 // Layout
 public void ToStandardLayout(TSLayout layout)
 {
     if (layout != null)
     {
         layout.BackgroundImage = LayoutBackgroundImage;
     }
 }
Ejemplo n.º 5
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();
        }