/// <summary>
 /// 此处参数为增量,即过了几个时间单位(例如经过了上午和下午就写2)
 /// </summary>
 /// <param name="increment"></param>
 public void UpdateTime(int increment)
 {
     if (nowIndex + increment >= 0)
     {
         nowIndex += increment;
         totalDay  = (int)Mathf.Floor((nowIndex / (float)timeSequence.Count));
         now       = timeSequence[nowIndex % timeSequence.Count];
         onTimeChangedEvent.Invoke();
     }
     else
     {
         Debug.LogWarning("回退了过多时间!");
     }
 }
Exemple #2
0
        public async Task <IReadOnlyList <Departure> > All(DepartureRequest request)
        {
            var(response, elapsed) = await Timeing.Time(RequestDepartures);

            _requestTime?.Invoke(elapsed, RequestTimeSource(nameof(All)));

            if (!response.IsSuccessStatusCode)
            {
                throw GetDeparturesFailed.Create(response);
            }

            var departureBoardDto = await response.Content.Read <RequestEnvelopeDto <DepartureBoardDto> >(_jsonConverter);

            return(departureBoardDto.Payload
                   .Departures.Select(d => d.ToDeparture())
                   .ToList());

            Task <HttpResponseMessage> RequestDepartures()
            => _httpClientFactory().GetAsync($"v2/departures?{request.Build()}");
        }