// Button event do protected void SetSceneComponents() { this.uiManager = new UIControlManager(this.Game, DefaultGestureHandlingFactory.Instance); this.gestureManager.AddDispatcher(this.uiManager); this.Components.Add(this.uiManager); this.spriteBatch = SCSServices.Instance.SpriteBatch; this.background = SCSServices.Instance.ResourceManager.GetResource<Texture2D>("Images\\Controls\\MainMenu"); start = new Button(this.Game, this.spriteBatch, SCSServices.Instance.ResourceManager.GetResource<Texture2D>("Images\\Controls\\MStartGame"), SCSServices.Instance.ResourceManager.GetResource<Texture2D>("Images\\Controls\\MStartGameOver")); start.FitSizeByImage(); start.Canvas.Bound.Position = new Vector2(60f, 380f); start.OnTouched += this.start_Clicked; this.uiManager.Add(start); option = new Button(this.Game, this.spriteBatch, SCSServices.Instance.ResourceManager.GetResource<Texture2D>("Images\\Controls\\MOption"), SCSServices.Instance.ResourceManager.GetResource<Texture2D>("Images\\Controls\\MOptionOver")); option.FitSizeByImage(); option.Canvas.Bound.Position = new Vector2(300f, 370f); option.OnTouched += this.option_Clicked; this.uiManager.Add(option); help = new Button(this.Game, this.spriteBatch, SCSServices.Instance.ResourceManager.GetResource<Texture2D>("Images\\Controls\\MHelp"), SCSServices.Instance.ResourceManager.GetResource<Texture2D>("Images\\Controls\\MHelpOver")); help.FitSizeByImage(); help.Canvas.Bound.Position = new Vector2(435f, 415f); help.OnTouched += this.help_Clicked; this.uiManager.Add(help); quit = new Button(this.Game, this.spriteBatch, SCSServices.Instance.ResourceManager.GetResource<Texture2D>("Images\\Controls\\MQuitGame"), SCSServices.Instance.ResourceManager.GetResource<Texture2D>("Images\\Controls\\MQuitGameOver")); quit.FitSizeByImage(); quit.Canvas.Bound.Position = new Vector2(680f, 450f); quit.OnTouched += this.quit_Clicked; this.uiManager.Add(quit); }
public override void Initialize() { this.waitList = new PvZChooseList(this.Game, ButtonWidth, ButtonHeight, ButtonPadding, this.uiManager); this.chosenList = new PvZChooseList(this.Game, ButtonWidth, ButtonHeight, ButtonPadding, this.uiManager); this.waitList.Canvas.Bound.Position = new Vector2(outsidePosition, 150); this.waitList.Canvas.Bound.Size = new Vector2(480, 200); this.waitList.Canvas.Content.Position = new Vector2(20, 40); this.waitList.Canvas.Content.Size = new Vector2(430, 150); this.waitList.Background = SCSServices.Instance.ResourceManager.GetResource<ISprite>("ChoosePlant"); this.chosenList.Canvas.Bound.Position = new Vector2(outsidePosition, 400); this.chosenList.Canvas.Bound.Size = new Vector2(460, 70); this.chosenList.Canvas.Content.Position = new Vector2(90, 5); this.chosenList.Canvas.Content.Size = new Vector2(440, 56); this.chosenList.Background = SCSServices.Instance.ResourceManager.GetResource<ISprite>("BuyPlant"); foreach (var buttonF in this.buttonFB) { var chButton = buttonF.Value.CreateChooseButton(this.Game); chButton.OnTap += this.OnChooseButtonInWaitListTapped; this.waitList.AddChooseButton(chButton); } this.waitList.ReArrange(); this.uiManager.Add(this.waitList); this.uiManager.Add(this.chosenList); this.readyButton = new Button(this.Game, SCSServices.Instance.SpriteBatch, SCSServices.Instance.ResourceManager.GetResource<Texture2D>("Ready"), SCSServices.Instance.ResourceManager.GetResource<Texture2D>("ReadyOver")); readyButton.IsOverlay = true; readyButton.FitSizeByImage(); readyButton.Canvas.Bound.Position = new Vector2(outsidePosition + readyButtonMargin, 360f); readyButton.OnTouched += this.OnReadyButtonTouched; this.uiManager.Add(readyButton); this.state = ChooseSystemState.OUTSIDE; base.Initialize(); }