Example #1
0
    void ProcesarDatos(byte[] recBuffer)
    {
        Stream          stream    = new MemoryStream(recBuffer);
        BinaryFormatter formatter = new BinaryFormatter();
        string          message   = formatter.Deserialize(stream) as string;

        Debug.Log("mensaje recibido: " + message);
        switch (prefs.esperado)
        {
        case Constantes.NINGUNO:
            Debug.Log("ignorado");
            break;

        case Constantes.SELECCION_JUGADOR:
            SeleccionPersonaje sel = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <SeleccionPersonaje>();
            sel.RegistrarSeleccionPersonaje(int.Parse(message));
            break;

        case Constantes.ID_COMPONENTE:
            break;

        case Constantes.ID_BOTON_COMPONENTE_ELEGIDO:
            if (int.Parse(message) > 0)
            {
                GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Partida> ().RecibirSeleccionRed(int.Parse(message));
            }
            else
            {
                //es senal de termino de insulto
                GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Partida> ().BotonTerminarRed();
            }
            break;
        }
    }