// Hilo que mantiene el servicio Bluetooth
 public void runBluetooth()
 {
     do
     {
         try
         {
             BluetoothClient client     = btListener.AcceptBluetoothClient(); // Acepta conexión con un cliente
             StreamReader    sr         = new StreamReader(client.GetStream(), Encoding.UTF8);
             string          clientData = "";
             while (true)
             {
                 string line = sr.ReadLine();
                 clientData += line;
                 if (line.Equals("</ClientOrder>"))
                 {
                     break;                                  // Recibe XML con los datos del pedido del cliente
                 }
             }
             manager = JourneyManager.Instance;
             string       reply = manager.OrdersManager.manageNFCOrder(clientData.Substring(2));
             StreamWriter sw    = new StreamWriter(client.GetStream(), Encoding.ASCII);
             sw.Write(Convert.ToString(reply));  // Envío de la respuesta calculada
             sw.Flush();
             sw.Close();
             sr.Close();
             client.Close(); // Da por finalizada la comunicación con el cliente
         }
         catch (Exception e) { }
     } while (!exit);
 }
 // Hilo que mantiene el servicio Bluetooth
 public void runBluetooth()
 {
     do
     {
         try
         {
             BluetoothClient client     = btListener.AcceptBluetoothClient(); // Acepta conexión con un cliente
             StreamReader    sr         = new StreamReader(client.GetStream(), Encoding.UTF8);
             string          clientData = "";
             while (true)
             {
                 string aux = sr.ReadLine();
                 clientData += aux;
                 if (aux.Equals("</Profile>"))
                 {
                     break;                              // Recibe XML con los datos del perfil del cliente
                 }
             }
             manager = JourneyManager.Instance;
             string       recommendation = manager.ClientManager.manageNFCClient(clientData.Substring(2));
             StreamWriter sw             = new StreamWriter(client.GetStream(), Encoding.ASCII);
             sw.Write(Convert.ToString(recommendation)); // Se le envía recomendación personalizada
             sw.Flush();
             sw.Close();
             sr.Close();
             client.Close(); // Da por finalizada la comunicación con el cliente
         }
         catch (Exception e) { }
     } while (!exit);
 }
Exemple #3
0
 void CheckEnemyHealth()
 {
     if (currentEnemy.getHealth() == 0)
     {
         AudioManager.Get().PlaySound(AudioManager.SoundClipName.Death);
         updateItem();
         JourneyManager.Get().NextBattle();
     }
 }
Exemple #4
0
    public static JourneyManager Get()
    {
        JourneyManager jm = null;

        if (GameObject.FindWithTag("Managers") != null)
        {
            jm = GameObject.FindWithTag("Managers").GetComponent <JourneyManager>();
        }

        return(jm);
    }