From 7da8b274a53cae4102a5af2281adc4d01f56927a Mon Sep 17 00:00:00 2001 From: Ronja Date: Fri, 25 Sep 2020 16:49:25 +0200 Subject: [PATCH] fix previously mentioned issue --- Luxe/blocks/ui/adventure.wren | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Luxe/blocks/ui/adventure.wren b/Luxe/blocks/ui/adventure.wren index 7aba971..6aa8eab 100644 --- a/Luxe/blocks/ui/adventure.wren +++ b/Luxe/blocks/ui/adventure.wren @@ -62,7 +62,7 @@ class UiAdventure{ _ui.list_button(list, [0, 0], "Abort") { _ui.ui_mode = Ui.Info _game.adventures.discard() - _page = UiAdventure.direction + _page.value = UiAdventure.direction } _ui.list_button(list, [3, 0], "Direction") {_page.value = UiAdventure.direction} _ui.list_button(list, [2, 0], "People") {_page.value = UiAdventure.people} @@ -161,18 +161,13 @@ class UiAdventure{ UILayout.set_behave(_ent, text, UILayoutBehave.left) //| UILayout.set_margin(_ent, text, 4, 8, 4, 0) - var update_text = Fn.new{ - var adventure = _game.adventures.planning.value - if(adventure == null) return - var direction = full_step_names[adventure.direction] - System.print("-----") - System.print(adventure) - System.print(adventure.distance) - var dist = adventure.distance - System.print(dist) - UILabel.set_text(text, "%(dist)km %(direction)") + _game.adventures.planning.on_change(true) { |val| + if(val == null) return + //this stuff does bad things + var dir = full_step_names[val.direction] + var dist = val.distance + UILabel.set_text(text, "%(dist)km\n%(dir)") } - _game.adventures.planning.on_change(true, update_text) } people(){