相同灯光 不添加 只叠加时间
This commit is contained in:
parent
ba51f93b17
commit
2b8d2f91be
@ -142,8 +142,12 @@ namespace FlyCube
|
|||||||
{
|
{
|
||||||
List<LedInfos> ledInfos = new List<LedInfos>();
|
List<LedInfos> ledInfos = new List<LedInfos>();
|
||||||
Color[] colors = img.GetColorsForGifPos((int)item.X, (int)item.Y);
|
Color[] colors = img.GetColorsForGifPos((int)item.X, (int)item.Y);
|
||||||
|
string c = "";
|
||||||
foreach (var color in colors)
|
foreach (var color in colors)
|
||||||
{
|
{
|
||||||
|
if (c != color.ToString().Remove(0, 3))//判断和一帧颜色是否相同 不同的话添加 新的灯光信息
|
||||||
|
{
|
||||||
|
//添加灯光信息
|
||||||
LedInfos led = new LedInfos();
|
LedInfos led = new LedInfos();
|
||||||
led.Delay = 0.1;
|
led.Delay = 0.1;
|
||||||
led.LEDMode = 0;
|
led.LEDMode = 0;
|
||||||
@ -152,6 +156,14 @@ namespace FlyCube
|
|||||||
led.LEDTimes = 0;
|
led.LEDTimes = 0;
|
||||||
led.LEDRGB = color.ToString().Remove(0, 3);
|
led.LEDRGB = color.ToString().Remove(0, 3);
|
||||||
ledInfos.Add(led);
|
ledInfos.Add(led);
|
||||||
|
//记录这一帧颜色 用于下次循环和 这一帧进行对比
|
||||||
|
c = color.ToString().Remove(0, 3);
|
||||||
|
}
|
||||||
|
else//如果和上一帧颜色一样 则不进行Add 并把上一帧的 灯光延时自加0.1秒
|
||||||
|
{
|
||||||
|
ledInfos[ledInfos.Count-1].Delay += 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
this.FcgmInfo.tasks[2].singleCopterInfos[id].ledInfos = ledInfos;
|
this.FcgmInfo.tasks[2].singleCopterInfos[id].ledInfos = ledInfos;
|
||||||
id++;
|
id++;
|
||||||
|
Loading…
Reference in New Issue
Block a user