コード例 #1
0
        void music_LeftClickEvent(object sender, EventArgs e)
        {
            if (OptionsState == TowerDefense.OptionsState.Normal)
            {
                Button b = sender as Button;
                b.Texture = activeButtonTexture;
                Vector2 pos = new Vector2((int)(musicBlock.Dimensions.Left + b.Texture.Width), (int)(musicBlock.Dimensions.Top + b.Texture.Height));
                b.Position            = pos;
                b.ButtonText.Position = new Vector2(pos.X - (b.Texture.Width / 2) + 10, pos.Y - (b.Texture.Height / 2));
                b.SetColor(Selected);

                musicBlock.GetText("MusicInstructions").Value    = "Press the Up or Down arrow keys to change the value.\nClick the button again to deselect.";
                musicBlock.GetText("MusicInstructions").Position = new Vector2(b.Rectangle.Right + 10, b.ButtonText.Position.Y);

                OptionsState = TowerDefense.OptionsState.Music;
            }
            else if (OptionsState == TowerDefense.OptionsState.Music)
            {
                Button b = sender as Button;
                b.Texture = inactiveButtonTexture;
                Vector2 pos = new Vector2((int)(musicBlock.Dimensions.Left + b.Texture.Width), (int)(musicBlock.Dimensions.Top + b.Texture.Height));
                b.Position            = pos;
                b.ButtonText.Position = new Vector2(pos.X - (b.Texture.Width / 2) + 10, pos.Y - (b.Texture.Height / 2));
                b.SetColor(Normal);

                musicBlock.GetText("MusicInstructions").Value    = "Select the Music button to change settings";
                musicBlock.GetText("MusicInstructions").Position = new Vector2(b.Position.X + (b.Texture.Width / 2) + 10, b.ButtonText.Position.Y);

                OptionsState = TowerDefense.OptionsState.Normal;
            }
        }