void StreamCommandData <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, XML.BXmlSerializerInterface xs)
                where TDoc : class
                where TCursor : class
            {
                const string attr_name = "CommandData";

                switch (CommandType)
                {
                case BProtoObjectCommandType.Research:                 // proto tech
                    xs.StreamDBID(s, attr_name, ref CommandData, DatabaseObjectKind.Tech, false, XML.XmlUtil.kSourceAttr);
                    break;

                case BProtoObjectCommandType.TrainUnit:                 // proto object
                case BProtoObjectCommandType.Build:
                case BProtoObjectCommandType.BuildOther:
                    xs.StreamDBID(s, attr_name, ref CommandData, DatabaseObjectKind.Object, false, XML.XmlUtil.kSourceAttr);
                    break;

                case BProtoObjectCommandType.TrainSquad:                 // proto squad
                    xs.StreamDBID(s, attr_name, ref CommandData, DatabaseObjectKind.Squad, false, XML.XmlUtil.kSourceAttr);
                    break;

                case BProtoObjectCommandType.ChangeMode:                 // unused
                    s.StreamAttributeEnum(attr_name, ref CommandDataSM);
                    break;

                case BProtoObjectCommandType.Ability:
                    xs.StreamDBID(s, attr_name, ref CommandData, DatabaseObjectKind.Ability, false, XML.XmlUtil.kSourceAttr);
                    break;

                case BProtoObjectCommandType.Power:
                    xs.StreamDBID(s, attr_name, ref CommandData, DatabaseObjectKind.Power, false, XML.XmlUtil.kSourceAttr);
                    break;
                }
            }
 public static void StreamType <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s,
                                               string keyName, ref MegaloScriptVariableReferenceType type)
     where TDoc : class
     where TCursor : class
 {
     s.StreamAttributeEnum(keyName, ref type);
 }
示例#3
0
        protected override void SerializeValue <TDoc, TCursor>(MegaloScriptModel model, IO.TagElementStream <TDoc, TCursor, string> s)
        {
            s.StreamAttributeEnum("shapeType", ref mShapeType);

            switch (ShapeType)
            {
            case MegaloScriptShapeType.Sphere:
                using (s.EnterCursorBookmark(kVar0ElementName)) mRadius.SerializeCustom(model, s);
                break;

            case MegaloScriptShapeType.Cylinder:
                using (s.EnterCursorBookmark(kVar0ElementName)) mRadius.SerializeCustom(model, s);
                using (s.EnterCursorBookmark(kVar2ElementName)) mTop.SerializeCustom(model, s);
                using (s.EnterCursorBookmark(kVar3ElementName)) mBottom.SerializeCustom(model, s);
                break;

            case MegaloScriptShapeType.Box:
                using (s.EnterCursorBookmark("Width")) mRadius.SerializeCustom(model, s);
                using (s.EnterCursorBookmark(kVar1ElementName)) mLength.SerializeCustom(model, s);
                using (s.EnterCursorBookmark(kVar2ElementName)) mTop.SerializeCustom(model, s);
                using (s.EnterCursorBookmark(kVar3ElementName)) mBottom.SerializeCustom(model, s);
                break;

            case MegaloScriptShapeType.None: break;

            default: throw new KSoft.Debug.UnreachableException(ShapeType.ToString());
            }
        }
示例#4
0
        internal static void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, MegaloScriptModel model,
                                                       ref MegaloScriptModelObjectHandle handle)
            where TDoc : class
            where TCursor : class
        {
            bool reading = s.IsReading;
            var  type    = reading
                                ? MegaloScriptModelObjectType.None
                                : handle.Type;
            int id = reading
                                ? TypeExtensions.kNone
                                : handle.Id;

            s.StreamAttributeEnum("type", ref type);

            if (!model.TagElementStreamSerializeFlags.EmbedObjectsWriteSansIds())
            {
                s.StreamAttribute(MegaloScriptModelObject.kIdAttributeName, ref id);
            }
            else if (reading)
            {
                handle = CreateForWriteSansId(model, type).Handle;
            }

            // handle will already be valid if the above case is hit
            if (reading && handle.Type == MegaloScriptModelObjectType.None)
            {
                handle = new MegaloScriptModelObjectHandle(type, id);
            }
        }
 protected void StreamType <TTypeEnum, TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, ref TTypeEnum type)
     where TTypeEnum : struct, IComparable, IFormattable, IConvertible
     where TDoc : class
     where TCursor : class
 {
     s.StreamAttributeEnum(kXmlAttrType, ref type);
 }
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var  db      = s.Owner as MegaloScriptDatabase;
            bool reading = s.IsReading;

            s.StreamAttributeEnum("type", ref Type);
            s.StreamAttribute("name", ref Name);

            bool read_only = IsReadOnly;

            s.StreamAttributeOpt("readonly", ref read_only, Predicates.IsTrue);

            if (db.SerializeValueTypeReference(s, "paramTypeEnum", ref EnumValueType, isOptional: true))
            {
                Flags |= MegaloScriptProtoVariableReferenceMemberFlags.HasDataType;
            }

            if (db.SerializeValueTypeReference(s, "paramValueType", ref ValueType, isOptional: true))
            {
                Flags |= MegaloScriptProtoVariableReferenceMemberFlags.HasDataValue;
                s.StreamAttribute("paramValueName", ref ValueName);
            }

            if (reading)
            {
                if (read_only)
                {
                    Flags |= MegaloScriptProtoVariableReferenceMemberFlags.Readonly;
                }
            }
        }
示例#7
0
 public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
     where TDoc : class
     where TCursor : class
 {
     s.StreamAttributeEnum("Mode", ref mMode);
     s.StreamCursor(ref mAnimType);
 }
示例#8
0
 public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
     where TDoc : class
     where TCursor : class
 {
     s.StreamAttributeEnum("exceptionType", ref ExceptionType);
     s.StreamElements("MapID", MapIds);
 }
示例#9
0
        //string mValue;

        public override void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
        {
            base.Serialize(s);

            s.StreamAttributeEnum(kXmlAttrType, ref mType);
            s.StreamAttribute(kXmlAttrIsNull, ref mIsNull);
            //s.StreamCursor(ref mValue);
        }
 internal static void SerializePrototype <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s,
                                                         object _context, ref BlamEngine engine)
     where TDoc : class
     where TCursor : class
 {
     s.StreamAttributeEnum("generation", engine, obj => obj.Generation);
     s.StreamAttribute("name", engine, obj => obj.Name);
 }
示例#11
0
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            s.StreamAttributeEnum("position", ref mPosition);

            SerializeCodeName(s);
        }
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var xs = s.GetSerializerInterface();

            s.StreamAttributeEnum("type", ref mType);
            StreamValueID(s, xs);
        }
 public void StreamIcon <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, XML.BXmlSerializerInterface xs)
     where TDoc : class
     where TCursor : class
 {
     // #NOTE engine parses this as "IconType", but its parser ignores case
     s.StreamAttributeEnum("iconType", ref Icon_Type);
     // #NOTE engine parses this as "IconType", but its parser ignores case
     s.StreamString("iconName", ref Icon_Name, false);
 }
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var xs = s.GetSerializerInterface();

            xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref mDamageType, DatabaseObjectKind.DamageType, isOptional: false, xmlSource: XML.XmlUtil.kSourceCursor);
            s.StreamAttributeEnum("direction", ref mDirection);
            s.StreamAttributeEnumOpt("mode", ref mMode, e => e != BSquadMode.Normal);
        }
示例#15
0
        protected override void SerializeValue <TDoc, TCursor>(MegaloScriptModel model, IO.TagElementStream <TDoc, TCursor, string> s)
        {
            s.StreamAttributeEnum("filterType", ref mFilterType);

            if (FilterType == MegaloScriptPlayerFilterType.PlayerMask)
            {
                using (s.EnterCursorBookmark("Player")) mPlayer.SerializePlayer(model, s);
                using (s.EnterCursorBookmark("AddOrRemove")) mPlayerAddOrRemove.SerializeCustom(model, s);
            }
        }
 public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
     where TDoc : class
     where TCursor : class
 {
     //if (s.IsReading) s.ReadCursorName(ref mType);
     s.StreamAttributeEnum(kXmlAttrType, ref mType);
     s.StreamAttribute(kXmlAttrSigId, ref mSigID);
     s.StreamAttribute(DatabaseNamedObject.kXmlAttrNameN, ref mName);
     s.StreamAttributeOpt(kXmlAttrOptional, ref mOptional, Predicates.IsTrue);
     s.StreamCursorEnum(ref mVarType);
 }
示例#17
0
		public void Serialize<TDoc, TCursor>(IO.TagElementStream<TDoc, TCursor, string> s)
			where TDoc : class
			where TCursor : class
		{
			s.StreamAttributeEnum("type", ref Type);
			SerializeActivity(s, "activity", ref Activity);
			s.StreamAttributeEnum("mode", ref Mode);
			s.StreamAttributeEnum("engine", ref EngineType);

			s.StreamAttributeOpt("fileLength", ref FileLength, Predicates.IsNotZero);

			using (s.EnterCursorBookmark("Unknown"))
			{
				s.StreamAttributeOpt("id0", ref unk08, Predicates.IsNotZero, NumeralBase.Hex);
				s.StreamAttributeOpt("id1", ref unk10, Predicates.IsNotZero, NumeralBase.Hex);
				s.StreamAttributeOpt("id2", ref unk18, Predicates.IsNotZero, NumeralBase.Hex);
				s.StreamAttributeOpt("unk20", ref unk20, Predicates.IsNotZero, NumeralBase.Hex);

				s.StreamAttributeOpt("unk2C", ref unk2C, Predicates.IsNotNone);
			}

			using (s.EnterCursorBookmark("Creator"))
				s.StreamObject(Creator);
			using (s.EnterCursorBookmark("Modifier"))
				s.StreamObject(Modifier);

			s.StreamElement("Title", ref Title);
			s.StreamElementOpt("Description", ref Description, Predicates.IsNotNullOrEmpty);

			if (Type == ContentType.Film || Type == ContentType.FilmClip)
				s.StreamElement("FilmLength_", ref unk280);
			else if (Type == ContentType.GameVariant)
				if (!s.StreamElementOpt("EngineIconIndex", ref unk280, Predicates.IsNotNone))
					EngineIconIndex = TypeExtensions.kNone;
			s.StreamAttributeOpt("EngineCategoryIndex", ref EngineCategoryIndex, Predicates.IsNotNone);

			if (Activity == 2)
				s.StreamElement("HopperID", ref HopperId);

			SerializeGameSpecificData(s);
		}
示例#18
0
 protected override void SerializeGameSpecificData <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
 {
     if (EngineType == Blam.RuntimeData.GameEngineType.Campaign)
     {
         using (s.EnterCursorBookmark("Campaign"))
         {
             s.StreamAttribute("id", ref CampaignId);
             s.StreamAttributeEnum("difficulty", ref DifficultyLevel);
             s.StreamAttribute("mapID_", ref unk2A4);
             s.StreamAttributeOpt("insertionPoint", ref InsertionPoint, Predicates.IsNotZero);
             s.StreamAttributeEnumOpt("scoring", ref GameScoring, e => e != Blam.RuntimeData.MetagameScoring.None);
         }
     }
     else if (EngineType == Blam.RuntimeData.GameEngineType.Survival)
     {
         using (s.EnterCursorBookmark("Survival"))
         {
             s.StreamAttributeEnum("difficulty", ref DifficultyLevel);
             s.StreamAttribute("mapID_", ref unk2A4);
         }
     }
 }
示例#19
0
        protected override void SerializeValue <TDoc, TCursor>(MegaloScriptModel model, IO.TagElementStream <TDoc, TCursor, string> s)
        {
            s.StreamAttributeEnum("targetType", ref mTargetType);

            switch (TargetType)
            {
            case MegaloScriptTargetType.Team: mValue.SerializeTeam(model, s); break;

            case MegaloScriptTargetType.Player: mValue.SerializePlayer(model, s); break;

            case MegaloScriptTargetType.None: mValue = MegaloScriptVariableReferenceData.Null; break;
            }
        }
示例#20
0
        protected override void SerializeActivity <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s,
                                                                  string attrName, ref sbyte value)
        {
            var activity = s.IsReading ? GameActivity.None : (GameActivity)value;

            s.StreamAttributeEnum(attrName, ref activity);

            Contract.Assert(activity < GameActivity.kNumberOf);

            if (s.IsReading)
            {
                value = (sbyte)activity;
            }
        }
示例#21
0
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var xs = s.GetSerializerInterface();

            s.StreamAttributeEnum("type", ref mDataType);
            s.StreamAttribute("name", ref mName);

            switch (DataType)
            {
            case ProtoPowerDataType.Float:
                s.StreamCursor(ref mDataFloat);
                break;

            case ProtoPowerDataType.Int:
                s.StreamCursor(ref mDataInt);
                break;

            case ProtoPowerDataType.ProtoObject:
                xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref mDataInt, DatabaseObjectKind.Object, isOptional: false, xmlSource: XML.XmlUtil.kSourceCursor);
                break;

            case ProtoPowerDataType.ProtoSquad:
                xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref mDataInt, DatabaseObjectKind.Squad, isOptional: false, xmlSource: XML.XmlUtil.kSourceCursor);
                break;

            case ProtoPowerDataType.Tech:
                xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref mDataInt, DatabaseObjectKind.Tech, isOptional: false, xmlSource: XML.XmlUtil.kSourceCursor);
                break;

            case ProtoPowerDataType.ObjectType:
                xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref mDataInt, DatabaseObjectKind.ObjectType, isOptional: false, xmlSource: XML.XmlUtil.kSourceCursor);
                break;

            case ProtoPowerDataType.Bool:
                s.StreamCursor(ref mDataBool);
                break;

            case ProtoPowerDataType.Sound:
                s.StreamCursor(ref mDataString);
                break;

            case ProtoPowerDataType.Texture:
                s.StreamCursor(ref mDataString);
                break;
            }

            //xs.StreamDBID(s, "ObjectType", ref mObjectType, DatabaseObjectKind.ObjectType, isOptional: false, xmlSource: XML.XmlUtil.kSourceAttr);
        }
示例#22
0
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var model = (MegaloScriptModel)s.Owner;

            s.StreamAttributeEnum("type", ref mType);
            model.MegaloVariant.SerializeStringTableIndex(s, "labelIndex", ref mLabelStringIndex);
            model.MegaloVariant.SerializeStringTableIndexOpt(s, "unkIndex1", ref mUnknown1);
            model.MegaloVariant.SerializeStringTableIndexOpt(s, "unkIndex2", ref mUnknown2);
            model.MegaloVariant.SerializeStringTableIndexOpt(s, "unkIndex3", ref mUnknown3);

            SerializeCodeName(s);
        }
示例#23
0
        protected override void SerializeValue <TDoc, TCursor>(MegaloScriptModel model, IO.TagElementStream <TDoc, TCursor, string> s)
        {
            s.StreamAttributeEnum("meterType", ref mType);

            if (Type == MegaloScriptWidgetMeterType.Numeric)
            {
                using (s.EnterCursorBookmark("Value")) mNumeric1.SerializeCustom(model, s);
                using (s.EnterCursorBookmark("MaxValue")) mNumeric2.SerializeCustom(model, s);
            }
            else if (Type == MegaloScriptWidgetMeterType.Timer)
            {
                using (s.EnterCursorBookmark("Timer"))
                    mTimer.SerializeTimer(model, s);
            }
        }
示例#24
0
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            Engine.EngineBuildHandle.Serialize(s, ref mGameBuild);
            s.StreamAttributeEnum("engineType", ref mType);
            if (s.IsReading)
            {
                InitializeVariant();
            }

            if (Variant != null)
            {
                Variant.Serialize(s);
            }
        }
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var xs = s.GetSerializerInterface();

            s.StreamAttribute("Position", ref mPosition);

            s.StreamAttributeEnum("Type", ref mCommandType);
            switch (mCommandType)
            {
            case BProtoObjectCommandType.Research:             // proto tech
                xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref mID, DatabaseObjectKind.Tech, false, XML.XmlUtil.kSourceCursor);
                break;

            case BProtoObjectCommandType.TrainUnit:             // proto object
            case BProtoObjectCommandType.Build:
            case BProtoObjectCommandType.BuildOther:
                xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref mID, DatabaseObjectKind.Object, false, XML.XmlUtil.kSourceCursor);
                break;

            case BProtoObjectCommandType.TrainSquad:             // proto squad
                xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref mID, DatabaseObjectKind.Squad, false, XML.XmlUtil.kSourceCursor);
                break;

            case BProtoObjectCommandType.ChangeMode:             // unused
                s.StreamCursorEnum(ref mSquadMode);
                break;

            case BProtoObjectCommandType.Ability:
                xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref mID, DatabaseObjectKind.Ability, false, XML.XmlUtil.kSourceCursor);
                break;

            case BProtoObjectCommandType.Power:
                xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref mID, DatabaseObjectKind.Power, false, XML.XmlUtil.kSourceCursor);
                break;
            }

            s.StreamAttributeOpt("AutoClose", ref mAutoClose, Predicates.IsTrue);
        }
示例#26
0
        // #NOTE_BLAM: up to concrete implementations to serialize References
        public override void Serialize <TDoc, TCursor>(MegaloScriptModel model, IO.TagElementStream <TDoc, TCursor, string> s)
        {
            SerializeIdOpt(model, s);
            s.StreamAttributeEnumOpt("trigType", ref mTriggerType, e => e != MegaloScriptTriggerType.Normal);
            s.StreamAttributeEnumOpt("execMode", ref mExecutionMode, e => e != MegaloScriptTriggerExecutionMode.General);
            SerializeNameOpt(s);

            if (ExecutionMode == MegaloScriptTriggerExecutionMode.OnObjectFilter)
            {
                s.StreamAttributeIdAsString("objectFilter", ref mObjectFilterIndex, model,
                                            (_model, name) => model.FromIndexName(Proto.MegaloScriptValueIndexTarget.ObjectFilter, name),
                                            (_model, id) => model.ToIndexName(Proto.MegaloScriptValueIndexTarget.ObjectFilter, id));
            }
            else
            {
                ObjectFilterIndex = -1;
            }

            if (ExecutionMode == MegaloScriptTriggerExecutionMode.OnCandySpawnerFilter)
            {
                using (s.EnterCursorBookmark("GameObject"))
                {
                    s.StreamAttributeEnum("type", ref mGameObjectType);

                    s.StreamAttributeIdAsString("filter", ref mGameObjectFilterIndex, model,
                                                (_model, name) => model.FromIndexName(Proto.MegaloScriptValueIndexTarget.GameObjectFilter, name),
                                                (_model, id) => model.ToIndexName(Proto.MegaloScriptValueIndexTarget.GameObjectFilter, id));
                }
            }
            else
            {
                GameObjectFilterIndex = -1;
            }

            if (TriggerType == MegaloScriptTriggerType.Normal)
            {
                s.StreamAttributeOpt("commentOut", ref mCommentOut, Predicates.IsTrue);
            }
        }
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var xs = s.GetSerializerInterface();

            s.StreamAttributeEnum("Type", ref mType);

            switch (mType)
            {
            case LimitType.Unit:
                xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref mID, DatabaseObjectKind.Object, false, XML.XmlUtil.kSourceCursor);
                break;

            case LimitType.Squad:
                xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref mID, DatabaseObjectKind.Squad, false, XML.XmlUtil.kSourceCursor);
                break;
            }

            s.StreamAttributeOpt("Count", ref mCount, Predicates.IsNotZero);
            s.StreamAttributeOpt("Bucket", ref mBucket, Predicates.IsNotZero);
        }
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var xs = s.GetSerializerInterface();

            s.StreamAttribute(DatabaseNamedObject.kXmlAttrNameN, ref mName);
            s.StreamAttributeEnum(kXmlAttrType, ref mType);
            s.StreamAttribute(kXmlAttrNextTriggerVar, ref mNextTriggerVarID);
            s.StreamAttribute(kXmlAttrNextTrigger, ref mNextTriggerID);
            s.StreamAttribute(kXmlAttrNextCondition, ref mNextConditionID);
            s.StreamAttribute(kXmlAttrNextEffect, ref mNextEffectID);
            s.StreamAttribute(kXmlAttrExternal, ref mExternal);

            using (s.EnterUserDataBookmark(this))
            {
                XML.XmlUtil.Serialize(s, Groups, BTriggerGroup.kBListXmlParams);
                if (s.IsReading)
                {
                    BuildDictionary(out mDbiGroups, Groups);
                }

                XML.XmlUtil.Serialize(s, Vars, BTriggerVar.kBListXmlParams);
                if (s.IsReading)
                {
                    BuildDictionary(out mDbiVars, Vars);
                }
                XML.XmlUtil.Serialize(s, Triggers, BTrigger.kBListXmlParams);
                if (s.IsReading)
                {
                    BuildDictionary(out mDbiTriggers, Triggers);
                }
            }

            if (s.IsReading)
            {
                (xs as XML.BTriggerScriptSerializer).TriggerDb.UpdateFromGameData(this);
            }
        }
示例#29
0
        public virtual void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var model = (MegaloScriptModel)s.Owner;

            model.MegaloVariant.SerializeStringTableIndexOpt(s, "nameIndex", ref mNameStringIndex);
            s.StreamAttributeEnum("format", ref mFormat);
            s.StreamAttributeEnumOpt("sortOrder", ref mSortOrder, e => e != MegaloScriptGameStatisticSortOrder.Ascending);
            s.StreamAttributeEnumOpt("grouping", ref mGrouping, e => e != 0);

            SerializeCodeName(s);

            if (SupportsUnk5)
            {
                s.StreamAttributeOpt("unk5", ref mUnk5, Predicates.IsTrue);
            }
            if (SupportsIsScoreToWin)
            {
                s.StreamAttributeOpt("isScoreToWin", ref mIsScoreToWin, Predicates.IsTrue);
            }
        }
示例#30
0
        public void Serialize <TDoc, TCursor>(MegaloScriptModel model, IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            s.StreamAttributeEnum("type", ref mType);

            switch (Type)
            {
            case MegaloScriptTokenAbstractType.Player:                      mValue.SerializePlayer(model, s); break;

            case MegaloScriptTokenAbstractType.Team:                        mValue.SerializeTeam(model, s); break;

            case MegaloScriptTokenAbstractType.Object:                      mValue.SerializeObject(model, s); break;

            case MegaloScriptTokenAbstractType.Numeric:
            case MegaloScriptTokenAbstractType.SignedNumeric:       mValue.SerializeCustom(model, s); break;

            case MegaloScriptTokenAbstractType.Timer:                       mValue.SerializeTimer(model, s); break;

            default: throw new KSoft.Debug.UnreachableException(Type.ToString());
            }
        }