Beispiel #1
0
 public KPSCOLOR[] GetNewColors()
 {
     KPSCOLOR[] nc = new KPSCOLOR[kpscolorcount];
     for (int i = 0; i < kpscolorcount; i++)
     {
         nc[i] = kpscolorcontrols[i].Export();
     }
     return(nc);
 }
Beispiel #2
0
        private string SerializeKpsColors(KPSCOLOR[] colors, int count)
        {
            StringBuilder b = new StringBuilder();

            for (int i = 0; i < count; i++)
            {
                KPSCOLOR c = colors[i];
                b.Append("|").Append(c.kps).Append(",").Append(c.color.ToArgb()).Append(",").Append(c.smoothen);
            }

            if (b.Length != 0)
            {
                b.Remove(0, 1);
            }

            return(b.ToString());
        }
Beispiel #3
0
 public void Use(KPSCOLOR kpscolor)
 {
     this.btnColor.BackColor     = kpscolor.color;
     this.nudKps.Value           = kpscolor.kps;
     this.chkSmoothColor.Checked = kpscolor.smoothen;
 }
Beispiel #4
0
        private void UpdateLabels()
        {
            byte kps = this.kps[index];

            if (kps > max)
            {
                max = kps;
            }

            bool  smoothen = false;
            Color nextcol  = frmMain.FgColor;
            Color prevcol  = nextcol;
            int   nextkps  = 0;
            float progress = 0;
            int   i        = frmMain.kpscolorscount;

            if (i > 0)
            {
                KPSCOLOR kc = frmMain.kpscolors[i - 1];
                nextcol = kc.color;
                nextkps = kc.kps;
            }
            while (--i >= 0)
            {
                KPSCOLOR kc = frmMain.kpscolors[i];
                if (kps >= kc.kps)
                {
                    prevcol = kc.color;
                    if (kps != 0)
                    {
                        progress = (kps - kc.kps) / (float)(nextkps - kc.kps);
                    }
                    break;
                }
                nextcol  = kc.color;
                nextkps  = kc.kps;
                smoothen = kc.smoothen;
                if (i == 0)
                {
                    prevcol  = frmMain.FgColor;
                    progress = kps / (float)(nextkps);
                }
            }
            if (smoothen)
            {
                prevcol = Color.FromArgb(
                    255,
                    prevcol.R + (int)((nextcol.R - prevcol.R) * progress),
                    prevcol.G + (int)((nextcol.G - prevcol.G) * progress),
                    prevcol.B + (int)((nextcol.B - prevcol.B) * progress)
                    );
            }
            lblKps.ForeColor = prevcol;

            if (kps == 0)
            {
                lblKps.Text = string.Format("{0} Max", max);
            }
            else
            {
                lblKps.Text = string.Format("{0} Kps", kps);
            }

            lblTotal.Text = total.ToString();
        }