/// <summary> /// Queue up a request to the online service that needs to be called on the RUYI platform level. /// </summary> /// <typeparam name="Response">A serialisiable class we can receive the data in.</typeparam> /// <param name="index">The index of user</param> /// <param name="onExecute">The method to call when we execute the task.</param> internal async Task <Response> EnqueuePlatformTask <Response>(int index, RuyiNetTask <Response> .ExecuteType onExecute) { await BCService.Identity_SwitchToParentProfileAsync("RUYI", index, token); var response = await onExecute(); await BCService.Identity_SwitchToSingletonChildProfileAsync(AppId, false, index, token); var data = JsonConvert.DeserializeObject <Response>(response, jsonSerializerSettings); return(data); }
/// <summary> /// Returns TRUE while there are tasks in the queue. /// </summary> //public bool IsWorking { get { return mTaskQueue.Work > 0; } } /// <summary> /// Cleanup native resources before destruction. /// </summary> /// <param name="disposing">Whether or not we are disposing resources.</param> protected virtual void Dispose(bool disposing) { if (disposing) { if (BCService != null) { for (int i = 0; i < MAX_PLAYERS; ++i) { if (CurrentPlayers[i] != null) { BCService.Script_RunParentScriptAsync("RUYI_Cleanup", "{}", "RUYI", i, token).Wait(); BCService.Identity_SwitchToParentProfileAsync("RUYI", i, token).Wait(); } } BCService.Dispose(); BCService = null; } } }