Exemple #1
0
        private async Task MainSets1_SetClickedAsync(int setNumber, int section, int deck)
        {
            if (setNumber == 0)
            {
                throw new BasicBlankException("If the set is 0, rethinking is required");
            }
            var thisSet = _model.MainSets1 !.GetIndividualSet(setNumber);
            var thisCol = _mainGame !.GetSelectedList();

            if (thisCol.Count == 0)
            {
                if (deck == 0 || thisSet.HandList.Count < 2)
                {
                    if (_mainGame.BasicData !.MultiPlayer)
                    {
                        await _mainGame.Network !.SendAllAsync("removeentireset", setNumber);
                    }
                    await _mainGame.RemoveEntireSetAsync(setNumber);

                    return;
                }
                if (_mainGame.BasicData !.MultiPlayer)
                {
                    SendSet thisSend = new SendSet();
                    thisSend.Index = setNumber;
                    thisSend.Tile  = deck;
                    await _mainGame.Network !.SendAllAsync("removeonefromset", thisSend);
                }
                await _mainGame.RemoveTileFromSetAsync(setNumber, deck);

                return;
            }
            if (thisCol.Count > 1)
            {
                await UIPlatform.ShowMessageAsync("Can only add one tile to the set at a time");

                return;
            }
            var thisTile = thisCol.First();
            var newPos   = thisSet.PositionToPlay(thisTile, section);

            if (_mainGame.BasicData !.MultiPlayer)
            {
                SendSet finSend = new SendSet();
                finSend.Index    = setNumber;
                finSend.Position = newPos;
                finSend.Tile     = thisTile.Deck;
                await _mainGame.Network !.SendAllAsync("addtoset", finSend);
            }
            if (_model.TempSets !.HasObject(thisTile.Deck))
            {
                _model.TempSets.RemoveObject(thisTile.Deck);
            }
        private async Task DiceChosenAsync(RummyDiceInfo dice)
        {
            int x = HandList.IndexOf(dice);

            if (_mainGame.BasicData !.MultiPlayer == true)
            {
                SendSet thisSet = new SendSet();
                thisSet.WhichSet = Index;
                thisSet.Dice     = x;
                await _mainGame.Network !.SendAllAsync("diceset", thisSet);
            }
            await SelectUnselectDiceAsync(x);
        }