Пример #1
0
        public bool Matches(string message)
        {
            string[] lines = message.Split(';');
            if (lines.Length > 0 && lines[0].StartsWith("HandFx"))
            {
                handFxDto = new HandFxDto();
                bool success = false;
                foreach (string line in lines)
                {
                    Match match = Regex.Match(line.Trim(), @"^HandFx\s+(\w+)\s+([-+]?\d+)(?:\s+(\d+)%)?");

                    if (match.Success)
                    {
                        success = true;
                        int scalePercent = 100;
                        if (match.Groups.Count > 3 && !string.IsNullOrWhiteSpace(match.Groups[3].Value))
                        {
                            scalePercent = int.Parse(match.Groups[3].Value);
                        }
                        handFxDto.AddHandEffect(match.Groups[1].Value, int.Parse(match.Groups[2].Value), scalePercent);
                    }
                }
                return(success);
            }
            return(false);
        }
Пример #2
0
 public void TriggerHandFx(HandFxDto handFxDto)
 {
     // TODO: Add support for hand-specific (left or right) placement.
     // TODO: Add support for tossable objects in the stream deck commands.
     foreach (HandEffectDto handEffect in handFxDto.HandEffects)
     {
         if (handEffect.HueShift == -1)
         {
             if (random == null)
             {
                 random = new Random();
             }
             if ((DateTime.Now - lastTimeWeGeneratedRandomColor).TotalSeconds > 5)
             {
                 lastTimeWeGeneratedRandomColor = DateTime.Now;
                 lastRandomColor     = new Random().Next(360);
                 handEffect.HueShift = lastRandomColor;
             }
             else
             {
                 handEffect.HueShift = lastRandomColor + random.Next(20) - 10;
                 lastRandomColor    += 20;
             }
         }
     }
     skeletalData2d.HandEffect = handFxDto;
 }
Пример #3
0
 public void TriggerHandFx(HandFxDto handFxDto)
 {
     // TODO: Add support for hand-specific (left or right) placement.
     // TODO: Add support for tossable objects in the stream deck commands.
     skeletalData2d.HandEffect = handFxDto;
 }
Пример #4
0
 public void Execute(IDungeonMasterApp dungeonMasterApp, ChatMessage chatMessage)
 {
     // TODO: Fill out the HandFxDto properties before sending.
     dungeonMasterApp.TriggerHandFx(handFxDto);
     handFxDto = null;
 }