Esempio n. 1
0
    private void Start()
    {
        var canvas         = transform.Find("Canvas");
        var canvasPosition = canvas.position;

        experience =
            Instantiate(sliderBarPrefab, canvas)
            .Init(new Vector3(-450 + canvasPosition.x, 635 + canvasPosition.y),
                  new Color(0.4157809f, 0.735849f, 0.2742079f),
                  expForLvlUp);
        death =
            Instantiate(sliderBarPrefab, canvas)
            .Init(new Vector3(450 + canvasPosition.x, 635 + canvasPosition.y),
                  new Color(0.764151f, 0.025849f, 0.04650033f),
                  countForDeath);

        lvlUpEffect = transform.Find("LvlUpEffect").GetComponent <ParticleSystem>();

        for (var i = 0; i < 5; i++)
        {
            purposes.Enqueue(Instantiate(purposePrefabs[i], new Vector3(0, 11, i + 20), Quaternion.identity));
        }

        list.NeedCheckSumEvent.AddListener(() => StartCoroutine(NeedCheckSumEventHandler()));
        playerTurnEvent.AddListener(() => StartCoroutine(BeforePlayerTurn()));

        CircleList.Center = transform.position;
        StartCoroutine(PlaceStartCircles());
    }
Esempio n. 2
0
 public override void Start()
 {
     base.Start();
     sliderBar = GetComponentInChildren <SliderBar>();
     sliderBar.SetSliderValues(character.characterInfo.health.GetValue(), character.characterInfo.health.GetCurrentValue());
     sliderBar.gameObject.SetActive(false);
 }
Esempio n. 3
0
        public override void Reset()
        {
            base.Reset();

            sliderBarValue = new BindableDouble(8)
            {
                MinValue = -10,
                MaxValue = 10
            };
            sliderBarValue.ValueChanged += sliderBarValueChanged;

            sliderbarText = new SpriteText
            {
                Text     = $"Selected value: {sliderBarValue.Value}",
                Position = new Vector2(25, 0)
            };
            sliderBar = new SliderBar
            {
                Size           = new Vector2(200, 10),
                Position       = new Vector2(25, 25),
                Bindable       = sliderBarValue,
                Color          = Color4.White,
                SelectionColor = Color4.Pink,
                KeyboardStep   = 1
            };

            Add(sliderBar);
            Add(sliderbarText);
        }
Esempio n. 4
0
    //Methods for displaying

    public override void Init()
    {
        base.Init();

        sliderBar = transform.Find("SliderBar").GetComponent <SliderBar>();
        sliderBar.Init();
    }
        public static void RemoveSingeRoute(int dispatchIndex)
        {
            GUI_Base slider = s_root.GetChildByName(string.Format("Deployment Route {0}", dispatchIndex));

            s_root.RemoveChild(slider);
            slider = null;
            GUI_Base cancelButton = s_root.GetChildByName(string.Format("Cancel Button {0}", dispatchIndex));

            s_root.RemoveChild(cancelButton);
            cancelButton = null;
            GUI_Base name = s_root.GetChildByName(string.Format("Label {0}", dispatchIndex));

            s_root.RemoveChild(name);
            name = null;

            dispatchIndex++;
            SliderBar s = null;

            while ((s = (SliderBar)s_root.GetChildByName(string.Format("Deployment Route {0}", dispatchIndex))) != null)
            {
                s.ControlName = string.Format("Deployment Route {0}", dispatchIndex - 1);
                GUI_Base button = s_root.GetChildByName(string.Format("Cancel Button {0}", dispatchIndex));
                button.ControlName = string.Format("Cancel Button {0}", dispatchIndex - 1);
                GUI_Base label = s_root.GetChildByName(string.Format("Label {0}", dispatchIndex));
                label.ControlName = string.Format("Label {0}", dispatchIndex - 1);
                dispatchIndex++;
            }
        }
Esempio n. 6
0
                protected override void Layout()
                {
                    base.Layout();

                    SliderBar slider = ScrollBar.slide;

                    slider.BarColor = TerminalFormatting.OuterSpace.SetAlphaPct(HudMain.UiBkOpacity);
                }
Esempio n. 7
0
                protected override void Layout()
                {
                    SliderBar slider = scrollBox.ScrollBar.slide;

                    slider.BarColor = TerminalFormatting.OuterSpace.SetAlphaPct(HudMain.UiBkOpacity);

                    scrollBox.Height = _size.Y - (layout.Height - scrollBox.Height);
                }
                protected override void Layout()
                {
                    SliderBar slider = scrollBox.ScrollBar.slide;

                    slider.BarColor = TerminalFormatting.OuterSpace.SetAlphaPct(HudMain.UiBkOpacity);

                    scrollBox.Height = cachedSize.Y - header.Height - subheader.Height - cachedPadding.Y;
                }
Esempio n. 9
0
        public void SetUp() => Schedule(() =>
        {
            Child = beatDivisorControl = new BeatDivisorControl(bindableBeatDivisor = new BindableBeatDivisor(16))
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Size   = new Vector2(90, 90)
            };

            tickSliderBar  = beatDivisorControl.ChildrenOfType <SliderBar <int> >().Single();
            tickMarkerHead = tickSliderBar.ChildrenOfType <EquilateralTriangle>().Single();
        });
Esempio n. 10
0
        public void SliderBarConstructorTest()
        {
            Vector2    position = new Vector2(); // TODO: Initialize to an appropriate value
            float      width    = 0F;            // TODO: Initialize to an appropriate value
            float      height   = 0F;            // TODO: Initialize to an appropriate value
            int        min      = 0;             // TODO: Initialize to an appropriate value
            int        max      = 0;             // TODO: Initialize to an appropriate value
            SpriteFont font     = null;          // TODO: Initialize to an appropriate value
            float      progress = 0F;            // TODO: Initialize to an appropriate value
            SliderBar  target   = new SliderBar(position, width, height, min, max, font, progress);

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
Esempio n. 11
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            ScreenManager.FadeBackBufferToBlack(byte.MaxValue);
            GuiData.startDraw();
            PatternDrawer.draw(
                new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
                              ScreenManager.GraphicsDevice.Viewport.Height), 0.5f, Color.Black, new Color(2, 2, 2),
                GuiData.spriteBatch);
            if (Button.doButton(999, 10, 10, 200, 30, "<- Back", Color.Gray))
            {
                SettingsLoader.writeStatusFile();
                ExitScreen();
            }
            TextItem.doLabel(new Vector2(400f, 65f), "Resolutions", new Color?());
            var num = currentResIndex;

            currentResIndex = SelectableTextList.doFancyList(10, 400, 100, 200, 450, resolutions, currentResIndex,
                                                             new Color?(), false);
            if (!mouseHasBeenReleasedOnThisScreen)
            {
                currentResIndex = num;
            }
            else if (SelectableTextList.wasActivated)
            {
                resolutionChanged = true;
            }
            TextItem.doLabel(new Vector2(100f, 64f), "Fullscreen", new Color?());
            windowed = CheckBox.doCheckBox(20, 100, 100, windowed, new Color?());
            TextItem.doLabel(new Vector2(100f, 124f), "Bloom", new Color?());
            PostProcessor.bloomEnabled = CheckBox.doCheckBox(21, 100, 160, PostProcessor.bloomEnabled, new Color?());
            TextItem.doLabel(new Vector2(100f, 184f), "Scanlines", new Color?());
            PostProcessor.scanlinesEnabled = CheckBox.doCheckBox(22, 100, 220, PostProcessor.scanlinesEnabled,
                                                                 new Color?());
            TextItem.doLabel(new Vector2(100f, 244f), "Sound Enabled", new Color?());
            MusicManager.setIsMuted(!CheckBox.doCheckBox(23, 100, 280, !MusicManager.isMuted, new Color?()));
            TextItem.doLabel(new Vector2(100f, 305f), "Music Volume", new Color?());
            MusicManager.setVolume(SliderBar.doSliderBar(24, 100, 350, 210, 30, 1f, 0.0f, MusicManager.getVolume(),
                                                         1.0f / 1000.0f));
            TextItem.doLabel(new Vector2(100f, 384f), "Text Size", new Color?());
            currentFontIndex = SelectableTextList.doFancyList(25, 100, 414, 200, 160, fontConfigs, currentFontIndex,
                                                              new Color?(), false);
            if (Button.doButton(990, 10, ScreenManager.GraphicsDevice.Viewport.Height - 120, 200, 30, "Apply Changes",
                                Color.LightBlue))
            {
                needsApply = true;
            }
            GuiData.endDraw();
            PostProcessor.end();
        }
Esempio n. 12
0
        public TestCaseSliderbar()
        {
            sliderBarValue = new BindableDouble(8)
            {
                MinValue = -10,
                MaxValue = 10
            };
            sliderBarValue.ValueChanged += sliderBarValueChanged;

            sliderbarText = new SpriteText
            {
                Text     = $"Selected value: {sliderBarValue.Value}",
                Position = new Vector2(25, 0)
            };

            sliderBar = new BasicSliderBar <double>
            {
                Size             = new Vector2(200, 10),
                Position         = new Vector2(25, 25),
                BackgroundColour = Color4.White,
                SelectionColour  = Color4.Pink,
                KeyboardStep     = 1,
                Current          = sliderBarValue
            };

            Add(sliderBar);
            Add(sliderbarText);

            Add(sliderBar = new BasicSliderBar <double>
            {
                Size             = new Vector2(200, 10),
                RangePadding     = 20,
                Position         = new Vector2(25, 45),
                BackgroundColour = Color4.White,
                SelectionColour  = Color4.Pink,
                KeyboardStep     = 1,
                Current          = sliderBarValue
            });

            Add(new BasicSliderBar <double>
            {
                TransferValueOnCommit = true,
                Size             = new Vector2(200, 10),
                RangePadding     = 20,
                Position         = new Vector2(25, 65),
                BackgroundColour = Color4.White,
                SelectionColour  = Color4.Pink,
                KeyboardStep     = 1,
                Current          = sliderBarValue
            });
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Slider"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        protected IntSlider(ControlBase parent)
            : base(parent)
        {
            SetBounds(new Rectangle(0, 0, 32, 128));

            m_SliderBar          = new SliderBar(this);
            m_SliderBar.Dragged += OnMoved;
            m_Min   = 0;
            m_Max   = 1;
            m_Value = 0;

            KeyboardInputEnabled = true;
            IsTabable            = true;
        }
Esempio n. 14
0
        public void DrawTest()
        {
            Vector2     position = new Vector2();                                                    // TODO: Initialize to an appropriate value
            float       width    = 0F;                                                               // TODO: Initialize to an appropriate value
            float       height   = 0F;                                                               // TODO: Initialize to an appropriate value
            int         min      = 0;                                                                // TODO: Initialize to an appropriate value
            int         max      = 0;                                                                // TODO: Initialize to an appropriate value
            SpriteFont  font     = null;                                                             // TODO: Initialize to an appropriate value
            float       progress = 0F;                                                               // TODO: Initialize to an appropriate value
            SliderBar   target   = new SliderBar(position, width, height, min, max, font, progress); // TODO: Initialize to an appropriate value
            SpriteBatch sb       = null;                                                             // TODO: Initialize to an appropriate value

            target.Draw(sb);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
                protected override void Layout()
                {
                    ITextBoard textBoard = textBox.TextBoard;

                    SliderBar slider = verticalScroll.slide;

                    slider.BarColor     = TerminalFormatting.OuterSpace.SetAlphaPct(HudMain.UiBkOpacity);
                    slider.SliderHeight = (textBoard.Size.Y / textBoard.TextSize.Y) * verticalScroll.Height;

                    textBox.Height = Height - header.Height - subheader.Height - Padding.Y;
                    textBox.Width  = Width - verticalScroll.Width - Padding.X;

                    header.Width    = textBox.Width;
                    subheader.Width = textBox.Width;
                }
Esempio n. 16
0
        public void getNumberTest()
        {
            Vector2    position = new Vector2();                                                    // TODO: Initialize to an appropriate value
            float      width    = 0F;                                                               // TODO: Initialize to an appropriate value
            float      height   = 0F;                                                               // TODO: Initialize to an appropriate value
            int        min      = 0;                                                                // TODO: Initialize to an appropriate value
            int        max      = 0;                                                                // TODO: Initialize to an appropriate value
            SpriteFont font     = null;                                                             // TODO: Initialize to an appropriate value
            float      progress = 0F;                                                               // TODO: Initialize to an appropriate value
            SliderBar  target   = new SliderBar(position, width, height, min, max, font, progress); // TODO: Initialize to an appropriate value
            int        expected = 0;                                                                // TODO: Initialize to an appropriate value
            int        actual;

            actual = target.getNumber();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Esempio n. 17
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Slider" /> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        protected Slider(Base parent, string name = "") : base(parent, name)
        {
            SetBounds(new Rectangle(0, 0, 32, 128));

            mSliderBar          = new SliderBar(this);
            mSliderBar.Dragged += OnMoved;

            mMin = 0.0f;
            mMax = 1.0f;

            mSnapToNotches = false;
            mNotchCount    = 5;
            mValue         = 0.0f;

            KeyboardInputEnabled = true;
            IsTabable            = true;
        }
Esempio n. 18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Slider"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        protected Slider(ControlBase parent)
            : base(parent)
        {
            SetBounds(new Rectangle(0, 0, 32, 128));

            m_SliderBar          = new SliderBar(this);
            m_SliderBar.Dragged += OnMoved;
            m_Min = 0.0f;
            m_Max = 1.0f;

            m_SnapToNotches = false;
            m_NotchCount    = 5;
            m_Value         = 0.0f;

            KeyboardInputEnabled = true;
            IsTabable            = true;
        }
Esempio n. 19
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            YogUILibrary.YogUI.YogUI_LoadContent(this);
            font = Content.Load<SpriteFont>("Console");

            //Create a new Text Field with position (top-left) at 0, 10. Width 100, height 20 (don't change this to anything else yet),
            //White text, Black background, White border, SpriteFont font, doing nothing on text enter, and nothing on text changed.
            textField = new TextField(new Vector2(0, 10), 200, 20, Color.Black, font, (string s) => { /*Pressed Enter*/ }, (string s) => { /*Text changed*/});
            textField.SetText("TextField");
            textField.placeHolderText = "Default text";
            textField.scaleToText = true;

            filterTextField = new TextField(new Vector2(330, 10), 150, 20, Color.Black, font, (string s) => { });
            filterTextField.stringPattern = "^\\d+?\\.\\d+?\\.\\d+?\\.\\d+?$";
            //Create a new ListBox at (0, 150), 90 width, 100 height, and doing nothing on Selected Index Changed.
            listBox = new ListBox(new Vector2(0, 150), 90, 100, font, () => { /*Selected Index Changed*/});
            listBox.dataSource = new string[] { "Index 1", "Index 2", "Index 3" }.ToList<string>();

            //Create a new ProgressBar at (150, 100), 100 width, 30 height, 50% progress.
            progressBar = new ProgressBar(new Vector2(150, 100), 100, 30, 50f);

            //Create a new sliderbar at (150, 150), 100 width, 30 height, 0 minimum value, 200 maximum value, SpriteFont font, 25% progress.
            sliderBar = new SliderBar(new Vector2(150, 150), 100, 30, 0, 200, font, 25);

            //Create two new radiobuttons
            radioButton1 = new RadioButton(new Vector2(200, 50), font, "RadioButton 1");
            radioButton2 = new RadioButton(new Vector2(200, 65), font, "Radiobutton 2");

            //Add the radiobuttons to a RadioButtonGroup that controls only one being "checked" at a time.
            radioButtonGroup.addButton(radioButton1);
            radioButtonGroup.addButton(radioButton2);

            //Create a new CheckBox at (200, 90), SpriteFont font.
            checkBox = new CheckBox(new Vector2(200, 90), font);

            //Create a new ComboBox at (500, 200), SpriteFont font.
            comboBox = new ComboBox(new Vector2(500, 200), font, "Combo box option 1", "Combo box option 2", "Combo box option 3");

            //Create a new button at (500, 100), with the text "Button", Adding a new item to the listbox when it is clicked, the text being from the TextField.
            button = new Button(new Vector2(500, 100), "Button", font, () => { listBox.dataSource.Add(textField.GetText()); });
            //   button.paddingHeight = 10;
            // button.paddingWidth = 200;
        }
Esempio n. 20
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            YogUI.YogUI_LoadContent(this);

            SpriteFont buttonFont = Content.Load <SpriteFont>("buttonFont");

            loadNinepatch   = new Button(new Vector2(46, 23), "Open", buttonFont, loadExisting);
            saveNinepatchAs = new Button(new Vector2(150, 23), "Save", buttonFont, saveImage);

            xStart = new TextField(new Vector2(225, 3), 70, 15, Color.Black, buttonFont, (string s) => { refresh(); }, (string s) => { refresh(); });
            xEnd   = new TextField(new Vector2(225, 28), 70, 15, Color.Black, buttonFont, (string s) => { refresh(); }, (string s) => { refresh(); });
            xStart.stringPattern   = xEnd.stringPattern = "^\\d+?$";
            xStart.placeHolderText = "X start";
            xEnd.placeHolderText   = "X end";

            yStart = new TextField(new Vector2(305, 3), 70, 15, Color.Black, buttonFont, (string s) => { refresh(); }, (string s) => { refresh(); });
            yEnd   = new TextField(new Vector2(305, 28), 70, 15, Color.Black, buttonFont, (string s) => { refresh(); }, (string s) => { refresh(); });
            yStart.stringPattern   = yEnd.stringPattern = "^\\d+?$";
            yStart.placeHolderText = "Y start";
            yEnd.placeHolderText   = "Y end";

            refreshNinepatch = new Button(new Vector2(420, 18), "Refresh", buttonFont, refresh);

            patchScale = new SliderBar(new Vector2(465, 9), 225, 30, 0, 100, buttonFont);

            drawContent = new CheckBox(new Vector2(390, 45), buttonFont);
            drawContent.SetLabel("Draw content");
            drawContent.SetChecked(true);

            scaleX  = new RadioButton(new Vector2(700, 9), buttonFont, "Scale X");
            scaleY  = new RadioButton(new Vector2(700, 23), buttonFont, "Scale Y");
            scaleXY = new RadioButton(new Vector2(700, 37), buttonFont, "Scale X+Y");

            scaleGroup.addButton(scaleX);
            scaleGroup.addButton(scaleY);
            scaleGroup.addButton(scaleXY);

            scaleX.selected = true;

            // TODO: use this.Content to load your game content here
        }
Esempio n. 21
0
                    protected override void Layout()
                    {
                        Vector2 listSize = scrollBox.Size,
                                listPos  = scrollBox.Position;

                        listSize.X -= scrollBox.ScrollBar.Width;
                        listPos.X  -= scrollBox.ScrollBar.Width;

                        listInput.ListRange = scrollBox.ClipRange;
                        listInput.ListPos   = listPos;
                        listInput.ListSize  = listSize;

                        header.Color    = TerminalFormatting.Dark.SetAlphaPct(HudMain.UiBkOpacity);
                        scrollBox.Color = TerminalFormatting.DarkSlateGrey.SetAlphaPct(HudMain.UiBkOpacity);

                        SliderBar slider = scrollBox.ScrollBar.slide;

                        slider.BarColor = TerminalFormatting.OuterSpace.SetAlphaPct(HudMain.UiBkOpacity);
                    }
Esempio n. 22
0
        public override void Reset()
        {
            base.Reset();

            sliderBarValue = new BindableDouble(8)
            {
                MinValue = -10,
                MaxValue = 10
            };
            sliderBarValue.ValueChanged += sliderBarValueChanged;

            sliderbarText = new SpriteText
            {
                Text     = $"Selected value: {sliderBarValue.Value}",
                Position = new Vector2(25, 0)
            };
            sliderBar = new BasicSliderBar <double>
            {
                Size           = new Vector2(200, 10),
                Position       = new Vector2(25, 25),
                Color          = Color4.White,
                SelectionColor = Color4.Pink,
                KeyboardStep   = 1
            };

            sliderBar.Current.BindTo(sliderBarValue);

            Add(sliderBar);
            Add(sliderbarText);

            Add(sliderBar = new BasicSliderBar <double>
            {
                Size           = new Vector2(200, 10),
                RangePadding   = 20,
                Position       = new Vector2(25, 45),
                Color          = Color4.White,
                SelectionColor = Color4.Pink,
                KeyboardStep   = 1,
            });

            sliderBar.Current.BindTo(sliderBarValue);
        }
        /// <summary>
        /// Update the info for the selected. This updates production / defense information  in the GUI as well as
        /// updates the planet's depolyment route distrobutions.
        /// </summary>
        /// <param name="root">Root GUI elemtn that contains all the sliderbars for the deployment routes</param>
        /// <param name="viewing">The player viewing this information the screen.  The player's access to
        /// to the planet is determined by the its access level</param>
        public static void Update(XNA_GUI.GUIElements.GUI_Base root, Player viewing)
        {
            if (s_previousSelected == null)
            {
                return;
            }
            TextLabel planetName   = (TextLabel)root.GetChildByName("Planet Name");
            TextLabel defenseLabel = (TextLabel)root.GetChildByName("Defense Fleets");
            TextLabel production   = (TextLabel)root.GetChildByName("Production");

            planetName.DisplayText   = s_previousSelected.Name;
            defenseLabel.DisplayText = "Deffense Fleets: " + s_previousSelected.DefenseFleets.ToString();

            if (viewing.CanSeePlanet(s_previousSelected))
            {
                production.DisplayText = string.Format("Production: {0} per min", (int)s_previousSelected.Production);
            }
            else
            {
                production.DisplayText = "No Data Available";
            }

            //store the depolyment route distrobutions;
            SliderBar    s      = null;
            int          index  = 0;
            List <float> routes = s_previousSelected.DispatchRates;

            while ((s = (SliderBar)root.GetChildByName(string.Format(c_sliderName, index))) != null)
            {
                routes[index] = (float)s.CurrentValue / (float)s.MaxValue;
                index++;
            }

            s_previousSelected.NormalizeRoutes();

            index = 0;
            while ((s = (SliderBar)root.GetChildByName(string.Format(c_sliderName, index))) != null)
            {
                s.CurrentValue = (int)(s_previousSelected.DispatchRates[index] * s.MaxValue);
                index++;
            }
        }
Esempio n. 24
0
        public void Init()
        {
            texture = new Texture2D(manager.GraphicsDevice, 1, 1);
            texture.SetData <Color>(new Color[] { Color.White });

            #region Window
            window = new Window(manager);
            window.Init();
            window.Text   = "Tank Creation";
            window.Width  = 600;
            window.Height = 500;
            window.Center();
            window.Visible            = true;
            window.CloseButtonVisible = false;
            #endregion

            #region ListBoxes

            #region Tank
            tankBoxLbl = new Label(manager);
            tankBoxLbl.Init();
            tankBoxLbl.Text   = "Tanks: ";
            tankBoxLbl.Width  = 100;
            tankBoxLbl.Height = 10;
            tankBoxLbl.Left   = 20;
            tankBoxLbl.Top    = 10;
            tankBoxLbl.Anchor = Anchors.Left;
            tankBoxLbl.Parent = window;

            tankBox = new ListBox(manager);
            tankBox.Init();
            tankBox.Width         = 200;
            tankBox.Height        = 75;
            tankBox.Left          = 30;
            tankBox.Top           = 30;
            tankBox.Anchor        = Anchors.Left;
            tankBox.HideSelection = false;
            tankBox.Parent        = window;
            foreach (String s in tanks)
            {
                tankBox.Items.Add(s);
            }
            tankBox.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(tankBox_ItemIndexChanged);
            #endregion

            #region Turret

            turretBoxLbl = new Label(manager);
            turretBoxLbl.Init();
            turretBoxLbl.Text   = "Turrets: ";
            turretBoxLbl.Width  = 50;
            turretBoxLbl.Height = 10;
            turretBoxLbl.Left   = tankBoxLbl.Left;
            turretBoxLbl.Top    = tankBox.Top + tankBox.Height + 20;
            turretBoxLbl.Anchor = Anchors.Left;
            turretBoxLbl.Parent = window;

            turretBox = new ListBox(manager);
            turretBox.Init();
            turretBox.Width         = 200;
            turretBox.Height        = 100;
            turretBox.Left          = 30;
            turretBox.Top           = turretBoxLbl.Top + turretBoxLbl.Height + 10;
            turretBox.Anchor        = Anchors.Left;
            turretBox.HideSelection = false;
            turretBox.Parent        = window;
            foreach (String s in tanks)
            {
                turretBox.Items.Add(s);
            }
            turretBox.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(turretBox_ItemIndexChanged);

            tPowerLbl = new Label(manager);
            tPowerLbl.Init();
            tPowerLbl.Text   = "Power: ";
            tPowerLbl.Width  = 50;
            tPowerLbl.Height = 10;
            tPowerLbl.Left   = turretBox.Left;
            tPowerLbl.Top    = turretBox.Top + turretBox.Height + 10;
            tPowerLbl.Anchor = Anchors.Left;
            tPowerLbl.Parent = window;

            tPower = new ProgressBar(manager);
            tPower.Init();
            tPower.Width  = 75;
            tPower.Height = 10;
            tPower.Left   = tPowerLbl.Left + tPowerLbl.Width + 5;
            tPower.Top    = tPowerLbl.Top;
            tPower.Anchor = Anchors.Left;
            tPower.Parent = window;
            tPower.Value  = 50;

            tRateLbl = new Label(manager);
            tRateLbl.Init();
            tRateLbl.Text   = "Rate: ";
            tRateLbl.Width  = 50;
            tRateLbl.Height = 10;
            tRateLbl.Left   = turretBox.Left;
            tRateLbl.Top    = tPowerLbl.Top + tPowerLbl.Height;
            tRateLbl.Anchor = Anchors.Left;
            tRateLbl.Parent = window;

            tRate = new ProgressBar(manager);
            tRate.Init();
            tRate.Width  = 75;
            tRate.Height = 10;
            tRate.Left   = tRateLbl.Left + tRateLbl.Width + 5;
            tRate.Top    = tRateLbl.Top;
            tRate.Anchor = Anchors.Left;
            tRate.Parent = window;
            tRate.Value  = 50;

            tRangeLbl = new Label(manager);
            tRangeLbl.Init();
            tRangeLbl.Text   = "Range: ";
            tRangeLbl.Width  = 50;
            tRangeLbl.Height = 15;
            tRangeLbl.Left   = turretBox.Left;
            tRangeLbl.Top    = tRateLbl.Top + tRateLbl.Height;
            tRangeLbl.Anchor = Anchors.Left;
            tRangeLbl.Parent = window;

            tRange = new ProgressBar(manager);
            tRange.Init();
            tRange.Width  = 75;
            tRange.Height = 10;
            tRange.Left   = tRangeLbl.Left + tRangeLbl.Width + 5;
            tRange.Top    = tRangeLbl.Top;
            tRange.Anchor = Anchors.Left;
            tRange.Parent = window;
            tRange.Value  = 50;


            #endregion

            #endregion

            #region TankStats

            armorLbl = new Label(manager);
            armorLbl.Init();
            armorLbl.Text   = "Armor: ";
            armorLbl.Width  = 50;
            armorLbl.Height = 24;
            armorLbl.Left   = 20;
            armorLbl.Top    = window.Height - 160;;
            armorLbl.Anchor = Anchors.Left;
            armorLbl.Parent = window;

            armorBar = new ProgressBar(manager);
            armorBar.Init();
            armorBar.Width  = 150;
            armorBar.Height = 24;
            armorBar.Left   = armorLbl.Left + armorLbl.Width + 20;;
            armorBar.Top    = armorLbl.Top;
            armorBar.Anchor = Anchors.Left;
            armorBar.Parent = window;
            armorBar.Value  = 50;

            speedLbl = new Label(manager);
            speedLbl.Init();
            speedLbl.Text   = "Speed: ";
            speedLbl.Width  = 50;
            speedLbl.Height = 24;
            speedLbl.Left   = armorLbl.Left;
            speedLbl.Top    = armorLbl.Top + armorLbl.Height;
            speedLbl.Anchor = Anchors.Left;
            speedLbl.Parent = window;

            speedBar = new ProgressBar(manager);
            speedBar.Init();
            speedBar.Width  = 150;
            speedBar.Height = 24;
            speedBar.Left   = speedLbl.Left + speedLbl.Width + 20;;
            speedBar.Top    = speedLbl.Top;
            speedBar.Anchor = Anchors.Left;
            speedBar.Parent = window;
            speedBar.Value  = 50;

            ratioLbl = new Label(manager);
            ratioLbl.Init();
            ratioLbl.Text   = "Ratio: ";
            ratioLbl.Width  = 50;
            ratioLbl.Height = 24;
            ratioLbl.Left   = armorLbl.Left;
            ratioLbl.Top    = speedLbl.Top + speedLbl.Height + 20;
            ratioLbl.Anchor = Anchors.Left;
            ratioLbl.Parent = window;

            ratioSlide = new SliderBar(manager);
            ratioSlide.Init();
            ratioSlide.Width         = 150;
            ratioSlide.Height        = 20;
            ratioSlide.Left          = ratioLbl.Left + ratioLbl.Width + 20;;
            ratioSlide.Top           = ratioLbl.Top + 3;
            ratioSlide.Anchor        = Anchors.Left;
            ratioSlide.Parent        = window;
            ratioSlide.Value         = 50;
            ratioSlide.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(ratioSlide_ValueChanged);

            #endregion

            #region Render Region
            image = new ImageBox(manager);
            image.Init();
            image.SizeMode = SizeMode.Stretched;
            image.Width    = 200;
            image.Height   = 150;
            image.Left     = window.Width - image.Width - 70;
            image.Top      = 40;
            image.Anchor   = Anchors.Right;
            image.Parent   = window;
            image.Image    = texture;
            #endregion

            #region Skin Scrolling (Left/Right)
            ScrollSkinLeft = new Button(manager);
            ScrollSkinLeft.Init();
            ScrollSkinLeft.Width  = 25;
            ScrollSkinLeft.Height = 25;
            ScrollSkinLeft.Left   = window.Width - image.Width - 70;
            ScrollSkinLeft.Top    = image.Top + image.Height + 10;
            ScrollSkinLeft.Text   = " < ";
            ScrollSkinLeft.Parent = window;

            ScrollSkinRight = new Button(manager);
            ScrollSkinRight.Init();
            ScrollSkinRight.Width  = 25;
            ScrollSkinRight.Height = 25;
            ScrollSkinRight.Left   = image.Left + image.Width - ScrollSkinRight.Width;
            ScrollSkinRight.Top    = image.Top + image.Height + 10;
            ScrollSkinRight.Text   = " > ";
            ScrollSkinRight.Parent = window;
            #endregion

            #region Skin Label
            SkinLabel = new Label(manager);
            SkinLabel.Init();
            SkinLabel.Alignment = Alignment.MiddleCenter;
            SkinLabel.Height    = 15;
            SkinLabel.Width     = 100;
            SkinLabel.Left      = ScrollSkinRight.Left - 120;
            SkinLabel.Top       = image.Top + image.Width - 33;
            SkinLabel.Text      = "Skin";
            SkinLabel.Parent    = window;
            #endregion

            #region Color Choosing
            redLbl = new Label(manager);
            redLbl.Init();
            redLbl.Text   = "Red: ";
            redLbl.Width  = 50;
            redLbl.Height = 24;
            redLbl.Left   = image.Left;
            redLbl.Top    = ScrollSkinLeft.Top + ScrollSkinLeft.Height + 20;
            redLbl.Anchor = Anchors.Left;
            redLbl.Parent = window;

            red = new SliderBar(manager);
            red.Init();
            red.Width         = 120;
            red.Height        = 15;
            red.Left          = redLbl.Left + redLbl.Width + 20;
            red.Top           = ScrollSkinLeft.Top + ScrollSkinLeft.Height + 25;
            red.Anchor        = Anchors.Left;
            red.Parent        = window;
            red.Value         = 50;
            red.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(Color_Changed);

            greenLbl = new Label(manager);
            greenLbl.Init();
            greenLbl.Text   = "Green: ";
            greenLbl.Width  = 50;
            greenLbl.Height = 24;
            greenLbl.Left   = redLbl.Left;
            greenLbl.Top    = redLbl.Top + redLbl.Height;
            greenLbl.Anchor = Anchors.Left;
            greenLbl.Parent = window;

            green = new SliderBar(manager);
            green.Init();
            green.Width         = red.Width;
            green.Height        = red.Height;
            green.Left          = greenLbl.Left + greenLbl.Width + 20;
            green.Top           = greenLbl.Top + 5;
            green.Anchor        = Anchors.Left;
            green.Parent        = window;
            green.Value         = 50;
            green.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(Color_Changed);

            blueLbl = new Label(manager);
            blueLbl.Init();
            blueLbl.Text   = "Blue: ";
            blueLbl.Width  = 50;
            blueLbl.Height = 24;
            blueLbl.Left   = redLbl.Left;
            blueLbl.Top    = greenLbl.Top + greenLbl.Height;
            blueLbl.Anchor = Anchors.Left;
            blueLbl.Parent = window;

            blue = new SliderBar(manager);
            blue.Init();
            blue.Width         = red.Width;
            blue.Height        = red.Height;
            blue.Left          = blueLbl.Left + blueLbl.Width + 20;;
            blue.Top           = blueLbl.Top + 5;
            blue.Anchor        = Anchors.Left;
            blue.Parent        = window;
            blue.Value         = 50;
            blue.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(Color_Changed);
            #endregion

            #region Tank Name
            name = new Label(manager);
            name.Init();
            name.Text   = "Tank Name: ";
            name.Width  = 100;
            name.Height = 24;
            name.Left   = redLbl.Left;
            name.Top    = blueLbl.Top + blueLbl.Height + 20;
            name.Anchor = Anchors.Left;
            name.Parent = window;

            nameBox = new TextBox(manager);
            nameBox.Init();
            nameBox.Text   = "";
            nameBox.Width  = 180;
            nameBox.Height = 24;
            nameBox.Left   = name.Left + 10;
            nameBox.Top    = name.Top + name.Height;
            nameBox.Anchor = Anchors.Left;
            nameBox.Parent = window;

            #endregion

            #region Buttons
            create = new Button(manager);
            create.Init();
            create.Text   = "Create";
            create.Width  = 90;
            create.Height = 24;
            create.Left   = window.Width - create.Width - 40;;
            create.Top    = ratioLbl.Top;
            create.Anchor = Anchors.Left;
            create.Parent = window;

            cancel = new Button(manager);
            cancel.Init();
            cancel.Text   = "Cancel";
            cancel.Width  = 80;
            cancel.Height = 24;
            cancel.Left   = create.Left - cancel.Width - 60;
            cancel.Top    = create.Top;
            cancel.Anchor = Anchors.Right;
            cancel.Parent = window;
            #endregion
        }
Esempio n. 25
0
        public TestSceneSliderBar()
        {
            sliderBarValue = new BindableDouble
            {
                MinValue = -10,
                MaxValue = 10
            };
            sliderBarValue.ValueChanged += sliderBarValueChanged;

            Add(new FillFlowContainer
            {
                RelativeSizeAxes = Axes.Both,
                Direction        = FillDirection.Vertical,
                Padding          = new MarginPadding(5),
                Spacing          = new Vector2(5, 5),
                Children         = new Drawable[]
                {
                    sliderBarText = new SpriteText
                    {
                        Text = $"Value of Bindable: {sliderBarValue.Value}",
                    },
                    new SpriteText
                    {
                        Text = "BasicSliderBar:",
                    },
                    sliderBar = new BasicSliderBar <double>
                    {
                        Size             = new Vector2(200, 50),
                        BackgroundColour = Color4.White,
                        SelectionColour  = Color4.Pink,
                        KeyboardStep     = 1,
                        Current          = sliderBarValue
                    },
                    new SpriteText
                    {
                        Text = "w/ RangePadding:",
                    },
                    new BasicSliderBar <double>
                    {
                        Size             = new Vector2(200, 10),
                        RangePadding     = 20,
                        BackgroundColour = Color4.White,
                        SelectionColour  = Color4.Pink,
                        KeyboardStep     = 1,
                        Current          = sliderBarValue
                    },
                    new SpriteText
                    {
                        Text = "w/ TransferValueOnCommit:",
                    },
                    transferOnCommitSliderBar = new BasicSliderBar <double>
                    {
                        TransferValueOnCommit = true,
                        Size             = new Vector2(200, 10),
                        BackgroundColour = Color4.White,
                        SelectionColour  = Color4.Pink,
                        KeyboardStep     = 1,
                        Current          = sliderBarValue
                    },
                }
            });
        }
Esempio n. 26
0
        /*
         * Gameplay
         * - Aiming Type (radio button) Drag / Splice
         * - Scroll Speed (slider bar)
         * - Mouse Speed (slider bar)
         * Sound
         * - BGM (slider Bar)
         * - SFX (slider bar)
         * Misc
         * - Background (radio button) On / Off
         * - Interface  (radio button) Classic / TH Blue / TH Pink / OpenBound
         */

        public PopupGameOptions(Vector2 position) : base(true)
        {
            positionOffset = position;

            sliderBarList      = new List <SliderBar>();
            radioButtonSetList = new List <RadioButtonSet>();

            Background = new Sprite("Interface/Popup/Blue/Options/Background", layerDepth: DepthParameter.InterfacePopupBackground);
            background.PositionOffset = position;

            //SpriteText Session
            //Gameplay
            SpriteText sp = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsGameplay, Parameter.TextColorPopupIngameOptionsCategory, Alignment.Left, DepthParameter.InterfacePopupText)
            {
                PositionOffset = position + new Vector2(-120, -120)
            };

            spriteTextList.Add(sp);

            //Gameplay / Shooting Mode
            sp = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsGameplayAimingMode, Parameter.TextColorPopupIngameOptionsSubCategory, Alignment.Left, DepthParameter.InterfacePopupText)
            {
                PositionOffset = position + new Vector2(-110, -100)
            };
            spriteTextList.Add(sp);

            //Gameplay / Shooting Mode / Drag
            SpriteText spDrag = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsGameplayAimingModeDrag, Parameter.TextColorPopupIngameOptionsElement, Alignment.Left, DepthParameter.InterfacePopupText);

            //Gameplay / Shooting Mode / Slice
            SpriteText spSlice = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsGameplayAimingModeSlice, Parameter.TextColorPopupIngameOptionsElement, Alignment.Left, DepthParameter.InterfacePopupText);

            //Gameplay / Scroll Speed
            sp = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsGameplayScrollSpeed, Parameter.TextColorPopupIngameOptionsElement, Alignment.Left, DepthParameter.InterfacePopupText)
            {
                PositionOffset = position + new Vector2(-110, -80)
            };
            spriteTextList.Add(sp);

            //Gameplay / Mouse Speed
            sp = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsGameplayMouseSpeed, Parameter.TextColorPopupIngameOptionsElement, Alignment.Left, DepthParameter.InterfacePopupText)
            {
                PositionOffset = position + new Vector2(-110, -60)
            };
            spriteTextList.Add(sp);

            //Sound
            sp = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsSound, Parameter.TextColorPopupIngameOptionsCategory, Alignment.Left, DepthParameter.InterfacePopupText)
            {
                PositionOffset = position + new Vector2(-120, -40)
            };
            spriteTextList.Add(sp);

            //Sound / BGM
            sp = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsSoundBGM, Parameter.TextColorPopupIngameOptionsElement, Alignment.Left, DepthParameter.InterfacePopupText)
            {
                PositionOffset = position + new Vector2(-110, -20)
            };
            spriteTextList.Add(sp);

            //Sound / SFX
            sp = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsSoundSFX, Parameter.TextColorPopupIngameOptionsElement, Alignment.Left, DepthParameter.InterfacePopupText)
            {
                PositionOffset = position + new Vector2(-110, 0)
            };
            spriteTextList.Add(sp);

            //Misc
            sp = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsMisc, Parameter.TextColorPopupIngameOptionsCategory, Alignment.Left, DepthParameter.InterfacePopupText)
            {
                PositionOffset = position + new Vector2(-120, 20)
            };
            spriteTextList.Add(sp);

            //Misc / Background
            sp = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsMiscBackground, Parameter.TextColorPopupIngameOptionsSubCategory, Alignment.Left, DepthParameter.InterfacePopupText)
            {
                PositionOffset = position + new Vector2(-110, 40)
            };
            spriteTextList.Add(sp);

            //Misc / Background / On
            SpriteText spOn = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsMiscBackgroundOn, Parameter.TextColorPopupIngameOptionsElement, Alignment.Left, DepthParameter.InterfacePopupText)
            {
                PositionOffset = position + new Vector2(20, 40)
            };

            //Misc / Background / Off
            SpriteText spOff = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsMiscBackgroundOff, Parameter.TextColorPopupIngameOptionsElement, Alignment.Left, DepthParameter.InterfacePopupText)
            {
                PositionOffset = position + new Vector2(90, 40)
            };

            //Misc / Interface
            sp = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsMiscInterface, Parameter.TextColorPopupIngameOptionsSubCategory, Alignment.Left, DepthParameter.InterfacePopupText)
            {
                PositionOffset = position + new Vector2(-110, 60)
            };
            spriteTextList.Add(sp);

            //Misc / Interface / Classic
            SpriteText spClassic = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsMiscInterfaceClassic, Parameter.TextColorPopupIngameOptionsElement, Alignment.Left, DepthParameter.InterfacePopupText);

            //Misc / Interface / TH Blue
            SpriteText spTHBlue = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsMiscInterfaceTHBlue, Parameter.TextColorPopupIngameOptionsElement, Alignment.Left, DepthParameter.InterfacePopupText);

            //Misc / Interface / TH White
            SpriteText spTHWhite = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsMiscInterfaceTHWhite, Parameter.TextColorPopupIngameOptionsElement, Alignment.Left, DepthParameter.InterfacePopupText);

            //Misc / Interface / OpenBound
            SpriteText spOpenBound = new SpriteText(FontTextType.Consolas10, Language.PopupGameOptionsMiscInterfaceOpenBound, Parameter.TextColorPopupIngameOptionsElement, Alignment.Left, DepthParameter.InterfacePopupText);

            //Radio Button Sections
            aimingRadioSet = new RadioButtonSet(RadioButtonType.InterfaceRadioButton, position + new Vector2(10, -94), new Vector2(70, 0), new List <SpriteText>()
            {
                spDrag, spSlice
            }, new Vector2(5, 1), 1, DepthParameter.InterfacePopupButtons);
            #warning Pre-release deactivation
            //radioButtonSetList.Add(aimingRadioSet);

            RadioButtonSet rbSet2 = new RadioButtonSet(RadioButtonType.InterfaceRadioButton, position + new Vector2(10, 46), new Vector2(70, 0), new List <SpriteText>()
            {
                spOn, spOff
            }, new Vector2(5, 1), 0, DepthParameter.InterfacePopupButtons);
            #warning Pre-release deactivation
            //radioButtonSetList.Add(rbSet2);

            RadioButtonSet rbSet3 = new RadioButtonSet(RadioButtonType.InterfaceRadioButton, position + new Vector2(-90, 86), new Vector2(120, 0), new List <SpriteText>()
            {
                spClassic, spTHBlue, spTHWhite, spOpenBound
            }, new Vector2(5, 1), 1, DepthParameter.InterfacePopupButtons);
            rbSet3.UpdateButtonPosition(2, position + new Vector2(-90, 106));
            rbSet3.UpdateButtonPosition(3, position + new Vector2(30, 106));
            #warning Pre-release deactivation
            //radioButtonSetList.Add(rbSet3);

            //Sliding Bar Section
            //Gameplay / Scroll Speed
            SliderBar sbSensitivity1 = new SliderBar(position + new Vector2(60, -73), 50);
#warning Pre-release deactivation
            //sliderBarList.Add(sbSensitivity1);

            //Gameplay / Mouse Speed
#warning Pre-release deactivation
            SliderBar sbSensitivity2 = new SliderBar(position + new Vector2(60, -53), 50);
            //sliderBarList.Add(sbSensitivity2);

            //Sound / BGM
            SliderBar sbSound1 = new SliderBar(position + new Vector2(60, -13), (int)(AudioHandler.BGMVolume * 100));
            sliderBarList.Add(sbSound1);
            sbSound1.OnBeingDragged += (pgBar) => AudioHandler.ChangeBGMVolume((int)((ProgressBar)pgBar).Intensity);

            //Sound / SFX
            SliderBar sbSound2 = new SliderBar(position + new Vector2(60, 7), (int)(AudioHandler.SFXVolume * 100));
            sliderBarList.Add(sbSound2);
            sbSound2.OnBeingDragged += (pgBar) => AudioHandler.ChangeSFXVolume((int)((ProgressBar)pgBar).Intensity);

            //Accept / Cancel Popup
            buttonList.Add(new Button(ButtonType.Accept, DepthParameter.InterfacePopupButtons, CloseAction, buttonOffset: position + new Vector2(130, 144)));
            //buttonList.Add(new Button(ButtonType.Cancel, 1, CloseAction, buttonOffset: new Vector2(130, 144)));
        }
Esempio n. 27
0
        public override void OnInitialize()
        {
            base.OnInitialize();    // Leave this or it wont work

            CookbookHeader RandomFuelHeader = new CookbookHeader("Random Fuel");

            RandomFuelHeader.HAlign     = 0.6f;
            RandomFuelHeader.Top.Pixels = -20;
            RandomFuelHeader.TextColor  = Color.LightGray;

            UIText RandomFuelFlavorText = new UIText("Kerosene and Nitroglycerin");

            RandomFuelFlavorText.HAlign     = 0.5f;
            RandomFuelFlavorText.Top.Pixels = 30;
            RandomFuelFlavorText.TextColor  = Color.Yellow;
            RandomFuelHeader.Append(RandomFuelFlavorText);

            UIText RandomFuelDescription = new UIText("Explosives are infused with\n" +
                                                      "one of three status effects");

            RandomFuelDescription.Top.Pixels  = 40;
            RandomFuelDescription.HAlign      = 0.7f;
            RandomFuelDescription.Left.Pixels = -10;
            RandomFuelDescription.TextColor   = Color.LightGray;
            leftPage.Append(RandomFuelDescription);
            leftPage.Append(RandomFuelHeader);

            CookbookHeader ShortFuzeHeader = new CookbookHeader("Short Fuze");

            ShortFuzeHeader.HAlign     = 0.65f;
            ShortFuzeHeader.Top.Pixels = -20;
            ShortFuzeHeader.TextColor  = Color.LightGray;

            UIText ShortFuzeFlavorText = new UIText("As short as my temper");

            ShortFuzeFlavorText.HAlign     = 0.5f;
            ShortFuzeFlavorText.Top.Pixels = 30;
            ShortFuzeFlavorText.TextColor  = Color.Orange;
            ShortFuzeHeader.Append(ShortFuzeFlavorText);

            UIText ShortFuzeDescription = new UIText("Allows for chaning the fuze\n" +
                                                     "length for most  explosives\n");

            ShortFuzeDescription.Top.Pixels  = 40;
            ShortFuzeDescription.HAlign      = 0.85f;
            ShortFuzeDescription.Left.Pixels = -20;
            ShortFuzeDescription.TextColor   = Color.LightGray;
            rightPage.Append(ShortFuzeDescription);
            rightPage.Append(ShortFuzeHeader);

            CaptainExplosiveBossBox = new UIPanel();
            CaptainExplosiveBossBox.Height.Pixels   = 140;
            CaptainExplosiveBossBox.Width.Pixels    = 200;
            CaptainExplosiveBossBox.Top.Pixels      = 330;
            CaptainExplosiveBossBox.HAlign          = 0.5f;
            CaptainExplosiveBossBox.Left.Pixels     = -20;
            CaptainExplosiveBossBox.BackgroundColor = new Color(0, 0, 0, 50);
            CaptainExplosiveBossBox.BorderColor     = new Color(0, 0, 0, 75);
            leftPage.Append(CaptainExplosiveBossBox);

            UIText foundRF = new UIText("    Dropped by: \nCaptain Explosive");

            foundRF.TextColor  = Color.LightGray;
            foundRF.HAlign     = 0.5f;
            foundRF.Top.Pixels = -60;
            CaptainExplosiveBossBox.Append(foundRF);

            UIText foundCEB = new UIText("13.33% Chance");

            foundCEB.TextColor  = Color.LightGray;
            foundCEB.HAlign     = 0.5f;
            foundCEB.Top.Pixels = 140;
            CaptainExplosiveBossBox.Append(foundCEB);

            CaptainExplosiveBossAnimated               = new AnimatedImage("ExtraExplosives/UI/AnarchistCookbookUI/Animations/CaptainExplosiveBoss/CaptainExplosiveBoss", 4, 5);
            CaptainExplosiveBossAnimated.HAlign        = 0.5f;
            CaptainExplosiveBossAnimated.VAlign        = 0.5f;
            CaptainExplosiveBossAnimated.Height.Pixels = 140;
            CaptainExplosiveBossAnimated.Width.Pixels  = 200;
            CaptainExplosiveBossBox.Append(CaptainExplosiveBossAnimated);

            CaptainExplosiveNPCBox = new UIPanel();
            CaptainExplosiveNPCBox.Height.Pixels   = 112;
            CaptainExplosiveNPCBox.Width.Pixels    = 80;
            CaptainExplosiveNPCBox.Top.Pixels      = 330;
            CaptainExplosiveNPCBox.HAlign          = 0.5f;
            CaptainExplosiveNPCBox.Left.Pixels     = 10;
            CaptainExplosiveNPCBox.BackgroundColor = new Color(0, 0, 0, 50);
            CaptainExplosiveNPCBox.BorderColor     = new Color(0, 0, 0, 75);
            rightPage.Append(CaptainExplosiveNPCBox);

            UIText foundSF = new UIText("     Sold By:\nCaptain Explosive");

            foundSF.TextColor  = Color.LightGray;
            foundSF.HAlign     = 0.5f;
            foundSF.Top.Pixels = -60;
            CaptainExplosiveNPCBox.Append(foundSF);

            UIText foundCENPC = new UIText("Always");

            foundCENPC.TextColor  = Color.LightGray;
            foundCENPC.HAlign     = 0.5f;
            foundCENPC.Top.Pixels = 110;
            CaptainExplosiveNPCBox.Append(foundCENPC);

            CaptainExplosiveNPCAnimated               = new AnimatedImage("ExtraExplosives/UI/AnarchistCookbookUI/Animations/CaptainExplosiveNPC/CaptainExplosiveNPC", 13, 5);
            CaptainExplosiveNPCAnimated.HAlign        = 0.5f;
            CaptainExplosiveNPCAnimated.VAlign        = 0.5f;
            CaptainExplosiveNPCAnimated.Height.Pixels = 112;
            CaptainExplosiveNPCAnimated.Width.Pixels  = 80;
            CaptainExplosiveNPCBox.Append(CaptainExplosiveNPCAnimated);

            ToggleRandomFuel  = new UIImageButton(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/Box"));
            RandomFuel        = new UIImage(ModContent.GetTexture("ExtraExplosives/Items/Accessories/AnarchistCookbook/RandomFuel"));
            RandomFuel.VAlign = 0.5f;
            RandomFuel.HAlign = 0.5f;
            ToggleRandomFuel.Append(RandomFuel);        // Image of Random fuel for labeling
            ToggleRandomFuel.Left.Pixels = 50;
            ToggleRandomFuel.Top.Pixels  = rightPage.Height.Pixels / 2 - 100;
            ToggleRandomFuel.OnClick    += new MouseEvent(RandomFuelToggle);
            leftPage.Append(ToggleRandomFuel);

            /*ToggleOnFire = new UIImageButton(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/Box"));
             *  OnFire = new UIImage(ModContent.GetTexture("Terraria/Buff_24"));
             *  OnFire.VAlign = 0.5f;
             *  OnFire.HAlign = 0.5f;
             *  ToggleOnFire.Append(OnFire);    // Image of Random fuel for labeling
             * ToggleOnFire.Left.Pixels = 25;
             * ToggleOnFire.Top.Pixels = leftPage.Height.Pixels/2 - 75;
             * ToggleOnFire.OnClick += new MouseEvent(OnFireToggle);
             * leftPage.Append(ToggleOnFire);
             *
             * ToggleFrostburn = new UIImageButton(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/Box"));
             *  Frostburn = new UIImage(ModContent.GetTexture("Terraria/Buff_44"));
             *  Frostburn.VAlign = 0.5f;
             *  Frostburn.HAlign = 0.5f;
             *      ToggleFrostburn.Append(Frostburn);    // Image of Random fuel for labeling
             * ToggleFrostburn.Left.Pixels = 250;
             * ToggleFrostburn.Top.Pixels = leftPage.Height.Pixels/2 - 125;
             * ToggleFrostburn.OnClick += new MouseEvent(FrostburnToggle);
             * leftPage.Append(ToggleFrostburn);
             *
             * ToggleConfused = new UIImageButton(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/Box"));
             *  Confused = new UIImage(ModContent.GetTexture("Terraria/Buff_31"));
             *  Confused.VAlign = 0.5f;
             *  Confused.HAlign = 0.5f;
             *  ToggleConfused.Append(Confused);    // Image of Random fuel for labeling
             * ToggleConfused.Left.Pixels = 250;
             * ToggleConfused.Top.Pixels = leftPage.Height.Pixels/2 - 75;
             * ToggleConfused.OnClick += new MouseEvent(ConfusedToggle);
             * leftPage.Append(ToggleConfused);*/

            ToggleShortFuze  = new UIImageButton(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/Box"));
            ShortFuze        = new UIImage(ModContent.GetTexture("ExtraExplosives/Items/Accessories/AnarchistCookbook/ShortFuse"));
            ShortFuze.VAlign = 0.5f;
            ShortFuze.HAlign = 0.5f;
            ToggleShortFuze.Append(ShortFuze);        // Image of Random fuel for labeling
            ToggleShortFuze.Left.Pixels = 50;
            ToggleShortFuze.Top.Pixels  = rightPage.Height.Pixels / 2 - 100;
            ToggleShortFuze.OnClick    += new MouseEvent(ShortFuzeToggle);
            rightPage.Append(ToggleShortFuze);

            FuseSliderBar               = new SliderBar("Fuze Length");
            FuseSliderBar.HAlign        = 0.1f;
            FuseSliderBar.VAlign        = 0.5f;
            FuseSliderBar.Left.Pixels   = 200;
            FuseSliderBar.Top.Pixels    = rightPage.Height.Pixels / 2 - 325;
            FuseSliderBar.Width.Pixels  = 220;
            FuseSliderBar.Height.Pixels = 20;
            rightPage.Append(FuseSliderBar);

            FuseOut            = new UIText("null");
            FuseOut.VAlign     = 1;
            FuseOut.HAlign     = 0.5f;
            FuseOut.Top.Pixels = 25;
            FuseSliderBar.Append(FuseOut);

            RandomFuelImage             = new UIImage(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/Accessories/RandomFuel"));
            RandomFuelImage.Left.Pixels = 0;
            RandomFuelImage.Top.Pixels  = 0;
            RandomFuelImage.ImageScale  = 0.8f;
            RandomFuelImage.OnClick    += new MouseEvent(RandomFuelToggle);
            leftPage.Append(RandomFuelImage);

            ShortFuzeImage             = new UIImage(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/Accessories/ShortFuse"));
            ShortFuzeImage.Left.Pixels = 20;
            ShortFuzeImage.Top.Pixels  = -16;
            ShortFuzeImage.ImageScale  = 0.7f;
            ShortFuzeImage.OnClick    += new MouseEvent(ShortFuzeToggle);
            rightPage.Append(ShortFuzeImage);

            RandomFuel_GreyscaleImage             = new UIImage(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/Accessories/RandomFuel_Greyscale"));
            RandomFuel_GreyscaleImage.Left.Pixels = 0;
            RandomFuel_GreyscaleImage.Top.Pixels  = 0;
            RandomFuel_GreyscaleImage.ImageScale  = 0.8f;
            RandomFuel_GreyscaleImage.OnClick    += new MouseEvent(RandomFuelToggle);
            leftPage.Append(RandomFuel_GreyscaleImage);

            ShortFuze_GreyscaleImage             = new UIImage(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/Accessories/ShortFuse_Greyscale"));
            ShortFuze_GreyscaleImage.Left.Pixels = 20;
            ShortFuze_GreyscaleImage.Top.Pixels  = -16;
            ShortFuze_GreyscaleImage.ImageScale  = 0.7f;
            ShortFuze_GreyscaleImage.OnClick    += new MouseEvent(ShortFuzeToggle);
            rightPage.Append(ShortFuze_GreyscaleImage);
        }
Esempio n. 28
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            this.ScreenManager.FadeBackBufferToBlack((int)byte.MaxValue);
            GuiData.startDraw();
            int      x        = 0;
            int      y        = 0;
            Viewport viewport = this.ScreenManager.GraphicsDevice.Viewport;
            int      width    = viewport.Width;

            viewport = this.ScreenManager.GraphicsDevice.Viewport;
            int height = viewport.Height;

            PatternDrawer.draw(new Rectangle(x, y, width, height), 0.5f, Color.Black, new Color(2, 2, 2), GuiData.spriteBatch);
            if (Button.doButton(999, 10, 10, 220, 30, "<- " + LocaleTerms.Loc("Back"), new Color?(Color.Gray)))
            {
                SettingsLoader.writeStatusFile();
                this.ExitScreen();
            }
            if (Button.doButton(9907, 10, 44, 220, 20, LocaleTerms.Loc("Apply Changes"), new Color?(Color.LightBlue)))
            {
                this.needsApply = true;
            }
            int num1 = 100;

            TextItem.doLabel(new Vector2(400f, (float)num1), LocaleTerms.Loc("Resolutions"), new Color?(), 200f);
            int currentResIndex = this.currentResIndex;

            this.currentResIndex = SelectableTextList.doFancyList(10, 400, num1 + 36, 200, 450, this.resolutions, this.currentResIndex, new Color?(), false);
            if (!this.mouseHasBeenReleasedOnThisScreen)
            {
                this.currentResIndex = currentResIndex;
            }
            else if (SelectableTextList.wasActivated)
            {
                this.resolutionChanged = true;
            }
            if (!this.startedFromGameContext)
            {
                TextItem.doLabel(new Vector2(620f, (float)num1), LocaleTerms.Loc("Language"), new Color?(), 200f);
                int currentLocaleIndex = this.currentLocaleIndex;
                this.currentLocaleIndex = SelectableTextList.doFancyList(1013, 620, num1 + 36, 200, 450, this.localeNames, this.currentLocaleIndex, new Color?(), false);
                if (!this.mouseHasBeenReleasedOnThisScreen)
                {
                    this.currentLocaleIndex = currentLocaleIndex;
                }
                else if (SelectableTextList.wasActivated)
                {
                    LocaleActivator.ActivateLocale(LocaleActivator.SupportedLanguages[this.currentLocaleIndex].Code, Game1.getSingleton().Content);
                    Settings.ActiveLocale = LocaleActivator.SupportedLanguages[this.currentLocaleIndex].Code;
                }
            }
            int   num2     = 64;
            float MaxWidth = 280f;
            int   num3;

            TextItem.doLabel(new Vector2(100f, (float)(num3 = num2 + 36)), LocaleTerms.Loc("Fullscreen"), new Color?(), MaxWidth);
            int num4;

            this.windowed = CheckBox.doCheckBox(20, 100, num4 = num3 + 34, this.windowed, new Color?());
            int num5;

            TextItem.doLabel(new Vector2(100f, (float)(num5 = num4 + 32)), LocaleTerms.Loc("Bloom"), new Color?(), MaxWidth);
            int num6;

            PostProcessor.bloomEnabled = CheckBox.doCheckBox(21, 100, num6 = num5 + 34, PostProcessor.bloomEnabled, new Color?());
            int num7;

            TextItem.doLabel(new Vector2(100f, (float)(num7 = num6 + 32)), LocaleTerms.Loc("Scanlines"), new Color?(), MaxWidth);
            int num8;

            PostProcessor.scanlinesEnabled = CheckBox.doCheckBox(22, 100, num8 = num7 + 34, PostProcessor.scanlinesEnabled, new Color?());
            int num9;

            TextItem.doLabel(new Vector2(100f, (float)(num9 = num8 + 32)), LocaleTerms.Loc("Multisampling"), new Color?(), MaxWidth);
            bool shouldMultisample = SettingsLoader.ShouldMultisample;
            int  num10;

            SettingsLoader.ShouldMultisample = CheckBox.doCheckBox(221, 100, num10 = num9 + 34, SettingsLoader.ShouldMultisample, new Color?());
            if (shouldMultisample != SettingsLoader.ShouldMultisample)
            {
                this.resolutionChanged = true;
            }
            int num11;

            TextItem.doLabel(new Vector2(100f, (float)(num11 = num10 + 32)), LocaleTerms.Loc("Audio Visualiser"), new Color?(), MaxWidth);
            int num12;

            SettingsLoader.ShouldDrawMusicVis = CheckBox.doCheckBox(223, 100, num12 = num11 + 34, SettingsLoader.ShouldDrawMusicVis, new Color?());
            int num13;

            TextItem.doLabel(new Vector2(100f, (float)(num13 = num12 + 32)), LocaleTerms.Loc("Sound Enabled"), new Color?(), MaxWidth);
            int num14;

            MusicManager.setIsMuted(!CheckBox.doCheckBox(23, 100, num14 = num13 + 34, !MusicManager.isMuted, new Color?()));
            int num15;

            TextItem.doLabel(new Vector2(100f, (float)(num15 = num14 + 32)), LocaleTerms.Loc("Music Volume"), new Color?(), MaxWidth);
            int num16;

            MusicManager.setVolume(SliderBar.doSliderBar(24, 100, num16 = num15 + 34, 210, 30, 1f, 0.0f, MusicManager.getVolume(), 1f / 1000f));
            int num17;

            TextItem.doLabel(new Vector2(100f, (float)(num17 = num16 + 32)), LocaleTerms.Loc("Text Size"), new Color?(), MaxWidth);
            int currentFontIndex = this.currentFontIndex;
            int num18;

            this.currentFontIndex = SelectableTextList.doFancyList(25, 100, num18 = num17 + 34, 200, 160, this.fontConfigs, this.currentFontIndex, new Color?(), false);
            if (this.currentFontIndex != currentFontIndex && this.startedFromGameContext)
            {
                try
                {
                    if (OS.currentInstance != null)
                    {
                        OS.currentInstance.terminal.reset();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine((object)ex);
                    Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
                }
            }
            if (Button.doButton(990, 10, num18 + 150, 220, 30, LocaleTerms.Loc("Apply Changes"), new Color?(Color.LightBlue)))
            {
                this.needsApply = true;
            }
            GuiData.endDraw();
            PostProcessor.end();
        }
Esempio n. 29
0
        public SettingsScreen(Game game) : base("Settings")
        {
            this.game      = game;
            Title.Position = new CPos(0, -4096, 0);

            // Window
            var fullscreen = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6096, -3000, 0)
            };

            fullscreen.SetText("Fullscreen:");
            Add(fullscreen);

            var width = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6096, -2300, 0)
            };

            if (Settings.Fullscreen)
            {
                width.SetColor(new Color(128, 128, 128));
            }
            width.SetText("Width:");
            Add(width);

            var height = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6096, -1600, 0)
            };

            if (Settings.Fullscreen)
            {
                height.SetColor(new Color(128, 128, 128));
            }
            height.SetText("Height:");
            Add(height);

            fullscreenCheck = new CheckBox("wooden", Settings.Fullscreen, (ticked) =>
            {
                width.SetColor(ticked ? new Color(128, 128, 128) : Color.White);
                height.SetColor(ticked ? new Color(128, 128, 128) : Color.White);
            })
            {
                Position = new CPos(-1536, -3000, 0)
            };
            Add(fullscreenCheck);

            widthWrite = new TextBox("wooden", 5, InputType.NUMBERS)
            {
                Position = new CPos(-2048, -2300, 0),
                Text     = Settings.Width.ToString(),
                OnEnter  = () =>
                {
                    var parse = int.Parse(widthWrite.Text);
                    if (parse < 640)
                    {
                        widthWrite.Text = 640 + "";
                    }
                    else if (parse > ScreenInfo.ScreenWidth)
                    {
                        widthWrite.Text = ScreenInfo.ScreenWidth + "";
                    }
                }
            };
            Add(widthWrite);

            heightWrite = new TextBox("wooden", 5, InputType.NUMBERS)
            {
                Position = new CPos(-2048, -1600, 0),
                Text     = Settings.Height.ToString(),
                OnEnter  = () =>
                {
                    var parse = int.Parse(heightWrite.Text);
                    if (parse < 480)
                    {
                        heightWrite.Text = 480 + "";
                    }
                    else if (parse > ScreenInfo.ScreenHeight)
                    {
                        heightWrite.Text = ScreenInfo.ScreenHeight + "";
                    }
                }
            };
            Add(heightWrite);

            // Graphics
            var vSync = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-512, -3000, 0)
            };

            vSync.SetText("Enable V-Sync:");
            Add(vSync);

            var pixeling = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-512, -2300, 0)
            };

            pixeling.SetText("Enable Pixeling:");
            Add(pixeling);

            var textshadow = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-512, -1600, 0)
            };

            textshadow.SetText("Enable text shadows:");
            Add(textshadow);

            vSyncCheck = new CheckBox("wooden", Settings.VSync, (b) =>
            {
                Settings.VSync = b;
                Window.SetVSync();
            })
            {
                Position = new CPos(6656, -3000, 0)
            };
            Add(vSyncCheck);
            pixelingCheck = new CheckBox("wooden", Settings.EnablePixeling, (b) => Settings.EnablePixeling = b)
            {
                Position = new CPos(6656, -2300, 0)
            };
            Add(pixelingCheck);
            textshadowCheck = new CheckBox("wooden", Settings.EnableTextShadowing, (b) => Settings.EnableTextShadowing = b)
            {
                Position = new CPos(6656, -1600, 0)
            };
            Add(textshadowCheck);

            // Scrolling
            var scrollSpeed = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, -600, 0)
            };

            scrollSpeed.SetText("Camera panning speed:");
            Add(scrollSpeed);
            var edgeScrolling = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, 100, 0)
            };

            edgeScrolling.SetText("Edge Panning (0 = disabled):");
            Add(edgeScrolling);

            panningSlider = new SliderBar(4096, "wooden", () => Settings.ScrollSpeed = (int)(panningSlider.Value * 10))
            {
                Position = new CPos(5120, -600, 0),
                Value    = Settings.ScrollSpeed / 10f
            };
            Add(panningSlider);
            edgePanningSlider = new SliderBar(4096, "wooden", () => Settings.EdgeScrolling = (int)(edgePanningSlider.Value * 10))
            {
                Position = new CPos(5120, 100, 0),
                Value    = Settings.EdgeScrolling / 10f
            };
            Add(edgePanningSlider);

            // Additional features
            var frameLimiter = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, 1000, 0)
            };

            frameLimiter.SetText("Framelimiter (0 = disabled):");
            Add(frameLimiter);

            frameLimiterWrite = new TextBox("wooden", 2, InputType.NUMBERS)
            {
                Position = new CPos(5120, 1000, 0),
                Text     = Settings.FrameLimiter.ToString(),
                OnEnter  = () =>
                {
                    var number = int.Parse(frameLimiterWrite.Text);
                    if (number > ScreenInfo.ScreenRefreshRate)
                    {
                        frameLimiterWrite.Text = ScreenInfo.ScreenRefreshRate.ToString();
                    }
                }
            };
            Add(frameLimiterWrite);

            var developerMode = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, 1900, 0)
            };

            developerMode.SetText("Enable Developermode:");
            Add(developerMode);
            developerModeCheck = new CheckBox("wooden", Settings.DeveloperMode, (b) =>
            {
                Settings.DeveloperMode = b;
            })
            {
                Position = new CPos(5120, 1900, 0)
            };
            Add(developerModeCheck);

            // Volume
            var masterVol = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, 2800, 0)
            };

            masterVol.SetText("Master Volume:");
            Add(masterVol);
            var effectVol = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, 3700, 0)
            };

            effectVol.SetText("Effects Volume:");
            Add(effectVol);
            var musicVol = new UITextLine(FontManager.Default)
            {
                Position = new CPos(-6144, 4600, 0)
            };

            musicVol.SetText("Music Volume:");
            Add(musicVol);

            masterVolumeSlider = new SliderBar(4096, "wooden", () =>
            {
                Settings.MasterVolume = (float)Math.Round(masterVolumeSlider.Value, 2);
                MusicController.UpdateVolume();
            })
            {
                Position = new CPos(5120, 2800, 0),
                Value    = Settings.MasterVolume
            };
            Add(masterVolumeSlider);
            effectVolumeSlider = new SliderBar(4096, "wooden", () =>
            {
                Settings.EffectsVolume = (float)Math.Round(effectVolumeSlider.Value, 2);
            })
            {
                Position = new CPos(5120, 3700, 0),
                Value    = Settings.EffectsVolume
            };
            Add(effectVolumeSlider);
            musicVolumeSlider = new SliderBar(4096, "wooden", () =>
            {
                Settings.MusicVolume = (float)Math.Round(musicVolumeSlider.Value, 2);
                MusicController.UpdateVolume();
            })
            {
                Position = new CPos(5120, 4600, 0),
                Value    = Settings.MusicVolume
            };
            Add(musicVolumeSlider);

            var warning = new UITextLine(FontManager.Default, TextOffset.MIDDLE)
            {
                Position = new CPos(0, 5450, 0),
                Color    = Color.Red
            };

            warning.SetText("Some changes only take effect after restarting and can cause visual bugs.");
            Add(warning);

            Add(new Button("Apply", "wooden", Save)
            {
                Position = new CPos(-5120, 6144, 0)
            });
            Add(new Button("Save & Back", "wooden", () => game.ShowScreen(ScreenType.MENU))
            {
                Position = new CPos(5120, 6144, 0)
            });
            Add(new Button("Key Bindings", "wooden", () => game.ShowScreen(ScreenType.KEYSETTINGS))
            {
                Position = new CPos(0, 6144, 0)
            });
        }
Esempio n. 30
0
        private void load(Game game, AudioManager audio)
        {
            track = new TrackBass(game.Resources.GetStream("Tracks/sample-track.mp3"));
            audio.Track.AddItem(track);

            var waveform = new Waveform(game.Resources.GetStream("Tracks/sample-track.mp3"));

            FillFlowContainer flow;

            const float track_width = 1366; // required because RelativeSizeAxes.X doesn't seem to work with horizontal scroll

            Child = new FillFlowContainer
            {
                RelativeSizeAxes = Axes.Both,
                Direction        = FillDirection.Vertical,
                Children         = new Drawable[]
                {
                    new FillFlowContainer
                    {
                        AutoSizeAxes     = Axes.Y,
                        RelativeSizeAxes = Axes.X,
                        Spacing          = new Vector2(10),
                        Children         = new Drawable[]
                        {
                            button = new Button
                            {
                                Text             = "Start",
                                Size             = new Vector2(100, 50),
                                BackgroundColour = Color4.DarkSlateGray,
                                Anchor           = Anchor.CentreLeft,
                                Origin           = Anchor.CentreLeft,
                                Action           = startStop
                            },
                            new SpriteText
                            {
                                Text   = "Zoom Level:",
                                Origin = Anchor.CentreLeft,
                                Anchor = Anchor.CentreLeft,
                            },
                            zoomSlider = new BasicSliderBar <float>
                            {
                                Anchor = Anchor.CentreLeft,
                                Origin = Anchor.CentreLeft,
                                Size   = new Vector2(200, 40)
                            },
                        },
                    },
                    new ScrollContainer(Direction.Horizontal)
                    {
                        RelativeSizeAxes = Axes.Both,
                        Child            = flow = new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.Y,
                            Width            = track_width,
                            Direction        = FillDirection.Vertical,
                            Spacing          = new Vector2(0, 10)
                        }
                    }
                }
            };

            for (int i = 1; i <= 16; i *= 2)
            {
                flow.Add(new TestWaveform(track, 1f / i)
                {
                    Waveform = waveform
                });
            }

            zoomSlider.Current.BindTo(zoom);
            zoomSlider.Current.ValueChanged += v => flow.Width = track_width * v;
        }