Wire up inventory select to ship state
Also mixed into this commit: * Use returning drivers where possible * Make the credits screen returnable via click
This commit is contained in:
@@ -1,36 +1,68 @@
|
||||
package flow
|
||||
|
||||
import (
|
||||
"code.ur.gs/lupine/ordoor/internal/ship"
|
||||
)
|
||||
|
||||
func (f *Flow) linkNewGame() {
|
||||
// New game
|
||||
f.onClick(newGame, "2.1", f.setDriver(levelPly)) // New campaign button
|
||||
f.onClick(newGame, "2.2", f.setDriver(singles)) // Single scenario button
|
||||
f.onClick(newGame, "2.3", f.setDriver(randomMap)) // Random scenario button
|
||||
f.onClick(newGame, "2.4", f.setDriver(main)) // Back button
|
||||
f.onClick(newGame, "2.1", f.setReturningDriver(newGame, levelPly)) // New campaign button
|
||||
f.onClick(newGame, "2.2", f.setReturningDriver(newGame, singles)) // Single scenario button
|
||||
f.onClick(newGame, "2.3", f.setReturningDriver(newGame, randomMap)) // Random scenario button
|
||||
f.onClick(newGame, "2.4", f.returnToLastDriver(newGame)) // Back button
|
||||
|
||||
f.linkLevelPly()
|
||||
f.linkSingles()
|
||||
f.linkRandomMap()
|
||||
}
|
||||
|
||||
func (f *Flow) linkLevelPly() {
|
||||
// We want the default difficulty level to be Veteran, not Hero.
|
||||
func (f *Flow) resetLevelPlyInventorySelect() {
|
||||
// FIXME: Make the radio button respect changes via setValue
|
||||
resetLevel := func() {
|
||||
f.setValueBool(levelPly, "2.1", false)
|
||||
f.setValueBool(levelPly, "2.2", true)
|
||||
for _, v := range []string{"2.1", "2.2", "2.3", "2.4"} {
|
||||
f.setValueBool(levelPly, v, false)
|
||||
}
|
||||
resetLevel()
|
||||
|
||||
switch f.ship.Difficulty {
|
||||
case ship.DifficultyLevelMarine:
|
||||
f.setValueBool(levelPly, "2.1", true)
|
||||
case ship.DifficultyLevelVeteran:
|
||||
f.setValueBool(levelPly, "2.2", true)
|
||||
case ship.DifficultyLevelHero:
|
||||
f.setValueBool(levelPly, "2.3", true)
|
||||
case ship.DifficultyLevelMighty:
|
||||
f.setValueBool(levelPly, "2.4", true)
|
||||
}
|
||||
}
|
||||
|
||||
func (f *Flow) linkLevelPly() {
|
||||
f.onClick(levelPly, "2.5", func() { // Back button
|
||||
resetLevel()
|
||||
f.setDriverNow(newGame)
|
||||
f.resetLevelPlyInventorySelect() // FIXME: should use data binding
|
||||
f.returnToLastDriverNow(levelPly)
|
||||
})
|
||||
|
||||
// FIXME: we should select a savegame if Mighty Hero is selected here
|
||||
// FIXME: we should show a movie here. Need an internal SMK player first
|
||||
// FIXME: we should set up new game state here!
|
||||
// FIXME: we should be able to read the difficulty level from the group
|
||||
f.onClick(levelPly, "2.7", func() { // Select button
|
||||
if f.valueBool(levelPly, "2.1") {
|
||||
f.ship.Difficulty = ship.DifficultyLevelMarine
|
||||
}
|
||||
|
||||
if f.valueBool(levelPly, "2.2") {
|
||||
f.ship.Difficulty = ship.DifficultyLevelVeteran
|
||||
}
|
||||
|
||||
if f.valueBool(levelPly, "2.3") {
|
||||
f.ship.Difficulty = ship.DifficultyLevelHero
|
||||
}
|
||||
|
||||
if f.valueBool(levelPly, "2.4") {
|
||||
// FIXME: we should select a savegame. Mighty Hero disables manual saves.
|
||||
f.ship.Difficulty = ship.DifficultyLevelMighty
|
||||
}
|
||||
|
||||
f.ship.NextScenario = f.generic.CampaignMaps[0]
|
||||
|
||||
// FIXME: we should show a movie here. Need an internal SMK player first
|
||||
|
||||
f.setDriverNow(bridge)
|
||||
})
|
||||
|
||||
@@ -39,9 +71,9 @@ func (f *Flow) linkLevelPly() {
|
||||
}
|
||||
|
||||
func (f *Flow) linkSingles() {
|
||||
f.onClick(singles, "4.11", f.setDriver(newGame)) // Back button
|
||||
f.onClick(singles, "4.11", f.returnToLastDriver(singles)) // Back button
|
||||
}
|
||||
|
||||
func (f *Flow) linkRandomMap() {
|
||||
f.onClick(randomMap, "2.19", f.setDriver(newGame)) // Back button
|
||||
f.onClick(randomMap, "2.19", f.returnToLastDriver(randomMap)) // Back button
|
||||
}
|
||||
|
Reference in New Issue
Block a user