using LitJson; namespace Wizard; public class BattlePassGaugeInfo { public int CurrentPoint { get; private set; } public int CurrentLevel { get; private set; } public BattlePassLevelInfo BattlePassLevelInfo => Data.Load.data.BattlePassLevelInfoList[CurrentLevel]; public bool IsMaxPoint => CurrentPoint >= BattlePassUtility.BattlePassMaxPoint; public int BeforeCurrentPoint { get; private set; } public int BeforeCurrentLevel { get; private set; } public BattlePassLevelInfo BeforeBattlePassLevelInfo => Data.Load.data.BattlePassLevelInfoList[BeforeCurrentLevel]; public bool IsBeforeMaxPoint => BeforeCurrentPoint >= BattlePassUtility.BattlePassMaxPoint; public int PointAdd { get; private set; } public int DailryMissionPoint { get; private set; } public int BattlePassMissionPoint { get; private set; } public int BattleResultPoint { get; private set; } public int WeeklyBattlePassPoint { get; private set; } public int WeeklyLimitPoint { get; private set; } public bool IsPremium { get; private set; } public bool IsLevelChange => CurrentLevel != BeforeCurrentLevel; public float BeforeGaugeValue => (float)(BeforeCurrentPoint - BeforeBattlePassLevelInfo.RequiredPoint) / (float)BattlePassUtility.NextLevelRequiredPoint(BeforeCurrentLevel); public int NextLevelRequiredPoint { get { if (!IsMaxPoint) { return Data.Load.data.BattlePassLevelInfoList[CurrentLevel + 1].RequiredPoint - CurrentPoint; } return 0; } } public int BeforeLevelNextLevelRequiredPoint { get { if (!IsBeforeMaxPoint) { return Data.Load.data.BattlePassLevelInfoList[BeforeCurrentLevel + 1].RequiredPoint - BeforeCurrentPoint; } return 0; } } public BattlePassGaugeInfo(JsonData jsonData) { CurrentPoint = jsonData["current_point"].ToInt(); CurrentLevel = jsonData["current_level"].ToInt(); if (jsonData.Keys.Contains("point_add")) { BeforeCurrentPoint = jsonData["before_current_point"].ToInt(); BeforeCurrentLevel = jsonData["before_target_level"].ToInt(); DailryMissionPoint = jsonData["daily_mission_point"].ToInt(); BattlePassMissionPoint = jsonData["battle_pass_mission_point"].ToInt(); BattleResultPoint = jsonData["battle_result_point"].ToInt(); IsPremium = jsonData["is_premium"].ToBoolean(); PointAdd = jsonData["point_add"].ToInt(); } WeeklyBattlePassPoint = jsonData.GetValueOrDefault("weekly_battle_pass_point", 0); WeeklyLimitPoint = jsonData.GetValueOrDefault("weekly_limit_point", 0); } public float CurrentGaugeValue() { if (IsMaxPoint) { return 1f; } return (float)(CurrentPoint - BattlePassLevelInfo.RequiredPoint) / (float)BattlePassUtility.NextLevelRequiredPoint(CurrentLevel); } }