public static SerializedGameKeyCategory FromGameKeyCategory(AGameKeyCategory category) { return(new SerializedGameKeyCategory { CategoryId = category.GameKeyCategoryId, GameKeys = category.GameKeys.Select(SerializedGameKey.FromGameKey).ToList() }); }
public void ToGameKeyCategory(AGameKeyCategory category) { var dictionary = GameKeys.ToDictionary(serializedGameKey => serializedGameKey.StringId); for (var i = 0; i < category.GameKeys.Count; i++) { var gameKey = category.GameKeys[i]; if (dictionary.TryGetValue(gameKey.StringId, out SerializedGameKey serializedGameKey)) { category.GameKeys[i] = new GameKey(gameKey.Id, gameKey.StringId, gameKey.GroupId, serializedGameKey.Key, gameKey.MainCategoryId); } } }