public SerializableLevel(Level levelPassed) { entityList = new List<List<SerializableEntity>>(); foreach (var subList in levelPassed.objectList) { List<TargetTapping.Back_end.SerializableEntity> placeHolder = new List<TargetTapping.Back_end.SerializableEntity>(); foreach (var entity in subList) { SerializableEntity sEntity = new SerializableEntity(); sEntity.entitySubName = entity.objectName; sEntity.entityType = entity.shapeType; sEntity.rectangle = entity.rectangle; sEntity.color = entity.color; placeHolder.Add(sEntity); } entityList.Add(placeHolder); } currentPosition = levelPassed.currentPosition; multiSelect = levelPassed.multiSelect; upTime = levelPassed.upTime; holdTime = levelPassed.holdTime; levelName = levelPassed.levelName; }
public Level constructLevel(ContentManager content, GraphicsDeviceManager graphics) { Level levelLoaded = new Level(); List<List<TargetTapping.Back_end.Object>> objectList = new List<List<TargetTapping.Back_end.Object>>(); foreach (var subList in entityList) { List<TargetTapping.Back_end.Object> placeHolder = new List<TargetTapping.Back_end.Object>(); foreach (var entity in subList) { Back_end.Object sObject = new Back_end.Object(entity.entityType, entity.entitySubName, entity.rectangle, entity.color, content, graphics); placeHolder.Add(sObject); } objectList.Add(placeHolder); } levelLoaded.objectList = objectList; levelLoaded.currentPosition = currentPosition; levelLoaded.multiSelect = multiSelect; levelLoaded.upTime = upTime; levelLoaded.holdTime = holdTime; levelLoaded.levelName = levelName; return levelLoaded; }