Пример #1
0
        public PlayerPilesViewModel(CommandContainer commandContainer, FlinchGameContainer gameContainer, FlinchVMData model, FlinchMainGameClass mainGame)
        {
            gameContainer.SingleInfo = gameContainer.PlayerList !.GetWhoPlayer();
            CommandContainer         = commandContainer;
            _model    = model;
            _mainGame = mainGame;
            _model.StockPile.ClearCards();
            //model.StockPile = new Piles.StockViewModel(commandContainer, gameContainer.Aggregator);
            gameContainer.SingleInfo !.StockList.ForEach(x =>
            {
                model.StockPile.AddCard(x);
            });

            //model.StockPile.StockFrame.PileList!.ReplaceRange(gameContainer.SingleInfo!.StockList);

            _model.DiscardPiles = new DiscardPilesVM <FlinchCardInformation>(commandContainer, gameContainer.Aggregator);
            _model.DiscardPiles.Init(HowManyDiscards);
            if (gameContainer.SingleInfo !.DiscardList.Count > 0)
            {
                model.DiscardPiles !.PileList !.ReplaceRange(gameContainer.SingleInfo.DiscardList);
            }

            _model.DiscardPiles.PileClickedAsync += DiscardPiles_PileClickedAsync;
            _model.StockPile !.StockClickedAsync += StockPile_StockClickedAsync;
        }
        private readonly FlinchGameContainer _gameContainer; //if not needed, delete.

        public FlinchMainViewModel(CommandContainer commandContainer,
                                   FlinchMainGameClass mainGame,
                                   FlinchVMData viewModel,
                                   BasicData basicData,
                                   TestOptions test,
                                   IGamePackageResolver resolver,
                                   FlinchGameContainer gameContainer
                                   )
            : base(commandContainer, mainGame, viewModel, basicData, test, resolver)
        {
            _mainGame      = mainGame;
            _model         = viewModel;
            _resolver      = resolver;
            _gameContainer = gameContainer;
            _model.Deck1.NeverAutoDisable       = true;
            _model.PlayerHand1.Maximum          = 5;
            _gameContainer.LoadPlayerPilesAsync = LoadPlayerPilesAsync;
        }
        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;
        }
 } = new CustomBasicList <ComputerData>();                                                                //the computer ai needs it.
 public FlinchMainGameClass(IGamePackageResolver mainContainer,
                            IEventAggregator aggregator,
                            BasicData basicData,
                            TestOptions test,
                            FlinchVMData currentMod,
                            IMultiplayerSaveState state,
                            IAsyncDelayer delay,
                            ICardInfo <FlinchCardInformation> cardInfo,
                            CommandContainer command,
                            FlinchGameContainer gameContainer,
                            FlinchComputerAI ai
                            )
     : base(mainContainer, aggregator, basicData, test, currentMod, state, delay, cardInfo, command, gameContainer)
 {
     _model         = currentMod;
     _command       = command;
     _gameContainer = gameContainer;
     _ai            = ai;
     _model.PublicPiles.PileClickedAsync += PublicPiles_PileClickedAsync;
     _gameContainer.IsValidMove           = IsValidMove;
 }
 public FlinchComputerAI(FlinchGameContainer gameContainer, FlinchVMData model)
 {
     _gameContainer = gameContainer;
     _model         = model;
 }