コード例 #1
0
ファイル: Form1.cs プロジェクト: pauladrianfrench/RipOff
        private void Form1_KeyUp(object sender, KeyEventArgs e)
        {
            ActionParams ap = new ActionParams();

            ap.A = e.KeyData == Keys.A;
            ap.D = e.KeyData == Keys.D;
            ap.L = e.KeyData == Keys.L;
            ap.J = e.KeyData == Keys.J;
            ap.N = e.KeyData == Keys.N;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: pauladrianfrench/RipOff
        private void Form1_KeyPress(object sender, KeyPressEventArgs e)
        {
            ActionParams ap = new ActionParams();

            ap.A = e.KeyChar == 'a';
            ap.D = e.KeyChar == 'd';
            ap.J = e.KeyChar == 'j';
            ap.L = e.KeyChar == 'l';
            ap.N = e.KeyChar == 'n';

            string key = e.KeyChar.ToString();
            GameClient.Client(key);
        }
コード例 #3
0
ファイル: GameServer.cs プロジェクト: pauladrianfrench/RipOff
        public static void Server()
        {
            TcpListener listener = new TcpListener(IPAddress.Any, 51111);
            listener.Start();

            using (TcpClient c = listener.AcceptTcpClient())
            using (NetworkStream n = c.GetStream())
            {
                string msg = new BinaryReader(n).ReadString();

                if (msg == "a" || msg == "A")
                {
                    ActionParams ap = new ActionParams();

                    ap.A = true;
                    ap.D = false;
                    ap.J = false;
                    ap.L = false;
                    ap.N = false;

                    GameController.KeyDown(ap);
                }
                else if (msg == "d" || msg == "D")
                {
                    ActionParams ap = new ActionParams();

                    ap.A = false;
                    ap.D = true;
                    ap.J = false;
                    ap.L = false;
                    ap.N = false;

                    GameController.KeyDown(ap);
                }
            }
            listener.Stop();
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: pauladrianfrench/RipOff
        private void Form1_KeyPress(object sender, KeyPressEventArgs e)
        {
            ActionParams ap = new ActionParams();

            ap.A = e.KeyChar == 'a';
            ap.D = e.KeyChar == 'd';
            ap.J = e.KeyChar == 'j';
            ap.L = e.KeyChar == 'l';
            ap.N = e.KeyChar == 'n';

            gameArea.KeyDown(ap);
        }
コード例 #5
0
 public void KeyUp(ActionParams actions)
 {
     int count = gameObjects.Count;
     for (int i = 0; i < count; ++i)
     {
         if (gameObjects[i] is PlayerVehicle)
         {
             (gameObjects[i] as PlayerVehicle).KeyUp(actions);
         }
     }
 }
コード例 #6
0
        public void KeyUp(ActionParams actions)
        {
            if (actions.A)
            {
                left = false;
            }
            if (actions.D)
            {
                right = false;
            }
            if (actions.L)
            {
                driveForward = false;
            }

            if (actions.J)
            {
                driveBackward = false;
            }

            if (actions.N)
            {
                shoot = false;
            }
        }
コード例 #7
0
        public void KeyDown(ActionParams actions)
        {
            if (actions.A)
            {
                left = true;
            }
            if (actions.D)
            {
                right = true;
            }
            if (actions.L)
            {
                driveForward = true;
            }

            if (actions.J)
            {
                driveBackward = true;
            }

            if (actions.N)
            {
                shoot = true;
            }
        }