Example #1
0
    public IEnumerator GetUTCTime()
    {
        var data    = game.data;
        var request = UnityWebRequest.Get("https://worldtimeapi.org/api/timezone/etc/UTC/");

        yield return(request.SendWebRequest());

        if (request.isHttpError || request.isNetworkError)
        {
            yield break;
        }
        var json = request.downloadHandler.text;

        utcTime      = JsonUtility.FromJson <UTCTime>(json);
        tempDateTime = Convert.ToDateTime(utcTime.datetime);

        if ((data.UTCtime.Day != tempDateTime.Day ||
             data.UTCtime.Month != tempDateTime.Month ||
             data.UTCtime.Year != tempDateTime.Year) &&
            !data.dailyRewardReady)
        {
            data.dailyRewardReady = true;
            dailyReward.gameObject.SetActive(true);
            if (data.currentDay >= 7)
            {
                data.currentDay = 0;
            }
        }
    }
Example #2
0
    protected void DataArrived(string FromIP, string message)
    {
      System.Diagnostics.Debug.WriteLine("UDPHandler.DataArrived");
        try
        {
            // Aca debo parsear la informacion
            SharpMap.Data.Providers.MemoryDataProviderBase dataProvider = null;
            if (Parser.ParseData(message, ref ParsedData))
            {
                if (ParsedData.Count >= 15)
                {
                    // Aca busco el layer al que pertenece el elemento
                    dataProvider = GetDataProvider(ParsedData["FromID"]);
                }
                else if (ParsedData.Count == 3)
                {
                  dataProvider = GetDataProvider("00" + ParsedData["Id. Caja"]);
                }
                else if (ParsedData.Count == 11)
                {
                  /*
                  int Anio;
                  int.TryParse(ParsedData["DateFix"].Substring(4, 2), out Anio);
                  Anio += 2000;

                  int Mes;
                  int.TryParse(ParsedData["DateFix"].Substring(2, 2), out Mes);

                  int Dia;
                  int.TryParse(ParsedData["DateFix"].Substring(0, 2), out Dia);

                  int Hora;
                  int.TryParse(ParsedData["UTCTIME"].Substring(0, 2), out Hora);

                  int Minuto;
                  int.TryParse(ParsedData["UTCTIME"].Substring(2, 2), out Minuto);

                  int Segundo;
                  int.TryParse(ParsedData["UTCTIME"].Substring(4, 2), out Segundo);

                  System.DateTime dt = new DateTime(Anio, Mes, Dia, Hora, Minuto, Segundo, 0);
                  Checker.SetEfemerides(dt);
                  */
                  UTCTime time = new UTCTime(ParsedData["DateFix"], ParsedData["UTCTIME"]);
                  Checker.SetEfemerides(time);
                }

                if (dataProvider != null)
                {
                    dataProvider.UpdateInformation(ParsedData);
                }
                // Actualizo el elemento

                // Actualizo los campos del elemento.

                // La informacion es correcta
                // Obtengo el DataSource que hay que actualizar
            }
            // Por algun motivo no se pudo actualizar la informacion.
            if (UDPArrivedData != null)
                UDPArrivedData(FromIP, message);
        }
        catch (Exception ex)
        {
          IntelliTrack.Client.Application.Logging.logError.Error(ex.Message, ex);
        }
    }
Example #3
0
 /// <summary>
 /// Gets .NET Hash code of GPS struct data.
 /// </summary>
 /// <returns>Hash code.</returns>
 public override int GetHashCode() => UTCTime.GetHashCode();