Esempio n. 1
0
        protected override void Initialize(UIAdvPanel WindowPanel)
        {
            _spectrumAnalyzer                = new SpectrumAnalyzer();
            musicPlayer.OnProgressUpdate    += MusicPlayer_OnProgressUpdate;
            musicPlayer.OnSongPicLoaded     += MusicPlayer_OnSongPicLoaded;
            musicPlayer.OnFFTCalculated     += MusicPlayer_OnFFTCalculated;
            musicPlayer.OnMaximumCalculated += MusicPlayer_OnMaximumCalculated;
            base.Initialize(WindowPanel);
            WindowPanel.MainTexture = MusicBox.ModTexturesTable["AdvInvBack1"];
            WindowPanel.SetPadding(0);
            WindowPanel.Left.Set(Main.screenWidth / 2 - UI_PANEL_WIDTH / 2, 0f);
            WindowPanel.Top.Set(Main.screenHeight / 2 - UI_PANEL_HEIGHT / 2, 0f);
            WindowPanel.Width.Set(UI_PANEL_WIDTH, 0f);
            WindowPanel.Height.Set(UI_PANEL_HEIGHT, 0f);
            WindowPanel.Color      = Color.White;
            WindowPanel.CornerSize = 12;


            _progressBar = new UIBar();
            _progressBar.SetPadding(0);
            _progressBar.Top.Set(100f, 0.5f);
            _progressBar.Left.Set(-UI_BAR_WIDTH / 2 + UI_BAR_LEFT_OFFSET, 0.5f);
            _progressBar.Width.Set(UI_BAR_WIDTH, 0f);
            _progressBar.Height.Set(UI_BAR_HEIGHT, 0f);
            _progressBar.BarFrameTex           = MusicBox.ModTexturesTable["BarFrame"];
            _progressBar.BarFillTex            = MusicBox.ModTexturesTable["BarFiller"];
            _progressBar.BarFrameTexCornerSize = new Vector2(6, 6);
            _progressBar.FillerDrawOffset      = new Vector2(6, 6);
            _progressBar.FillerSize            = new Vector2(UI_BAR_WIDTH - 12, 6);
            WindowPanel.Append(_progressBar);

            _playButton         = new UIPicButton();
            _playButton.Texture = MusicBox.ModTexturesTable["PlayButtonN"];
            _playButton.Top.Set(135f - 15f, 0.5f);
            _playButton.Left.Set(-15 + UI_BAR_LEFT_OFFSET, 0.5f);
            _playButton.Width.Set(30, 0f);
            _playButton.Height.Set(30, 0f);
            _playButton.OnMouseHover += _playButton_OnMouseHover;
            _playButton.OnMouseOut   += _playButton_OnMouseOut;
            _playButton.OnClick      += _playButton_OnClick;
            WindowPanel.Append(_playButton);

            _playSlider         = new UISliderH();
            _playSlider.Texture = MusicBox.ModTexturesTable["PlaySliderN"];
            _playSlider.Top.Set(0, 0f);
            _playSlider.Left.Set(0, 0f);
            _playSlider.Width.Set(30, 0f);
            _playSlider.Height.Set(30, 0f);
            _playSlider.StartX         = 6f;
            _playSlider.EndX           = UI_BAR_WIDTH - 6;
            _playSlider.Scale          = 1.35f;
            _playSlider.OnValueChange += _playSlider_OnValueChange;
            _playSlider.OnMouseOver   += _playSlider_OnMouseOver;
            _playSlider.OnMouseOut    += _playSlider_OnMouseOut;
            _progressBar.Append(_playSlider);

            _volumeSlider         = new UISliderV();
            _volumeSlider.Texture = MusicBox.ModTexturesTable["PlaySliderN"];
            _volumeSlider.Top.Set(200f, 0f);
            _volumeSlider.Left.Set(-50f, 1f);
            _volumeSlider.Width.Set(30, 0f);
            _volumeSlider.Height.Set(30, 0f);
            _volumeSlider.StartY         = 200f;
            _volumeSlider.EndY           = 160f;
            _volumeSlider.Scale          = 1.35f;
            _volumeSlider.OnValueChange += _volumeSlider_OnValueChange;
            _volumeSlider.OnMouseOver   += _volumeSlider_OnMouseOver;
            _volumeSlider.OnMouseOut    += _volumeSlider_OnMouseOut;
            _volumeSlider.DragSync       = true;
            _volumeSlider.PreDraw       += (s, sb) =>
            {
                sb.Draw(MusicBox.ModTexturesTable["Box"], new Rectangle((int)(WindowPanel.GetInnerDimensions().X + WindowPanel.GetInnerDimensions().Width) - 37,
                                                                        (int)WindowPanel.GetInnerDimensions().Y + 160 - 5, 4, 50), Color.Gray * 0.5f);
                //Drawing.DrawAdvBox(sb, new Rectangle((int)(WindowPanel.GetInnerDimensions().X + WindowPanel.GetInnerDimensions().Width) - 50 - 2,
                //		(int)WindowPanel.GetInnerDimensions().Y + 200 - 2, 8, 44), Color.Gray, MusicBox.ModTexturesTable["Box"], new Vector2(8, 8));
            };
            WindowPanel.Append(_volumeSlider);

            _forwardButton         = new UIPicButton();
            _forwardButton.Texture = MusicBox.ModTexturesTable["ForwardButtonN"];
            _forwardButton.Top.Set(135f - 15f, 0.5f);
            _forwardButton.Left.Set(30f + UI_BAR_LEFT_OFFSET, 0.5f);
            _forwardButton.Width.Set(30, 0f);
            _forwardButton.Height.Set(30, 0f);
            _forwardButton.OnMouseHover += _forwardButton_OnMouseHover;
            _forwardButton.OnMouseOut   += _forwardButton_OnMouseOut;
            _forwardButton.OnClick      += _forwardButton_OnClick;
            WindowPanel.Append(_forwardButton);


            _backwardButton         = new UIPicButton();
            _backwardButton.Texture = MusicBox.ModTexturesTable["BackwardButtonN"];
            _backwardButton.Top.Set(135f - 15f, 0.5f);
            _backwardButton.Left.Set(-60f + UI_BAR_LEFT_OFFSET, 0.5f);
            _backwardButton.Width.Set(30, 0f);
            _backwardButton.Height.Set(30, 0f);
            _backwardButton.OnMouseHover += _backwardButton_OnMouseHover;
            _backwardButton.OnMouseOut   += _backwardButton_OnMouseOut;
            _backwardButton.OnClick      += _backwardButton_OnClick;
            WindowPanel.Append(_backwardButton);

            _songTexture = MusicBox.ModTexturesTable["AdvInvBack1"];
            _songImage   = new UIFixedImage(_songTexture);
            _songImage.Top.Set(60f, 0.5f);
            _songImage.Left.Set(-UI_BAR_WIDTH / 2 + UI_BAR_LEFT_OFFSET - 110f, 0.5f);
            _songImage.Width.Set(90f, 0f);
            _songImage.Height.Set(90f, 0f);
            WindowPanel.Append(_songImage);
        }