示例#1
0
        private void CreateLogicObject()
        {
            if (EntitySystemWorld.Instance.LogicSystemScriptsAssembly == null)
            {
                Log.Error("Entity: CreateLogicObject: Dynamin link library with compiled code from Logic Editor is not loaded.");
                return;
            }
            if (this.logicClass.loadingTextBlock != null && string.IsNullOrEmpty(this.logicClass.ClassName) && this.logicClass.loadingTextBlock.IsAttributeExist("className"))
            {
                this.logicClass.className = this.logicClass.loadingTextBlock.GetAttribute("className");
            }
            Type logicSystemScriptsAssemblyClassByClassName = EntitySystemWorld.Instance.GetLogicSystemScriptsAssemblyClassByClassName(this.logicClass.ClassName);

            if (logicSystemScriptsAssemblyClassByClassName == null)
            {
                Log.Error("Entity: CreateLogicObject: classType = null. \"{0}\"", this.logicClass.ClassName);
                return;
            }
            ConstructorInfo constructorInfo = null;

            ConstructorInfo[] constructors = logicSystemScriptsAssemblyClassByClassName.GetConstructors();
            for (int i = 0; i < constructors.Length; i++)
            {
                ConstructorInfo constructorInfo2 = constructors[i];
                if (constructorInfo2.GetParameters().Length == 1)
                {
                    constructorInfo = constructorInfo2;
                    break;
                }
            }
            this.logicObject = (LogicEntityObject)constructorInfo.Invoke(new object[]
            {
                this
            });
        }
示例#2
0
 private void resetLogicObject()
 {
     this.logicObject = null;
 }