internal void InternalInitializeObject(SLUIObject obj) { if (Objects.Contains(obj)) { return; } Objects.Add(obj); }
/// <summary> /// Destroys given object. /// </summary> public void Destroy([NotNull] SLUIObject obj) { if (obj == null) { throw new ArgumentNullException(nameof(obj)); } if (Objects.Contains(obj)) { Objects.Remove(obj); } Object.Destroy(obj.Original); }
/// <summary> /// Direct unity event execution. /// </summary> public void ExecuteUnityEvent([NotNull] SLUIObject target, [NotNull] string methodName, params object[] args) { if (target == null) { throw new ArgumentNullException(nameof(target)); } if (methodName == null) { throw new ArgumentNullException(nameof(methodName)); } var obj = target.Original; var method = obj.GetType().GetMethod(methodName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (method == null) { throw new ArgumentException($"Method {methodName} does not exist in object of type {obj.GetType()}."); } object[] a = args?.ToArray(); method.Invoke(obj, a); }