introduce enums as map keys

This commit is contained in:
2023-07-07 00:56:33 +02:00
parent 415a564317
commit faa6f00891
15 changed files with 52 additions and 31 deletions

View File

@@ -4,9 +4,13 @@ import (
"game/konstructor"
)
const (
DialogTest konstructor.DialogMapKey = "DialogTest"
)
func (d *Domain) InitDialog() {
d.DialogMap = konstructor.DialogMap{
"TestDialog": {
DialogTest: {
Layout: konstructor.DialogLayout{
ChoiceFont: GetDefaultFontLayout(),
},
@@ -28,11 +32,11 @@ func (d *Domain) GetDialogMap() konstructor.DialogMap {
return d.DialogMap
}
func (d *Domain) GetDialog(name string) konstructor.Dialog {
func (d *Domain) GetDialog(name konstructor.DialogMapKey) konstructor.Dialog {
value, _ := d.DialogMap[name]
return value
}
func (d *Domain) SetDialog(name string, dialog konstructor.Dialog) {
func (d *Domain) SetDialog(name konstructor.DialogMapKey, dialog konstructor.Dialog) {
d.DialogMap[name] = dialog
}