public PvZGrowList(Game game, float elemWidth, float elemPadding, UIControlManager uiManager, IPvZGameCurrency currSys, IPvZGameGrow gg)
     : base(game)
 {
     this.ElementWidth = elemWidth;
     this.spritePlayer = ((SCSServices)game.Services.GetService(typeof(SCSServices))).SpritePlayer;
     this.uiManager = uiManager;
     this.currencySystem = currSys;
     this.gameGrow = gg;
 }
        private void InitGamePlay()
        {
            PZObjectManager.Instance.RemoveAllObject();

            this.dispatcher = DefaultGestureHandlingFactory.Instance.CreateDispatcher();
            gm.AddDispatcher(this.dispatcher);

            this.uiControlManager = new UIControlManager(this.Game, DefaultGestureHandlingFactory.Instance);
            gm.AddDispatcher(this.uiControlManager);
            this.Components.Add(this.uiControlManager);

            //
            // Sun system
            _sunSystem = new PvZSunSystem(this.Game, 50, this.dispatcher);
            SCSServices.Instance.Game.Services.RemoveService(typeof(PvZSunSystem));
            SCSServices.Instance.Game.Services.AddService(typeof(PvZSunSystem), _sunSystem);
            this.Components.Add(_sunSystem);

            this.gameGrow = new PvZGameGrow(this.gameBoard);

            var chooseSys = new PvZChooseSystem(this.Game, this.growSystem.ButtonFactoryBank, this.uiControlManager, _sunSystem, level.NumberOfPlants);
            chooseSys.Initialize();
            chooseSys.OnCameOut += this.OnChooseSystemCompleted;
            this.Components.Add(chooseSys);
            chooseSys.ComeIn();
        }
 public PvZGrowSystem(Game game, IPvZGameGrow gameGrow)
 {
     this.game = game;
     this.shadowFB = new PvZPlantShadowFactoryBank(this.game, gameGrow);
     this.buttonFB = new PvZGrowButtonFactoryBank(this.shadowFB);
 }
        public PvZGrowList MakeGrowList(IPvZGameGrow gameGrow)
        {
            var growList = new PvZGrowList(this.Game, this.chosenList.ElementWidth, this.chosenList.ElemPad, this.uiManager, _currency, gameGrow);
            growList.Canvas.Bound.Alter(this.chosenList.Canvas.Bound);
            growList.Canvas.Content.Alter(this.chosenList.Canvas.Content);
            growList.Background = this.chosenList.Background;

            foreach (var button in this.chosenList.ChooseButtons)
            {
                growList.AddGrowButton(this.buttonFB[button.Name].CreateButton(this.Game));
            }

            return growList;
        }