Exemplo n.º 1
0
        protected internal virtual void OnSave(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.SaveFieldValue(true, this, current.field, block, null, text))
                {
                    break;
                }
            }
        }
Exemplo n.º 2
0
        internal bool Save(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)
                {
                    object defaultValue = entityTypeSerializableFields[current];
                    bool   failure      = !EntityHelper.SaveFieldValue(false, this, current.Field, block, defaultValue, errorString);
                    if (failure)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemplo n.º 3
0
        protected virtual void OnSave(TextBlock block)
        {
            block.SetAttribute("type", Type.Name);
            block.SetAttribute("uin", uin.ToString());

            if (!(this is LogicComponent))
            {
                block.SetAttribute("classPrompt", Type.ClassInfo.entityClassType.Name);
            }

            if (subscriptionsToDeletionEvent != null && subscriptionsToDeletionEvent.Count != 0)
            {
                string _subscriptionsToDeletionEvent = string.Join(" ", subscriptionsToDeletionEvent.Select(_x => _x.UIN));
                block.SetAttribute("subscriptionsToDeletionEvent", _subscriptionsToDeletionEvent);
            }

            string text = Type.Name;

            if (this.name != "")
            {
                text += string.Format(" ({0})", this.name);
            }

            text = string.Format("Entity: \"{0}\"", text);

            for (EntityTypes.ClassInfo classInfo = Type.ClassInfo; classInfo != null; classInfo = classInfo.BaseClassInfo)
            {
                foreach (EntityTypes.ClassInfo.EntitySerializableFieldItem current2 in classInfo.EntitySerializableFields)
                {
                    //if (EntitySystemWorld.Instance.IsEntityFieldSerializable(current2.SupportedSerializationTypes))
                    {
                        if (!EntityHelper.SaveFieldValue(true, this, current2.Field, block, text))
                        {
                            return;
                        }
                    }
                }
            }
            if (logicClass != null)
            {
                block.SetAttribute("logicClass", logicClass.UIN.ToString());
            }

            if (extendedProperties != null)
            {
                TextBlock textBlock = block.AddChild("extendedProperties");
                textBlock.SetAttribute("class", this.extendedProperties.GetType().Name);
                extendedProperties.OnSave(textBlock);
            }

            if (logicObject != null)
            {
                TextBlock logicObjectBlock = block.FindChild("logicObject");
                if (logicObjectBlock == null)
                {
                    logicObjectBlock = block.AddChild("logicObject");
                }

                logicObject.OnSave(logicObjectBlock);
                return;
            }
        }