always tick tooltip :/
also get the resources stuff back into a each after understanding what happened
This commit is contained in:
parent
d28dfac423
commit
488a913cd9
3 changed files with 9 additions and 4 deletions
|
|
@ -17,9 +17,14 @@ class Resources is Observable{
|
||||||
var list = _nameList.map{ |res| {"name": res, "amount": _resources[res["name"]]}}.//<-- butt dot!
|
var list = _nameList.map{ |res| {"name": res, "amount": _resources[res["name"]]}}.//<-- butt dot!
|
||||||
//filter out the ones without an amount
|
//filter out the ones without an amount
|
||||||
where{ |res| res["amount"] }.
|
where{ |res| res["amount"] }.
|
||||||
|
toList //toList makes the each work ^^ otherwise the result sequence runs map twice
|
||||||
//get correct name and respect plural rules //also this is its own line because each returns void >.>
|
//get correct name and respect plural rules //also this is its own line because each returns void >.>
|
||||||
map{ |res| {"name": res["amount"] != 1 && !res["name"]["alwaysSingular"] ? StringUtil.plural(res["name"]["name"]) : res["name"]["name"],
|
list.each{ |res|
|
||||||
"amount": res["amount"] }}
|
var name = res["name"]["name"]
|
||||||
|
var singular = res["amount"] == 1 || res["name"]["alwaysSingular"]
|
||||||
|
res["name"] = singular ? name : StringUtil.plural(name)
|
||||||
|
}
|
||||||
|
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class Tooltip{
|
||||||
|
|
||||||
tick(){
|
tick(){
|
||||||
var pos = Vector.new(Globals["UiMouse"])
|
var pos = Vector.new(Globals["UiMouse"])
|
||||||
if(_active && pos){
|
if(pos){
|
||||||
if(_x){
|
if(_x){
|
||||||
pos.x = _x
|
pos.x = _x
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,9 +58,9 @@ class Game is Ready {
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawDebug.commit()
|
DrawDebug.commit()
|
||||||
|
_tooltip.tick()
|
||||||
|
|
||||||
app.tick(delta)
|
app.tick(delta)
|
||||||
_tooltip.tick() //important to tick after systems to not have a 1 frame lag after setting text
|
|
||||||
} //tick
|
} //tick
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue