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 "math/observable" for Observable
import "luxe: Game" for Game
import "luxe: world" for Entity, Values, Tags import "luxe: world" for Entity, Values, Tags
import "globals" for Globals
class Adventures{ class Adventures{
planning{_planning} planning{_planning}
@ -12,11 +12,7 @@ class Adventures{
} }
plan_new(){ plan_new(){
var adventure = Entity.create(Game.app.world, "Adventure") var adventure = Adventure.new()
Values.set(adventure, "adventurers", [])
Values.set(adventure, "resources", {})
Values.set(adventure, "data", {})
Tags.add(adventure, "Adventure")
_planning.value = adventure _planning.value = adventure
return adventure return adventure
} }
@ -27,7 +23,26 @@ class Adventures{
} }
discard(){ discard(){
Entity.destroy(_planning.value)
_planning.value = null _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/simple_text" for UISimpleText
import "blocks/ui/ui" for Ui import "blocks/ui/ui" for Ui
import "blocks/human/human" for Human import "blocks/human/human" for Human
import "luxe: Game" for Game
class UiInfo{ class UiInfo{
root{_root} root{_root}
@ -82,7 +81,7 @@ class UiInfo{
ImageButton.set_tile_uv(button, tiles, [1, 0]) ImageButton.set_tile_uv(button, tiles, [1, 0])
ImageButton.set_state_change(button) { |data| ImageButton.set_state_change(button) { |data|
if(data["press"]){ if(data["press"]){
Game.adventures.new_or_current() Globals["Game"].adventures.new_or_current()
_ui.ui_mode = Ui.Planning _ui.ui_mode = Ui.Planning
} }
} }

View file

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