/
difficultyconfirm.go
153 lines (131 loc) · 4.5 KB
/
difficultyconfirm.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
package main
import (
"fmt"
"github.com/Nightgunner5/agwycctmiatstsycbmrm/state"
"github.com/Nightgunner5/agwycctmiatstsycbmrm/util"
"github.com/nsf/termbox-go"
"time"
)
var (
difficultyDescription = [][][]rune{
util.SplitForUI("Grump mode, for when you're down in the grumps. Alternatively, it can be used for your gramps. Grandpa! No! That is not the right button. Grandpa, stop. You're horrible at this. No Grandpa, you can't check your AOL on this. It's a video game. No, that is not a film projector."),
util.SplitForUI("Six inches is a normal mode for normal people. Alternatively, you can replace 'normal' with 'boring'. Six inches is a boring mode for boring people. See what I did there? Get it? Wh- why are you walking away? Guys?"),
util.SplitForUI("This game mode is rude. It does rude things and brings its rude friends to be rude near you. Recommended for torture-seekers. And rude people."),
util.SplitForUI("AAAAAAAAAAAAAAAAAAAAAAAAA PUT IT OUT PUT IT OUT PUT IT OUT AAAAAAAAAAAAAAAAAA MAKE IT STOP IT BURNS AAAAAAAAAAAAAAAAAAAA HELP ME SOMEONE HELP AAAAAAAAAAAAAAAA HELP ME EVERYTHING IS ON FIRE"),
util.SplitForUI("Hey guys let's make a game where you play a game and then there's space and stuff and then you get items or something but really the whole thing is a metaphor for the triviality of life. Ooh, the pizza is here."),
}
difficultyStartingMoney = []rune("Starting Cash")
difficultyGimmick = []rune("Gimmick")
difficultyDayLength = []rune("Day Length")
difficultyTuning = []struct {
startingmoney uint64
gimmick [][]rune
dayLength time.Duration
}{
{
startingmoney: 1000000000,
gimmick: util.SplitForUI("grandpa-friendly"),
dayLength: time.Second * 60,
},
{
startingmoney: 10000000,
gimmick: util.SplitForUI("boring"),
dayLength: time.Second * 10,
},
{
startingmoney: 1000000,
gimmick: util.SplitForUI("the game insults you"),
dayLength: time.Second * 7,
},
{
startingmoney: 100000,
gimmick: util.SplitForUI("everything is on fire"),
dayLength: time.Second * 5,
},
{
startingmoney: 250,
gimmick: util.SplitForUI("slave labor required"),
dayLength: time.Second * 2,
},
}
difficultyStartHint = util.SplitForUI("Push B to begin.")
)
type difficultyConfirm struct {
parent context
difficulty int
}
func (d *difficultyConfirm) paint(w, h int) {
for i, r := range backHint {
termbox.SetCell(w-len(backHint)+i, 1, r, termbox.ColorDefault, termbox.ColorDefault)
}
x, y := 1, 3
for _, word := range difficultyDescription[d.difficulty] {
if x+len(word)+1 >= w {
x, y = 1, y+1
}
for i, r := range word {
termbox.SetCell(x+i, y, r, termbox.ColorDefault, termbox.ColorDefault)
}
x += len(word) + 1
}
tuning := &difficultyTuning[d.difficulty]
x, y = 16, y+2
for i, r := range difficultyStartingMoney {
termbox.SetCell(x-len(difficultyStartingMoney)+i-1, y, r, termbox.ColorDefault|termbox.AttrBold, termbox.ColorDefault)
}
for i, r := range []rune(fmt.Sprintf("%d", tuning.startingmoney)) {
termbox.SetCell(x+i, y, r, termbox.ColorDefault, termbox.ColorDefault)
}
x, y = 16, y+1
for i, r := range difficultyGimmick {
termbox.SetCell(x-len(difficultyGimmick)+i-1, y, r, termbox.ColorDefault|termbox.AttrBold, termbox.ColorDefault)
}
for _, word := range tuning.gimmick {
if x+len(word)+1 >= w {
x, y = 16, y+1
}
for i, r := range word {
termbox.SetCell(x+i, y, r, termbox.ColorDefault, termbox.ColorDefault)
}
x += len(word) + 1
}
x, y = 16, y+1
for i, r := range difficultyDayLength {
termbox.SetCell(x-len(difficultyDayLength)+i-1, y, r, termbox.ColorDefault|termbox.AttrBold, termbox.ColorDefault)
}
for i, r := range []rune(fmt.Sprintf("%d seconds", int(tuning.dayLength.Seconds()))) {
termbox.SetCell(x+i, y, r, termbox.ColorDefault, termbox.ColorDefault)
}
x, y = 16, y+2
for _, word := range difficultyStartHint {
if x+len(word)+1 >= w {
x, y = 16, y+1
}
for i, r := range word {
termbox.SetCell(x+i, y, r, termbox.ColorDefault, termbox.ColorDefault)
}
x += len(word) + 1
}
}
func (d *difficultyConfirm) char(r rune) {
switch r {
case 'q', 'Q':
paintCtx = d.parent
repaint()
case 'b', 'B':
tuning := difficultyTuning[d.difficulty]
game := &gameUI{
parent: d.parent,
state: &state.State{
DayLength: tuning.dayLength,
Cash: tuning.startingmoney,
},
}
game.state.Init()
paintCtx = game
go game.process()
repaint()
}
}
func (d *difficultyConfirm) key(k termbox.Key) {
}