public LogicMethod CreateEntityEventMethod(LogicMethodType methodType, string methodName) { if (this.EntityClassInfo == null) { Log.Error("LogicEntityClass: CreateEntityEventMethod: class not defined \"{0}\"", this.abe); return(null); } LogicMethod logicMethod = base.GetMethodByName(methodName); if (logicMethod != null) { Log.Fatal("LogicClass: already create method \"{0}\"", methodName); return(null); } logicMethod = (LogicMethod)Entities.Instance.Create(methodType, this); logicMethod.MethodName = methodName; logicMethod.isEntityEventMethod = true; logicMethod.PostCreate(); base.Add(logicMethod); MethodInfo method = logicMethod.EntityEventInfo.EventHandlerType.GetMethod("Invoke"); ParameterInfo[] parameters = method.GetParameters(); for (int i = 1; i < parameters.Length; i++) { ParameterInfo parameterInfo = parameters[i]; logicMethod.CreateParameter(parameterInfo.ParameterType, parameterInfo.Name); } return(logicMethod); }
private void initMethods() { if (this.methods == null) { this.methods = new Dictionary <string, LogicMethod>(); foreach (Entity current in base.Children) { LogicMethod logicMethod = current as LogicMethod; if (logicMethod != null) { this.methods.Add(logicMethod.MethodName, logicMethod); } } } }
public LogicMethod CreateMethod(LogicMethodType methodType, string methodName) { this.initMethods(); LogicMethod logicMethod = this.GetMethodByName(methodName); if (logicMethod != null) { Log.Fatal("LogicClass: already create method \"{0}\"", methodName); return(null); } logicMethod = (LogicMethod)Entities.Instance.Create(methodType, this); logicMethod.MethodName = methodName; logicMethod.PostCreate(); this.methods.Add(methodName, logicMethod); return(logicMethod); }
protected internal override void OnRemoveChild(Entity entity) { if (this.methods != null) { LogicMethod logicMethod = entity as LogicMethod; if (logicMethod != null) { this.methods.Remove(logicMethod.MethodName); } } if (this.variables != null) { LogicVariable logicVariable = entity as LogicVariable; if (logicVariable != null) { this.variables.Remove(logicVariable.VariableName); } } base.OnRemoveChild(entity); }
internal void Add(LogicMethod logicMethod) { this.initMethods(); this.methods.Add(logicMethod.MethodName, logicMethod); }