Example #1
0
        async Task IMiscDataNM.MiscDataReceived(string status, string content)
        {
            switch (status) //can't do switch because we don't know what the cases are ahead of time.
            {
            case "laiddowninitial":
                await CreateSetsAsync(content);
                await LaidDownInitialSetsAsync();

                return;

            case "pass":
                await PassAsync();

                return;

            case "expandrummy":
                SendExpandedSet thiss = await js.DeserializeObjectAsync <SendExpandedSet>(content);
                await AddToSetAsync(thiss.Number, thiss.Deck, thiss.Position);

                return;

            default:
                throw new BasicBlankException($"Nothing for status {status}  with the message of {content}");
            }
        }
Example #2
0
        private async Task MainSets_SetClickedAsync(int setNumber, int section, int deck)
        {
            if (setNumber == 0)
            {
                return;
            }
            //has to wait to do more of main before doing this.
            if (_mainGame !.SaveRoot !.CompletedPhase == false)
            {
                await UIPlatform.ShowMessageAsync("Sorry, the phase must be completed before expanding onto a set");

                return;
            }
            var  thisSet  = _model.MainSets !.GetIndividualSet(setNumber);
            int  position = section;
            bool rets;

            rets = _mainGame.CanHumanExpand(thisSet, ref position, out Phase10CardInformation? thisCard, out string message);
            if (rets == false)
            {
                if (message != "")
                {
                    await UIPlatform.ShowMessageAsync(message);
                }
                return;
            }
            if (_mainGame.BasicData !.MultiPlayer == true)
            {
                SendExpandedSet expands = new SendExpandedSet();
                expands.Deck     = thisCard !.Deck;
                expands.Position = position;
                expands.Number   = setNumber;
                await _mainGame.Network !.SendAllAsync("expandrummy", expands);
            }
            await _mainGame.ExpandHumanRummyAsync(setNumber, thisCard !.Deck, position);
        }