Beispiel #1
0
        public async Task OpenSavedGameAsync()
        {
            _opened = true;
            DeckList.OrderedObjects(); //i think
            SaveRoot = await _thisState.RetrieveSinglePlayerGameAsync <S>();

            S tempRoot = SaveRoot.AutoMap <S>();

            _score.Score = SaveRoot.Score; //i think.
            SaveRoot     = tempRoot;       //hopefully this simple so more efficient.
            //SaveRoot = await _thisState.RetrieveSinglePlayerGameAsync<S>(); //try to repeat again just in case.
            await _thisMod !.MainPiles1 !.LoadGameAsync(SaveRoot.MainPileData);

            _thisMod.MainDiscardPile !.SavedDiscardPiles(SaveRoot.Discard);
            await _thisMod.WastePiles1 !.LoadGameAsync(SaveRoot.WasteData);

            if (SaveRoot.IntDeckList.Count > 0)
            {
                var newList = SaveRoot.IntDeckList.GetNewObjectListFromDeckList(DeckList);
                _thisMod.DeckPile !.OriginalList(newList);
            }
            _thisMod.MainPiles1.SetSavedScore(SaveRoot.Score); //i think.
            CardList         = DeckList.ToRegularDeckDict();
            NoCardsToShuffle = false;
            HowManyCards     = CardList.Count;
            await ContinueOpenSavedAsync(); //sometimes you need something else.

            AfterInit();
        }
        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();
        }
Beispiel #3
0
        private async Task ReloadGameAsync(Func <BuncoDiceGameSaveInfo, bool, DiceCup <SimpleDice> > loadCup)
        {
            _saveRoot = await _thisState.RetrieveSinglePlayerGameAsync <BuncoDiceGameSaveInfo>();

            _container.ReplaceObject(_saveRoot);                     //this is now the new object.
            _saveRoot.PlayerList.MainContainer = _container;         //has to redo that part.
            _saveRoot.PlayerList.AutoSaved(_saveRoot !.PlayOrder !); //i think this is needed too.
            _cup = loadCup.Invoke(_saveRoot, true);
            await Aggregator.SendLoadAsync();                        //still needed.

            await NewTurnAsync();
        }
        public override async Task OpenSavedGameAsync()
        {
            DeckList.OrderedObjects(); //i think
            _saveRoot = await _thisState.RetrieveSinglePlayerGameAsync <BlackjackSaveInfo>();

            if (_saveRoot.DeckList.Count > 0)
            {
                var newList = _saveRoot.DeckList.GetNewObjectListFromDeckList(DeckList);
                DeckPile !.OriginalList(newList);
                //not sure if we need this or not (?)
                //DeckPile.Visible = true;
            }
            //anything else that is needed to open the saved game will be here.
        }
Beispiel #5
0
        public override async Task OpenSavedGameAsync()
        {
            DeckList.OrderedObjects(); //i think
            SaveRoot = await _thisState.RetrieveSinglePlayerGameAsync <ClockSolitaireSaveInfo>();

            if (SaveRoot.DeckList.Count > 0)
            {
                var newList = SaveRoot.DeckList.GetNewObjectListFromDeckList(DeckList);
                DeckPile !.OriginalList(newList);
                //not sure if we need this or not (?)
                //DeckPile.Visible = true;
            }
            _clock1 !.LoadSavedClocks(SaveRoot.SavedClocks);
            SaveRoot.LoadMod(Aggregator);
        }
Beispiel #6
0
        public override async Task OpenSavedGameAsync()
        {
            DeckList.OrderedObjects(); //i think
            _saveRoot = await _thisState.RetrieveSinglePlayerGameAsync <AccordianSolitaireSaveInfo>();

            if (_saveRoot.DeckList.Count > 0)
            {
                var newList = _saveRoot.DeckList.GetNewObjectListFromDeckList(DeckList);
                DeckPile !.OriginalList(newList);
                //not sure if we need this or not (?)
                //DeckPile.Visible = true;
            }
            //anything else that is needed to open the saved game will be here.
            _saveRoot.LoadMod(Aggregator);
            _board !.ReloadSavedGame(_saveRoot);
        }
        public override async Task OpenSavedGameAsync()
        {
            DeckList.OrderedObjects(); //i think
            SaveRoot = await _thisState.RetrieveSinglePlayerGameAsync <HeapSolitaireSaveInfo>();

            if (SaveRoot.DeckList.Count > 0)
            {
                var newList = SaveRoot.DeckList.GetNewObjectListFromDeckList(DeckList);
                DeckPile !.OriginalList(newList);
                //not sure if we need this or not (?)
                //DeckPile.Visible = true;
            }
            //anything else that is needed to open the saved game will be here.
            _model !.Main1.PileList !.ReplaceRange(SaveRoot.MainPiles !); //iffy.
            _model.Main1.RefreshInfo();
            SaveRoot.Load(Aggregator);
            _model.Waste1 !.PileList !.ReplaceRange(SaveRoot.WasteData !); //also iffy.
        }
Beispiel #8
0
        public async Task NewGameAsync()
        {
            if (await _thisSave.CanOpenSavedSinglePlayerGameAsync() == false)
            {
                _games.SpaceList.ClearBoard();
                PreviousOpen = new Vector(3, 3);
                CustomBasicList <int> thisList = _rs.GenerateRandomList(8);
                _games.SpaceList.PopulateBoard(thisList);
            }
            else
            {
                _games = await _thisSave.RetrieveSinglePlayerGameAsync <XPuzzleSaveInfo>(); //hopefully this is not iffy.

                MainContainer !.ReplaceObject(_games);
            }
            await _aggregator.SendLoadAsync();

            await _thisSave.SaveSimpleSinglePlayerGameAsync(_games);
        }
        public override async Task OpenSavedGameAsync()
        {
            DeckList.OrderedObjects(); //i think
            _saveRoot = await _thisState.RetrieveSinglePlayerGameAsync <CribbagePatienceSaveInfo>();

            if (_saveRoot.DeckList.Count > 0)
            {
                var newList = _saveRoot.DeckList.GetNewObjectListFromDeckList(DeckList);
                DeckPile !.OriginalList(newList);
                //not sure if we need this or not (?)
                //DeckPile.Visible = true;
            }
            //anything else that is needed to open the saved game will be here.
            _model !.StartPile !.SavedDiscardPiles(_saveRoot.StartCard !);
            _saveRoot.Load(Aggregator);
            _model.Scores !.Reload();
            var thisCategory = CalculateCurrentHandCategory();

            if (thisCategory == EnumHandCategory.Crib)
            {
                _model.Hand1 !.Visible    = false;
                _model.Hand1.Text         = "None"; //to stop from having problems on tablets.
                _model.TempCrib !.Visible = false;
                if (_model.DeckPile !.IsEndOfDeck())
                {
                    GameGoing = false;
                    await this.SendGameOverAsync();

                    //ThisMod.NewGameVisible = true;
                }
                return;
            }
            _model.Hand1 !.Visible = true;
            _model.Hand1.HandList.ReplaceRange(GetCards(thisCategory));
            _model.Hand1.HandList.Sort();
            _model.Hand1.Text = GetText(thisCategory);
            if (thisCategory == EnumHandCategory.Hand2)
            {
                _model.TempCrib !.HandList.ReplaceRange(GetCards(EnumHandCategory.Crib));
                _model.TempCrib.Visible = true;
            }
        }
 private async Task RestoreGameAsync()
 {
     _saveRoot = await _thisState.RetrieveSinglePlayerGameAsync <XPuzzleSaveInfo>();
 }