public static JSON.Report ModelToJson(Scaffold.Report report) { var result = new JSON.Report(); result.ReportId = report.ReportId; result.OccurredAt = report.OccuredAt; result.Morale = report.Morale; result.Luck = report.Luck; result.AttackingPlayerId = report.AttackerPlayerId; result.AttackingVillageId = report.AttackerVillageId; result.AttackingArmy = ArmyConvert.ArmyToJson(report.AttackerArmy); result.AttackingArmyLosses = ArmyConvert.ArmyToJson(report.AttackerLossesArmy); result.DefendingPlayerId = report.DefenderPlayerId; result.DefendingVillageId = report.DefenderVillageId; result.DefendingArmy = ArmyConvert.ArmyToJson(report.DefenderArmy); result.DefendingArmyLosses = ArmyConvert.ArmyToJson(report.DefenderLossesArmy); result.TravelingTroops = ArmyConvert.ArmyToJson(report.DefenderTravelingArmy); result.BuildingLevels = BuildingConvert.ReportBuildingToJson(report.Building); return(result); }
public static JSON.Command ModelToJson(Scaffold.Command command) { var result = new JSON.Command(); result.CommandId = command.CommandId; result.UserLabel = command.UserLabel; result.SourcePlayerId = command.SourcePlayerId; result.SourceVillageId = command.SourceVillageId; result.TargetPlayerId = command.TargetPlayerId; result.TargetVillageId = command.TargetVillageId; result.LandsAt = command.LandsAt; result.CommandType = command.IsAttack ? JSON.CommandType.Attack : JSON.CommandType.Support; result.IsReturning = command.IsReturning; result.TroopType = TroopTypeConvert.StringToTroopType(command.TroopType); result.Troops = ArmyConvert.ArmyToJson(command.Army); return(result); }