当前位置: 首页>>代码示例>>C#>>正文


C# Button.FitSizeByImage方法代码示例

本文整理汇总了C#中Button.FitSizeByImage方法的典型用法代码示例。如果您正苦于以下问题:C# Button.FitSizeByImage方法的具体用法?C# Button.FitSizeByImage怎么用?C# Button.FitSizeByImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Button的用法示例。


在下文中一共展示了Button.FitSizeByImage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: onInit

        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);
        }
开发者ID:doanhtdpl,项目名称:boom-game,代码行数:29,代码来源:PauseScene.cs

示例2: onInit

        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);
        }
开发者ID:doanhtdpl,项目名称:boom-game,代码行数:49,代码来源:MenuScene.cs

示例3: onInit

        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;
        }
开发者ID:doanhtdpl,项目名称:boom-game,代码行数:38,代码来源:GameModeScene.cs

示例4: onInit

        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);
        }
开发者ID:doanhtdpl,项目名称:boom-game,代码行数:23,代码来源:DefaultInputLayer.cs

示例5: onInit

        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);
        }
开发者ID:doanhtdpl,项目名称:boom-game,代码行数:51,代码来源:ChooseGame.cs

示例6: onInit

        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);
        }
开发者ID:doanhtdpl,项目名称:boom-game,代码行数:65,代码来源:WinScene.cs


注:本文中的Button.FitSizeByImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。