public static void PostStats(bool force_post = false) { #if XBOX_LIVE if (StatTracker.FoodEaten > 0) { XboxLiveStatsManager.SetStatInteger(XboxLiveStats.FoodEaten, StatTracker.FoodEaten); } var game_rooms = Enum.GetValues(typeof(GameRooms)); var game_speeds = Enum.GetValues(typeof(GameplaySpeeds)); foreach (GameRooms game_room in game_rooms) { foreach (GameplaySpeeds gameplay_speed in game_speeds) { const string prefix = "LongestSnake"; string stat_string = prefix + game_room + gameplay_speed; bool success = Enum.TryParse(typeof(XboxLiveStats), stat_string, out var stat); if (success && stat is XboxLiveStats) { string data = SaveDataHandler.LoadData(Settings.GetSaveFilePath(game_room, gameplay_speed)); int.TryParse(data, out int score); if (score > 0) { XboxLiveStatsManager.SetStatInteger((XboxLiveStats)stat, score); } } } } XboxLiveStatsManager.CheckAndFlush(force_post); #else #endif }
private static void PostFoodStatOnly(bool force_post = false) { #if XBOX_LIVE if (StatTracker.FoodEaten > 0) { XboxLiveStatsManager.SetStatInteger(XboxLiveStats.FoodEaten, StatTracker.FoodEaten); XboxLiveStatsManager.CheckAndFlush(); } #else #endif }