Fable test
This commit is contained in:
@@ -172,8 +172,14 @@ func on_cost_group_pick_request(req: Dictionary) -> void:
|
||||
var option_idx: int = 0
|
||||
for entry: Variant in entries:
|
||||
var entry_d: Dictionary = entry as Dictionary
|
||||
var label: String = str(entry_d.get("typestr", entry_d.get("typeStr", "Option %d" % (option_idx + 1))))
|
||||
var btn: Button = Button.new()
|
||||
# Keys are normalised to lowercase; the server serializes CostEntry.Type/Amount.
|
||||
var label: String = str(entry_d.get("type", ""))
|
||||
var amt: int = int(entry_d.get("amount", 0))
|
||||
if label.is_empty():
|
||||
label = "Option %d" % (option_idx + 1)
|
||||
elif amt > 0:
|
||||
label = "%s ×%d" % [label, amt]
|
||||
var btn: Button = Button.new()
|
||||
btn.text = label
|
||||
btn.add_theme_font_size_override("font_size", 12)
|
||||
var cap_idx: int = option_idx
|
||||
@@ -232,10 +238,11 @@ func on_action_group_pick_request(req: Dictionary) -> void:
|
||||
var option_idx: int = 0
|
||||
for act: Variant in actions:
|
||||
var act_d: Dictionary = act as Dictionary
|
||||
var label: String = str(act_d.get("label", "Action %d" % (option_idx + 1)))
|
||||
var label: String = str(act_d.get("label", ""))
|
||||
if label.is_empty():
|
||||
# Keys are normalised to lowercase; the target's type key is "type".
|
||||
var tgt: Dictionary = act_d.get("target", {}) as Dictionary
|
||||
label = "%s %s" % [tgt.get("ownership", ""), tgt.get("targetType", "")]
|
||||
label = "%s %s" % [tgt.get("ownership", ""), tgt.get("type", "")]
|
||||
label = label.strip_edges()
|
||||
if label.is_empty():
|
||||
label = "Action %d" % (option_idx + 1)
|
||||
|
||||
Reference in New Issue
Block a user