Example #1
0
        private void UpdateVolMusic(object o, Label l, Save.GeneralSettings gs)
        {
            TrackBar tb  = (TrackBar)o;
            float    vol = Helper.ByteToFloat((byte)tb.Value);

            l.Text      = tb.Value.ToString();
            gs.VolMusic = vol;
        }
Example #2
0
 private void UpdateFreePlayTracks(object o, Save.GeneralSettings gs)
 {
     BeginInvoke((MethodInvoker) delegate
     {
         CheckedListBox v             = (CheckedListBox)o;
         Save.TrackUnlockFlags unlock = 0;
         foreach (Save.TrackUnlockFlags track in v.CheckedItems)
         {
             unlock |= track;
         }
         gs.AvailableTracks = unlock;
     });
 }
Example #3
0
 private void UpdateFreePlayVehicles(object o, Save.GeneralSettings gs)
 {
     BeginInvoke((MethodInvoker) delegate
     {
         CheckedListBox v = (CheckedListBox)o;
         Save.VehicleUnlockFlags unlock = 0;
         foreach (Save.VehicleUnlockFlags vehicle in v.CheckedItems)
         {
             unlock |= vehicle;
         }
         gs.AvailableVehicles = unlock;
     });
 }
Example #4
0
        private void SetupSection(Panel p, Save.GeneralSettings gs)
        {
            //sfx vol, music vol, pods, tracks
            int pad = 8, padMid = 4, h = 20, wT = 96, wI = 160, wI2 = 32, hIoff = -2;

            string[] cols = new string[2] {
                "SFX Volume", "Music Volume"
            };
            Label l1;

            for (int i = 0; i < cols.Length; i++)
            {
                l1          = new Label();
                l1.Text     = cols[i];
                l1.Location = new Point(pad, pad + (h + padMid) * i);
                l1.Size     = new Size(wT, h);
                l1.Padding  = new Padding(0);
                l1.Margin   = new Padding(0);
                l1.AutoSize = true;
                p.Controls.Add(l1);
            }

            Label lSfx = new Label();

            lSfx          = new Label();
            lSfx.Text     = Helper.FloatToByte(gs.VolSFX).ToString();
            lSfx.Location = new Point(pad + wT + wI + padMid, pad + (h + padMid) * 0);
            lSfx.Size     = new Size(wI2, h);
            lSfx.Padding  = new Padding(0);
            lSfx.Margin   = new Padding(0);
            lSfx.AutoSize = true;
            p.Controls.Add(lSfx);
            TrackBar tbSfx = new TrackBar();

            tbSfx.Maximum       = byte.MaxValue;
            tbSfx.Minimum       = byte.MinValue;
            tbSfx.Value         = Helper.FloatToByte(gs.VolSFX);
            tbSfx.TickStyle     = TickStyle.None;
            tbSfx.AutoSize      = false;
            tbSfx.Location      = new Point(pad + wT, pad + hIoff + (h + padMid) * 0);
            tbSfx.Size          = new Size(wI, h);
            tbSfx.ValueChanged += (o, e) => UpdateVolSfx(o, lSfx, gs);
            p.Controls.Add(tbSfx);

            Label lMus = new Label();

            lMus          = new Label();
            lMus.Text     = Helper.FloatToByte(gs.VolMusic).ToString();
            lMus.Location = new Point(pad + wT + wI + padMid, pad + (h + padMid) * 1);
            lMus.Size     = new Size(wI2, h);
            lMus.Padding  = new Padding(0);
            lMus.Margin   = new Padding(0);
            lMus.AutoSize = true;
            p.Controls.Add(lMus);
            TrackBar tbMus = new TrackBar();

            tbMus.Maximum       = byte.MaxValue;
            tbMus.Minimum       = byte.MinValue;
            tbMus.Value         = Helper.FloatToByte(gs.VolMusic);
            tbMus.TickStyle     = TickStyle.None;
            tbMus.AutoSize      = false;
            tbMus.Location      = new Point(pad + wT, pad + hIoff + (h + padMid) * 1);
            tbMus.Size          = new Size(wI, h);
            tbMus.ValueChanged += (o, e) => UpdateVolMusic(o, lMus, gs);
            p.Controls.Add(tbMus);

            int clbW = (basepanel.Width - pad * 3 - 32) / 2, clbH = 110, clbBtnW = clbW / 4;

            Label lVcl = new Label();

            lVcl          = new Label();
            lVcl.Text     = "Free Play Vehicles";
            lVcl.Location = new Point(pad + (clbW + pad) * 0, pad + (h + padMid) * 2);
            lVcl.Size     = new Size(wI2, h);
            lVcl.Padding  = new Padding(0);
            lVcl.Margin   = new Padding(0);
            lVcl.AutoSize = true;
            p.Controls.Add(lVcl);
            CheckedListBox clbVcl = new CheckedListBox();

            clbVcl.IntegralHeight = false;
            clbVcl.Location       = new Point(lVcl.Location.X, lVcl.Location.Y + lVcl.Size.Height + padMid);
            clbVcl.Size           = new Size(clbW, clbH);
            clbVcl.CheckOnClick   = true;
            Array vclFlagList = Enum.GetValues(typeof(Save.VehicleUnlockFlags));

            foreach (Save.VehicleUnlockFlags flag in vclFlagList)
            {
                if (gs.AvailableVehicles.HasFlag(flag))
                {
                    clbVcl.Items.Add(flag, true);
                }
                else
                {
                    clbVcl.Items.Add(flag, false);
                }
            }
            clbVcl.ItemCheck += (o, e) => UpdateFreePlayVehicles(o, gs);
            p.Controls.Add(clbVcl);
            Button btnVnone = new Button();

            btnVnone.Text     = "None";
            btnVnone.Size     = new Size(clbBtnW, h);
            btnVnone.Location = new Point(clbVcl.Location.X, clbVcl.Location.Y + clbVcl.Size.Height + padMid);
            btnVnone.Click   += (o, e) => SelectAll(clbVcl, false);
            p.Controls.Add(btnVnone);
            Button btnVall = new Button();

            btnVall.Text     = "All";
            btnVall.Size     = new Size(clbBtnW, h);
            btnVall.Location = new Point(btnVnone.Location.X + btnVnone.Size.Width + padMid, clbVcl.Location.Y + clbVcl.Size.Height + padMid);
            btnVall.Click   += (o, e) => SelectAll(clbVcl, true);
            p.Controls.Add(btnVall);

            Label lTrk = new Label();

            lTrk          = new Label();
            lTrk.Text     = "Free Play Tracks";
            lTrk.Location = new Point(pad + (clbW + pad) * 1, pad + (h + padMid) * 2);
            lTrk.Size     = new Size(wI2, h);
            lTrk.Padding  = new Padding(0);
            lTrk.Margin   = new Padding(0);
            lTrk.AutoSize = true;
            p.Controls.Add(lTrk);
            CheckedListBox clbTrk = new CheckedListBox();

            clbTrk.IntegralHeight = false;
            clbTrk.Location       = new Point(lTrk.Location.X, lTrk.Location.Y + lTrk.Size.Height + padMid);
            clbTrk.Size           = new Size(clbW, clbH);
            clbTrk.CheckOnClick   = true;
            Array trkFlagList = Enum.GetValues(typeof(Save.TrackUnlockFlags));

            foreach (Save.TrackUnlockFlags flag in trkFlagList)
            {
                if (gs.AvailableTracks.HasFlag(flag) && !flag.ToString().EndsWith("Done"))
                {
                    clbTrk.Items.Add(flag, true);
                }
                else if (!flag.ToString().EndsWith("Done"))
                {
                    clbTrk.Items.Add(flag, false);
                }
            }
            clbTrk.ItemCheck += (o, e) => UpdateFreePlayTracks(o, gs);
            p.Controls.Add(clbTrk);
            Button btnTnone = new Button();

            btnTnone.Text     = "None";
            btnTnone.Size     = new Size(clbBtnW, h);
            btnTnone.Location = new Point(clbTrk.Location.X, clbTrk.Location.Y + clbTrk.Size.Height + padMid);
            btnTnone.Click   += (o, e) => SelectAll(clbTrk, false);
            p.Controls.Add(btnTnone);
            Button btnTall = new Button();

            btnTall.Text     = "All";
            btnTall.Size     = new Size(clbBtnW, h);
            btnTall.Location = new Point(btnTnone.Location.X + btnTnone.Size.Width + padMid, clbTrk.Location.Y + clbTrk.Size.Height + padMid);
            btnTall.Click   += (o, e) => SelectAll(clbTrk, true);
            p.Controls.Add(btnTall);
        }