Exemplo n.º 1
0
        private void KeyDown_Listner(object sender, KeyEventArgs e)
        {
            if (onlinehost == true || online == false)
            {
                tank1.SetDirection(e, true);
            }

            if (onlinehost == false || online == false)
            {
                tank2.SetDirection(e, true);
            }

            if (e.KeyCode == Keys.Escape)
            {
                Timers_off();
                gameTimer.Enabled = false;
                disconect         = true;
                if (online)
                {
                    SocketConnect.SendTimer();
                    online = false;
                }
                Application.Restart();
            }
        }
Exemplo n.º 2
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 when both players ready";
            Initialise.SetVisibilityEnable(ref startButton, true);
        }
Exemplo n.º 3
0
 private void timerHost_Tick(object sender, EventArgs e)
 {
     if (timersOff == true)
     {
         timersOff         = false;
         timerHost.Enabled = false;
         timerSend.Enabled = false;
         gameTimer.Enabled = false;
     }
     SocketConnect.HostTimer();
 }
Exemplo n.º 4
0
 private void timerSend_Tick(object sender, EventArgs e)
 {
     if (timersOff == true)
     {
         timersOff         = false;
         timerHost.Enabled = false;
         timerSend.Enabled = false;
         gameTimer.Enabled = false;
     }
     if (onlinehost && listBonus.Count < 1)
     {
         bonusLocation = (byte)Initialise.random.Next(0, listSwamp.Count - 1); // Przyszła lokacja bonusu
     }
     SocketConnect.SendTimer();
 }