void OnClick() { DSPlayerScore score = GameManager.Instance.SavablePlayerData.PlayerProgress.Score; if (stat.Value < stat.MaxValue && score.expirience.Value > 0) { if (nextLevelCost <= score.expirience.Value) { GPSWrapper.Achivement.IncrementProgress(GPSConstants.achievement_there_is_healthy_mind_in_a_healthy_body, (int)nextLevelCost, null); score.expirience.Value -= nextLevelCost; stat.Value += additionnalVal; stat.Progress = 0; } else { GPSWrapper.Achivement.IncrementProgress(GPSConstants.achievement_there_is_healthy_mind_in_a_healthy_body, (int)score.expirience.Value, null); nextLevelCost -= score.expirience.Value; score.expirience.Value = 0; stat.Progress = 1 - nextLevelCost / nextLevelCostWhenProgressZero; } SetValues(); } else { if (score.expirience.Value <= 0) { Toast.Instance.Show(LocalizedStrings.toast_not_enough_expirience); } else { Toast.Instance.Show(LocalizedStrings.toast_stat_max_upgrade); } } }
public PlayerProgress() { Flags = new DSFlags(); Score = new DSPlayerScore(); Stats = new DSUnitStats(); Skills = new DSPlayerSkills(); Equipment = new DSPlayerEquipment(); Squad = new DSPlayerSquad(); Level = new LevelInfo(); }
public void ApplyLoadedData(object data) { var d = data as DSPlayerScore; if (d == null) { d = new DSPlayerScore(); } gold.Value = d.gold.Value; silver.Value = d.silver.Value; expirience.Value = d.expirience.Value; tempGold.Value = d.tempGold.Value; tempSilver.Value = d.tempSilver.Value; tempExpirience.Value = d.tempExpirience.Value; }