private void ApplyNewGameActions(string actionsResponse) { GetActionsResponse actions = JsonUtility.FromJson <GetActionsResponse>(actionsResponse); List <IGameAction> newActions = actions.GetGameActionsFromRecord(); int numNewActions = newActions.Count; bool keepListening = true; if (numNewActions > 0) { seenActionIndex = actions.ActionIndex; bool areActionsRunning = currentPendingActions.Count > 0; for (int i = 0; i < numNewActions; ++i) { Debug.Log("ENQUEUE ACTION: " + newActions[i].ActionType); currentPendingActions.Enqueue(newActions[i]); keepListening = newActions[i].ActionType != "TableGameEndAction"; } if (!areActionsRunning && numNewActions > 0) { InvokeNextAction(); } } if (keepListening) { Service.TimerManager.CreateTimer(GAME_UPDATE_TIME, GetGameUpdates, null); } }
private async void RFIDReaders_CardConnected(object sender, string e) { if (string.IsNullOrEmpty(e)) { return; } if (_core.TryGetUiManager(out IUiManager _uiManager)) { await _uiManager.DoWhileBusy(async() => { _currentCardCode = e; try { var response = await _core.HttpClient.GetObjectAsync <GetActionsResponse>("card_actions/get_cardcategories/" + e + "/"); if (response.Success) { _obj = response.Result; _actions = _obj.CardCategoriesObject.CardActions.CardCategories .SelectMany(cc => cc.Actions.Select(a => a.Action)) .ToList() .Where(ac => ac.ForSignedInUser == (_obj.User != null && _core.UserService.User.Id == _obj.User.Id)) .ToList(); _currentAction = 0; } } catch { } }); } else { _core.Logger.Error(this, "ui manager not loaded"); } await StartActions(); _lastCard = e; }