private IEnumerator ReplayEvents(EventModelCollection events) { var allEvents = events.GetAllEvents(); allEvents = allEvents.OrderBy(item => item.TimestampMillis).ToList(); if (allEvents.Count == 0) { yield break; } var firstTimestampMillis = allEvents[0].TimestampMillis; float GetTimeSinceStartSeconds(long timeStampMillis) { return((timeStampMillis - firstTimestampMillis) / 1000f); } for (int i = 0; i < allEvents.Count; i++) { var currentEvent = allEvents[i]; var lastEventExists = i - 1 >= 0; var lastEvent = lastEventExists ? allEvents[i - 1] : null; var currentTimeSinceStartSeconds = GetTimeSinceStartSeconds(currentEvent.TimestampMillis); var lastTimeSinceStartSeconds = lastEventExists ? GetTimeSinceStartSeconds(lastEvent.TimestampMillis) : 0; var timeToWait = currentTimeSinceStartSeconds - lastTimeSinceStartSeconds; if (!Mathf.Approximately(0, timeToWait)) { yield return(new WaitForSeconds(timeToWait)); } ReplayEvent(currentEvent, currentTimeSinceStartSeconds); } }
public override EventModelCollection ExtractNewEvents() { var collection = new EventModelCollection(); collection.DropdownEvents.AddRange(_dropdownChangedEvents); _dropdownChangedEvents.Clear(); return(collection); }
public override EventModelCollection ExtractNewEvents() { var collection = new EventModelCollection(); collection.TouchEvents.AddRange(_events); _events.Clear(); return(collection); }
public override EventModelCollection ExtractNewEvents() { var collection = new EventModelCollection(); collection.SceneChangedEvents.AddRange(_sceneChangedEvents); _sceneChangedEvents.Clear(); return(collection); }
public override EventModelCollection ExtractNewEvents() { var collection = new EventModelCollection(); var eventCollectionList = new List <EventModelCollection>(); _collectors.ForEach(col => { var events = col.ExtractNewEvents(); eventCollectionList.Add(events); }); collection.TouchEvents = eventCollectionList.SelectMany(col => col.TouchEvents).ToList(); collection.ToggleEvents = eventCollectionList.SelectMany(col => col.ToggleEvents).ToList(); collection.DropdownEvents = eventCollectionList.SelectMany(col => col.DropdownEvents).ToList(); collection.TextInputEvents = eventCollectionList.SelectMany(col => col.TextInputEvents).ToList(); return(collection); }
/// <summary> /// Инициализирует все события на календаре /// </summary> /// <returns>Список событий</returns> public EventModelCollection InitializeEvents() { List <Journal> journalRecords = journOfAccountingRepository.GetManyObjects().ToList(); EventModelCollection eventModelsCollection = new EventModelCollection(); int calendarId = 1; foreach (var record in journalRecords) { if (calendarId == 4) { calendarId = 1; } else { calendarId += 1; } RentingViewModel rentingModel = new RentingViewModel() { EventId = record.JOURNAL_OF_ACCOUNTING_ID, Title = record.FIO_DECLARANT, StartDate = record.DEPARTURE_TIME, EndDate = record.ARRIVAL_TIME, IsAllDay = false, Notes = record.COMMENTS, Auto = record.CAR_ID, Driver = record.DRIVER_ID, PointSending = record.DESTINATION_POINT_SENDING_ID, PointArrival = record.DESTINATION_POINT_ARRIVAL_ID, Status = record.STATUS_ID, CalendarId = calendarId }; eventModelsCollection.Add(rentingModel); } return(eventModelsCollection); }