Show tooltips when hovering
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"code.ur.gs/lupine/ordoor/internal/data"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -32,11 +34,12 @@ type AssetStore struct {
|
||||
entries entryMap
|
||||
|
||||
// These members are used to store things we've already loaded
|
||||
maps map[string]*Map
|
||||
menus map[string]*Menu
|
||||
objs map[string]*Object
|
||||
sets map[string]*Set
|
||||
sounds map[string]*Sound
|
||||
maps map[string]*Map
|
||||
menus map[string]*Menu
|
||||
objs map[string]*Object
|
||||
sets map[string]*Set
|
||||
sounds map[string]*Sound
|
||||
strings *data.I18n
|
||||
}
|
||||
|
||||
// New returns a new AssetStore
|
||||
@@ -86,6 +89,7 @@ func (a *AssetStore) Refresh() error {
|
||||
a.objs = make(map[string]*Object)
|
||||
a.sets = make(map[string]*Set)
|
||||
a.sounds = make(map[string]*Sound)
|
||||
a.strings = nil
|
||||
|
||||
return nil
|
||||
}
|
||||
|
29
internal/assetstore/i18n.go
Normal file
29
internal/assetstore/i18n.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package assetstore
|
||||
|
||||
import (
|
||||
"code.ur.gs/lupine/ordoor/internal/data"
|
||||
)
|
||||
|
||||
// Internationalisation is completely hidden inside the asset store. Everything
|
||||
// comes out already converted.
|
||||
//
|
||||
// FIXME: Allow the language to be set. Right now, it's hardcoded to USEng
|
||||
// because that's the only copy of Chaos Gate I have.
|
||||
func (a *AssetStore) i18n() (*data.I18n, error) {
|
||||
if a.strings != nil {
|
||||
return a.strings, nil
|
||||
}
|
||||
|
||||
filename, err := a.lookup(data.I18nFile, "", "Data")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
i18n, err := data.LoadI18n(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
a.strings = i18n
|
||||
return i18n, nil
|
||||
}
|
@@ -54,6 +54,13 @@ func (a *AssetStore) Menu(name string) (*Menu, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
i18n, err := a.i18n()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
raw.Internationalize(i18n)
|
||||
|
||||
obj, err := a.loadMenuObject(raw) // TODO: multiple objects
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user