private void AutoCompleteAchievableDelivery() { CardData selectedCardData = GetSelectedCardData(); if (selectedCardData != null) { BingoData bingoData = FindBingoMissionCompleted(selectedCardData); if (bingoData != null) { DoCompleteBingo(bingoData); } else { GridData gridData = FindGridMissionCompleted(selectedCardData); if (gridData != null) { DoCompleteGrid(gridData); } else { AllBingoData allBingoData = FindAllBingoMissionCompleted(selectedCardData); if (allBingoData != null) { DoCompleteAllBingo(allBingoData); } } } } }
private static async Task <AppResponse> Play(CloudTable table, string gameId, string move, string argument, string userName, string displayName, string channelName, ILogger log, CancellationToken token, Func <string, IEnumerable <BingoPlayer>, ILogger, CancellationToken, Task> postCards) { if (!Enum.TryParse <MoveType>(move, true, out var action)) { return("Invalid move"); } var row = await GetGame(table, gameId, token); var data = row?.Content; if (data == null && action != MoveType.Join) { return("A game has not yet been created. Try `/bingo join` to start a new game"); } if (data == null) { row = new TableRow <BingoData> { Content = data = new BingoData { ChannelName = channelName, SideSize = 5, Activities = new List <BingoActivity>(), Players = new List <BingoPlayer>() }, PartitionKey = BingoPartition, RowKey = gameId } } ; try { var game = new BingoGame(data, userName, displayName); var(error, result) = await game.TryMove(action, argument, log, token); switch (action) { case MoveType.Join: return(error == null ? (true, $"{displayName} has joined the game." + (result == null ? " You will receive a card once the game has been started with `/bingo start`." : " The game has already started, so you can view your card with `/bingo card`")) : (false, error)); case MoveType.Next: return(error == null ? (true, $"The next word is `{result}`") : (false, error)); case MoveType.Leave: return(error == null ? (true, $"{displayName} has left the game") : (false, error)); case MoveType.Bingo: return(error == null ? (true, $"{displayName} has won!") : (false, error)); case MoveType.Start: if (error != null) { return(error); } await postCards(gameId, data.Players, log, token); return(true, $"The game has been started. The first word is `{result}`"); default: return(error ?? result); } } finally { await table.ExecuteAsync(TableOperation.InsertOrReplace(row)); } }
private void SetBingosChildrenData(CardData cardData) { List <BingoData> bingoDataList = cardData.bingoDataList; int i = 0; for (int count = bingoDataList.Count; i < count; i++) { BingoData bingoData = bingoDataList[i]; SetABingoChildrenData(cardData, bingoData); } }
private void DoCompleteBingo(BingoData completedData) { string event_name = "COMPLETE_BINGO"; if (isComeFromAutoEvent) { DispatchEvent(event_name, completedData); isComeFromAutoEvent = false; } else { RequestEvent(event_name, completedData); } }
private BingoData FindBingoMissionCompleted(CardData cardData) { List <BingoData> bingoDataList = cardData.bingoDataList; int i = 0; for (int count = bingoDataList.Count; i < count; i++) { BingoData bingoData = bingoDataList[i]; if (!bingoData.isCompleted && MonoBehaviourSingleton <DeliveryManager> .I.IsCompletableDelivery((int)bingoData.deliveryData.id)) { return(bingoData); } } return(null); }
private void SetABingoChildrenData(CardData cardData, BingoData bingoData) { DeliveryTable.DeliveryData.NeedData[] needs = bingoData.deliveryData.needs; int i = 0; for (int num = needs.Length; i < num; i++) { DeliveryTable.DeliveryData.NeedData need = needs[i]; if ((uint)need.needId != 0) { GridData gridData = cardData.gridDataList.FirstOrDefault((GridData grid) => grid.deliveryData.id == (uint)need.needId); if (gridData != null && gridData.deliveryData != null) { bingoData.childrenGridList.Add(gridData); } } } }
private void OnQuery_COMPLETE_BINGO() { BingoData bingoData = GameSection.GetEventData() as BingoData; GameSection.StayEvent(); Delivery deliveryInfo = bingoData.deliveryInfo; CardData cardData = GetCurrentCard(); DeliveryTable.DeliveryData.NeedData[] needs = bingoData.deliveryData.needs; MonoBehaviourSingleton <DeliveryManager> .I.isStoryEventEnd = false; MonoBehaviourSingleton <DeliveryManager> .I.SendDeliveryComplete(deliveryInfo.uId, false, delegate(bool is_success, DeliveryRewardList recv_reward) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) this.StartCoroutine(WaitAndDo(delegate { OnEndSendBingoMission(is_success, cardData, bingoData, bingoData.childrenGridList); }, 0.2f)); }); }
private void OnEndSendBingoMission(bool is_success, CardData cardData, BingoData bingoData, List <GridData> gridDatas) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (is_success) { if (gridDatas == null || gridDatas.Count <= 0) { OnSuccessSend(cardData, bingoData.deliveryData); } else { int i = 0; for (int count = gridDatas.Count; i < count; i++) { PlayGridCompleteAnimation(gridDatas[i], false, null); } UpdateReward(GetCurrentCard(), bingoData, true); PlayTweenComplete(); if (gridDatas.Count <= 4) { PlayCenterAnimation(); } this.StartCoroutine(WaitAndDo(delegate { PlayBingoAnimation(delegate { OnSuccessSend(cardData, bingoData.deliveryData); }); }, GridAnimationTime)); } } else { GameSection.ResumeEvent(false, null); } }
private void UpdateAReach(BingoData bingoData) { List <GridData> childrenGridList = bingoData.childrenGridList; GridData gridData = null; int num = 0; int i = 0; for (int count = childrenGridList.Count; i < count; i++) { if (!childrenGridList[i].isCompleted) { gridData = childrenGridList[i]; num++; } if (num >= 2) { return; } } if (gridData != null) { SetReachVisual(gridData); } }