Get character stats (kind of) displaying in-scenario
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/hajimehoshi/ebiten"
|
||||
"github.com/hajimehoshi/ebiten/inpututil"
|
||||
|
||||
"code.ur.gs/lupine/ordoor/internal/assetstore"
|
||||
"code.ur.gs/lupine/ordoor/internal/config"
|
||||
@@ -118,6 +119,14 @@ func (f *Flow) Update(screenX, screenY int) error {
|
||||
if ebiten.IsKeyPressed(ebiten.KeyDown) {
|
||||
f.scenario.Viewpoint.Y += step
|
||||
}
|
||||
|
||||
if inpututil.IsMouseButtonJustReleased(ebiten.MouseButtonLeft) {
|
||||
f.scenario.SelectHighlightedCharacter()
|
||||
|
||||
// Now we need to update the info screens with data about the
|
||||
// selected character. FIXME: oh, for data binding
|
||||
f.selectedMainGameCharacter(f.scenario.SelectedCharacter())
|
||||
}
|
||||
}
|
||||
|
||||
if f.scenario != nil {
|
||||
|
@@ -1,5 +1,9 @@
|
||||
package flow
|
||||
|
||||
import (
|
||||
"code.ur.gs/lupine/ordoor/internal/maps"
|
||||
)
|
||||
|
||||
// TODO: There are Chaos and Ultramarine versions of MainGame. Do we really want
|
||||
// to duplicate everything for both?
|
||||
|
||||
@@ -154,3 +158,48 @@ func (f *Flow) linkMainGameViewMenu() {
|
||||
}))
|
||||
|
||||
}
|
||||
|
||||
func (f *Flow) maybeSetErr(next func() error) {
|
||||
if f.exit != nil {
|
||||
return
|
||||
}
|
||||
|
||||
f.exit = next()
|
||||
}
|
||||
|
||||
func (f *Flow) selectedMainGameCharacter(chr *maps.Character) {
|
||||
if chr == nil {
|
||||
chr = &maps.Character{}
|
||||
}
|
||||
|
||||
d := f.drivers[mainGame]
|
||||
|
||||
// 7.1 Portrait
|
||||
f.maybeSetErr(func() error { return d.SetValue("7.2", chr.Name) }) // Name
|
||||
// 7.3 doesn't exit
|
||||
// 7.4 more button (ignore)
|
||||
// 7.5 AP icon
|
||||
// f.maybeSetErr(func() error { return d.SetValueInt("7.6", chr.ActionPoints)}) // AP meter
|
||||
f.maybeSetErr(func() error { return d.SetValueInt("7.7", chr.ActionPoints) }) // AP value
|
||||
// 7.8 armor icon
|
||||
// 7.9 armor meter
|
||||
f.maybeSetErr(func() error { return d.SetValueInt("7.10", chr.Armor) }) // armor value
|
||||
// 7.11 health icon
|
||||
// 7.12 health meter
|
||||
f.maybeSetErr(func() error { return d.SetValueInt("7.13", chr.Health) }) // health value
|
||||
// 7.14 action points status bar
|
||||
// 7.15 armor status bar
|
||||
// 7.16 health status bar
|
||||
|
||||
// 8.1 to 8.10 are hot spots
|
||||
f.maybeSetErr(func() error { return d.SetValueInt("8.11", chr.ActionPoints) }) // AP
|
||||
f.maybeSetErr(func() error { return d.SetValueInt("8.12", chr.Health) }) // Health
|
||||
f.maybeSetErr(func() error { return d.SetValueInt("8.13", chr.Armor) }) // Armor
|
||||
f.maybeSetErr(func() error { return d.SetValueInt("8.14", chr.BallisticSkill) }) // Ballistic Skill
|
||||
f.maybeSetErr(func() error { return d.SetValueInt("8.15", chr.WeaponSkill) }) // Weapon Skill
|
||||
f.maybeSetErr(func() error { return d.SetValueInt("8.16", chr.Strength) }) // Strength
|
||||
f.maybeSetErr(func() error { return d.SetValueInt("8.17", chr.Toughness) }) // Toughness
|
||||
// 8.18 Initiative
|
||||
// 8.19 Attacks
|
||||
f.maybeSetErr(func() error { return d.SetValueInt("8.20", chr.Leadership) }) // Leadership
|
||||
}
|
||||
|
Reference in New Issue
Block a user