コード例 #1
0
        public GuiScreenEditor() : base(0, EditorWindow.Instance.ClientSize.Height - 64, EditorWindow.Instance.ClientSize.Width - 512 - 64, 64)
        {
            _toast = new GuiLabel(0, 0, "")
            {
                Centered = true,
                FontSize = 36
            };

            var playPause = new GuiButtonPlayPause(0, EditorWindow.Instance.ClientSize.Width - 512 - 64, EditorWindow.Instance.ClientSize.Height - 64, 64, 64);

            Bpm = new GuiTextBox(0, 0, 128, 32)
            {
                Text     = "0",
                Centered = true,
                Numeric  = true,
                Decimal  = true
            };
            Offset = new GuiTextBox(0, 0, 128, 32)
            {
                Text          = "0",
                Centered      = true,
                Numeric       = true,
                CanBeNegative = true
            };
            Reposition      = new GuiCheckBox(1, "Offset Notes", 10, 0, 32, 32, false);
            BeatSnapDivisor = new GuiSlider(0, 0, 256, 40);
            Timeline        = new GuiSliderTimeline(0, 0, EditorWindow.Instance.ClientSize.Width, 64);
            Tempo           = new GuiSlider(0, 0, 512, 64)
            {
                MaxValue = 8,
                Value    = 8
            };

            Timeline.Snap            = false;
            BeatSnapDivisor.Value    = Track.BeatDivisor - 1;
            BeatSnapDivisor.MaxValue = 23;

            MasterVolume = new GuiSlider(0, 0, 40, 256)
            {
                MaxValue = 50
            };
            SfxVolume = new GuiSlider(0, 0, 40, 256)
            {
                MaxValue = 50
            };

            SetOffset  = new GuiButton(2, 0, 0, 64, 32, "SET");
            BackButton = new GuiButton(3, 0, 0, Grid.ClientRectangle.Width + 1, 42, "BACK TO MENU");
            CopyButton = new GuiButton(4, 0, 0, Grid.ClientRectangle.Width + 1, 42, "COPY MAP DATA");

            Autoplay          = new GuiCheckBox(5, "Autoplay", 0, 0, 32, 32, Settings.Default.Autoplay);
            ApproachSquares   = new GuiCheckBox(5, "Approach Squares", 0, 0, 32, 32, Settings.Default.ApproachSquares);
            GridNumbers       = new GuiCheckBox(5, "Grid Numbers", 0, 0, 32, 32, Settings.Default.GridNumbers);
            AnimateBackground = new GuiCheckBox(5, "Animate Background", 0, 0, 32, 32, Settings.Default.AnimateBackground);

            Bpm.Focused    = true;
            Offset.Focused = true;
            Bpm.OnKeyDown(Key.Right, false);
            Offset.OnKeyDown(Key.Right, false);
            Bpm.Focused    = false;
            Offset.Focused = false;

            Buttons.Add(playPause);
            Buttons.Add(Timeline);
            Buttons.Add(Tempo);
            Buttons.Add(MasterVolume);
            Buttons.Add(SfxVolume);
            Buttons.Add(BeatSnapDivisor);
            Buttons.Add(Reposition);
            Buttons.Add(Autoplay);
            Buttons.Add(ApproachSquares);
            Buttons.Add(GridNumbers);
            Buttons.Add(AnimateBackground);
            Buttons.Add(SetOffset);
            Buttons.Add(BackButton);
            Buttons.Add(CopyButton);

            OnResize(EditorWindow.Instance.ClientSize);

            EditorWindow.Instance.MusicPlayer.Volume = (float)Settings.Default.MasterVolume;

            MasterVolume.Value = (int)(Settings.Default.MasterVolume * MasterVolume.MaxValue);
            SfxVolume.Value    = (int)(Settings.Default.SFXVolume * SfxVolume.MaxValue);
        }
コード例 #2
0
        //private object TimingPanel;
        //TimingPoints TimingPoints;

        public GuiScreenEditor() : base(0, EditorWindow.Instance.ClientSize.Height - 64, EditorWindow.Instance.ClientSize.Width - 512 - 64, 64)
        {
            if (File.Exists(Path.Combine(EditorWindow.Instance.LauncherDir, "background_editor.png")))
            {
                this.bgImg = true;
                using (Bitmap img = new Bitmap(Path.Combine(EditorWindow.Instance.LauncherDir, "background_editor.png")))
                {
                    this._textureId = TextureManager.GetOrRegister("bg", img, true);
                }
            }

            _toast = new GuiLabel(0, 0, "", false)
            {
                Centered = true,
                FontSize = 36
            };

            var playPause = new GuiButtonPlayPause(0, EditorWindow.Instance.ClientSize.Width - 512 - 64, EditorWindow.Instance.ClientSize.Height - 64, 64, 64);

            Offset = new GuiTextBox(0, 0, 128, 32)
            {
                Text          = "0",
                Centered      = true,
                Numeric       = true,
                CanBeNegative = false
            };
            JumpMSBox = new GuiTextBox(0, 0, 128, 32)
            {
                Text          = "0",
                Centered      = true,
                Numeric       = true,
                CanBeNegative = false,
            };
            RotateBox = new GuiTextBox(0, 0, 128, 32)
            {
                Text          = "0",
                Centered      = true,
                Numeric       = true,
                CanBeNegative = false,
            };
            SfxOffset = new GuiTextBox(EditorWindow.Instance.ClientSize.Width - 128, 0, 128, 32)
            {
                Text          = "0",
                Centered      = true,
                Numeric       = true,
                CanBeNegative = true
            };
            NoteAlign = new GuiSlider(0, 0, 256, 40)
            {
                MaxValue = 59,
                Value    = 2
            };
            BeatSnapDivisor = new GuiSlider(0, 0, 256, 40);
            Timeline        = new GuiSliderTimeline(0, 0, EditorWindow.Instance.ClientSize.Width, 64);
            Tempo           = new GuiSlider(0, 0, 512, 64)
            {
                MaxValue = 26,
                Value    = 16
            };

            Timeline.Snap            = false;
            BeatSnapDivisor.Value    = GuiTrack.BeatDivisor - 1;
            BeatSnapDivisor.MaxValue = 31;

            MasterVolume = new GuiSlider(0, 0, 40, 256)
            {
                MaxValue = 50
            };
            SfxVolume = new GuiSlider(0, 0, 40, 256)
            {
                MaxValue = 50
            };

            SetOffset  = new GuiButton(2, 0, 0, 64, 32, "SET", false);
            BackButton = new GuiButton(3, 0, 0, Grid.ClientRectangle.Width + 1, 42, "BACK TO MENU", false);
            CopyButton = new GuiButton(4, 0, 0, (Grid.ClientRectangle.Width - 5) / 2, 42, "COPY MAP DATA", false);
            PlayButton = new GuiButton(99, 0, 0, (Grid.ClientRectangle.Width - 5) / 2, 42, "PLAY MAP", false);

            JumpMSButton = new GuiButton(6, 0, 0, 64, 32, "JUMP", false);
            RotateButton = new GuiButton(7, 0, 0, 64, 32, "ROTATE", false);

            OpenTimings  = new GuiButton(8, 0, 0, 200, 32, "OPEN TIMING SETUP PANEL", false);
            UseCurrentMs = new GuiButton(9, 0, 0, 200, 32, "USE CURRENT MS", false);

            Autoplay         = new GuiCheckBox(5, "Autoplay", 0, 0, 32, 32, Settings.Default.Autoplay);
            ApproachSquares  = new GuiCheckBox(5, "Approach Squares", 0, 0, 32, 32, Settings.Default.ApproachSquares);
            GridNumbers      = new GuiCheckBox(5, "Grid Numbers", 0, 0, 32, 32, Settings.Default.GridNumbers);
            Quantum          = new GuiCheckBox(5, "Quantum", 0, 0, 32, 32, Settings.Default.Quantum);
            AutoAdvance      = new GuiCheckBox(5, "Auto-Advance", 0, 0, 32, 32, Settings.Default.AutoAdvance);
            Numpad           = new GuiCheckBox(5, "Use Numpad", 0, 0, 32, 32, Settings.Default.Numpad);
            QuantumGridLines = new GuiCheckBox(5, "Quantum Grid Lines", 0, 0, 32, 32, Settings.Default.QuantumGridLines);
            QuantumGridSnap  = new GuiCheckBox(5, "Snap to Grid", 0, 0, 32, 32, Settings.Default.QuantumGridSnap);
            Metronome        = new GuiCheckBox(5, "Metronome", 0, 0, 32, 32, Settings.Default.Metronome);
            //LegacyBPM = new GuiCheckBox(5, "Use Legacy Panel", 0, 0, 24, 24, Settings.Default.LegacyBPM);

            Offset.Focused    = true;
            SfxOffset.Focused = true;
            JumpMSBox.Focused = true;
            RotateBox.Focused = true;

            Offset.OnKeyDown(Key.Right, false);
            SfxOffset.OnKeyDown(Key.Right, false);
            JumpMSBox.OnKeyDown(Key.Right, false);
            RotateBox.OnKeyDown(Key.Right, false);

            Offset.Focused    = false;
            SfxOffset.Focused = false;
            JumpMSBox.Focused = false;
            RotateBox.Focused = false;

            Buttons.Add(playPause);
            Buttons.Add(Timeline);
            Buttons.Add(Tempo);
            Buttons.Add(NoteAlign);
            Buttons.Add(MasterVolume);
            Buttons.Add(SfxVolume);
            Buttons.Add(BeatSnapDivisor);
            Buttons.Add(Autoplay);
            Buttons.Add(ApproachSquares);
            Buttons.Add(GridNumbers);
            Buttons.Add(Quantum);
            Buttons.Add(AutoAdvance);
            Buttons.Add(Numpad);
            Buttons.Add(QuantumGridLines);
            Buttons.Add(QuantumGridSnap);
            Buttons.Add(Metronome);
            //Buttons.Add(LegacyBPM);
            Buttons.Add(SetOffset);
            Buttons.Add(BackButton);
            Buttons.Add(CopyButton);
            Buttons.Add(PlayButton);
            Buttons.Add(JumpMSButton);
            Buttons.Add(RotateButton);
            Buttons.Add(OpenTimings);
            Buttons.Add(UseCurrentMs);

            OnResize(EditorWindow.Instance.ClientSize);

            EditorWindow.Instance.MusicPlayer.Volume = (float)Settings.Default.MasterVolume;

            SfxOffset.Text     = Settings.Default.SfxOffset;
            MasterVolume.Value = (int)(Settings.Default.MasterVolume * MasterVolume.MaxValue);
            SfxVolume.Value    = (int)(Settings.Default.SFXVolume * SfxVolume.MaxValue);
            // NoteAlign.Value = (int)(Settings.Default.NoteAlign * NoteAlign.MaxValue);

            SfxOffset.OnChanged += (_, value) =>
            {
                Settings.Default.SfxOffset = SfxOffset.Text;
            };
        }