Ejemplo n.º 1
0
        public async Task StartGameAsync(Func <BuncoDiceGameSaveInfo, bool, DiceCup <SimpleDice> > loadCup)
        {
            if (await _thisState.CanOpenSavedSinglePlayerGameAsync() == true)
            {
                await ReloadGameAsync(loadCup);

                return;
            }
            _saveRoot            = _container.Resolve <BuncoDiceGameSaveInfo>();
            _saveRoot.PlayOrder  = (PlayOrderClass)_container.Resolve <IPlayOrder>(); //has to be here so they both use the same object.
            _saveRoot.PlayerList = new PlayerCollection <PlayerItem>();
            _saveRoot.PlayerList.LoadPlayers(1, 11);
            _saveRoot.PlayerList.FinishLoading(); //i think we will go ahead and shuffle the players.
            _saveRoot.PlayerList.ForEach(singleInfo =>
            {
                singleInfo.Buncos        = 0;
                singleInfo.Wins          = 0;
                singleInfo.Losses        = 0;
                singleInfo.PlayerNum     = -1;
                singleInfo.Points        = 0;
                singleInfo.WinDetermined = false;
                singleInfo.Acceptable    = false;
                singleInfo.PreviousMate  = -1;
                singleInfo.Team          = 0;
                singleInfo.Table         = 0;
                singleInfo.WonPrevious   = false;
            });
            _saveRoot.WhatSet          = 1;
            _saveRoot.WhatNumber       = 1;
            _saveRoot.ThisStats.Status = "Game In Progress";
            _cup = loadCup.Invoke(_saveRoot, false);
            await Aggregator.SendLoadAsync();

            await StartRoundAsync();
        }
        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();
        }
Ejemplo n.º 3
0
        public virtual async Task NewGameAsync() //so for eight off, can do other things like clear cards.
        {
            if (await _thisState.CanOpenSavedSinglePlayerGameAsync() && _opened == false)
            {
                await OpenSavedGameAsync();

                return;
            }
            ShuffleCards();
        }
        public async Task NewGameAsync()
        {
            _gameGoing = true;
            if (_opened == false)
            {
                _opened = true;
                if (await _thisState.CanOpenSavedSinglePlayerGameAsync())
                {
                    await RestoreGameAsync();

                    return;
                }
            }
        }
Ejemplo n.º 5
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 <bool> CanOpenSavedSinglePlayerGameAsync()
 {
     return(await _thisState.CanOpenSavedSinglePlayerGameAsync());
 }