Exemplo n.º 1
0
        internal bool loadEntityTypeFromTextBlock(TextBlock block)
        {
            string errorString = string.Format("File path: \"{0}\"", this.FilePath);

            for (EntityTypes.ClassInfo baseClassInfo = this.ClassInfo; baseClassInfo != null; baseClassInfo = baseClassInfo.BaseClassInfo)
            {
                foreach (EntityTypes.ClassInfo.EntityTypeSerializableFieldItem current in baseClassInfo.EntityTypeSerializableFields)
                {
                    bool failure = !EntityHelper.LoadFieldValue(false, this, current.Field, block, errorString);
                    if (failure)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        protected internal virtual bool OnLoad(TextBlock block)
        {
            string text = this.Owner.Type.Name;

            if (this.Owner.Name != "")
            {
                text += string.Format(" ({0})", this.Owner.Name);
            }
            text = string.Format("Entity: \"{0}\"; ExtendedProperties", text);
            foreach (EntityExtendedProperties.AT current in EntityExtendedProperties.A(base.GetType()))
            {
                if (/*EntitySystemWorld.Instance.isEntityExtendedPropertiesSerializable(current.supportedSerializationTypes) &&*/ !EntityHelper.LoadFieldValue(true, this, current.field, block, text))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 3
0
        protected virtual bool OnLoad(TextBlock block)
        {
            if (block.IsAttributeExist("logicClass"))
            {
                this.logicClass = (Entities.Instance.GetLoadingEntityBySerializedUIN(uint.Parse(block.GetAttribute("logicClass"))) as LogicClass);
            }
            if (this.logicObject == null && this.logicClass != null)
            {
                this.CreateLogicObject();
                TextBlock textBlock = block.FindChild("logicObject");
                if (textBlock != null && !this.logicObject.A(textBlock))
                {
                    return(false);
                }
            }
            string text = this.Type.Name;

            if (this.name != "")
            {
                text += string.Format(" ({0})", this.name);
            }
            text = string.Format("Entity: \"{0}\"", text);
            for (EntityTypes.ClassInfo classInfo = this.Type.ClassInfo; classInfo != null; classInfo = classInfo.BaseClassInfo)
            {
                foreach (EntityTypes.ClassInfo.EntitySerializableFieldItem current in classInfo.EntitySerializableFields)
                {
                    if (/*EntitySystemWorld.Instance.isEntitySerializable(current.SupportedSerializationTypes) &&*/ !EntityHelper.LoadFieldValue(true, this, current.Field, block, text))
                    {
                        return(false);
                    }
                }
            }
            string text2 = null;

            if (block.IsAttributeExist("subscriptionsToDeletionEvent"))
            {
                text2 = block.GetAttribute("subscriptionsToDeletionEvent");
            }
            else if (block.IsAttributeExist("relationships"))
            {
                text2 = block.GetAttribute("relationships");
            }
            else if (block.IsAttributeExist("relations"))
            {
                text2 = block.GetAttribute("relations");
            }
            if (text2 != null)
            {
                string[] array = text2.Split(new char[]
                {
                    ' '
                }, StringSplitOptions.RemoveEmptyEntries);
                this.subscriptionsToDeletionEvent = new List <Entity>(Math.Max(array.Length, 4));
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string s = array2[i];
                    Entity loadingEntityBySerializedUIN = Entities.Instance.GetLoadingEntityBySerializedUIN(uint.Parse(s));
                    if (loadingEntityBySerializedUIN != null)
                    {
                        this.subscriptionsToDeletionEvent.Add(loadingEntityBySerializedUIN);
                    }
                }
            }
            TextBlock textBlock2 = block.FindChild("extendedProperties");

            if (textBlock2 != null)
            {
                string typeClass = textBlock2.GetAttribute("class");
                Type   type      = EntitySystemWorld.Instance.FindEntityClassType(typeClass);
                if (type == null)
                {
                    Log.Error("Extended properties class \"{0}\" not exists.", typeClass);
                    return(false);
                }
                this.CreateExtendedProperties(type);
                if (!this.extendedProperties.OnLoad(textBlock2))
                {
                    return(false);
                }
            }
            if (block.IsAttributeExist("textUserData"))
            {
                string attribute2 = block.GetAttribute("textUserData");
                if (!string.IsNullOrEmpty(attribute2))
                {
                    this.SetTag("TextUserData", attribute2);
                }
            }
            return(true);
        }