Refactor formatting functions and improve item production logic; update UI components for better layout and usability
This commit is contained in:
+5
-4
@@ -34,14 +34,15 @@ func get_description(item_id: String, items: Array = []) -> String:
|
||||
return description
|
||||
|
||||
|
||||
func format(value: float, digits: int = 0) -> String:
|
||||
func format_number(value: float, digits: int = 0) -> String:
|
||||
if value == 0: return ""
|
||||
if value < 10_000:
|
||||
return "%.*f" % [digits, value]
|
||||
|
||||
var exp = int(floor(log(abs(value)) / log(10.0)))
|
||||
var mantissa = value / pow(10.0, exp)
|
||||
var exp_value = int(floor(log(abs(value)) / log(10.0)))
|
||||
var mantissa = value / pow(10.0, exp_value)
|
||||
|
||||
return "%.*f" % [digits, mantissa] + "E%+d" % exp
|
||||
return "%.*f" % [digits, mantissa] + "E%+d" % exp_value
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
Reference in New Issue
Block a user