Пример #1
0
        private void SetUpTeamPiles()
        {
            _mainGame !.SingleInfo = _mainGame.PlayerList !.GetSelf();
            if (_mainGame.SingleInfo.MainHandList.Any(items => items.CompleteCategory == EnumCompleteCategories.None))
            {
                throw new BasicBlankException("Cannot have category of none.  Rethink");
            }
            _pileGrid !.Children.Clear();
            int x = 0;

            _gameContainer.TeamList.ForEach(thisTeam =>
            {
                x++;
                Grid tempGrid   = new Grid();
                tempGrid.Margin = new Thickness(0, 0, 0, 5);
                Label ThisLabel = new Label();
                if (ScreenUsed == EnumScreen.SmallPhone)
                {
                    ThisLabel.FontSize = 8;
                    AddPixelRow(tempGrid, 12);
                    AddPixelRow(tempGrid, 68);
                }
                else
                {
                    AddAutoRows(tempGrid, 1);
                    AddLeftOverRow(tempGrid, 1);
                    if (ScreenUsed == EnumScreen.SmallTablet)
                    {
                        ThisLabel.FontSize = 12;
                    }
                    else
                    {
                        ThisLabel.FontSize = 20;
                    }
                }
                AddAutoColumns(tempGrid, 2);
                ThisLabel.Text           = thisTeam.Text;
                ThisLabel.TextColor      = Color.Aqua;
                ThisLabel.FontAttributes = FontAttributes.Bold;
                AddControlToGrid(tempGrid, ThisLabel, 0, 0);
                ThisLabel.HorizontalOptions = LayoutOptions.Center; // try this
                BasicMultiplePilesXF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsXF> thisDis = new BasicMultiplePilesXF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsXF>();
                thisDis.Init(thisTeam.CardPiles, "");
                thisDis.StartAnimationListener("team" + thisTeam.TeamNumber);
                AddControlToGrid(tempGrid, thisDis, 1, 0);
                SafetiesXF thisS = new SafetiesXF();
                thisS.Init(thisTeam, _mainGame, _gameContainer.Command);
                _disList.Add(thisDis);
                if (x == 1)
                {
                    AddControlToGrid(tempGrid, thisS, 0, 1);
                    Grid.SetRowSpan(thisS, 2);
                }
                else
                {
                    AddControlToGrid(tempGrid, thisS, 1, 1);
                }
                AddControlToGrid(_pileGrid, tempGrid, x - 1, 0);
            });
        }
        public PlayerPilesView(FlinchVMData model, FlinchGameContainer gameContainer, IEventAggregator aggregator)
        {
            StackLayout stack = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal
            };
            var player = gameContainer.PlayerList !.GetWhoPlayer();

            _discardGraphics = new BasicMultiplePilesXF <FlinchCardInformation, FlinchGraphicsCP, CardGraphicsXF>();
            _discardGraphics.Init(model.DiscardPiles !, "");
            _discardGraphics.StartAnimationListener("discard" + player.NickName);
            stack.Children.Add(_discardGraphics);
            _stockGraphics = new BasicMultiplePilesXF <FlinchCardInformation, FlinchGraphicsCP, CardGraphicsXF>();
            _stockGraphics.Init(model.StockPile !.StockFrame, ""); // i think
            _stockGraphics.StartAnimationListener("stock" + player.NickName);
            stack.Children.Add(_stockGraphics);
            _aggregator = aggregator;
            Content     = stack;
        }
Пример #3
0
        Task IHandleAsync <LoadEventModel> .HandleAsync(LoadEventModel message)
        {
            GamePackageViewModelBinder.ManuelElements.Clear(); //often times i have to add manually.


            _playerHandWPF !.LoadList(_model.PlayerHand1 !, ""); // i think
            _discardGPile !.Init(_model.Pile1 !, "");            // may have to be here (well see)
            _discardGPile.StartListeningDiscardPile();           // its the main one.

            _deckGPile !.Init(_model.Deck1 !, "");               // try here.  may have to do something else as well (?)
            _deckGPile.StartListeningMainDeck();

            FirstHookUp();
            _yourChocolatePiles !.Init(_gameContainer !.SingleInfo !.ChocolatePiles !, "");
            _yourStrawberryPiles !.Init(_gameContainer.SingleInfo.StrawberryPiles !, "");
            _yourChocolatePiles.StartAnimationListener(EnumMilkType.Chocolate + _gameContainer.SingleInfo.NickName);
            _yourStrawberryPiles.StartAnimationListener(EnumMilkType.Strawberry + _gameContainer.SingleInfo.NickName);
            _opponentChocolatePiles !.Init(_otherPlayer !.ChocolatePiles !, "");
            _opponentStrawberryPiles !.Init(_otherPlayer !.StrawberryPiles !, "");
            _opponentChocolatePiles.StartAnimationListener(EnumMilkType.Chocolate + _otherPlayer.NickName);
            _opponentStrawberryPiles.StartAnimationListener(EnumMilkType.Strawberry + _otherPlayer.NickName);

            return(this.RefreshBindingsAsync(_aggregator));
        }
        public SkipboMainView(IEventAggregator aggregator,
                              TestOptions test,
                              SkipboVMData model
                              )
        {
            _aggregator = aggregator;
            _model      = model;
            _aggregator.Subscribe(this);

            _deckGPile      = new BaseDeckXF <SkipboCardInformation, SkipboGraphicsCP, CardGraphicsXF>();
            _score          = new ScoreBoardXF();
            _playerHandWPF  = new BaseHandXF <SkipboCardInformation, SkipboGraphicsCP, CardGraphicsXF>();
            _publicGraphics = new BasicMultiplePilesXF <SkipboCardInformation, SkipboGraphicsCP, CardGraphicsXF>();
            StackLayout             mainStack = new StackLayout();
            ParentSingleUIContainer?restoreP  = null;

            if (test.SaveOption == EnumTestSaveCategory.RestoreOnly)
            {
                restoreP = new ParentSingleUIContainer(nameof(SkipboMainViewModel.RestoreScreen));
            }

            StackLayout otherStack = new StackLayout();

            otherStack.Orientation = StackOrientation.Horizontal;
            otherStack.Children.Add(_deckGPile);
            otherStack.Children.Add(_publicGraphics);
            mainStack.Children.Add(otherStack);
            _score.AddColumn("In Stock", false, nameof(SkipboPlayerItem.InStock));
            int x;

            for (x = 1; x <= 4; x++) //has to change for flinch.
            {
                var thisStr = "Discard" + x;
                _score.AddColumn(thisStr, false, thisStr);
            }
            _score.AddColumn("Stock Left", false, nameof(SkipboPlayerItem.StockLeft));
            _score.AddColumn("Cards Left", false, nameof(SkipboPlayerItem.ObjectCount)); //very common.
            SimpleLabelGridXF firstInfo = new SimpleLabelGridXF();

            firstInfo.AddRow("RS Cards", nameof(SkipboMainViewModel.CardsToShuffle));
            firstInfo.AddRow("Turn", nameof(SkipboMainViewModel.NormalTurn));
            firstInfo.AddRow("Status", nameof(SkipboMainViewModel.Status));


            mainStack.Children.Add(_playerHandWPF);
            ParentSingleUIContainer parent = new ParentSingleUIContainer(nameof(SkipboMainViewModel.PlayerPilesScreen));

            mainStack.Children.Add(parent);
            mainStack.Children.Add(firstInfo.GetContent);
            mainStack.Children.Add(_score);


            _deckGPile.Margin = new Thickness(5, 5, 5, 5);


            if (restoreP != null)
            {
                mainStack.Children.Add(restoreP);                    //default add to grid but does not have to.
            }
            GamePackageViewModelBinder.ManuelElements.Clear();       //often times i have to add manually.

            SkipboSaveInfo save = cons !.Resolve <SkipboSaveInfo>(); //usually needs this part for multiplayer games.

            _score !.LoadLists(save.PlayerList);
            _playerHandWPF !.LoadList(_model.PlayerHand1 !, ""); // i think

            _deckGPile !.Init(_model.Deck1 !, "");               // try here.  may have to do something else as well (?)
            _deckGPile.StartListeningMainDeck();
            _publicGraphics !.Init(_model.PublicPiles !, "");    // i think
            _publicGraphics.StartAnimationListener("public");
            Content = mainStack;
        }