Skip to content

Commit 048caf7

Browse files
committed
support external plugins
1 parent 90b9432 commit 048caf7

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Plugins/PluginManager.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,23 @@ public class PluginManager
1818
};
1919
private static Dictionary<string, Type> plugins;
2020

21+
public static void Activate(Type pluginType)
22+
{
23+
TSPlugin plugin = Activator.CreateInstance(pluginType) as TSPlugin;
24+
if (plugin != null)
25+
{
26+
plugins[plugin.PropertyName] = pluginType;
27+
}
28+
}
29+
2130
public static void Init()
2231
{
2332
if (plugins == null)
2433
{
2534
plugins = new Dictionary<string, Type>();
2635
foreach (Type pluginType in pluginList)
2736
{
28-
TSPlugin plugin = Activator.CreateInstance(pluginType) as TSPlugin;
29-
plugins[plugin.PropertyName] = pluginType;
37+
Activate(pluginType);
3038
}
3139
pluginList = null;
3240
}

TweenSharp.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public class TweenSharp
3939
private float startTime;
4040
public TSEase.EaseFunction ease = Linear.EaseNone;
4141

42+
public static void Activate(Type pluginType)
43+
{
44+
PluginManager.Activate(pluginType);
45+
}
4246

4347
public TweenSharp(object target, float duration, Dictionary<string, object> args)
4448
{

0 commit comments

Comments
 (0)