This commit is contained in:
Ronja 2020-09-19 22:38:55 +02:00
parent 58abf3fffa
commit fa40c19c50
3 changed files with 24 additions and 10 deletions

View file

@ -1,6 +1,6 @@
import "math/observable" for Observable
import "luxe: Game" for Game
import "luxe: world" for Entity, Values, Tags
import "globals" for Globals
class Adventures{
planning{_planning}
@ -12,11 +12,7 @@ class Adventures{
}
plan_new(){
var adventure = Entity.create(Game.app.world, "Adventure")
Values.set(adventure, "adventurers", [])
Values.set(adventure, "resources", {})
Values.set(adventure, "data", {})
Tags.add(adventure, "Adventure")
var adventure = Adventure.new()
_planning.value = adventure
return adventure
}
@ -27,7 +23,26 @@ class Adventures{
}
discard(){
Entity.destroy(_planning.value)
_planning.value = null
}
}
class Adventure{
adventurers{_adventurers}
resources{_resources}
data{_data}
construct new(){
_adventurers = []
_resources = []
_data = {}
}
add_adventurer(adventurer){
_adventurers.add(adventurer)
}
add_resource(resource){
_resources.add(resource)
}
}

View file

@ -17,7 +17,6 @@ import "math/stringUtil" for StringUtil
import "blocks/ui/simple_text" for UISimpleText
import "blocks/ui/ui" for Ui
import "blocks/human/human" for Human
import "luxe: Game" for Game
class UiInfo{
root{_root}
@ -82,7 +81,7 @@ class UiInfo{
ImageButton.set_tile_uv(button, tiles, [1, 0])
ImageButton.set_state_change(button) { |data|
if(data["press"]){
Game.adventures.new_or_current()
Globals["Game"].adventures.new_or_current()
_ui.ui_mode = Ui.Planning
}
}

View file

@ -84,7 +84,7 @@ class Ui{
var button = list_button(parent, tile)
ImageButton.set_state_change(button) { |data|
if(data["press"]){
_ui.ui_mode = Ui.Info
pressFn.call()
}
}
}