Exemplo n.º 1
0
 public EditSpeedTemplateHud(ScreenManager screenManager, Metronome metronome, Rectangle rect)
     : base(screenManager, metronome, rect)
 {
     // Initialize basic buttons "Ok" and "Close" that should be displayed on every HUD.
     var tmpButtons = new Button[mButtons.Length + 1];
     tmpButtons[0] = mButtons[0];
     tmpButtons[1] = mButtons[1];
     tmpButtons[2].mTexName = "Delete";
     tmpButtons[2].mState = OwnButtonState.Normal;
     tmpButtons[2].mAction = Delete;
     tmpButtons[2].mTextures = new Texture2D[3];
     tmpButtons[2].mRectangle = new Rectangle(mRectangle.Width + 5, mRectangle.Height + 5, 32, 32);
     mButtons = tmpButtons;
 }
Exemplo n.º 2
0
        public SideBar(ScreenManager screenManager, ContentManager content, Metronome metronome, Rectangle rect)
            : base(screenManager, metronome, rect)
        {
            mContent = content;
            // Initialize other screens
            const int width = 300;
            const int height = 200;
            var rectangle = new Rectangle(Game.mScreenWidth / 2 - width / 2, Game.mScreenHeight / 2 - height / 2, width, height);
            mCreateSpeedTemplateHud = new CreateSpeedTemplateHud(mScreenManager, mMetronome, rectangle);
            mCreateRudimentHud = new CreateRudimentHud(mScreenManager, mMetronome, rectangle);
            mEditSpeedTemplateHud = new EditSpeedTemplateHud(mScreenManager, mMetronome, rectangle);

            // Initialize Create buttons
            var labels = new[] {"New Template", "New Rudiment"};
            var actions = new MetronomeScreen.RunAction[] {CreateNewTemplate, CreateNewRudiment};
            mButtons = new Button[labels.Length + mMetronome.mSpeedTemplates.Count];
            for (var i = 0; i < labels.Length; i++)
            {
                mButtons[i].mLabel = labels[i];
                mButtons[i].mTexName = "TextButton";
                mButtons[i].mState = OwnButtonState.Normal;
                mButtons[i].mAction = actions[i];
                mButtons[i].mTextures = new Texture2D[3];
            }
            mButtons[0].mRectangle = new Rectangle(mRectangle.X + 10, mRectangle.Y + 40 + mMetronome.mSpeedTemplates.Count*30, 100, 25);
            mButtons[1].mRectangle = new Rectangle(mRectangle.X + 10, mButtons[0].mRectangle.Y + 80 + mMetronome.mRudiments.Count*30, 100, 25);
            // Initialize Speed Template buttons
            for (var i = 2; i - 2 < mMetronome.mSpeedTemplates.Count; i++)
            {
                mButtons[i].mLabel = mMetronome.mSpeedTemplates[i - 2].mName;
                mButtons[i].mTexName = "TextButtonBlue";
                mButtons[i].mState = OwnButtonState.Normal;
                mButtons[i].mParameterAction = StartTemplate;
                mButtons[i].mParameterActionRight = EditTemplate;
                mButtons[i].mParameter = i - 2;
                mButtons[i].mTextures = new Texture2D[3];
                mButtons[i].mRectangle = new Rectangle(10, 40 + (i - 2) * 30, 100, 20);
            }
        }
Exemplo n.º 3
0
 public CreateRudimentHud(ScreenManager screenManager, Metronome metronome, Rectangle rect)
     : base(screenManager, metronome, rect)
 {
     mButtons = new Button[0];
 }
Exemplo n.º 4
0
        public override void Update(GameTime gameTime, Input mouseInput, Input keyboardInput)
        {
            if (mCheckForChanges)
            {
                // Update the position of the buttons, in case a template or rudiment was added
                mButtons[0].mRectangle = new Rectangle(mRectangle.X + 10, mRectangle.Y + 40 + mMetronome.mSpeedTemplates.Count * 30, 100, 25);
                mButtons[1].mRectangle = new Rectangle(mRectangle.X + 10, mButtons[0].mRectangle.Y + 80 + mMetronome.mRudiments.Count * 30, 100, 25);

                // Update the buttons
                var tmpButtons = new Button[mMetronome.mSpeedTemplates.Count + 2];
                tmpButtons[0] = mButtons[0];
                tmpButtons[1] = mButtons[1];
                for (var i = 2; i - 2 < mMetronome.mSpeedTemplates.Count; i++)
                {
                    tmpButtons[i].mLabel = mMetronome.mSpeedTemplates[i - 2].mName;
                    tmpButtons[i].mTexName = "TextButtonBlue";
                    tmpButtons[i].mState = OwnButtonState.Normal;
                    tmpButtons[i].mParameterAction = StartTemplate;
                    tmpButtons[i].mParameterActionRight = EditTemplate;
                    tmpButtons[i].mParameter = i - 2;
                    tmpButtons[i].mTextures = mTextButtonTextures;
                    tmpButtons[i].mRectangle = new Rectangle(10, 40 + (i - 2) * 30, 100, 20);
                }
                mButtons = tmpButtons;
                mCheckForChanges = false;
            }

            base.Update(gameTime, mouseInput, keyboardInput);
        }