Exemplo n.º 1
0
        async void ChangeBulbSettings(string bulbLabel, int hueShift, double brightness)
        {
            HueSatLight hsl = new HueSatLight(hueShift / 360.0, 1, 0.5);

            System.Diagnostics.Debug.WriteLine($"{hsl.AsHtml}");
            await lifxService.ChangeBulbSettings(bulbLabel, hsl.AsHtml, brightness);
        }
Exemplo n.º 2
0
        private void SetColor(HueSatLight hueSatLight)
        {
            Color asRGB = hueSatLight.AsRGB;

            Dmx.Controller.SetChannel(ChannelStart, asRGB.R);
            Dmx.Controller.SetChannel(ChannelStart + 1, asRGB.G);
            Dmx.Controller.SetChannel(ChannelStart + 2, asRGB.B);
        }
Exemplo n.º 3
0
        public BasePropertyChanger GetPropertyChanger()
        {
            ChangeColor result      = new ChangeColor();
            HueSatLight hueSatLight = GetHsl();
            float       multiplier  = trkMultiplier.Value / 10.0f;

            result.SetValue(hueSatLight.AsHtml, multiplier);
            return(result);
        }
Exemplo n.º 4
0
        private HueSatLight GetHsl()
        {
            HueSatLight hueSatLight = new HueSatLight();

            hueSatLight.Hue        = trkHue.Value / 100.0;
            hueSatLight.Saturation = trkSat.Value / 100.0;
            hueSatLight.Lightness  = trkLight.Value / 100.0;
            return(hueSatLight);
        }
Exemplo n.º 5
0
 private static void CorrectHueShifts(DiceRoll diceRoll, HueSatLight hueSatLight)
 {
     foreach (TrailingEffect trailingEffect in diceRoll.TrailingEffects)
     {
         double hueOffset = 0;
         if (trailingEffect.Name == "FrostTrail")
         {
             hueOffset = 163;                      // FrostTrail raw color is blue - this shifts it back to red.
         }
         trailingEffect.HueShift = (360 * hueSatLight.Hue + hueOffset).ToString();
     }
 }
        void UpdateColor()
        {
            Hue        = sldHue.Value;
            Saturation = sldSaturation.Value;
            Lightness  = sldLightness.Value;
            HueSatLight hueSatLight = new HueSatLight(Hue / 360.0, Saturation / 100, Lightness / 100);

            rctSample.Fill    = new SolidColorBrush(hueSatLight.AsRGB);
            tbHue.Text        = Math.Round(sldHue.Value).ToString();
            tbSaturation.Text = Math.Round(sldSaturation.Value).ToString();
            tbLightness.Text  = Math.Round(sldLightness.Value).ToString();
        }
Exemplo n.º 7
0
 private void UpdateHtml()
 {
     changingTextInternally = true;
     try
     {
         HueSatLight hueSatLight = new HueSatLight(btnSetColor.BackColor);
         tbxHtml.Text = hueSatLight.AsHtml;
     }
     finally
     {
         changingTextInternally = false;
     }
 }
Exemplo n.º 8
0
        private void trkColor_Scroll(object sender, EventArgs e)
        {
            if (changingTrackbarsInternally)
            {
                Talespire.Log.Debug($"changingTrackbarsInternally is true");
                return;
            }

            HueSatLight hueSatLight = GetHsl();

            //Talespire.Log.Debug($"hueSatLight - hue = {hueSatLight.Hue}, saturation = {hueSatLight.Saturation}, lightness = {hueSatLight.Lightness} ");
            btnSetColor.BackColor = hueSatLight.AsRGB;
            ColorChanged();
            UpdateHtml();
        }
Exemplo n.º 9
0
 private void UpdateTrackbars()
 {
     changingTrackbarsInternally = true;
     try
     {
         HueSatLight hueSatLight = new HueSatLight(btnSetColor.BackColor);
         trkHue.Value   = (int)(hueSatLight.Hue * 100);
         trkSat.Value   = (int)(hueSatLight.Saturation * 100);
         trkLight.Value = (int)(hueSatLight.Lightness * 100);
     }
     finally
     {
         changingTrackbarsInternally = false;
     }
 }
Exemplo n.º 10
0
        static DiceRoll CreateRoll(string command, CardDto cardDto, DndViewer viewer)
        {
            string parameterStr = command.EverythingAfter("(").EverythingBeforeLast(")");

            string[] parameters = parameterStr.Split(',');
            if (parameters.Length < 2)
            {
                return(null);
            }

            DiceRoll diceRoll = new DiceRoll(DiceRollType.ViewerRoll);

            diceRoll.AddTrailingEffects(viewer.TrailingEffects);

            HueSatLight hueSatLight = new HueSatLight(viewer.DieBackColor);

            CorrectHueShifts(diceRoll, hueSatLight);
            diceRoll.DieTotalMessage  = $"{cardDto.Card.UserName}'s {cardDto.Card.CardName}";
            diceRoll.TextOutlineColor = viewer.DieTextColor;
            diceRoll.TextFillColor    = viewer.DieBackColor;
            diceRoll.DiceGroup        = DiceGroup.Viewers;
            diceRoll.RollScope        = RollScope.Viewer;
            diceRoll.RollID           = cardDto.InstanceID;
            diceRoll.Viewer           = cardDto.Card.UserName;

            for (int i = 0; i < parameters.Length; i += 2)
            {
                string dieLabel = parameters[i + 1].Trim();
                string dieStr   = parameters[i].Trim();
                if (dieStr.Contains("save:"))
                {
                    foreach (int targetCharacterId in cardDto.TargetCharacterIds)
                    {
                        DiceDto diceDto = AddDieStr(diceRoll, cardDto, viewer, dieStr, dieLabel, targetCharacterId);
                        diceDto.DieCountsAs = DieCountsAs.savingThrow;
                    }
                }
                else
                {
                    AddDieStr(diceRoll, cardDto, viewer, dieStr, dieLabel);
                }
            }

            savedCardsForViewerDieRolls.Add(cardDto);

            return(diceRoll);
        }
Exemplo n.º 11
0
        private void RefreshTrackHue()
        {
            if (MiniGrouperScript == null)
            {
                trkHue.Value = 0;
                return;
            }

            byte red   = (byte)Math.Round(MiniGrouperScript.IndicatorColor.r * 255.0);
            byte green = (byte)Math.Round(MiniGrouperScript.IndicatorColor.g * 255.0);
            byte blue  = (byte)Math.Round(MiniGrouperScript.IndicatorColor.b * 255.0);

            System.Drawing.Color color       = System.Drawing.Color.FromArgb(red, green, blue);
            HueSatLight          hueSatLight = new HueSatLight(color);

            trkHue.Value = (int)Math.Round(hueSatLight.Hue * 360.0);
        }
Exemplo n.º 12
0
        private void tbxHtml_TextChanged(object sender, EventArgs e)
        {
            if (changingTextInternally)
            {
                return;
            }

            try
            {
                HueSatLight hueSatLight = new HueSatLight(tbxHtml.Text);
                btnSetColor.BackColor = hueSatLight.AsRGB;
                ColorChanged(true);
                UpdateTrackbars();
            }
            catch (Exception ex)
            {
                Talespire.Log.Exception(ex);
                MessageBox.Show(ex.Message, ex.GetType().ToString());
            }
        }
Exemplo n.º 13
0
        public void SetColor(string htmlColorStr)
        {
            HueSatLight hueSatLight = new HueSatLight(htmlColorStr);

            SetColor(hueSatLight);
        }