public override void StreamXml(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { base.StreamXml(s, mode, xs); xs.StreamXmlForDBID(s, mode, kXmlElementTech, ref mTechID, DatabaseObjectKind.Tech); xs.StreamXmlForDBID(s, mode, kXmlElementCiv, ref mCivID, DatabaseObjectKind.Civ); xs.StreamXmlForDBID(s, mode, kXmlElementPower, ref mPowerID, DatabaseObjectKind.Power); xs.StreamXmlForStringID(s, mode, kXmlElementNameID, ref mNameID); XML.Util.Serialize(s, mode, xs, Resources, BResource.kBListTypeValuesXmlParams); if (ShouldStreamStartingUnit(s, mode)) { StreamXmlStartingUnit(s, mode, xs); } XML.Util.Serialize(s, mode, xs, StartingSquads, kStartingSquadBListXmlParams); XML.Util.Serialize(s, mode, xs, Populations, BPopulation.kBListXmlParams); }
void StreamXmlValueID(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { DatabaseObjectKind kind = ObjectKind; if (kind != DatabaseObjectKind.None) { xs.StreamXmlForDBID(s, mode, null, ref mValueID, kind, false, XML.Util.kSourceCursor); } }
public override void StreamXml(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { s.StreamElementOpt(mode, kXmlElementDamagePerSecond, ref mDamagePerSecond, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementDOTRate, ref mDOTRate, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementDOTDuration, ref mDOTDuration, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementAttackRate, ref mAttackRate, Util.kNotInvalidPredicateSingle); xs.StreamXmlForDBID(s, mode, kXmlElementProjectile, ref mProjectileObjectID, DatabaseObjectKind.Object); xs.StreamXmlForDBID(s, mode, kXmlElementWeaponType, ref mWeaponTypeID, DatabaseObjectKind.WeaponType); s.StreamElementOpt(mode, kXmlElementVisualAmmo, ref mVisualAmmo, Util.kNotInvalidPredicate); //mTriggerScriptID s.StreamElementOpt(mode, kXmlElementMinRange, ref mMinRange, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementMaxRange, ref mMaxRange, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementReflectDamageFactor, ref mReflectDamageFactor, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementMovingAccuracy, ref mMovingAccuracy, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementMaxDeviation, ref mMaxDeviation, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementMovingMaxDeviation, ref mMovingMaxDeviation, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementAccuracyDistanceFactor, ref mAccuracyDistanceFactor, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementAccuracyDeviationFactor, ref mAccuracyDeviationFactor, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementMaxVelocityLead, ref mMaxVelocityLead, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementAirBurstSpan, ref mAirBurstSpan, Util.kNotInvalidPredicateSingle); XML.Util.Serialize(s, mode, xs, DamageOverrides, BDamageRatingOverride.kBListXmlParams); XML.Util.Serialize(s, mode, xs, TargetPriorities, BTargetPriority.kBListXmlParams); #region Stasis if (ShouldStreamStasis(s, mode)) { using (s.EnterCursorBookmark(mode, kXmlElementStasis)) s.StreamAttribute(mode, kXmlElementStasisAttrSmartTargeting, ref mStasisSmartTargeting); } #endregion s.StreamElementOpt(mode, kXmlElementStasisHealToDrainRatio, ref mStasisHealToDrainRatio, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementBounces, ref mBounces, Util.kNotInvalidPredicateSByte); s.StreamElementOpt(mode, kXmlElementBounceRange, ref mBounceRange, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementMaxPullRange, ref mMaxPullRange, Util.kNotInvalidPredicateSingle); }
public void StreamXml(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { var td = s.Owner as BTacticData; s.StreamElementEnumOpt(mode, kXmlElementRelation, ref mRelation, e => e != BDiplomacy.Invalid); if (!s.StreamElementEnumOpt(mode, kXmlElementSquadMode, ref mSquadMode, e => e != BSquadMode.Invalid)) { s.StreamElementEnumOpt(mode, kXmlElementAutoTargetSquadMode, ref mAutoTargetSquadMode, e => e != BSquadMode.Invalid); } XML.Util.Serialize(s, mode, xs, DamageTypes, kDamageTypeBListXmlParams); XML.Util.Serialize(s, mode, xs, TargetTypes, kTargetTypeBListXmlParams); td.StreamXmlForID(s, mode, kXmlElementAction, ref mProtoActionID, BTacticData.ObjectKind.Action); if (!xs.StreamXmlForDBID(s, mode, kXmlElementAbility, ref mAbilityID, DatabaseObjectKind.Ability)) { IsOptionalAbility = xs.StreamXmlForDBID(s, mode, kXmlElementOptionalAbility, ref mAbilityID, DatabaseObjectKind.Ability); } }
public void StreamXml(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { xs.StreamXmlForDBID(s, mode, kXmlAttrUnit, ref mUnitID, DatabaseObjectKind.Object, false, XML.Util.kSourceAttr); if (!s.StreamAttributeEnumOpt(mode, kXmlAttrOperator, ref mOperator, e => e != BProtoTechTypeCountOperator.None)) { mOperator = BProtoTechTypeCountOperator.None; } if (!s.StreamAttributeOpt(mode, kXmlAttrCount, ref mCount, Util.kNotInvalidPredicateInt16)) { mCount = Util.kInvalidInt32; } }
public void StreamXml(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { s.StreamAttribute(mode, kXmlAttrCount, ref mCount); xs.StreamXmlForDBID(s, mode, null, ref mUnitID, DatabaseObjectKind.Object, false, XML.Util.kSourceCursor); }
public override void StreamXml(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { var td = s.Owner as BTacticData; s.StreamElementEnumOpt(mode, kXmlElementActionType, ref mActionType, kNotInvalidActionType); s.StreamElementOpt(mode, kXmlElementProjectileSpread, ref mProjectileSpread, Util.kNotInvalidPredicateSingle); xs.StreamXmlForDBID(s, mode, kXmlElementSquadType, ref mSquadTypeID, DatabaseObjectKind.Squad); td.StreamXmlForID(s, mode, kXmlElementWeapon, ref mWeaponID, BTacticData.ObjectKind.Weapon); td.StreamXmlForID(s, mode, kXmlElementLinkedAction, ref mLinkedActionID, BTacticData.ObjectKind.Action); s.StreamElementEnumOpt(mode, kXmlElementSquadMode, ref mSquadMode, kNotInvalidSquadMode); s.StreamElementEnumOpt(mode, kXmlElementNewSquadMode, ref mNewSquadMode, kNotInvalidSquadMode); #if false td.StreamXmlForID(s, mode, kXmlElementNewTacticState, ref mNewTacticStateID, BTacticData.ObjectKind.TacticState); #endif #region Work s.StreamElementOpt(mode, kXmlElementWorkRate, ref mWorkRate, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementWorkRateVariance, ref mWorkRateVariance, Util.kNotInvalidPredicateSingle); s.StreamElementOpt(mode, kXmlElementWorkRange, ref mWorkRange, Util.kNotInvalidPredicateSingle); #endregion #region DamageModifiers if (ShouldStreamDamageModifiers(s, mode)) { using (s.EnterCursorBookmark(mode, kXmlElementDamageModifiers)) { s.StreamAttribute(mode, kXmlElementDamageModifiersAttrDamage, ref mDamageModifiersDmg); s.StreamAttributeOpt(mode, kXmlElementDamageModifiersAttrDamageTaken, ref mDamageModifiersDmgTaken, Util.kNotInvalidPredicateSingle); s.StreamAttributeOpt(mode, kXmlElementDamageModifiersAttrByCombatValue, ref mDamageModifiersByCombatValue, Util.kNotFalsePredicate); } } #endregion xs.StreamXmlForTypeName(s, mode, kXmlElementResource, ref mResourceID, DatabaseTypeKind.Cost); s.StreamElementOpt(mode, kXmlElementDefault, ref mDefault, Util.kNotFalsePredicate); td.StreamXmlForID(s, mode, kXmlElementSlaveAttackAction, ref mSlaveAttackActionID, BTacticData.ObjectKind.Action); td.StreamXmlForID(s, mode, kXmlElementBaseDPSWeapon, ref mBaseDPSWeaponID, BTacticData.ObjectKind.Weapon); s.StreamElementEnumOpt(mode, kXmlElementPersistentActionType, ref mPersistentActionType, kNotInvalidActionType); #region Duration if (ShouldStreamDuration(s, mode)) { using (s.EnterCursorBookmark(mode, kXmlElementDuration)) { s.StreamCursor(mode, ref mDuration); s.StreamAttributeOpt(mode, kXmlElementDurationAttrSpread, ref mDurationSpread, Util.kNotInvalidPredicateSingle); } } #endregion #region AutoRepair if (ShouldStreamAutoRepair(s, mode)) { using (s.EnterCursorBookmark(mode, kXmlElementAutoRepair)) { s.StreamAttribute(mode, kXmlElementAutoRepairAttrIdleTime, ref mAutoRepairIdleTime); s.StreamAttribute(mode, kXmlElementAutoRepairAttrThreshold, ref mAutoRepairThreshold); s.StreamAttribute(mode, kXmlElementAutoRepairAttrSearchDistance, ref mAutoRepairSearchDistance); } } #endregion xs.StreamXmlForDBID(s, mode, kXmlElementInvalidTarget, ref mInvalidTargetObjectID, DatabaseObjectKind.Object); #region ProtoObject if (ShouldStreamProtoObject(s, mode)) { using (s.EnterCursorBookmark(mode, kXmlElementProtoObject)) { // TODO: This IS optional, right? Only on 'true'? s.StreamAttributeOpt(mode, kXmlElementProtoObjectAttrSquad, ref mProtoObjectIsSquad, Util.kNotFalsePredicate); xs.StreamXmlForDBID(s, mode, null, ref mSquadTypeID, mProtoObjectIsSquad ? DatabaseObjectKind.Squad : DatabaseObjectKind.Object, false, XML.Util.kSourceCursor); } } #endregion #if false xs.StreamXmlForStringID(s, mode, kXmlElementCount, ref mCountStringID); #endif s.StreamElementOpt(mode, kXmlElementMaxNumUnitsPerformAction, ref mMaxNumUnitsPerformAction, Util.kNotInvalidPredicate); s.StreamElementOpt(mode, kXmlElementDamageCharge, ref mDamageCharge, Util.kNotInvalidPredicateSingle); }
public void StreamXml(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { xs.StreamXmlForDBID(s, mode, kXmlAttrType, ref mUnitTypeID, DatabaseObjectKind.Unit, false, XML.Util.kSourceAttr); s.StreamCursor(mode, ref mPriority); }
public void StreamXml(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { s.StreamAttributeEnum(mode, kXmlAttrType, ref mType); bool stream_targets = false; switch (mType) { case BProtoTechEffectType.Data: s.StreamAttributeOpt(mode, kXmlAttrAllActions, ref mAllActions, Util.kNotFalsePredicate); XML.Util.StreamInternStringOpt(s, mode, kXmlAttrAction, ref mAction, false); s.StreamAttributeEnum(mode, kXmlAttrSubType, ref mDU.SubType); // e.g., SubType==Icon and these won't be used...TODO: is Icon the only one? s.StreamAttributeOpt(mode, kXmlAttrAmount, ref mAmount, Util.kNotInvalidPredicateSingleNaN); s.StreamAttributeEnumOpt(mode, kXmlAttrRelativity, ref mRelativity, x => x != BObjectDataRelative.Invalid); StreamXmlObjectData(s, mode, xs); stream_targets = true; break; case BProtoTechEffectType.TransformUnit: case BProtoTechEffectType.Build: xs.StreamXmlForDBID(s, mode, null, ref mDU.ToTypeID, DatabaseObjectKind.Object, false, XML.Util.kSourceCursor); break; case BProtoTechEffectType.TransformProtoUnit: case BProtoTechEffectType.TransformProtoSquad: xs.StreamXmlForDBID(s, mode, kXmlTransformProto_AttrFromType, ref mDU.FromTypeID, TransformProtoObjectKind, false, XML.Util.kSourceAttr); xs.StreamXmlForDBID(s, mode, kXmlTransformProto_AttrToType, ref mDU.ToTypeID, TransformProtoObjectKind, false, XML.Util.kSourceAttr); break; #region Unused case BProtoTechEffectType.SetAge: s.StreamCursorEnum(mode, ref mDU.SetAgeLevel); break; #endregion case BProtoTechEffectType.GodPower: xs.StreamXmlForDBID(s, mode, null, ref mDU.ID, DatabaseObjectKind.Power, false, XML.Util.kSourceCursor); s.StreamAttribute(mode, kXmlAttrAmount, ref mAmount); break; #region Unused case BProtoTechEffectType.TechStatus: xs.StreamXmlForDBID(s, mode, null, ref mDU.ID, DatabaseObjectKind.Tech, false, XML.Util.kSourceCursor); break; case BProtoTechEffectType.Ability: xs.StreamXmlForDBID(s, mode, null, ref mDU.ID, DatabaseObjectKind.Ability, false, XML.Util.kSourceCursor); break; case BProtoTechEffectType.SharedLOS: // no extra parsed data break; case BProtoTechEffectType.AttachSquad: xs.StreamXmlForDBID(s, mode, kXmlAttachSquadAttrType, ref mDU.ID, TransformProtoObjectKind, false, XML.Util.kSourceAttr); stream_targets = true; break; #endregion } if (stream_targets) { StreamXmlTargets(s, mode, xs); } }
void StreamXmlObjectData(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { switch (mDU.SubType) { #region Unused case BObjectDataType.RateAmount: case BObjectDataType.RateMultiplier: xs.StreamXmlForTypeName(s, mode, kXmlAttrODT_Rate, ref mDU.ID, DatabaseTypeKind.Rate, false, XML.Util.kSourceAttr); break; #endregion case BObjectDataType.CommandEnable: case BObjectDataType.CommandSelectable: // Unused mDU.StreamCommand(s, mode, xs); break; case BObjectDataType.Cost: mDU.StreamCost(s, mode, xs); break; #region Unused case BObjectDataType.DamageModifier: mDU.StreamDamageModifier(s, mode, xs); break; #endregion case BObjectDataType.PopCap: case BObjectDataType.PopMax: xs.StreamXmlForTypeName(s, mode, kXmlAttrODT_Pop_PopType, ref mDU.ID, DatabaseTypeKind.Pop, false, XML.Util.kSourceAttr); break; #region Unused case BObjectDataType.UnitTrainLimit: mDU.StreamTrainLimit(s, mode, xs, DatabaseObjectKind.Object); break; case BObjectDataType.SquadTrainLimit: mDU.StreamTrainLimit(s, mode, xs, DatabaseObjectKind.Squad); break; #endregion case BObjectDataType.PowerRechargeTime: case BObjectDataType.PowerUseLimit: case BObjectDataType.PowerLevel: xs.StreamXmlForDBID(s, mode, kXmlAttrODT_Power_Power, ref mDU.ID, DatabaseObjectKind.Power, false, XML.Util.kSourceAttr); break; #region Ignored case BObjectDataType.ImpactEffect: break; #endregion #region Unused // case BObjectDataType.DisplayNameID: // break; #endregion #region Ignored case BObjectDataType.TurretYawRate: case BObjectDataType.TurretPitchRate: break; #endregion case BObjectDataType.AbilityRecoverTime: xs.StreamXmlForDBID(s, mode, kXmlAttrODT_AbilityRecoverTime_Ability, ref mDU.ID, DatabaseObjectKind.Ability, false, XML.Util.kSourceAttr); break; #region Ignored case BObjectDataType.HPBar: break; #endregion #region Unused // case BObjectDataType.DeathSpawn: // break; #endregion // assume everything else (sans ignored/unused) only uses amount default: //throw new Debug.UnreachableException(mSubType.ToString()); break; } }
public void StreamDamageModifier(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { xs.StreamXmlForDBID(s, mode, kXmlAttrODT_DamageModifier_WeapType, ref DmgMod_WeapType, DatabaseObjectKind.WeaponType, false, XML.Util.kSourceAttr); xs.StreamXmlForDBID(s, mode, kXmlAttrODT_DamageModifier_DmgType, ref DmgMod_DmgType, DatabaseObjectKind.DamageType, false, XML.Util.kSourceAttr); }
public void StreamCost(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { xs.StreamXmlForTypeName(s, mode, kXmlAttrODT_Cost_Resource, ref Cost_Type, DatabaseTypeKind.Cost, false, XML.Util.kSourceAttr); xs.StreamXmlForDBID(s, mode, kXmlAttrODT_Cost_UnitType, ref Cost_UnitType, DatabaseObjectKind.Unit, true, XML.Util.kSourceAttr); }
int mTechID; // = Util.kInvalidInt32; #region IPhxXmlStreamable Members public void StreamXml(KSoft.IO.XmlElementStream s, FA mode, XML.BXmlSerializerInterface xs) { s.StreamAttributeEnum(mode, kXmlAttrOperator, ref mTechStatus); xs.StreamXmlForDBID(s, mode, null, ref mTechID, DatabaseObjectKind.Object, false, XML.Util.kSourceCursor); }