public object Any(GetTimeRequest request)
        {
            // Wait some time to simulate a working delay
            System.Threading.Thread.Sleep(1000);

            return DateTime.Now.ToString();
        }
Exemple #2
0
    public Service.ReturnData GetTime(string FirstName, string LastName)
    {
        GetTimeRequest inValue = new GetTimeRequest();

        inValue.FirstName = FirstName;
        inValue.LastName  = LastName;
        getTimeResponse retVal = ((ISer)(this)).GetTime(inValue);

        return(retVal.getTimeResult);
    }
Exemple #3
0
 public void GetCurrentServerTime()
 {
     var time = new GetTimeRequest();
     PlayFabClientAPI.GetTime(time, result =>
     {
         //Debug.Log("server time = " + result.Time);
         osTrackController.RecieveCurrentServerTime(result.Time);
     }, error =>
     {
         Debug.Log(error.ErrorMessage);
     });
 }
Exemple #4
0
    IEnumerator MakeUpdate()
    {
        try
        {
            var requestTime = new GetTimeRequest {
            };
            PlayFabClientAPI.GetTime(requestTime, onGetTimeResult =>
            {
                //TimeTMP.text = onGetTimeResult.Time.ToShortTimeString() + ", " + onGetTimeResult.Time.ToLongDateString();
                TimeTMP.text = "Tournament ends: " + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(onGetTimeResult.Time.Month);
            }, onGetTimeError => { });
        }
        catch (Exception e)
        {
            coroutine = MakeUpdate();

            StartCoroutine(coroutine);
        }
        yield return(new WaitForSeconds(5));

        StartCoroutine(MakeUpdate());
    }
Exemple #5
0
 /// <summary> Setter constructor. </summary>
 public GetTime(GetTimeRequest request)
 {
     Request  = request;
     Response = new GetTimeResponse();
 }
Exemple #6
0
 getTimeResponse ISer.GetTime(GetTimeRequest request)
 {
     return(base.Channel.GetTime(request));
 }
Exemple #7
0
		public GetTimeResponse GetTime(GetTimeRequest request)
        {
            return new GetTimeResponse(DateTime.Now);
        }
Exemple #8
0
    private void UpdateTime()
    {
        GetTimeRequest request = new GetTimeRequest();

        PlayFabClientAPI.GetTime(request, OnTimeUpdate, OnPlayFabError);
    }
Exemple #9
0
    void HeartsUpdate(GetPlayerStatisticsResult result)
    {
        currentHearts = result.Statistics.Find(stat => stat.StatisticName == "Lives").Value;

        startButton.gameObject.SetActive(currentHearts > 0);
        restertButton.gameObject.SetActive(currentHearts > 0);

        for (int i = 0; i < currentHearts; i++)
        {
            Hearts[i].color = Color.white;
        }
        for (int i = currentHearts; i < 3; i++)
        {
            Hearts[i].color = Color.black;
        }

        if (currentHearts < 3)
        {
            var requestTime = new GetTimeRequest {
            };
            PlayFabClientAPI.GetTime(requestTime, ServerTimeResult =>
            {
                PlayerTime = result.Statistics.Find(stat => stat.StatisticName == "Time").Value;
                Debug.Log("PlayerTime: " + PlayerTime);

                ServerTime = Convert.ToInt32(new TimeSpan(ServerTimeResult.Time.Ticks).TotalMinutes);
                Debug.Log("ServerTime B: " + ServerTime);

                RemainingTime.text = "Life will be restored in " + (60 - (ServerTime - PlayerTime)) + " minutes";

                Debug.Log("ServerTime A: " + ServerTime);

                switch (currentHearts)
                {
                case 0:
                    {
                        //string RemainingTime = "Life will be restored in " + (60 - (ServerTime - PlayerTime)) + " minutes";
                        if (ServerTime >= PlayerTime + 180)
                        {
                            UpdateLives(currentHearts + 3);
                            UpdateTime(PlayerTime + 180);
                            //RemainingTime = "";
                            RemainingTime.text = "Restoring life, Wait a second...";
                            startButton.gameObject.SetActive(false);
                        }
                        else if (ServerTime >= PlayerTime + 120)
                        {
                            UpdateLives(currentHearts + 2);
                            UpdateTime(PlayerTime + 120);
                            //RemainingTime = "Life will be restored in " + (60 - (ServerTime - (PlayerTime + 120))) + " minutes";
                            RemainingTime.text = "Restoring life, Wait a second...";
                            startButton.gameObject.SetActive(false);
                        }
                        else if (ServerTime >= PlayerTime + 60)
                        {
                            UpdateLives(currentHearts + 1);
                            UpdateTime(PlayerTime + 60);
                            //RemainingTime = "Life will be restored in " + (60 - (ServerTime - (PlayerTime + 60))) + " minutes";
                            RemainingTime.text = "Restoring life, Wait a second...";
                            startButton.gameObject.SetActive(false);
                        }
                        Debug.Log("ServerTime IN 0: " + ServerTime);
                        //this.RemainingTime.text = RemainingTime;
                    }
                    break;

                case 1:
                    {
                        //string RemainingTime = "Life will be restored in " + (60 - (ServerTime - PlayerTime)) + " minutes";
                        if (ServerTime >= PlayerTime + 120)
                        {
                            UpdateLives(currentHearts + 2);
                            UpdateTime(PlayerTime + 120);
                            //RemainingTime = "";
                            RemainingTime.text = "Restoring life, Wait a second...";
                            startButton.gameObject.SetActive(false);
                        }
                        else if (ServerTime >= PlayerTime + 60)
                        {
                            UpdateLives(currentHearts + 1);
                            UpdateTime(PlayerTime + 60);
                            //RemainingTime = "Life will be restored in " + (60 - (ServerTime - (PlayerTime + 60))) + " minutes";
                            RemainingTime.text = "Restoring life, Wait a second...";
                            startButton.gameObject.SetActive(false);
                        }
                        Debug.Log("ServerTime IN 1: " + ServerTime);
                        //this.RemainingTime.text = RemainingTime;
                    }
                    break;

                case 2:
                    {
                        //string RemainingTime = "Life will be restored in " + (60 - (ServerTime - PlayerTime)) + " minutes";
                        if (ServerTime >= PlayerTime + 60)
                        {
                            UpdateLives(currentHearts + 1);
                            UpdateTime(PlayerTime + 60);
                            //RemainingTime = "";
                            RemainingTime.text = "Restoring life, Wait a second...";
                            startButton.gameObject.SetActive(false);
                        }
                        Debug.Log("ServerTime IN 2: " + ServerTime);
                        //this.RemainingTime.text = RemainingTime;
                    }
                    break;
                }
            }, ServerTimeError => { });
        }
        else
        {
            RemainingTime.text = "";
            startButton.gameObject.SetActive(true);
        }
    }
Exemple #10
0
    //gets the timestamp to start a new streak of games. Upon getting the server time a game starts
    public void GetTimeStampedGame()
    {
        var timeRequest = new GetTimeRequest();

        PlayFabClientAPI.GetTime(timeRequest, OnStartTimeStampSuccess, OnGetTimeFailure);
    }
Exemple #11
0
    public void GetCurrentTime()
    {
        var timeRequest = new GetTimeRequest();

        PlayFabClientAPI.GetTime(timeRequest, OnGetTimeSuccess, OnGetTimeFailure);
    }
Exemple #12
0
 public GetTimeResponse GetTime(GetTimeRequest request)
 {
     return(new GetTimeResponse(DateTime.Now));
 }