コード例 #1
0
ファイル: FrmOption.cs プロジェクト: Nhom-2/ProjectSnake
        public FrmOption()
        {
            InitializeComponent();

            this.BGcolor_Option     = 14;
            this.snakeColor1_Option = 3;
            this.snakeColor2_Option = 0;
            this.foodColor_Option   = 5;

            this.BackgroundImage       = new Bitmap(Application.StartupPath + ClsParameter.LinkBackground + ClsParameter.Extension);
            this.BackgroundImageLayout = ImageLayout.Stretch;
            this.pictureBoxMapColor.BackgroundImageLayout     = ImageLayout.Stretch;
            this.pictureBoxPlayerColor1.BackgroundImageLayout = ImageLayout.Stretch;
            this.pictureBoxPlayerColor2.BackgroundImageLayout = ImageLayout.Stretch;
            this.pictureBoxFoodColor.BackgroundImageLayout    = ImageLayout.Stretch;

            this.isSingle  = true;
            this.mapSize   = ClsParameter.MapSize.Medium;
            this.hasBorder = false;
            this.BGcolor   = ClsParameter.SFColor.getColor(14);

            this.snakeLengh  = ClsParameter.SnakeLenghDefault;
            this.snakeSize   = ClsParameter.SnakeSize.Medium;
            this.snakeColor1 = ClsParameter.SFColor.getColor(3);
            this.snakeColor2 = ClsParameter.SFColor.getColor(4);
            this.foodColor   = ClsParameter.SFColor.getColor(3);

            this.playerKey1 = ClsParameter.PlayerKey1;
            this.playerKey2 = ClsParameter.PlayerKey2;

            this.isSpeedup = false;

            this.display();
        }
コード例 #2
0
        public FrmMode2(ClsMapWidthHeight winsize,
                        bool hasborder,
                        string color,
                        int lengh,
                        int snakesize,
                        string snakecolor1,
                        string snakecolor2,
                        string foodcolor,
                        bool isspeedup,
                        ClsKeyCode playerkey1,
                        ClsKeyCode playerkey2)
        {
            InitializeComponent();
            this.MapSizeWidth  = winsize.Width;
            this.MapSizeHeight = winsize.Height;
            this.hasBorder     = hasborder;

            this.BackgroundImage                 = new Bitmap(Application.StartupPath + ClsParameter.LinkBackground + ClsParameter.Extension);
            this.BackgroundImageLayout           = ImageLayout.Stretch;
            this.ptbGame.BackgroundImage         = new Bitmap(Application.StartupPath + ClsParameter.LinkBGGame + color + ClsParameter.Extension);
            this.ptbGame.BackgroundImageLayout   = ImageLayout.Stretch;
            this.ptbBorder.BackgroundImage       = new Bitmap(Application.StartupPath + ClsParameter.LinkBDGame + ClsParameter.Extension);
            this.ptbBorder.BackgroundImageLayout = ImageLayout.Stretch;
            this.ptbBorder.Visible               = (this.hasBorder);

            this.snake1 = new ClsSnake(lengh, snakesize, snakecolor1, 1, this.MapSizeWidth, this.MapSizeHeight);
            this.snake2 = new ClsSnake(lengh, snakesize, snakecolor2, 3, this.MapSizeWidth, this.MapSizeHeight);
            this.food   = new ClsFood(foodcolor);

            this.isSpeedup = isspeedup;
            this.key1      = playerkey1;
            this.key2      = playerkey2;

            this.increaceFree1 = false;
            this.increaceFree2 = false;

            this.process = new ClsProcessLogic();
            this.press   = new ClsEventKey();

            this.playerName1 = "";
            this.playerName2 = "";
            this.score1      = 0;
            this.score2      = 0;

            this.setWindow();

            this.timerDelay1.Interval = ClsParameter.DelayDefault;
            this.timerDelay1.Start();
            this.timerDelay2.Interval = ClsParameter.DelayDefault;
            this.timerDelay2.Start();

            this.food.generateFood(snake1, snake2, MapSizeWidth, MapSizeHeight);
        }
コード例 #3
0
ファイル: FrmOption.cs プロジェクト: Nhom-2/ProjectSnake
        private void saveOption()
        {
            this.isSingle = this.rdbtSnakeStylePlayer1.Checked;
            this.mapSize  = (this.rdbtMapSizeSmall.Checked) ? ClsParameter.MapSize.Small :
                            ((this.rdbtMapSizeMedium.Checked) ? ClsParameter.MapSize.Medium : ClsParameter.MapSize.Large);
            this.hasBorder = this.checkBoxMapOptionBorder.Checked;
            this.BGcolor   = ClsParameter.BGColor.getColor(this.BGcolor_Option);

            this.snakeSize   = (this.rdbtSnakeSizeSmall.Checked) ? ClsParameter.SnakeSize.Small : ClsParameter.SnakeSize.Medium;
            this.snakeColor1 = ClsParameter.SFColor.getColor(this.snakeColor1_Option);
            this.snakeColor2 = ClsParameter.SFColor.getColor(this.snakeColor2_Option);
            this.foodColor   = ClsParameter.SFColor.getColor(this.foodColor_Option);

            this.isSpeedup = this.checkBoxMapOptionSpeedup.Checked;
        }
コード例 #4
0
ファイル: ClsParameter.cs プロジェクト: Nhom-2/ProjectSnake
 public ClsMapSize()
 {
     this.Small  = new ClsMapWidthHeight(400, 300);
     this.Medium = new ClsMapWidthHeight(800, 600);
     this.Large  = new ClsMapWidthHeight(1200, 600);
 }