Add prestige graph
This commit is contained in:
@@ -30,8 +30,7 @@ func _on_game_state_ready() -> void:
|
||||
return
|
||||
|
||||
if config == null:
|
||||
if _manager.has_method("get_config"):
|
||||
config = _manager.get_config()
|
||||
config = _manager.get_config()
|
||||
|
||||
if config == null:
|
||||
push_warning("PrestigeProgressBar '%s' has no config; progress bar disabled." % String(name))
|
||||
@@ -57,14 +56,11 @@ func _update_progress() -> void:
|
||||
if _manager == null or config == null:
|
||||
return
|
||||
|
||||
_basis_value = _manager.call("get_basis_value_for_display")
|
||||
if _manager.has_method("get_next_prestige_threshold"):
|
||||
_next_threshold = _manager.call("get_next_prestige_threshold")
|
||||
else:
|
||||
_next_threshold = _get_threshold_from_config()
|
||||
_basis_value = _manager.get_basis_value_for_display()
|
||||
_next_threshold = _manager.get_next_prestige_threshold()
|
||||
|
||||
var basis_float: float = _big_number_to_float(_basis_value)
|
||||
var threshold_float: float = _big_number_to_float(_next_threshold)
|
||||
var basis_float: float = _basis_value.to_float()
|
||||
var threshold_float: float = _next_threshold.to_float()
|
||||
|
||||
if threshold_float > 0.0 and basis_float >= 0.0:
|
||||
var ratio: float = minf(basis_float / threshold_float, 1.0)
|
||||
@@ -74,25 +70,3 @@ func _update_progress() -> void:
|
||||
|
||||
_label_start.text = _basis_value.to_string_suffix(2)
|
||||
_label_end.text = _next_threshold.to_string_suffix(2)
|
||||
|
||||
func _get_threshold_from_config() -> BigNumber:
|
||||
if config == null:
|
||||
return BigNumber.from_float(0.0)
|
||||
|
||||
if not config.has_method("get_threshold"):
|
||||
return BigNumber.from_float(0.0)
|
||||
|
||||
var threshold = config.call("get_threshold")
|
||||
if threshold is BigNumber:
|
||||
return threshold
|
||||
|
||||
return BigNumber.from_float(0.0)
|
||||
|
||||
func _big_number_to_float(value: BigNumber) -> float:
|
||||
if value.mantissa <= 0.0:
|
||||
return 0.0
|
||||
if value.exponent > 308:
|
||||
return INF
|
||||
if value.exponent < -308:
|
||||
return 0.0
|
||||
return value.mantissa * pow(10.0, float(value.exponent))
|
||||
|
||||
Reference in New Issue
Block a user