mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-12-26 12:06:24 -05:00
fixed lints
This commit is contained in:
parent
122b49b1cf
commit
91f28516ff
@ -68,7 +68,7 @@ func getModifiers() map[string]int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetFontCharset returns modificator for language
|
// GetLabelModifier returns modificator for language
|
||||||
func GetLabelModifier(language string) int {
|
func GetLabelModifier(language string) int {
|
||||||
mod := getModifiers()
|
mod := getModifiers()
|
||||||
|
|
||||||
|
@ -278,6 +278,8 @@ func (am *AssetManager) LoadStringTable(tablePath string) (d2tbl.TextDictionary,
|
|||||||
return table, err
|
return table, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TranslateString returns the translation of the given string. The string is retrieved from
|
||||||
|
// the loaded string tables.
|
||||||
func (am *AssetManager) TranslateString(input interface{}) string {
|
func (am *AssetManager) TranslateString(input interface{}) string {
|
||||||
var key string
|
var key string
|
||||||
|
|
||||||
|
@ -105,7 +105,8 @@ func (v *Cinematics) OnLoad(_ d2screen.LoadingState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *Cinematics) createButtons() {
|
func (v *Cinematics) createButtons() {
|
||||||
v.cinematicsExitBtn = v.uiManager.NewButton(d2ui.ButtonTypeMedium, v.asset.TranslateString(translateLabel(cancelLabel, v.language, v.asset)))
|
v.cinematicsExitBtn = v.uiManager.NewButton(d2ui.ButtonTypeMedium,
|
||||||
|
v.asset.TranslateString(translateLabel(cancelLabel, v.language, v.asset)))
|
||||||
v.cinematicsExitBtn.SetPosition(cinematicsExitBtnX, cinematicsExitBtnY)
|
v.cinematicsExitBtn.SetPosition(cinematicsExitBtnX, cinematicsExitBtnY)
|
||||||
v.cinematicsExitBtn.OnActivated(func() { v.onCinematicsExitBtnClicked() })
|
v.cinematicsExitBtn.OnActivated(func() { v.onCinematicsExitBtnClicked() })
|
||||||
|
|
||||||
|
@ -89,6 +89,7 @@ const (
|
|||||||
copyrightLabel
|
copyrightLabel
|
||||||
allRightsReservedLabel
|
allRightsReservedLabel
|
||||||
singlePlayerLabel
|
singlePlayerLabel
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
battleNetLabel
|
battleNetLabel
|
||||||
otherMultiplayerLabel
|
otherMultiplayerLabel
|
||||||
exitLabel
|
exitLabel
|
||||||
@ -96,24 +97,30 @@ const (
|
|||||||
cinematicsLabel
|
cinematicsLabel
|
||||||
|
|
||||||
// cinematics menu labels
|
// cinematics menu labels
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
viewAllCinematicsLabel
|
viewAllCinematicsLabel
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
epilogueLabel
|
epilogueLabel
|
||||||
selectCinematicLabel
|
selectCinematicLabel
|
||||||
|
|
||||||
// multiplayer menu labels
|
// multiplayer menu labels
|
||||||
openBattleNetLaBEL
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
tcpIpGameLabel
|
openBattleNetLabeL
|
||||||
tcpIpOptionsLabel
|
tcpIPGameLabel
|
||||||
tcpIpHostGameLabel
|
tcpIPOptionsLabel
|
||||||
tcpIpJoinGameLabel
|
tcpIPHostGameLabel
|
||||||
tcpIpEnterHostIpLabel
|
tcpIPJoinGameLabel
|
||||||
tcpIpYourIpLabel
|
tcpIPEnterHostIPLabel
|
||||||
|
tcpIPYourIPLabel
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
tipHostLabel
|
tipHostLabel
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
tipJoinLabel
|
tipJoinLabel
|
||||||
ipNotFoundLabel
|
ipNotFoundLabel
|
||||||
|
|
||||||
// select hero class menu labels
|
// select hero class menu labels
|
||||||
charNameLabel
|
charNameLabel
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
hardCoreLabel
|
hardCoreLabel
|
||||||
selectHeroClassLabel
|
selectHeroClassLabel
|
||||||
amazonDescr
|
amazonDescr
|
||||||
@ -122,17 +129,25 @@ const (
|
|||||||
sorceressDescr
|
sorceressDescr
|
||||||
paladinDescr
|
paladinDescr
|
||||||
|
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
notUsed1 // this position isn't used here.
|
notUsed1 // this position isn't used here.
|
||||||
|
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
hellLabel
|
hellLabel
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
nightmareLabel
|
nightmareLabel
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
normalLabel
|
normalLabel
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
selectDifficultyLabel
|
selectDifficultyLabel
|
||||||
|
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
notUsed2
|
notUsed2
|
||||||
|
|
||||||
delCharConfLabel
|
delCharConfLabel
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
openLabel
|
openLabel
|
||||||
|
//nolint:deadcode,varcheck,unused // will be used, or is need
|
||||||
notUsed3
|
notUsed3
|
||||||
yesLabel
|
yesLabel
|
||||||
noLabel
|
noLabel
|
||||||
@ -200,6 +215,7 @@ func baseLabelNumbers(idx int) int {
|
|||||||
1926, // not used, for locales with +1 mod
|
1926, // not used, for locales with +1 mod
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseLabelNumbers[idx]
|
return baseLabelNumbers[idx]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,17 +414,17 @@ func (v *MainMenu) createLabels(loading d2screen.LoadingState) {
|
|||||||
v.tcpIPOptionsLabel = v.uiManager.NewLabel(d2resource.Font42, d2resource.PaletteUnits)
|
v.tcpIPOptionsLabel = v.uiManager.NewLabel(d2resource.Font42, d2resource.PaletteUnits)
|
||||||
v.tcpIPOptionsLabel.SetPosition(tcpOptionsX, tcpOptionsY)
|
v.tcpIPOptionsLabel.SetPosition(tcpOptionsX, tcpOptionsY)
|
||||||
v.tcpIPOptionsLabel.Alignment = d2ui.HorizontalAlignCenter
|
v.tcpIPOptionsLabel.Alignment = d2ui.HorizontalAlignCenter
|
||||||
v.tcpIPOptionsLabel.SetText(translateLabel(tcpIpOptionsLabel, v.language, v.asset))
|
v.tcpIPOptionsLabel.SetText(translateLabel(tcpIPOptionsLabel, v.language, v.asset))
|
||||||
|
|
||||||
v.tcpJoinGameLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits)
|
v.tcpJoinGameLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits)
|
||||||
v.tcpJoinGameLabel.Alignment = d2ui.HorizontalAlignCenter
|
v.tcpJoinGameLabel.Alignment = d2ui.HorizontalAlignCenter
|
||||||
v.tcpJoinGameLabel.SetText(d2util.SplitIntoLinesWithMaxWidthOneLine(translateLabel(tcpIpEnterHostIpLabel, v.language, v.asset), 27))
|
v.tcpJoinGameLabel.SetText(d2util.SplitIntoLinesWithMaxWidthOneLine(translateLabel(tcpIPEnterHostIPLabel, v.language, v.asset), 27))
|
||||||
v.tcpJoinGameLabel.Color[0] = rgbaColor(gold)
|
v.tcpJoinGameLabel.Color[0] = rgbaColor(gold)
|
||||||
v.tcpJoinGameLabel.SetPosition(joinGameX, joinGameY)
|
v.tcpJoinGameLabel.SetPosition(joinGameX, joinGameY)
|
||||||
|
|
||||||
v.machineIP = v.uiManager.NewLabel(d2resource.Font24, d2resource.PaletteUnits)
|
v.machineIP = v.uiManager.NewLabel(d2resource.Font24, d2resource.PaletteUnits)
|
||||||
v.machineIP.Alignment = d2ui.HorizontalAlignCenter
|
v.machineIP.Alignment = d2ui.HorizontalAlignCenter
|
||||||
v.machineIP.SetText(translateLabel(tcpIpYourIpLabel, v.language, v.asset) + "\n" + v.getLocalIP())
|
v.machineIP.SetText(translateLabel(tcpIPYourIPLabel, v.language, v.asset) + "\n" + v.getLocalIP())
|
||||||
v.machineIP.Color[0] = rgbaColor(lightYellow)
|
v.machineIP.Color[0] = rgbaColor(lightYellow)
|
||||||
v.machineIP.SetPosition(machineIPX, machineIPY)
|
v.machineIP.SetPosition(machineIPX, machineIPY)
|
||||||
|
|
||||||
@ -505,7 +521,7 @@ func (v *MainMenu) createMultiplayerMenuButtons() {
|
|||||||
v.multiplayerButton.SetPosition(multiplayerBtnX, multiplayerBtnY)
|
v.multiplayerButton.SetPosition(multiplayerBtnX, multiplayerBtnY)
|
||||||
v.multiplayerButton.OnActivated(func() { v.onMultiplayerClicked() })
|
v.multiplayerButton.OnActivated(func() { v.onMultiplayerClicked() })
|
||||||
|
|
||||||
v.networkTCPIPButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, translateLabel(tcpIpGameLabel, v.language, v.asset))
|
v.networkTCPIPButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, translateLabel(tcpIPGameLabel, v.language, v.asset))
|
||||||
v.networkTCPIPButton.SetPosition(tcpNetBtnX, tcpNetBtnY)
|
v.networkTCPIPButton.SetPosition(tcpNetBtnX, tcpNetBtnY)
|
||||||
v.networkTCPIPButton.OnActivated(func() { v.onNetworkTCPIPClicked() })
|
v.networkTCPIPButton.OnActivated(func() { v.onNetworkTCPIPClicked() })
|
||||||
|
|
||||||
@ -514,11 +530,11 @@ func (v *MainMenu) createMultiplayerMenuButtons() {
|
|||||||
v.networkCancelButton.SetPosition(networkCancelBtnX, networkCancelBtnY)
|
v.networkCancelButton.SetPosition(networkCancelBtnX, networkCancelBtnY)
|
||||||
v.networkCancelButton.OnActivated(func() { v.onNetworkCancelClicked() })
|
v.networkCancelButton.OnActivated(func() { v.onNetworkCancelClicked() })
|
||||||
|
|
||||||
v.btnTCPIPHostGame = v.uiManager.NewButton(d2ui.ButtonTypeWide, translateLabel(tcpIpHostGameLabel, v.language, v.asset))
|
v.btnTCPIPHostGame = v.uiManager.NewButton(d2ui.ButtonTypeWide, translateLabel(tcpIPHostGameLabel, v.language, v.asset))
|
||||||
v.btnTCPIPHostGame.SetPosition(tcpHostBtnX, tcpHostBtnY)
|
v.btnTCPIPHostGame.SetPosition(tcpHostBtnX, tcpHostBtnY)
|
||||||
v.btnTCPIPHostGame.OnActivated(func() { v.onTCPIPHostGameClicked() })
|
v.btnTCPIPHostGame.OnActivated(func() { v.onTCPIPHostGameClicked() })
|
||||||
|
|
||||||
v.btnTCPIPJoinGame = v.uiManager.NewButton(d2ui.ButtonTypeWide, translateLabel(tcpIpJoinGameLabel, v.language, v.asset))
|
v.btnTCPIPJoinGame = v.uiManager.NewButton(d2ui.ButtonTypeWide, translateLabel(tcpIPJoinGameLabel, v.language, v.asset))
|
||||||
v.btnTCPIPJoinGame.SetPosition(tcpJoinBtnX, tcpJoinBtnY)
|
v.btnTCPIPJoinGame.SetPosition(tcpJoinBtnX, tcpJoinBtnY)
|
||||||
v.btnTCPIPJoinGame.OnActivated(func() { v.onTCPIPJoinGameClicked() })
|
v.btnTCPIPJoinGame.OnActivated(func() { v.onTCPIPJoinGameClicked() })
|
||||||
}
|
}
|
||||||
|
@ -719,11 +719,13 @@ const (
|
|||||||
|
|
||||||
func (v *SelectHeroClass) setDescLabels(descKey int, key string) {
|
func (v *SelectHeroClass) setDescLabels(descKey int, key string) {
|
||||||
var heroDesc string
|
var heroDesc string
|
||||||
|
|
||||||
if key != "" {
|
if key != "" {
|
||||||
heroDesc = v.asset.TranslateString(key)
|
heroDesc = v.asset.TranslateString(key)
|
||||||
} else {
|
} else {
|
||||||
heroDesc = translateLabel(descKey, v.language, v.asset)
|
heroDesc = translateLabel(descKey, v.language, v.asset)
|
||||||
}
|
}
|
||||||
|
|
||||||
parts := d2util.SplitIntoLinesWithMaxWidth(heroDesc, heroDescCharWidth)
|
parts := d2util.SplitIntoLinesWithMaxWidth(heroDesc, heroDescCharWidth)
|
||||||
|
|
||||||
numLines := len(parts)
|
numLines := len(parts)
|
||||||
|
Loading…
Reference in New Issue
Block a user