private static string GetPatrolListRecordString(ICollection <EnemyPatrol> patrols) { var stringBuilder = new StringBuilder(); stringBuilder.Append($"[ {Patrols} ( "); foreach (EnemyPatrol patrol in patrols) { stringBuilder.Append($"( {OnePatrol} [ {EnemyRouteHelper.GetEnemyRoutesRecordString(patrol)} {SerializerHelper.GetCharacterRecordString(patrol)} {EnemyRouteHelper.GetEventsRouteRecordString(patrol)} " + $"{ColumnsCount} {patrol.ColumnsCount} {RowsCount} {patrol.RowsCount} {SoldierFileName} {patrol.SoldiersFileName} {LeaderFileName} {patrol.LeaderFileName} " + $".DETIENE 0 ] ) "); } stringBuilder.Append($") ]"); return(stringBuilder.ToString()); }
public static EnemySoldier Serialize(MultipleRecords multipleRecords) { var soldier = GetEnemySoldier(multipleRecords); if (soldier == null) { return(null); } SerializerHelper.PopulateCharacter(soldier, multipleRecords); var movementRecord = GetMovementInfoRecord(multipleRecords); if (movementRecord == null || movementRecord.Records.Count == 0) { return(soldier); } var routesRecord = EnemyRouteHelper.GetRoutesMultipleRecords(movementRecord); if (routesRecord != null && movementRecord.Records.Count != 0) { EnemyRouteHelper.PopulateRoutes(soldier, routesRecord); } return(soldier); }
public override ObservableCollection <EnemyPatrol> Serialize(Record record) { var patrols = new ObservableCollection <EnemyPatrol>(); if (record == null) { return(patrols); } var patrolRecords = record.GetRecords(); foreach (var patrolRecord in patrolRecords) { var mixedDataRecord = patrolRecord as MixedDataRecord; if (mixedDataRecord.GetStringValue(0) != OnePatrol) { continue; } var patrol = new EnemyPatrol(); var multipleRecords = mixedDataRecord.GetMultipleRecords(1); SerializerHelper.PopulateCharacter(patrol, multipleRecords); patrol.ColumnsCount = multipleRecords.GetStringValue(ColumnsCount); patrol.RowsCount = multipleRecords.GetStringValue(RowsCount); patrol.SoldiersFileName = multipleRecords.GetStringValue(SoldierFileName); patrol.LeaderFileName = multipleRecords.GetStringValue(LeaderFileName); var eventsRecord = multipleRecords.GetMixedDataRecord(EventsRoute); if (eventsRecord != null && eventsRecord.Count != 0) { patrol.EventRoute = eventsRecord[0].GetStringValue(); } EnemyRouteHelper.PopulateRoutes(patrol, EnemyRouteHelper.GetRoutesMultipleRecords(multipleRecords)); patrols.Add(patrol); } return(patrols); }
public static string GetSoldiersRecordString(ObservableCollection <EnemyCharacter> soldiers) { var stringBuilder = new StringBuilder(); foreach (EnemySoldier soldier in soldiers) { stringBuilder.Append($"[ {SerializerHelper.GetCharacterRecordString(soldier)} .BANDO ALEMAN .HTIP SOLD .COMPORTAMIENTO ( ComporAlemanScript [ .VIGILADOR [ .LONG_NORMAL {soldier.Range} ] .EVENTOS_RUTA ( ) .DISPARADOR [ .ARMA {soldier.Trigger} ALEMAN_pistola ] " + $".NUM_GRANADAS 0 .ANIMACION {soldier.AnimationFileNameComplete} .GESTOR_MOVIMIENTO [ {EnemyRouteHelper.GetEnemyRoutesRecordString(soldier)} ] ] ) " + $".VISTA ( VistaTriangular [ ] ) .OIDO ( Oido [ ] ) .MOTOR ( MotorPeaton [ ] ) .ANIMADOR ( AnimadorHumano [ .VOL ( Cilindro [ .RADIO 20.0 .ALTURA 50.0 ] ) .ANIM {soldier.AnimationFileNameComplete} ] ) .VOLCOLISION ( Cilindro [ .RADIO 12.0 .ALTURA 50.0 ] ) " + ".TIPOCOLISION PEATON .ZONASELECCION ( Cilindro [ .RADIO 10.0 .ALTURA 50.0 ] ) .LISTAS ( CHOC SELE VISI EJEC FLAE ) .COLORPUNTOLIBRETA ALEMAN .USAHAB [ ] " + ".PUEDE_CONDUCIR ( WILLIS ZODIAK CAMION CANON LANCHA_MOTORA NIDO_AMETRALLADORAS ASCENSOR MONTA_ALEMAN SILLA CAMA ) " + $".MICUADRICULA [ .DIMCUADX 4.0 .DIMCUADY 6.0 .GFXCUAD CUADRIC ] .GEL [ ] .DUMMY [ .ANIMADOR ( AnimadorHumano [ .VOL ( Cilindro [ .RADIO 10.0 .ALTURA 50.0 ] ) .ANIM {soldier.AnimationFileNameComplete} ] ) ] " + ".BICHOS ( ) ] "); } return(stringBuilder.ToString().Trim()); }