Skip to content

Commit

Permalink
fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
TroyFernandes committed Jan 15, 2018
1 parent afe3c0e commit 0b7f481
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions HuePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public PluginInfo Initialise(IntPtr apiInterfacePtr)
about.Type = PluginType.General;
about.VersionMajor = 1; // your plugin version
about.VersionMinor = 0;
about.Revision = 0;
about.Revision = 1;
about.MinInterfaceVersion = MinInterfaceVersion;
about.MinApiRevision = MinApiRevision;
about.ReceiveNotifications = (ReceiveNotificationFlags.PlayerEvents | ReceiveNotificationFlags.TagEvents);
Expand All @@ -47,10 +47,18 @@ public PluginInfo Initialise(IntPtr apiInterfacePtr)
Configuration.Initialize(Settings.Instance.APIKey);
settingsSelector.startup();
lights = new LightCollection();
foreach (string lightNames in Settings.Instance.HueLights)
try
{
new LightStateBuilder().For(lights[lightNames]).TurnOn().Apply();
foreach (string lightNames in Settings.Instance.HueLights)
{
new LightStateBuilder().For(lights[lightNames]).TurnOn().Apply();
}
}
catch (NullReferenceException e)
{
Console.WriteLine(e.ToString());
}

return about;
}

Expand Down Expand Up @@ -232,13 +240,15 @@ public void sendColors(List<Tuple<double, double>> colors, int max)
while (!threadStop)
{
index = rnd.Next(0, max);
foreach (string lightName in Settings.Instance.HueLights)

if (stopwatch.ElapsedMilliseconds > 4500)
{
if (stopwatch.ElapsedMilliseconds > 4500)
foreach (string lightName in Settings.Instance.HueLights)
{
new LightStateBuilder().For(lights[lightName]).TransitionTime(30).XYCoordinates(colors[index].Item1, colors[index].Item2).Apply();
stopwatch.Restart();
}

}
}
threadStop = !threadStop;
Expand Down

0 comments on commit 0b7f481

Please sign in to comment.