コード例 #1
0
        private void buttonClient_Click(object sender, EventArgs e)
        {
            SocketConnect.HostClientStart(8181, 8080, false);

            Initialise.SetVisibilityEnable(ref buttonHost, false);
            Initialise.SetVisibilityEnable(ref buttonClient, false);

            startButton.Text = "Start gdy gracze gotowi";
            Initialise.SetVisibilityEnable(ref startButton, true);
        }
コード例 #2
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (onlinehost == true || online == false)
            {
                //Czołg 1
                if (e.KeyCode == Keys.Up)
                {
                    tank1.keyTank[KUp] = true;
                }
                if (e.KeyCode == Keys.Right)
                {
                    tank1.keyTank[KRight] = true;
                }
                if (e.KeyCode == Keys.Down)
                {
                    tank1.keyTank[KDown] = true;
                }
                if (e.KeyCode == Keys.Left)
                {
                    tank1.keyTank[KLeft] = true;
                }
            }
            //Czołg 2
            if (onlinehost == false || online == false)
            {
                if (e.KeyCode == Keys.W)
                {
                    tank2.keyTank[KUp] = true;
                }
                if (e.KeyCode == Keys.D)
                {
                    tank2.keyTank[KRight] = true;
                }
                if (e.KeyCode == Keys.S)
                {
                    tank2.keyTank[KDown] = true;
                }
                if (e.KeyCode == Keys.A)
                {
                    tank2.keyTank[KLeft] = true;
                }
            }

            if (e.KeyCode == Keys.Escape)
            {
                disconect = true;
                if (online)
                {
                    SocketConnect.SendTimer();
                    online = false;
                }
                Application.Restart();
            }
        }
コード例 #3
0
 private void timerSend_Tick(object sender, EventArgs e)
 {
     if (timersOff == true)
     {
         timersOff           = false;
         timerHost.Enabled   = false;
         timerSend.Enabled   = false;
         tank1timer.Enabled  = false;
         tank2timer.Enabled  = false;
         bulletTimer.Enabled = false;
     }
     SocketConnect.SendTimer();
 }