public async Task NewGameAsync(GameBoardViewModel guess) { //hopefully no need to hide solution anymore since another class is responsible for it now. bool canRepeat = _level.LevelChosen == 2 || _level.LevelChosen == 4 || _level.LevelChosen == 6; int level = _level.LevelChosen; CustomBasicList <Bead> possibleList = new CustomBasicList <Bead>(); if (level == 5 || level == 6) { possibleList.Add(new Bead(EnumColorPossibilities.Aqua)); possibleList.Add(new Bead(EnumColorPossibilities.Black)); } possibleList.Add(new Bead(EnumColorPossibilities.Blue)); possibleList.Add(new Bead(EnumColorPossibilities.Green)); if (level > 2) { possibleList.Add(new Bead(EnumColorPossibilities.Purple)); } possibleList.Add(new Bead(EnumColorPossibilities.Red)); possibleList.Add(new Bead(EnumColorPossibilities.White)); if (level > 2) { possibleList.Add(new Bead(EnumColorPossibilities.Yellow)); } ICustomBasicList <Bead> tempList; if (canRepeat == false) { tempList = possibleList.GetRandomList(false, 4); } else { int x; tempList = new CustomBasicList <Bead>(); for (x = 1; x <= 4; x++) { var ThisBead = possibleList.GetRandomItem(); tempList.Add(ThisBead); // can have repeat } } _global.Solution = tempList.ToCustomBasicList(); await guess.NewGameAsync(); await guess.StartNewGuessAsync(); _global.ColorList = possibleList.Select(items => items.ColorChosen).ToCustomBasicList(); }
public async Task <ICustomBasicList <IBaseSong> > GetRandomListAsync() { ICustomBasicList <IBaseSong>?tempList = null; await Task.Run(() => { SongsChosen.Clear(); if (_alreadyHad == true) { _alreadyHad = false; tempList = _rList.ToCustomBasicList(); //to get a new one. return; } tempList = _rList.GetRandomList(); //i think this would work too. return; }); return(tempList !); //decided to risk it. }