fix previously mentioned issue

This commit is contained in:
Ronja 2020-09-25 16:49:25 +02:00
parent 129dc58f66
commit 7da8b274a5

View file

@ -62,7 +62,7 @@ class UiAdventure{
_ui.list_button(list, [0, 0], "Abort") { _ui.list_button(list, [0, 0], "Abort") {
_ui.ui_mode = Ui.Info _ui.ui_mode = Ui.Info
_game.adventures.discard() _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, [3, 0], "Direction") {_page.value = UiAdventure.direction}
_ui.list_button(list, [2, 0], "People") {_page.value = UiAdventure.people} _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_behave(_ent, text, UILayoutBehave.left) //|
UILayout.set_margin(_ent, text, 4, 8, 4, 0) UILayout.set_margin(_ent, text, 4, 8, 4, 0)
var update_text = Fn.new{ _game.adventures.planning.on_change(true) { |val|
var adventure = _game.adventures.planning.value if(val == null) return
if(adventure == null) return //this stuff does bad things
var direction = full_step_names[adventure.direction] var dir = full_step_names[val.direction]
System.print("-----") var dist = val.distance
System.print(adventure) UILabel.set_text(text, "%(dist)km\n%(dir)")
System.print(adventure.distance)
var dist = adventure.distance
System.print(dist)
UILabel.set_text(text, "%(dist)km %(direction)")
} }
_game.adventures.planning.on_change(true, update_text)
} }
people(){ people(){