IEnumerator StartLocationServiceCoroutine() { if (MockLocation != null) { _coroutine.SetupContinuousRoutine("location_service", MockLocationUpdate); yield break; } _coroutine.RunOnce("location_service_start", LocationServiceStarter.Start( () => _coroutine.SetupContinuousRoutine("location_service", UpdateLocation))); }
public Matchmore(Config config) { _config = config; MatchmoreLogger.Enabled = config.LoggingEnabled; if (string.IsNullOrEmpty(config.ApiKey)) { throw new ArgumentException("Api key null or empty"); } _apiKey = config.ApiKey; _servicePort = config.ServicePort; _environment = config.Environment ?? PRODUCTION; _secured = config.UseSecuredCommunication; InitGameObjects(); _state = new StateManager(_environment, config.PersistenceFile); if (MainDevice == null) { CreateDevice(new MobileDevice(), makeMain: true); } _coroutine.SetupContinuousRoutine("persistence", _state.PruneDead); }
public PollingMatchMonitor(Device device, DeviceApi _deviceApi, CoroutineWrapper coroutine, Action<string> closedCallback) { if (device == null || string.IsNullOrEmpty(device.Id)) { throw new ArgumentException("Device null or invalid id"); } _device = device; _coroutine = coroutine; _closedCallback = closedCallback; _coroutine.SetupContinuousRoutine(device.Id, () => { var matches = _deviceApi.GetMatches(device.Id); OnMatchReceived(new MatchReceivedEventArgs(device, Matchmore.MatchChannel.polling, matches)); }); }
public ThreadedPollingMatchMonitor(Device device, DeviceApi deviceApi, CoroutineWrapper coroutine, Action<string> closedCallback) { if (device == null || string.IsNullOrEmpty(device.Id)) { throw new ArgumentException("Device null or invalid id"); } _deviceApi = deviceApi; _device = device; _coroutine = coroutine; _closedCallback = closedCallback; _running = true; Start(); _coroutine.SetupContinuousRoutine(device.Id, () => { OnMatchReceived(new MatchReceivedEventArgs(device, Matchmore.MatchChannel.threadedPolling, _matches)); }); }
public override void Start() { if (MockLocation != null) { _running = true; base.Start(); } else { _coroutine.RunOnce("location_service_start", LocationServiceStarter.Start(() => { //setup a coroutine which will just copy data to this object so the thread actually can take it and send to matchmore _coroutine.SetupContinuousRoutine("data_update", () => { _status = Input.location.status; _locationInfo = Input.location.lastData; }); _running = true; base.Start(); })); } }