public void OnAfterDeserialize() { _editorArguementsNamesDirty = true; _arguementsCache = null; _cachedCall = null; _isCachedCallDirty = true; }
public void Reset(Object target, MethodInfo methodInfo) { if (methodInfo != null) { if (target == null) { throw new System.ArgumentNullException("target"); } if (!methodInfo.DeclaringType.IsAssignableFrom(target.GetType())) { throw new System.ArgumentException($"typemismatch {target.GetType()} vs {methodInfo.DeclaringType.GetType()}"); } } _target = target; _funcName = methodInfo == null ? null :methodInfo.Name; if (methodInfo != null) { var parameters = methodInfo.GetParameters(); RebuildArguements(parameters); } else { RebuildArguements(null); } _isCachedCallDirty = true; _cachedCall = null; _arguementsCache = null; }
private void DoActualInvoke(object[] args) { if (_cachedCall == null) { if (!_isCachedCallDirty) { return; } _isCachedCallDirty = false; try{ _cachedCall = CachedCallFactory.Create(_target, _funcName, arguementsCache.types, false); if (_cachedCall == null) { Debug.LogWarning($"failed to invoke method:{_target.GetType()}.{_funcName}"); return; } }catch (System.Exception e) { Debug.LogException(e); } } if (_arguementMode == ArguementMode.Dynamic) { if (args.Length != this.arguementsCount) { throw new System.ArgumentException($"arguements count mismatch for <{_target.GetType()}.{_funcName}>"); } _cachedCall.Invoke(args); } else { _cachedCall.Invoke(arguementsCache.values); } }