public void StatGameLevelFinished(GameLevelInfo gameLevelInfo, ILevelFinishStat levelFinishStat) { if (InfoResolver.Resolve <FortInfo>().Analytic.AnalyticsProvider == null) { return; } if (!InfoResolver.Resolve <FortInfo>().Analytic.StatGameLevelFinished) { return; } GameLevelCategory gameLevelCategory = InfoResolver.Resolve <FortInfo>().GameLevel.LevelCategoriesParentMap[gameLevelInfo.Id]; InfoResolver.Resolve <FortInfo>() .Analytic.AnalyticsProvider.StateEvent(gameLevelInfo.Name, gameLevelInfo.DisplayName, "GameLevelFinished", new GameLevelFinishedAnalyticStat { LevelFinishStat = levelFinishStat, GameLevelId = gameLevelInfo.Id, GameLevelName = gameLevelInfo.Name, GameLevelCategoryId = gameLevelCategory.Id, GameLevelCategoryName = gameLevelCategory.Name }); }
public static void ImportGameCategories() { string path = EditorUtility.OpenFilePanel("Import Game Categories", "", "xls"); if (string.IsNullOrEmpty(path)) { return; } using (Stream reader = File.OpenRead(path)) { IDictionary <string, PropertyInfo> customPossibleProperties = ExportData.GetCustomPossibleProperties( TypeHelper.GetAllTypes(AllTypeCategory.Game) .Where(type => typeof(GameLevelCategory).IsAssignableFrom(type)) .ToArray()); Dictionary <string, Type> parameters = new Dictionary <string, Type>(); parameters["Id"] = typeof(string); //parameters["DefaultScene"] = typeof(string); //parameters["DisplayName"] = typeof(string); parameters["Name"] = typeof(string); foreach (KeyValuePair <string, PropertyInfo> pair in customPossibleProperties) { parameters[pair.Key] = pair.Value.PropertyType; } HSSFWorkbook workbook = new HSSFWorkbook(reader); ExportData exportData = ExportData.DeserializeFromSheet(parameters, workbook.GetSheetAt(0)); foreach (ExportRow exportRow in exportData.ExportRows) { if (!exportRow.ContainsParameter("Id")) { continue; } string id = (string)exportRow.GetValue("Id").Value; if (!InfoResolver.Resolve <FortInfo>().GameLevel.LevelCategories.ContainsKey(id)) { continue; } GameLevelCategory gameLevelCategory = InfoResolver.Resolve <FortInfo>().GameLevel.LevelCategories[id]; if (exportRow.ContainsParameter("DefaultScene")) { /* gameLevelCategory.DefaultScene = new FortScene(); * gameLevelCategory.DefaultScene.Value.SceneName = (string)exportRow.GetValue("DefaultScene").Value;*/ } /* if (exportRow.ContainsParameter("DisplayName")) * { * gameLevelCategory.DisplayName = (string)exportRow.GetValue("DisplayName").Value; * }*/ if (exportRow.ContainsParameter("Name")) { gameLevelCategory.Name = (string)exportRow.GetValue("Name").Value; } exportRow.FillCustomExportParameter(gameLevelCategory); } } InfoResolver.Resolve <FortInfo>().Save(); }
private string GetCategorySceneName(GameLevelCategory category) { if (!FortScene.IsNullOrEmpty(category.DefaultScene)) { return(category.DefaultScene.Value.SceneName); } if (InfoResolver.Resolve <FortInfo>().GameLevel.LevelCategoriesParentMap.ContainsKey(category.Id)) { return(GetCategorySceneName(InfoResolver.Resolve <FortInfo>().GameLevel.LevelCategoriesParentMap[category.Id])); } return(string.Empty); }
public static GameLevelCategory GetParentCategory(this GameLevelCategory category) { Dictionary <string, GameLevelCategory> levelCategoriesParentMap = FortInfo.Instance.GameLevel.LevelCategoriesParentMap; return(!levelCategoriesParentMap.ContainsKey(category.Id) ? null : levelCategoriesParentMap[category.Id]); }