public async Task ClearBoardAsync() { if (await _thisState.CanOpenSavedSinglePlayerGameAsync() == false) { foreach (var ThisSpace in _saveRoot.SpaceList) { if (ThisSpace.Vector.Row == 4 && ThisSpace.Vector.Column == 4) { ThisSpace.HasImage = false; } else { ThisSpace.HasImage = true; } ThisSpace.ClearSpace(); } PreviousSpace = new GameSpace(); } else { _saveRoot = await _thisState.RetrieveSinglePlayerGameAsync <SolitaireBoardGameSaveInfo>(); MainContainer.ReplaceObject(_saveRoot); //hopefully no need to replacesavedgame (?) //ThisE.ReplaceSavedGame(); } await Aggregator.SendLoadAsync(); }
protected virtual void ReplaceGame() { //return; _ = MainContainer.ReplaceObject <IViewModelData>(); //this has to be replaced before the game obviously. Assembly assembly = Assembly.GetAssembly(GetType()) !; CustomBasicList <Type> thisList = assembly.GetTypes().Where(items => items.HasAttribute <AutoResetAttribute>()).ToCustomBasicList(); thisList.AddRange(GetAdditionalObjectsToReset()); ClearSubscriptions(); Type?type = MainContainer.LookUpType <IStandardRollProcesses>(); if (type != null) { thisList.Add(type); //hopefully this simple. this allows more parts to be able to be added without a new class //useful for dice games. } //attempt to also unsubscribe to all as well. //could do delegates. however, if not set, then won't do. if (MiscDelegates.GetMiscObjectsToReplace != null) { thisList.AddRange(MiscDelegates.GetMiscObjectsToReplace.Invoke()); } MainContainer.ResetSeveralObjects(thisList); _mainGame = MainContainer.ReplaceObject <IBasicGameProcesses <P> >(); //hopefully this works }