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(); }
private void InitGamePlayAtLevel() { level = PZLevelManager.Instance.GetLevel(m_level); IGestureDispatcher dp = DefaultGestureHandlingFactory.Instance.CreateDispatcher(); gm.AddDispatcher(dp); 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, dp); SCSServices.Instance.Game.Services.RemoveService(typeof(PvZSunSystem)); SCSServices.Instance.Game.Services.AddService(typeof(PvZSunSystem), _sunSystem); this.Components.Add(_sunSystem); this.growSystem = new PvZGrowSystem(this.Game, new PvZGameGrow(gameBoard)); this.growSystem.Deserialize(XmlSerialization.Instance.Deserialize(new FileStream(@"Xml\PlantGrowButtons.xml", FileMode.Open, FileAccess.Read))); var chooseSys = new PvZChooseSystem(this.Game, this.growSystem.ButtonFactoryBank, this.uiControlManager, _sunSystem); chooseSys.Initialize(); chooseSys.OnCameOut += this.OnChooseSystemCompleted; this.Components.Add(chooseSys); chooseSys.ComeIn(); }