public void onInit(BaseGameScreen parent) { this.parent = parent; aboutBackground = resourceManager.GetResource<Texture2D>(Shared.Resources.BackgroundPause); controlManager = new UIControlManager(Game, DefaultGestureHandlingFactory.Instance); Global.GestureManager.AddDispatcher(controlManager); btnReplay = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnReplay), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnOver)); btnReplay.Canvas.Bound.Position = new Vector2(199.0f, 229.0f); btnReplay.FitSizeByImage(); btnResume = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnResume), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnOver)); btnResume.Canvas.Bound.Position = new Vector2(348.0f, 229.0f); btnResume.FitSizeByImage(); btnMenu = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnMenu), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnOver)); btnMenu.Canvas.Bound.Position = new Vector2(505.0f, 229.0f); btnMenu.FitSizeByImage(); btnReplay.OnPressed += new ButtonEventHandler(btnReplay_OnPressed); btnResume.OnPressed += new ButtonEventHandler(btnResume_OnPressed); btnMenu.OnPressed += new ButtonEventHandler(btnMenu_OnPressed); controlManager.Add(btnReplay); controlManager.Add(btnResume); controlManager.Add(btnMenu); }
public void onInit() { this.Name = Shared.Macros.S_MENU; controlManager = new UIControlManager(Game, DefaultGestureHandlingFactory.Instance); Global.GestureManager.AddDispatcher(controlManager); background = resourceManager.GetResource<Texture2D>(Shared.Resources.BackgroundMenu); btnPlay = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnPlay), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnPlayOver)); btnPlay.Canvas.Bound.Position = new Vector2(662.0f, 68.0f); btnPlay.FitSizeByImage(); btnSoundOn = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnSound), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnSoundOver)); btnSoundOn.Canvas.Bound.Position = new Vector2(512.0f, 129.0f); btnSoundOn.FitSizeByImage(); btnSoundOff = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnMute), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnMuteOver)); btnSoundOff.Canvas.Bound.Position = new Vector2(512.0f, 129.0f); btnSoundOff.FitSizeByImage(); btnAbout = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnAbout), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnAbout)); btnAbout.Canvas.Bound.Position = new Vector2(627.0f, 185.0f); btnAbout.FitSizeByImage(); btnHelp = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnHelp), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnHelp)); btnHelp.Canvas.Bound.Position = new Vector2(666.0f, 244.0f); btnHelp.FitSizeByImage(); // Init event btnPlay.OnPressed += new ButtonEventHandler(btnPlay_OnPressed); btnSoundOn.OnPressed += new ButtonEventHandler(btnOption_OnPressed); btnSoundOff.OnPressed += new ButtonEventHandler(btnOption_OnPressed); btnAbout.OnPressed += new ButtonEventHandler(btnAbout_OnPressed); btnHelp.OnPressed += new ButtonEventHandler(btnHelp_OnPressed); controlManager.Add(btnPlay); controlManager.Add(btnSoundOn); controlManager.Add(btnSoundOff); controlManager.Add(btnAbout); controlManager.Add(btnHelp); if (s_background == null) { s_background = (SCSEngine.Audio.Sound)resourceManager.GetResource<SCSEngine.Audio.Sound>(Shared.Resources.Sound_Background_1); services.AudioManager.StopSound(s_background); } updateButtonSound(Global.isMusicOff); }
public void onInit() { // Get the number of map for initialize menu choose level Global.GetNumberOfMap(); // Save this name this.Name = Shared.Macros.S_CHOOSEGAME; background = resourceManager.GetResource<Texture2D>(Shared.Resources.BackgroundMode); // Create UI manager for button next & previous controlManager = new UIControlManager(Game, DefaultGestureHandlingFactory.Instance); Global.GestureManager.AddDispatcher(controlManager); // Create button btnAdventure = new Button(this.Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnAdventure), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnAdventureOver)); btnAdventure.Canvas.Bound.Position = new Vector2(512.0f, 219.0f); btnAdventure.FitSizeByImage(); btnBomb = new Button(this.Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnBomb), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnBombOver)); btnBomb.Canvas.Bound.Position = new Vector2(599.0f, 280.0f); btnBomb.FitSizeByImage(); btnTime = new Button(this.Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnTime), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnTimeOver)); btnTime.Canvas.Bound.Position = new Vector2(610.0f, 158.0f); btnTime.FitSizeByImage(); btnAdventure.OnPressed += new ButtonEventHandler(btnAdventure_OnPressed); btnBomb.OnPressed += new ButtonEventHandler(btnBomb_OnPressed); btnTime.OnPressed += new ButtonEventHandler(btnTime_OnPressed); controlManager.Add(btnAdventure); controlManager.Add(btnBomb); controlManager.Add(btnTime); // Reset to first page Global.CurrentPage = 0; }
public void onInit() { services = (SCSServices)Game.Services.GetService(typeof(SCSServices)); resourceManager = (IResourceManager)Game.Services.GetService(typeof(IResourceManager)); controller = new Controller(Game); controller.onInit(); btnSpace = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.ctrlButtonSpace), resourceManager.GetResource<Texture2D>(Shared.Resources.ctrlButtonSpace)); btnSpace.Canvas.Bound.Position = new Vector2(622, 392); btnSpace.FitSizeByImage(); controller.OnLeftFreeTap += new ControlEventHandler(btnUp_OnLeftFreeTap); controller.OnRightFreeTap += new ControlEventHandler(controller_OnRightFreeTap); controller.OnUpFreeTap += new ControlEventHandler(controller_OnUpFreeTap); controller.OnDownFreeTap += new ControlEventHandler(controller_OnDownFreeTap); btnSpace.OnPressed += new ButtonEventHandler(btnSpace_onClick); dispatcher.AddTarget(controller); controlManager.Add(btnSpace); }
public void onInit() { SaveLoadGame.LoadLevel(Global.CurrentMode, out currentLevel); // Get the number of map for initialize menu choose level Global.GetNumberOfMap(); // Save this name this.Name = Shared.Macros.S_CHOOSEGAME; // Loading background background = resourceManager.GetResource<Texture2D>(Shared.Resources.BackgroundChooseGame); // Create UI manager for button next & previous controlManager = new UIControlManager(Game, DefaultGestureHandlingFactory.Instance); Global.GestureManager.AddDispatcher(controlManager); // Dispatcher for menu item dispatcher = DefaultGestureHandlingFactory.Instance.CreateDispatcher(); Global.GestureManager.AddDispatcher(dispatcher); // Init button next page and previous page btnNext = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnNext), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnNext)); btnNext.Canvas.Bound.Position = new Vector2(708.0f, 110.0f); btnNext.FitSizeByImage(); btnNext.Visible = true; btnPrev = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnPrev), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnPrev)); btnPrev.Canvas.Bound.Position = new Vector2(-8.0f, 110.0f); btnPrev.FitSizeByImage(); btnPrev.Visible = false; btnNext.OnPressed += new ButtonEventHandler(btnNext_OnPressed); btnPrev.OnPressed += new ButtonEventHandler(btnPrev_OnPressed); controlManager.Add(btnNext); controlManager.Add(btnPrev); // Load font tile font = (SpriteFont)resourceManager.GetResource<SpriteFont>(Shared.Resources.Choose_TileFont); // Reset to first page Global.CurrentPage = 0; // Init first page onChangePage(); s_background = (SCSEngine.Audio.Sound)resourceManager.GetResource<SCSEngine.Audio.Sound>(Shared.Resources.Sound_Background_5); s_background.IsLooped = true; services.AudioManager.PlaySound(s_background, Global.isMusicOff, Global.isMusicZuneOff); }
public void onInit(BaseGameScreen parent) { this.parent = parent; aboutBackground = resourceManager.GetResource<Texture2D>(Shared.Resources.BackgroundWin); controlManager = new UIControlManager(Game, DefaultGestureHandlingFactory.Instance); Global.GestureManager.AddDispatcher(controlManager); btnReplay = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnReplay), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnOver)); btnReplay.Canvas.Bound.Position = new Vector2(516f, 352f); btnReplay.FitSizeByImage(); btnMenu = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnMenu), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnOver)); btnMenu.Canvas.Bound.Position = new Vector2(223f, 352f); btnMenu.FitSizeByImage(); btnReplay.OnPressed += new ButtonEventHandler(btnReplay_OnPressed); btnMenu.OnPressed += new ButtonEventHandler(btnMenu_OnPressed); controlManager.Add(btnReplay); controlManager.Add(btnMenu); // Exception for Next button, prevent choice next map when next map not available if (Convert.ToInt32(Global.CurrentMap) + 1 < Global.NumberOfMap) { btnNext = new Button(Game, services.SpriteBatch, resourceManager.GetResource<Texture2D>(Shared.Resources.BtnNextGame), resourceManager.GetResource<Texture2D>(Shared.Resources.BtnOver)); btnNext.Canvas.Bound.Position = new Vector2(370f, 352f); btnNext.FitSizeByImage(); btnNext.OnPressed += new ButtonEventHandler(btnNext_OnPressed); controlManager.Add(btnNext); } String gameType = ""; if (parent is BasicGameScene) { gameType = SaveLoadGame.GAME_SCORE_BASIC; currentScore = Global.Counter_Scores + Global.TotalCoin * 50 + (1000 - (long)Global.Counter_Time); } else if(parent is MiniGameLimitBomb) { gameType = SaveLoadGame.GAME_SCORE_BOMB; currentScore = Global.Bomb_Number; } else { gameType = SaveLoadGame.GAME_SCORE_TIME; currentScore = Global.Counter_Time; } SaveLoadGame.LoadGameScore(gameType, Convert.ToInt32(Global.CurrentMap), out lastScore); if (lastScore <= currentScore) { SaveLoadGame.SaveGameScore(gameType, Convert.ToInt32(Global.CurrentMap), currentScore); newHighScore = resourceManager.GetResource<Texture2D>(Shared.Resources.NewHighScore); newHighScorePos = new Vector2(486f, 24f); scoreFont = resourceManager.GetResource<SpriteFont>("Score"); scorePos = new Vector2(300f, 210f); } SaveLoadGame.SaveLevel(Global.CurrentMode, Convert.ToInt32(Global.CurrentMap) + 1); }