always tick tooltip :/

also get the resources stuff back into a each after understanding what happened
This commit is contained in:
Ronja 2020-09-19 09:17:15 +02:00
parent d28dfac423
commit 488a913cd9
3 changed files with 9 additions and 4 deletions

View file

@ -17,9 +17,14 @@ class Resources is Observable{
var list = _nameList.map{ |res| {"name": res, "amount": _resources[res["name"]]}}.//<-- butt dot!
//filter out the ones without an 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 >.>
map{ |res| {"name": res["amount"] != 1 && !res["name"]["alwaysSingular"] ? StringUtil.plural(res["name"]["name"]) : res["name"]["name"],
"amount": res["amount"] }}
list.each{ |res|
var name = res["name"]["name"]
var singular = res["amount"] == 1 || res["name"]["alwaysSingular"]
res["name"] = singular ? name : StringUtil.plural(name)
}
return list
}

View file

@ -35,7 +35,7 @@ class Tooltip{
tick(){
var pos = Vector.new(Globals["UiMouse"])
if(_active && pos){
if(pos){
if(_x){
pos.x = _x
}

View file

@ -58,9 +58,9 @@ class Game is Ready {
}
DrawDebug.commit()
_tooltip.tick()
app.tick(delta)
_tooltip.tick() //important to tick after systems to not have a 1 frame lag after setting text
} //tick
destroy() {