Пример #1
0
        private void Update()
        {
            _grid.Set(Color.Blue);

            foreach (var key in _pressCount)
            {
                var color = _colorHeatMap.GetColorForValue(key.Value, _max);
                _grid[key.Key] = color;
            }

            _chromaService.Send(_grid);
        }
Пример #2
0
        private static void RenderKeyboard(ref KeyboardCustom keyboard, int[] characterHPPoint, int[] characterMPPoint)
        {
            //reset
            keyboard.Set(fadeRed);

            /*
             * var currentTime = DateTime.Now;
             * var am_pm = currentTime.ToString("tt", CultureInfo.InvariantCulture);
             * keyboard[FunctionKeys[currentTime.Hour % 12]] = am_pm == "AM" ? ColoreColor.White : ColoreColor.Blue;
             * var decMin = (currentTime.Minute - (currentTime.Minute % 10)) / 10;
             * keyboard[NumpadKeys[decMin]] = contrastOrange;
             * keyboard[NumpadKeys[currentTime.Minute % 10]] = ColoreColor.Yellow;
             */
            for (var i = 0; i < charRenderGrid[0].Length; i++)
            {
                keyboard[charRenderGrid[0][i]] = fadeWhite;
                keyboard[charRenderGrid[1][i]] = fadeWhite;
                keyboard[charRenderGrid[2][i]] = fadeWhite;
            }
            for (var i = 0; i < charMPRows[0].Length; i++)
            {
                keyboard[charMPRows[0][i]] = fadeWhite;
                keyboard[charMPRows[1][i]] = fadeWhite;
                keyboard[charMPRows[2][i]] = fadeWhite;
            }
            for (var charIndex = 0; charIndex < characterHPPoint.Length; charIndex++)
            {
                ColoreColor hpColor     = GetHPStateColor(characterHPPoint[charIndex]);
                ColoreColor mpColor     = new ColoreColor((byte)0, (byte)0, (byte)(25.5 * characterMPPoint[charIndex]));
                var         manaPercent = Math.Round(((double)characterMPPoint[charIndex] / 10) * charMPRows[charIndex].Length, 0);
                for (var i = 0; i < manaPercent; i++)
                {
                    keyboard[charMPRows[charIndex][i]] = ColoreColor.Blue;
                }

                for (var i = 0; i < characterHPPoint[charIndex]; i++)
                {
                    keyboard[charRenderGrid[charIndex][i]] = hpColor;
                }
            }
            blinking = !blinking;
        }