Refactor formatting functions and improve item production logic; update UI components for better layout and usability
This commit is contained in:
+8
-10
@@ -93,9 +93,7 @@ func add_to_update_list(item_id: String, amount: int) -> void:
|
||||
|
||||
func set_owniverse_item_value() -> void:
|
||||
for item_id in owniverse.items_to_update:
|
||||
print("→ ", item_id)
|
||||
var item:OwniverseItem = owniverse_items[item_id]
|
||||
item.description.text = str(roundi(owniverse.items_to_update[item_id]))
|
||||
owniverse_items[item_id].set_label(owniverse.items_to_update[item_id])
|
||||
owniverse.items_to_update = {}
|
||||
|
||||
|
||||
@@ -175,7 +173,7 @@ func item_activated(item: OwniverseItem) -> void:
|
||||
_set_item_description(item)
|
||||
|
||||
if item.item_id == "S" or item.item_id == "H":
|
||||
owniverse.produce(item.item_id, 1000)
|
||||
owniverse.produce(item.item_id, 100_000)
|
||||
|
||||
func _unlock_item(item_id: String):
|
||||
owniverse_items[item_id].set_visible(true)
|
||||
@@ -253,14 +251,9 @@ func _process(delta: float) -> void:
|
||||
var sdt: String = str(snapped(owniverse.add_time_delta(delta), 0.1))
|
||||
set_datetime(sdt)
|
||||
|
||||
#set_owniverse_item_value()
|
||||
|
||||
var actions = _check_counters(delta)
|
||||
_do_actions(actions)
|
||||
|
||||
#page_actions[2].set_visible(true)
|
||||
#page_actions[2].set_action_values([1, 10, 100, 1000, 10_000])
|
||||
#page_actions[3].set_action_values([10000000, 10, 100, 1000, 10_000])
|
||||
##page_actions[1].set_visible(false)
|
||||
|
||||
_set_active_page_actions()
|
||||
@@ -268,12 +261,17 @@ func _process(delta: float) -> void:
|
||||
func _set_active_page_actions() -> void:
|
||||
for pa in page_actions:
|
||||
if !g_active_items.has(pa): continue
|
||||
|
||||
|
||||
var item_id: String = g_active_items[pa].item_id
|
||||
var amount = owniverse.get_available_to_produce(item_id)
|
||||
page_actions[pa].set_actions(item_id, amount)
|
||||
|
||||
|
||||
|
||||
func _page_action_pressed(page_id: int, action_amount: float) -> void:
|
||||
if !g_active_items.has(page_id):
|
||||
return
|
||||
|
||||
var item_id: String = g_active_items[page_id].item_id
|
||||
|
||||
if action_amount > 0:
|
||||
|
||||
Reference in New Issue
Block a user