public async Task RemoveTileFromSetAsync(int index, int deck) { SaveRoot !.TilesFromField.Add(deck); TileSet thisSet = _model !.MainSets1 !.GetIndividualSet(index); SaveRoot.DidExpand = true; var thisTile = _model.Pool1 !.GetTile(deck); thisTile.WhatDraw = EnumDrawType.FromSet; if (thisTile.IsJoker) { thisTile.Number = 20; } thisSet.HandList.RemoveObjectByDeck(deck); SingleInfo !.MainHandList.Add(thisTile); if (SingleInfo.PlayerCategory == EnumPlayerCategory.Self) { SingleInfo.MainHandList.Sort(); } await ContinueTurnAsync(); }
public async Task RemoveEntireSetAsync(int index) { TileSet thisSet = _model !.MainSets1 !.GetIndividualSet(index); //looks like 0 based bug again try a different method that is not 0 based. var tempList = new DeckRegularDict <TileInfo>(); thisSet.HandList.ForEach(thisTile => { thisTile.WhatDraw = EnumDrawType.FromSet; SaveRoot !.TilesFromField.Add(thisTile.Deck); if (thisTile.IsJoker) { thisTile.Number = 20; } tempList.Add(thisTile); }); _model.MainSets1.RemoveSet(index - 1); //i think 0 based bug again. SingleInfo !.MainHandList.AddRange(tempList); if (SingleInfo.PlayerCategory == EnumPlayerCategory.Self) { SingleInfo.MainHandList.Sort(); } await ContinueTurnAsync(); }