use new ui function
This commit is contained in:
parent
fa40c19c50
commit
46fd094a79
4 changed files with 20 additions and 87 deletions
|
|
@ -57,10 +57,12 @@ class Tooltip{
|
|||
|
||||
fix_y(value){
|
||||
_y = value
|
||||
tick()
|
||||
}
|
||||
|
||||
fix_x(value){
|
||||
_x = value
|
||||
tick()
|
||||
}
|
||||
|
||||
set(text, source){
|
||||
|
|
|
|||
|
|
@ -41,47 +41,12 @@ class UiAdventure{
|
|||
UILayout.set_margin(_ent, list, 0, 0, 0, 0)
|
||||
UILayout.set_contain(_ent, list, UILayoutContain.row | UILayoutContain.start) //|
|
||||
|
||||
var tiles = [10, 1]
|
||||
var button
|
||||
|
||||
//back to info
|
||||
button = _ui.list_button(list)
|
||||
ImageButton.set_tooltip(button, "Info")
|
||||
ImageButton.set_tile_uv(button, tiles, [1, 0])
|
||||
ImageButton.set_state_change(button) { |data|
|
||||
if(data["press"]){
|
||||
_ui.ui_mode = Ui.Info
|
||||
}
|
||||
}
|
||||
|
||||
//abort
|
||||
button = _ui.list_button(list)
|
||||
ImageButton.set_tooltip(button, "Abort")
|
||||
ImageButton.set_tile_uv(button, tiles, [0, 0])
|
||||
ImageButton.set_state_change(button) { |data|
|
||||
if(data["press"]){
|
||||
_ui.ui_mode = Ui.Info
|
||||
}
|
||||
}
|
||||
|
||||
//people
|
||||
button = _ui.list_button(list)
|
||||
ImageButton.set_tooltip(button, "People")
|
||||
ImageButton.set_tile_uv(button, tiles, [2, 0])
|
||||
|
||||
//stuff
|
||||
button = _ui.list_button(list)
|
||||
ImageButton.set_tooltip(button, "Stuff")
|
||||
ImageButton.set_tile_uv(button, tiles, [4, 0])
|
||||
|
||||
//direction
|
||||
button = _ui.list_button(list)
|
||||
ImageButton.set_tooltip(button, "Direction")
|
||||
ImageButton.set_tile_uv(button, tiles, [3, 0])
|
||||
|
||||
//go
|
||||
button = _ui.list_button(list)
|
||||
ImageButton.set_tooltip(button, "Depart")
|
||||
ImageButton.set_tile_uv(button, tiles, [5, 0])
|
||||
//toolbar icons
|
||||
_ui.list_button(list, [1, 0], "Info") {_ui.ui_mode = Ui.Info}
|
||||
_ui.list_button(list, [0, 0], "Abort") {_ui.ui_mode = Ui.Info}
|
||||
_ui.list_button(list, [2, 0], "People") {}
|
||||
_ui.list_button(list, [4, 0], "Stuff") {}
|
||||
_ui.list_button(list, [3, 0], "Direction") {}
|
||||
_ui.list_button(list, [5, 0], "Depart") {}
|
||||
}
|
||||
}
|
||||
|
|
@ -74,50 +74,14 @@ class UiInfo{
|
|||
var tiles = [10, 1]
|
||||
var button
|
||||
|
||||
//plan adventure
|
||||
button = _ui.list_button(list)
|
||||
UIImage.set_image(button, adventureButtons)
|
||||
ImageButton.set_tooltip(button, "Adventure!")
|
||||
ImageButton.set_tile_uv(button, tiles, [1, 0])
|
||||
ImageButton.set_state_change(button) { |data|
|
||||
if(data["press"]){
|
||||
Globals["Game"].adventures.new_or_current()
|
||||
_ui.ui_mode = Ui.Planning
|
||||
}
|
||||
}
|
||||
|
||||
//info
|
||||
button = _ui.list_button(list)
|
||||
UIImage.set_image(button, adventureButtons)
|
||||
ImageButton.set_tooltip(button, "Stats")
|
||||
ImageButton.set_tile_uv(button, tiles, [2, 0])
|
||||
ImageButton.set_state_change(button) { |data|
|
||||
if(data["press"]){
|
||||
_page.value = UiInfo.human
|
||||
}
|
||||
}
|
||||
|
||||
//read diary
|
||||
button = _ui.list_button(list)
|
||||
UIImage.set_image(button, adventureButtons)
|
||||
ImageButton.set_tooltip(button, "Diary")
|
||||
ImageButton.set_tile_uv(button, tiles, [1, 0])
|
||||
ImageButton.set_state_change(button) { |data|
|
||||
if(data["press"]){
|
||||
_page.value = UiInfo.diary
|
||||
}
|
||||
}
|
||||
|
||||
//resources
|
||||
button = _ui.list_button(list)
|
||||
UIImage.set_image(button, adventureButtons)
|
||||
ImageButton.set_tooltip(button, "Resources")
|
||||
ImageButton.set_tile_uv(button, tiles, [4, 0])
|
||||
ImageButton.set_state_change(button) { |data|
|
||||
if(data["press"]){
|
||||
_page.value = UiInfo.resources
|
||||
}
|
||||
//toolbar buttons
|
||||
_ui.list_button(list, [1, 0], "Adventure!") {
|
||||
Globals["Game"].adventures.new_or_current()
|
||||
_ui.ui_mode = Ui.Planning
|
||||
}
|
||||
_ui.list_button(list, [2, 0], "Stats") {_page.value = UiInfo.human}
|
||||
_ui.list_button(list, [1, 0], "Diary") {_page.value = UiInfo.diary}
|
||||
_ui.list_button(list, [4, 0], "Resources") {_page.value = UiInfo.resources}
|
||||
}
|
||||
|
||||
human(){
|
||||
|
|
|
|||
|
|
@ -78,18 +78,20 @@ class Ui{
|
|||
list_button(parent, tile, tooltip){
|
||||
var button = list_button(parent, tile)
|
||||
ImageButton.set_tooltip(button, tooltip)
|
||||
return button
|
||||
}
|
||||
|
||||
list_button(parent, tile, tooltip, pressFn){
|
||||
var button = list_button(parent, tile)
|
||||
var button = list_button(parent, tile, tooltip)
|
||||
ImageButton.set_state_change(button) { |data|
|
||||
if(data["press"]){
|
||||
pressFn.call()
|
||||
}
|
||||
}
|
||||
return button
|
||||
}
|
||||
}
|
||||
|
||||
//this is behind the class def to make cyclic dependency happy lol
|
||||
//this is behind the class def to make cyclic dependency happy ^^
|
||||
import "blocks/ui/info" for UiInfo
|
||||
import "blocks/ui/adventure" for UiAdventure
|
||||
Loading…
Reference in a new issue