Refactor gameplay menus into owned scenes
This commit is contained in:
parent
46196a1adb
commit
a17fe88197
50 changed files with 3449 additions and 3619 deletions
|
|
@ -107,12 +107,12 @@ func _process(delta: float) -> bool:
|
|||
|
||||
# --- B. one price widget everywhere ----------------------
|
||||
var tags: Array = []
|
||||
for entry in controller.build_menu_entries:
|
||||
tags.append(entry[3])
|
||||
tags.append_array(controller.craft_price_strips)
|
||||
tags.append_array(controller.lab_price_tags)
|
||||
tags.append(controller.info_cost)
|
||||
tags.append(controller.skill_cost)
|
||||
for entry in controller.build_menu.entries:
|
||||
tags.append(entry.cost)
|
||||
tags.append_array(controller.craft_menu.price_tags)
|
||||
tags.append_array(controller.lab_menu.price_tags)
|
||||
tags.append(controller.build_menu.info_cost)
|
||||
tags.append(controller.skill_menu.cost)
|
||||
if tags.size() < 15:
|
||||
return _fail("only %d price widgets found - the menus cannot all be covered" % tags.size())
|
||||
for tag in tags:
|
||||
|
|
@ -124,7 +124,7 @@ func _process(delta: float) -> bool:
|
|||
# --- C. have over cost, smaller, red when short ----------
|
||||
game_state.bank_inventory.set_amount(GameState.RESOURCE_ORE, 3)
|
||||
game_state.fleet_inventory.set_amount(GameState.RESOURCE_ORE, 0)
|
||||
var probe: Control = controller.info_cost
|
||||
var probe: Control = controller.build_menu.info_cost
|
||||
probe.show_price({GameState.RESOURCE_ORE: 25})
|
||||
if probe.priced(GameState.RESOURCE_ORE) != 25:
|
||||
return _fail("the tag does not carry the price it was given")
|
||||
|
|
@ -165,8 +165,8 @@ func _process(delta: float) -> bool:
|
|||
if String(node.desc).length() > longest.length():
|
||||
longest = String(node.desc)
|
||||
controller._refresh_skill_menu(String(node.id))
|
||||
var detail: Rect2 = _rect(controller.skill_detail)
|
||||
var price: Rect2 = _rect(controller.skill_cost)
|
||||
var detail: Rect2 = _rect(controller.skill_menu.detail)
|
||||
var price: Rect2 = _rect(controller.skill_menu.cost)
|
||||
if detail.intersects(price):
|
||||
return _fail("the explanation (%s) overlaps the price (%s)" % [detail, price])
|
||||
if detail.position.x >= price.position.x:
|
||||
|
|
@ -179,11 +179,11 @@ func _process(delta: float) -> bool:
|
|||
game_state.fleet_inventory.set_amount(GameState.RESOURCE_ORE, 0)
|
||||
game_state.unlocked.clear()
|
||||
controller._refresh_skill_menu("shipyards")
|
||||
if controller.skill_cost.is_affordable():
|
||||
if controller.skill_menu.cost.is_affordable():
|
||||
return _fail("a node reads as affordable with no ore at all")
|
||||
if controller.skill_status.text.to_lower().contains("not enough"):
|
||||
if controller.skill_menu.status.text.to_lower().contains("not enough"):
|
||||
return _fail("the shortfall is still written out as well: '%s'" \
|
||||
% controller.skill_status.text)
|
||||
% controller.skill_menu.status.text)
|
||||
print("the shortfall is shown once, on the price, and not repeated in words")
|
||||
|
||||
print("TEST_MENU_PRICE_UNIFICATION: PASS")
|
||||
|
|
|
|||
Loading…
Reference in a new issue