public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var db = (MegaloScriptDatabase)s.Owner;

            s.StreamAttribute("name", ref Name);
            if (db.SerializeActionTemplateReference(s, "template", ref Parent) && Parent == null)
            {
                throw new System.IO.InvalidDataException(string.Format(Util.InvariantCultureInfo,
                                                                       "Action Template '{0}' references undefined template", Name));
            }

            Parameters.Serialize(s);
        }
Beispiel #2
0
        public override void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
        {
            base.Serialize(s);
            var db = (MegaloScriptDatabase)s.Owner;

            if (!s.StreamAttributeOpt("name", ref Name, Predicates.IsNotNullOrEmpty) &&
                s.IsReading)
            {
                Name = string.Format("Action{0}", DBID.ToString());
            }
            if (db.SerializeProtoActionReference(s, "template", ref Template) && Template == null)
            {
                throw new System.IO.InvalidDataException(string.Format(
                                                             "Action '{0}' references undefined proto action {1}", Name, Template));
            }
            s.StreamAttributeEnumOpt("flags", ref Flags, f => f != 0);

            Parameters.Serialize(s);
        }