private void ResetField() { if (SingleInfo !.PlayerCategory == EnumPlayerCategory.Self) { _model !.TempSets !.ClearBoard(); //i think } DeckRegularDict <TileInfo> tempList = new DeckRegularDict <TileInfo>(); SaveRoot !.YourTiles.ForEach(thisIndex => { var thisTile = _model !.Pool1 !.GetTile(thisIndex); tempList.Add(thisTile); }); SingleInfo.MainHandList.ReplaceRange(tempList); SaveRoot.TilesFromField.Clear(); int x = SaveRoot.BeginningList.Count; //the first time, actually load manually. _model !.MainSets1 !.SetList.Clear(); //try this way. x.Times(y => { TileSet set = new TileSet(_command, _rummys); _model.MainSets1.CreateNewSet(set); }); _model.MainSets1.LoadSets(SaveRoot.BeginningList); _model.MainSets1.RedoSets(); //i think. SingleInfo.MainHandList.ForEach(thisCard => thisCard.WhatDraw = EnumDrawType.IsNone); if (SingleInfo.PlayerCategory == EnumPlayerCategory.Self) { SingleInfo.MainHandList.Sort(); } }
public void TestBasics() { SetList <int> list = new SetList <int>(); Assert.IsFalse(list.IsReadOnly); for (int i = 512; i >= 0; i--) { list.Add(i); } int offset = 0; foreach (int item in list) { Assert.AreEqual(offset++, item); } Assert.AreEqual(513, offset); Assert.AreEqual(513, list.Count); list.Clear(); list.AddRange(new int[] { 5, 10, 20 }); list.AddRange(new int[] { }); Assert.AreEqual(3, list.Count); Assert.IsTrue(list.Contains(20)); Assert.IsTrue(list.Remove(20)); Assert.IsFalse(list.Contains(20)); Assert.IsFalse(list.Remove(20)); Assert.AreEqual(2, list.Count); int pos; list.Add(10, out pos); Assert.AreEqual(1, pos); Assert.AreEqual(2, list.Count); int[] items = new int[2]; list.CopyTo(items, 0); Assert.AreEqual(5, items[0]); Assert.AreEqual(10, items[1]); items = list.ToArray(); Assert.AreEqual(5, items[0]); Assert.AreEqual(10, items[1]); List <int> tmp = new List <int>(); foreach (int i in list) { tmp.Add(i); } Assert.AreEqual(2, tmp.Count); Assert.AreEqual(5, tmp[0]); Assert.AreEqual(10, tmp[1]); }
protected override Task LastPartOfSetUpBeforeBindingsAsync() { if (IsLoaded == false) { LoadControls(); } SingleInfo = PlayerList !.GetSelf(); _model !.MainSets !.ClearBoard(); SaveRoot !.SetList.Clear(); //i think this too. return(base.LastPartOfSetUpBeforeBindingsAsync()); }
public void Reset() { var hasChanged = (_itemList.Count > 0); _itemList.Clear(); if (hasChanged && !IsSuspended) // Performance tweak; see OnSuspended and OnResumed { EhSelfChanged(new BoundariesChangedEventArgs(BoundariesChangedData.NumberOfItemsChanged | BoundariesChangedData.UpperBoundChanged)); } }
protected override Task LastPartOfSetUpBeforeBindingsAsync() { if (IsLoaded == false) { LoadControls(); } _model !.MainSets !.ClearBoard(); SaveRoot !.SetList.Clear(); //i think this too. //var tempCard = ManuallyChooseCard; //_model.Deck1!.ManuallyRemoveSpecificCard(tempCard); //_model.Pile1!.AddCard(tempCard); return(base.LastPartOfSetUpBeforeBindingsAsync()); }
protected override Task LastPartOfSetUpBeforeBindingsAsync() { _model !.Deck1 !.OriginalList(_gameContainer.DeckList !); //try this. if (IsLoaded == false) { LoadControls(); SingleInfo = PlayerList !.GetSelf(); Aggregator.Subscribe(SingleInfo); } _model.MainSets !.ClearBoard(); SaveRoot !.SetList.Clear(); //i think this too. SaveRoot.FirstTurn = true; var tempCol = _model.Deck1.DrawSeveralCards(8); PlayerList !.ForEach(thisPlayer => { thisPlayer.MainHandList.Clear(); thisPlayer.SetsPlayed = 0; thisPlayer.TotalScore = 0; }); _model.Pool1 !.NewGame(tempCol); SaveRoot.ImmediatelyStartTurn = true; return(base.LastPartOfSetUpBeforeBindingsAsync()); }