add last page
parent
b93c05f833
commit
4cd2b8bd81
|
@ -0,0 +1,40 @@
|
||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.sr.ht/~rockorager/vaxis"
|
||||||
|
"git.tilde.town/nbsp/welcome/ui"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Help struct{}
|
||||||
|
|
||||||
|
func (view *Help) Event(state *ui.State, event vaxis.Event) (processed bool) {
|
||||||
|
if key, ok := event.(vaxis.Key); ok && key.EventType == vaxis.EventPress {
|
||||||
|
switch key.String() {
|
||||||
|
case "Ctrl+c", "Ctrl+d", "Enter":
|
||||||
|
close(ui.Quit)
|
||||||
|
}
|
||||||
|
processed = true
|
||||||
|
}
|
||||||
|
win := state.Window()
|
||||||
|
win.Print(
|
||||||
|
vaxis.Segment{Text: ` ──── links, help, & goodbye ────
|
||||||
|
|
||||||
|
good job on getting all the way through this tutorial! i knew you could do it.
|
||||||
|
while there's a lot of things you can do in town, the tools you just received
|
||||||
|
should help you traverse the land and get further help if you need it.
|
||||||
|
|
||||||
|
• to join our chatroom and ask for help or just say hi, run `},
|
||||||
|
vaxis.Segment{Text: "town chat", Style: vaxis.Style{Foreground: vaxis.IndexColor(3)}},
|
||||||
|
vaxis.Segment{Text: `
|
||||||
|
• run `},
|
||||||
|
vaxis.Segment{Text: "town bbj", Style: vaxis.Style{Foreground: vaxis.IndexColor(3)}},
|
||||||
|
vaxis.Segment{Text: ` to see what we're talking about on our bulletin board
|
||||||
|
• oh, and you've got mail! run `},
|
||||||
|
vaxis.Segment{Text: "town mail", Style: vaxis.Style{Foreground: vaxis.IndexColor(3)}},
|
||||||
|
vaxis.Segment{Text: ` to see who it's from :)
|
||||||
|
|
||||||
|
press ↲ to quit to a shell!
|
||||||
|
`},
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
18
app/shell.go
18
app/shell.go
|
@ -43,21 +43,11 @@ you're ready.`},
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *Shell) Event(state *ui.State, event vaxis.Event) (processed bool) {
|
func (view *Shell) Event(state *ui.State, event vaxis.Event) (processed bool) {
|
||||||
if key, ok := event.(vaxis.Key); ok && key.EventType == vaxis.EventPress {
|
|
||||||
switch key.String() {
|
|
||||||
case "Ctrl+c", "Ctrl+d":
|
|
||||||
close(ui.Quit)
|
|
||||||
case "Enter":
|
|
||||||
ui.ViewChange <- &Settings{}
|
|
||||||
}
|
|
||||||
processed = true
|
|
||||||
}
|
|
||||||
win := state.Window()
|
win := state.Window()
|
||||||
|
|
||||||
view.Draw(state)
|
view.Draw(state)
|
||||||
|
|
||||||
vt := term.New()
|
vt := term.New()
|
||||||
vt.Draw(win.New(0, 15, 80, 80))
|
vt.Draw(win.New(0, 16, 80, 80))
|
||||||
vt.Attach(state.PostEvent())
|
vt.Attach(state.PostEvent())
|
||||||
vt.Focus()
|
vt.Focus()
|
||||||
err := vt.Start(exec.Command("bash", "-i"))
|
err := vt.Start(exec.Command("bash", "-i"))
|
||||||
|
@ -70,12 +60,14 @@ func (view *Shell) Event(state *ui.State, event vaxis.Event) (processed bool) {
|
||||||
switch ev.(type) {
|
switch ev.(type) {
|
||||||
case term.EventClosed:
|
case term.EventClosed:
|
||||||
state.HideCursor()
|
state.HideCursor()
|
||||||
|
vt.Detach()
|
||||||
|
vt.Close()
|
||||||
state.Window().Clear()
|
state.Window().Clear()
|
||||||
ui.ViewChange <- &Introduction{}
|
ui.ViewChange <- &Help{}
|
||||||
return
|
return
|
||||||
case vaxis.Redraw:
|
case vaxis.Redraw:
|
||||||
view.Draw(state)
|
view.Draw(state)
|
||||||
vt.Draw(win.New(0, 15, 80, 80))
|
vt.Draw(win.New(0, 16, 80, 80))
|
||||||
state.Render()
|
state.Render()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue