Exemplo n.º 1
0
func (ui *gameUI) stateInstruction() string {
	switch ui.game.State {
	case game.NotStarted:
		return lang.Get(lang.Menu)
	case game.BuildingFirstSettlement:
		return lang.Get(lang.BuildFirstSettlement)
	case game.BuildingFirstRoad:
		return lang.Get(lang.BuildFirstRoad)
	case game.BuildingSecondSettlement:
		return lang.Get(lang.BuildSecondSettlement)
	case game.BuildingSecondRoad:
		return lang.Get(lang.BuildSecondRoad)
	case game.BuildingNewRoad:
		return lang.Get(lang.BuildRoad)
	case game.BuildingNewSettlement:
		return lang.Get(lang.BuildSettlement)
	case game.BuildingNewCity:
		return lang.Get(lang.BuildCity)
	case game.ChoosingNextAction:
		return lang.Get(lang.ChooseNextAction)
	case game.RollingDice:
		return lang.Get(lang.RollDice)
	}
	return "Unknown State: " + strconv.Itoa(int(ui.game.State))
}
Exemplo n.º 2
0
func (c *checkBox) draw(g *graphics) {
	g.rect(c.x, c.y, c.w, c.h, menuColdBackColor)
	checkColor := checkBoxUncheckedColor
	if c.checked {
		checkColor = checkBoxCheckedColor
	}
	b := c.checkRect
	g.rect(b.x, b.y, b.w, b.h, checkColor)
	g.writeLeftAlignedVerticallyCenteredAt(lang.Get(c.textID), c.textX, c.textY, menuFontColor)
}
Exemplo n.º 3
0
func (b *button) draw(g *graphics) {
	color := menuColdBackColor
	if b.hot {
		color = menuHotBackColor
	}
	g.rect(b.x, b.y, b.w, b.h, color)
	fontColor := menuFontColor
	if !b.enabled {
		fontColor = menuColdFontColor
	}
	g.writeTextLineCenteredInRect(lang.Get(b.textID), b.rect, fontColor)
}
Exemplo n.º 4
0
func (t *textBox) draw(g *graphics) {
	t.recalcRects()
	fontColor := menuFontColor
	if t.disabled {
		fontColor = menuDisabledFontColor
	}

	g.rect(t.x, t.y, t.w, t.h, menuColdBackColor)
	g.writeTextLineCenteredInRect(lang.Get(t.captionID), t.captionRect, fontColor)
	if t.hot {
		g.rect(t.textRect.x, t.textRect.y, t.textRect.w, t.textRect.h, menuHotBackColor)
	}
	g.writeTextLineCenteredInRect(t.text, t.textRect, fontColor)
}
Exemplo n.º 5
0
func (t *textBox) recalcRects() {
	const margin = 20
	captionW, _ := t.font.TextSize(lang.Get(t.captionID))
	t.captionRect = rect{t.x + margin, t.y + margin, captionW, t.h - 2*margin}
	t.textRect = rect{t.x + 2*margin + captionW, t.y, t.w - 2*margin - captionW, t.h}
}
Exemplo n.º 6
0
func (ui *gameUI) setLanguage(id lang.Language) {
	lang.CurrentLanguage = id
	settings.Settings.Language = int(id)
	ui.window.SetTitle(lang.Get(lang.Title))
}