Exemplo n.º 1
0
        public VentanaJuego(string nombre, TcpClient tc, bool teclado)
        {
            InitializeComponent();
            entrada = new MetodoEntrada();
            c       = new Cliente(this, tc, nombre);
            gif     = new GifImage(Properties.Resources.lP, panel1);
            c.setPanel(panel1);
            if (teclado)
            {
                KeyDown += VentanaJuego_KeyDown;
            }
            else
            {
                SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
                sre.SetInputToDefaultAudioDevice();
                Choices direcciones = new Choices();
                direcciones.Add(new string[] { "arriba", "abajo", "izquierda", "derecha" });

                GrammarBuilder gb = new GrammarBuilder();
                gb.Culture = sre.RecognizerInfo.Culture;
                gb.Append(direcciones);

                Grammar g = new Grammar(gb);
                sre.RequestRecognizerUpdate();
                sre.LoadGrammar(g);

                sre.RecognizeAsync(RecognizeMode.Multiple);

                sre.RequestRecognizerUpdate();

                sre.SpeechRecognized += new EventHandler <SpeechRecognizedEventArgs>(hablaReconocida);
            }
        }
Exemplo n.º 2
0
        public void enviarEntrada(MetodoEntrada me)
        {
            // Send the message to the connected TcpServer.
            // The write flushes the stream automatically here

            Mensaje m = Serializador.Serialize(me);

            //Escribir primero la longitud del mensaje
            byte[] userDataLen = BitConverter.GetBytes(m.Data.Length);
            stream.Write(userDataLen, 0, 4);

            //escribir el mensaje
            stream.Write(m.Data, 0, m.Data.Length);

            me.liberar();
            Console.WriteLine("Se envio algo");
        }
Exemplo n.º 3
0
 public void enviarInstruccion(MetodoEntrada e)
 {
     ac.enviarEntrada(e);
     e.liberar();
 }