Skip to content

Commit 5a61e3c

Browse files
Injected attribute now takes a controller
1 parent d3144cf commit 5a61e3c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Runtime/Attributes/Injected.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ public static void SetAttributeValues (System.Object target) {
1212
foreach (var _field in _fields)
1313
if (System.Attribute.GetCustomAttribute (_field, typeof (Injected)) != null)
1414
foreach (var _fieldInterface in _field.FieldType.GetInterfaces ()) {
15-
if (_fieldInterface == typeof (IService))
16-
_field.SetValue (target, Controller.Instance.GetService (_field.FieldType));
17-
else if (_fieldInterface == typeof (IEntitySystem))
15+
if (_fieldInterface == typeof (IEntitySystem))
1816
_field.SetValue (target, Controller.Instance.GetSystem (_field.FieldType));
17+
else if (_fieldInterface == typeof (IService))
18+
_field.SetValue (target, Controller.Instance.GetService (_field.FieldType));
19+
else if (_fieldInterface == typeof (IController))
20+
_field.SetValue (target, Controller.Instance);
1921
}
2022
}
2123
}

0 commit comments

Comments
 (0)