private void HandleDateTimeSyncMessage(DateTimeSyncMessage message) { this.timestamps[message.PlayerId] = new WcDateTime(message.Seconds); if (Util.EnumeratePlayers(PLAYER_SLOT_STATE_PLAYING, MAP_CONTROL_USER).All(x => this.timestamps.ContainsKey(GetPlayerId(x)))) { var sync = this.method switch { DateTimeSyncMethod.Earliest => ResolveEarliest(), DateTimeSyncMethod.Latest => ResolveLatest(), DateTimeSyncMethod.Average => ResolveAverage(), _ => ResolveBestFit(), }; SyncSystem.Unsubscribe <DateTimeSyncMessage>(HandleDateTimeSyncMessage); WcDateTime.StoreSynchronisedTime(sync.TotalSeconds, this.method); this.action?.Invoke(sync); } }
/// <inheritdoc/> public void Dispose() { SyncSystem.Unsubscribe <SaveLoadedMessage <T> >(HandleSaveLoadedMessage); }