mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-01-28 12:16:24 -05:00
moved some stuff
This commit is contained in:
parent
e5bab6660b
commit
76257ca351
@ -922,7 +922,7 @@ func (a *App) ToMainMenu(errorMessageOptional ...string) {
|
|||||||
|
|
||||||
// ToSelectHero forces the game to transition to the Select Hero (create character) screen
|
// ToSelectHero forces the game to transition to the Select Hero (create character) screen
|
||||||
func (a *App) ToSelectHero(connType d2clientconnectiontype.ClientConnectionType, host string) {
|
func (a *App) ToSelectHero(connType d2clientconnectiontype.ClientConnectionType, host string) {
|
||||||
selectHero, err := d2gamescreen.CreateSelectHeroClass(a, a.asset, a.renderer, a.audio, a.ui, connType, a.config.LogLevel, a.language, host)
|
selectHero, err := d2gamescreen.CreateSelectHeroClass(a, a.asset, a.renderer, a.audio, a.ui, connType, a.config.LogLevel, host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.Error(err.Error())
|
a.Error(err.Error())
|
||||||
return
|
return
|
||||||
@ -952,7 +952,7 @@ func (a *App) ToCreateGame(filePath string, connType d2clientconnectiontype.Clie
|
|||||||
// ToCharacterSelect forces the game to transition to the Character Select (load character) screen
|
// ToCharacterSelect forces the game to transition to the Character Select (load character) screen
|
||||||
func (a *App) ToCharacterSelect(connType d2clientconnectiontype.ClientConnectionType, connHost string) {
|
func (a *App) ToCharacterSelect(connType d2clientconnectiontype.ClientConnectionType, connHost string) {
|
||||||
characterSelect, err := d2gamescreen.CreateCharacterSelect(a, a.asset, a.renderer, a.inputManager,
|
characterSelect, err := d2gamescreen.CreateCharacterSelect(a, a.asset, a.renderer, a.inputManager,
|
||||||
a.audio, a.ui, connType, a.config.LogLevel, a.language, connHost)
|
a.audio, a.ui, connType, a.config.LogLevel, connHost)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("unable to create character select screen: %s", err)
|
fmt.Printf("unable to create character select screen: %s", err)
|
||||||
}
|
}
|
||||||
@ -979,5 +979,5 @@ func (a *App) ToCredits() {
|
|||||||
|
|
||||||
// ToCinematics forces the game to transition to the cinematics menu
|
// ToCinematics forces the game to transition to the cinematics menu
|
||||||
func (a *App) ToCinematics() {
|
func (a *App) ToCinematics() {
|
||||||
a.screen.SetNextScreen(d2gamescreen.CreateCinematics(a, a.asset, a.renderer, a.audio, a.config.LogLevel, a.language, a.ui))
|
a.screen.SetNextScreen(d2gamescreen.CreateCinematics(a, a.asset, a.renderer, a.audio, a.config.LogLevel, a.ui))
|
||||||
}
|
}
|
||||||
|
@ -50,11 +50,21 @@ func GetFontCharset(language string) string {
|
|||||||
return charset[language]
|
return charset[language]
|
||||||
}
|
}
|
||||||
|
|
||||||
// modificators for labels (used in string tables)
|
/* modifiers for labels (used in string tables)
|
||||||
|
modifier is something like that:
|
||||||
|
english table: polish table:
|
||||||
|
key | value key | value
|
||||||
|
#1 | v1 |
|
||||||
|
#4 | v2 #4 | v1
|
||||||
|
#5 | v3 #5 | v2
|
||||||
|
#8 | v4 #8 | v3
|
||||||
|
So, GetLabelModifier returns value of offset in locale languages table
|
||||||
|
*/
|
||||||
// some of values need to be set up. For now values with "checked" comment
|
// some of values need to be set up. For now values with "checked" comment
|
||||||
// was tested and works fine in main menu.
|
// was tested and works fine in main menu.
|
||||||
func getModifiers() map[string]int {
|
// GetLabelModifier returns modifier for language
|
||||||
return map[string]int{
|
func GetLabelModifier(language string) int {
|
||||||
|
modifiers := map[string]int{
|
||||||
"ENG": 0, // (English) // checked
|
"ENG": 0, // (English) // checked
|
||||||
"ESP": 0, // (Spanish)
|
"ESP": 0, // (Spanish)
|
||||||
"DEU": 0, // (German) // checked
|
"DEU": 0, // (German) // checked
|
||||||
@ -66,13 +76,8 @@ func getModifiers() map[string]int {
|
|||||||
"SIN": 0, //
|
"SIN": 0, //
|
||||||
"CHI": 0, // (Chinese)
|
"CHI": 0, // (Chinese)
|
||||||
"POL": 1, // (Polish) // checked
|
"POL": 1, // (Polish) // checked
|
||||||
"RUS": 0, // (Russian) // checked
|
"RUS": 0, // (Russian)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// GetLabelModifier returns modificator for language
|
return modifiers[language]
|
||||||
func GetLabelModifier(language string) int {
|
|
||||||
mod := getModifiers()
|
|
||||||
|
|
||||||
return mod[language]
|
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ type AssetManager struct {
|
|||||||
palettes d2interface.Cache
|
palettes d2interface.Cache
|
||||||
transforms d2interface.Cache
|
transforms d2interface.Cache
|
||||||
Records *d2records.RecordManager
|
Records *d2records.RecordManager
|
||||||
|
language string
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetLogLevel sets the log level for the asset manager, record manager, and file loader
|
// SetLogLevel sets the log level for the asset manager, record manager, and file loader
|
||||||
@ -124,6 +125,7 @@ func (am *AssetManager) LoadLanguage(languagePath string) string {
|
|||||||
language := d2resource.GetLanguageLiteral(languageCode)
|
language := d2resource.GetLanguageLiteral(languageCode)
|
||||||
am.Infof("Language: %s", language)
|
am.Infof("Language: %s", language)
|
||||||
|
|
||||||
|
am.language = language
|
||||||
return language
|
return language
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,6 +303,76 @@ func (am *AssetManager) TranslateString(input interface{}) string {
|
|||||||
return key
|
return key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *AssetManager) baseLabelNumbers(idx int) int {
|
||||||
|
baseLabelNumbers := []int{
|
||||||
|
// main menu labels
|
||||||
|
1612, // CANCEL
|
||||||
|
1613, // (c) 2000 Blizzard Entertainment
|
||||||
|
1614, // All Rights Reserved.
|
||||||
|
1620, // SINGLE PLAYER
|
||||||
|
1621, // BATTLE.NET
|
||||||
|
1623, // OTHER MULTIPLAYER
|
||||||
|
1625, // EXIT DIABLO II
|
||||||
|
1627, // CREDITS
|
||||||
|
1639, // CINEMATICS
|
||||||
|
|
||||||
|
// cinematics menu labels
|
||||||
|
1640, // View All Earned Cinematics
|
||||||
|
1659, // Epilogue
|
||||||
|
1660, // SELECT CINEMATICS
|
||||||
|
|
||||||
|
// multiplayer labels
|
||||||
|
1663, // OPEN BATTLE.NET
|
||||||
|
1666, // TCP/IP GAME
|
||||||
|
1667, // TCP/IP Options
|
||||||
|
1675, // HOST GAME
|
||||||
|
1676, // JOIN GAME
|
||||||
|
1678, // Enter Host IP Address to Join Game
|
||||||
|
1680, // Your IP Address is:
|
||||||
|
1689, // Tip: host game
|
||||||
|
1690, // Tip: join game
|
||||||
|
1691, // Cannot detect a valid TCP/IP address.
|
||||||
|
1694, // Character Name
|
||||||
|
1696, // Hardcore
|
||||||
|
1697, // Select Hero Class
|
||||||
|
|
||||||
|
1698, // amazon description
|
||||||
|
1704, // nec description
|
||||||
|
1709, // barb description
|
||||||
|
1710, // sorc description
|
||||||
|
1711, // pal description
|
||||||
|
/*in addition, as many elements as the value
|
||||||
|
of the highest modifier must be listed*/
|
||||||
|
1712,
|
||||||
|
|
||||||
|
/* here, should be labels used to battle.net multiplayer, but they are not used yet,
|
||||||
|
therefore I don't list them here.*/
|
||||||
|
|
||||||
|
// difficulty levels:
|
||||||
|
1800, // Hell
|
||||||
|
1864, // Nightmare
|
||||||
|
1865, // Normal
|
||||||
|
1867, // Select Difficulty
|
||||||
|
|
||||||
|
1869, // not used, for locales with +1 mod
|
||||||
|
1878, // delete char confirm
|
||||||
|
1881, // Open
|
||||||
|
1889, // char name is currently taken (not used)
|
||||||
|
1896, // YES
|
||||||
|
1925, // NO
|
||||||
|
|
||||||
|
1926, // not used, for locales with +1 mod
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseLabelNumbers[idx]
|
||||||
|
}
|
||||||
|
|
||||||
|
// TranslateLabel translates the label taking into account its shift in the table
|
||||||
|
func (a *AssetManager) TranslateLabel(label int) string {
|
||||||
|
return a.TranslateString(fmt.Sprintf("#%d", a.baseLabelNumbers(label+d2resource.GetLabelModifier(a.language))))
|
||||||
|
}
|
||||||
|
|
||||||
// LoadPaletteTransform loads a palette transform file
|
// LoadPaletteTransform loads a palette transform file
|
||||||
func (am *AssetManager) LoadPaletteTransform(path string) (*d2pl2.PL2, error) {
|
func (am *AssetManager) LoadPaletteTransform(path string) (*d2pl2.PL2, error) {
|
||||||
if pl2, found := am.transforms.Retrieve(path); found {
|
if pl2, found := am.transforms.Retrieve(path); found {
|
||||||
|
@ -29,7 +29,6 @@ func CreateCharacterSelect(
|
|||||||
ui *d2ui.UIManager,
|
ui *d2ui.UIManager,
|
||||||
connectionType d2clientconnectiontype.ClientConnectionType,
|
connectionType d2clientconnectiontype.ClientConnectionType,
|
||||||
l d2util.LogLevel,
|
l d2util.LogLevel,
|
||||||
lang string,
|
|
||||||
connectionHost string,
|
connectionHost string,
|
||||||
) (*CharacterSelect, error) {
|
) (*CharacterSelect, error) {
|
||||||
playerStateFactory, err := d2hero.NewHeroStateFactory(asset)
|
playerStateFactory, err := d2hero.NewHeroStateFactory(asset)
|
||||||
@ -54,7 +53,6 @@ func CreateCharacterSelect(
|
|||||||
navigator: navigator,
|
navigator: navigator,
|
||||||
uiManager: ui,
|
uiManager: ui,
|
||||||
HeroStateFactory: playerStateFactory,
|
HeroStateFactory: playerStateFactory,
|
||||||
language: lang,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
characterSelect.Logger = d2util.NewLogger()
|
characterSelect.Logger = d2util.NewLogger()
|
||||||
@ -102,7 +100,6 @@ type CharacterSelect struct {
|
|||||||
navigator d2interface.Navigator
|
navigator d2interface.Navigator
|
||||||
|
|
||||||
*d2util.Logger
|
*d2util.Logger
|
||||||
language string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -232,7 +229,7 @@ func (v *CharacterSelect) loadHeroTitle() {
|
|||||||
|
|
||||||
func (v *CharacterSelect) loadDeleteCharConfirm() {
|
func (v *CharacterSelect) loadDeleteCharConfirm() {
|
||||||
v.deleteCharConfirmLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits)
|
v.deleteCharConfirmLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits)
|
||||||
lines := d2util.SplitIntoLinesWithMaxWidthOneLine(translateLabel(delCharConfLabel, v.language, v.asset), 30)
|
lines := d2util.SplitIntoLinesWithMaxWidthOneLine(v.asset.TranslateLabel(delCharConfLabel), 30)
|
||||||
v.deleteCharConfirmLabel.SetText(lines)
|
v.deleteCharConfirmLabel.SetText(lines)
|
||||||
v.deleteCharConfirmLabel.Alignment = d2ui.HorizontalAlignCenter
|
v.deleteCharConfirmLabel.Alignment = d2ui.HorizontalAlignCenter
|
||||||
deleteConfirmX, deleteConfirmY := 400, 185
|
deleteConfirmX, deleteConfirmY := 400, 185
|
||||||
@ -315,12 +312,12 @@ func (v *CharacterSelect) createButtons(loading d2screen.LoadingState) {
|
|||||||
|
|
||||||
loading.Progress(twentyPercent)
|
loading.Progress(twentyPercent)
|
||||||
|
|
||||||
v.deleteCharCancelButton = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, translateLabel(noLabel, v.language, v.asset))
|
v.deleteCharCancelButton = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateLabel(noLabel))
|
||||||
v.deleteCharCancelButton.SetPosition(deleteCancelX, deleteCancelY)
|
v.deleteCharCancelButton.SetPosition(deleteCancelX, deleteCancelY)
|
||||||
v.deleteCharCancelButton.SetVisible(false)
|
v.deleteCharCancelButton.SetVisible(false)
|
||||||
v.deleteCharCancelButton.OnActivated(func() { v.onDeleteCharacterCancelClicked() })
|
v.deleteCharCancelButton.OnActivated(func() { v.onDeleteCharacterCancelClicked() })
|
||||||
|
|
||||||
v.deleteCharOkButton = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, translateLabel(yesLabel, v.language, v.asset))
|
v.deleteCharOkButton = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateLabel(yesLabel))
|
||||||
v.deleteCharOkButton.SetPosition(deleteOkX, deleteOkY)
|
v.deleteCharOkButton.SetPosition(deleteOkX, deleteOkY)
|
||||||
v.deleteCharOkButton.SetVisible(false)
|
v.deleteCharOkButton.SetVisible(false)
|
||||||
v.deleteCharOkButton.OnActivated(func() { v.onDeleteCharacterConfirmClicked() })
|
v.deleteCharOkButton.OnActivated(func() { v.onDeleteCharacterConfirmClicked() })
|
||||||
|
@ -30,7 +30,6 @@ func CreateCinematics(
|
|||||||
renderer d2interface.Renderer,
|
renderer d2interface.Renderer,
|
||||||
aup d2interface.AudioProvider,
|
aup d2interface.AudioProvider,
|
||||||
l d2util.LogLevel,
|
l d2util.LogLevel,
|
||||||
lang string,
|
|
||||||
ui *d2ui.UIManager) *Cinematics {
|
ui *d2ui.UIManager) *Cinematics {
|
||||||
cinematics := &Cinematics{
|
cinematics := &Cinematics{
|
||||||
asset: asset,
|
asset: asset,
|
||||||
@ -38,7 +37,6 @@ func CreateCinematics(
|
|||||||
navigator: navigator,
|
navigator: navigator,
|
||||||
uiManager: ui,
|
uiManager: ui,
|
||||||
audioProvider: aup,
|
audioProvider: aup,
|
||||||
language: lang,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cinematics.Logger = d2util.NewLogger()
|
cinematics.Logger = d2util.NewLogger()
|
||||||
@ -70,7 +68,6 @@ type Cinematics struct {
|
|||||||
audioProvider d2interface.AudioProvider
|
audioProvider d2interface.AudioProvider
|
||||||
|
|
||||||
*d2util.Logger
|
*d2util.Logger
|
||||||
language string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnLoad is called to load the resources for the credits screen
|
// OnLoad is called to load the resources for the credits screen
|
||||||
@ -99,14 +96,14 @@ func (v *Cinematics) OnLoad(_ d2screen.LoadingState) {
|
|||||||
|
|
||||||
v.cinematicsLabel = v.uiManager.NewLabel(d2resource.Font30, d2resource.PaletteStatic)
|
v.cinematicsLabel = v.uiManager.NewLabel(d2resource.Font30, d2resource.PaletteStatic)
|
||||||
v.cinematicsLabel.Alignment = d2ui.HorizontalAlignCenter
|
v.cinematicsLabel.Alignment = d2ui.HorizontalAlignCenter
|
||||||
v.cinematicsLabel.SetText(translateLabel(selectCinematicLabel, v.language, v.asset))
|
v.cinematicsLabel.SetText(v.asset.TranslateLabel(selectCinematicLabel))
|
||||||
v.cinematicsLabel.Color[0] = rgbaColor(lightBrown)
|
v.cinematicsLabel.Color[0] = rgbaColor(lightBrown)
|
||||||
v.cinematicsLabel.SetPosition(cinematicsLabelX, cinematicsLabelY)
|
v.cinematicsLabel.SetPosition(cinematicsLabelX, cinematicsLabelY)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Cinematics) createButtons() {
|
func (v *Cinematics) createButtons() {
|
||||||
v.cinematicsExitBtn = v.uiManager.NewButton(d2ui.ButtonTypeMedium,
|
v.cinematicsExitBtn = v.uiManager.NewButton(d2ui.ButtonTypeMedium,
|
||||||
v.asset.TranslateString(translateLabel(cancelLabel, v.language, v.asset)))
|
v.asset.TranslateString(v.asset.TranslateLabel(cancelLabel)))
|
||||||
v.cinematicsExitBtn.SetPosition(cinematicsExitBtnX, cinematicsExitBtnY)
|
v.cinematicsExitBtn.SetPosition(cinematicsExitBtnX, cinematicsExitBtnY)
|
||||||
v.cinematicsExitBtn.OnActivated(func() { v.onCinematicsExitBtnClicked() })
|
v.cinematicsExitBtn.OnActivated(func() { v.onCinematicsExitBtnClicked() })
|
||||||
|
|
||||||
|
@ -153,72 +153,6 @@ const (
|
|||||||
noLabel
|
noLabel
|
||||||
)
|
)
|
||||||
|
|
||||||
func baseLabelNumbers(idx int) int {
|
|
||||||
baseLabelNumbers := []int{
|
|
||||||
// main menu labels
|
|
||||||
1612, // CANCEL
|
|
||||||
1613, // (c) 2000 Blizzard Entertainment
|
|
||||||
1614, // All Rights Reserved.
|
|
||||||
1620, // SINGLE PLAYER
|
|
||||||
1621, // BATTLE.NET
|
|
||||||
1623, // OTHER MULTIPLAYER
|
|
||||||
1625, // EXIT DIABLO II
|
|
||||||
1627, // CREDITS
|
|
||||||
1639, // CINEMATICS
|
|
||||||
|
|
||||||
// cinematics menu labels
|
|
||||||
1640, // View All Earned Cinematics
|
|
||||||
1659, // Epilogue
|
|
||||||
1660, // SELECT CINEMATICS
|
|
||||||
|
|
||||||
// multiplayer labels
|
|
||||||
1663, // OPEN BATTLE.NET
|
|
||||||
1666, // TCP/IP GAME
|
|
||||||
1667, // TCP/IP Options
|
|
||||||
1675, // HOST GAME
|
|
||||||
1676, // JOIN GAME
|
|
||||||
1678, // Enter Host IP Address to Join Game
|
|
||||||
1680, // Your IP Address is:
|
|
||||||
1689, // Tip: host game
|
|
||||||
1690, // Tip: join game
|
|
||||||
1691, // Cannot detect a valid TCP/IP address.
|
|
||||||
1694, // Character Name
|
|
||||||
1696, // Hardcore
|
|
||||||
1697, // Select Hero Class
|
|
||||||
|
|
||||||
1698, // amazon description
|
|
||||||
1704, // nec description
|
|
||||||
1709, // barb description
|
|
||||||
1710, // sorc description
|
|
||||||
1711, // pal description
|
|
||||||
/*in addition, as many elements as the value
|
|
||||||
of the highest modifier must be listed*/
|
|
||||||
1712,
|
|
||||||
|
|
||||||
/* here, should be labels used to battle.net multiplayer, but they are not used yet,
|
|
||||||
therefore I don't list them here.*/
|
|
||||||
|
|
||||||
// difficulty levels:
|
|
||||||
1800, // Hell
|
|
||||||
1864, // Nightmare
|
|
||||||
1865, // Normal
|
|
||||||
1867, // Select Difficulty
|
|
||||||
|
|
||||||
1869, // not used, for locales with +1 mod
|
|
||||||
|
|
||||||
1878, // delete char confirm
|
|
||||||
1881, // Open
|
|
||||||
1889, // char name is currently taken (not used)
|
|
||||||
1896, // YES
|
|
||||||
1925, // NO
|
|
||||||
|
|
||||||
1926, // not used, for locales with +1 mod
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return baseLabelNumbers[idx]
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateMainMenu creates an instance of MainMenu
|
// CreateMainMenu creates an instance of MainMenu
|
||||||
func CreateMainMenu(
|
func CreateMainMenu(
|
||||||
navigator d2interface.Navigator,
|
navigator d2interface.Navigator,
|
||||||
@ -248,7 +182,6 @@ func CreateMainMenu(
|
|||||||
buildInfo: buildInfo,
|
buildInfo: buildInfo,
|
||||||
uiManager: ui,
|
uiManager: ui,
|
||||||
heroState: heroStateFactory,
|
heroState: heroStateFactory,
|
||||||
language: lng,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mainMenu.Logger = d2util.NewLogger()
|
mainMenu.Logger = d2util.NewLogger()
|
||||||
@ -312,8 +245,6 @@ type MainMenu struct {
|
|||||||
buildInfo BuildInfo
|
buildInfo BuildInfo
|
||||||
|
|
||||||
*d2util.Logger
|
*d2util.Logger
|
||||||
|
|
||||||
language string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnLoad is called to load the resources for the main menu
|
// OnLoad is called to load the resources for the main menu
|
||||||
@ -374,10 +305,6 @@ func (v *MainMenu) loadBackgroundSprites() {
|
|||||||
v.serverIPBackground.SetPosition(serverIPbackgroundX, serverIPbackgroundY)
|
v.serverIPBackground.SetPosition(serverIPbackgroundX, serverIPbackgroundY)
|
||||||
}
|
}
|
||||||
|
|
||||||
func translateLabel(label int, lng string, asset *d2asset.AssetManager) string {
|
|
||||||
return asset.TranslateString(fmt.Sprintf("#%d", baseLabelNumbers(label+d2resource.GetLabelModifier(lng))))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *MainMenu) createLabels(loading d2screen.LoadingState) {
|
func (v *MainMenu) createLabels(loading d2screen.LoadingState) {
|
||||||
v.versionLabel = v.uiManager.NewLabel(d2resource.FontFormal12, d2resource.PaletteStatic)
|
v.versionLabel = v.uiManager.NewLabel(d2resource.FontFormal12, d2resource.PaletteStatic)
|
||||||
v.versionLabel.Alignment = d2ui.HorizontalAlignRight
|
v.versionLabel.Alignment = d2ui.HorizontalAlignRight
|
||||||
@ -393,14 +320,14 @@ func (v *MainMenu) createLabels(loading d2screen.LoadingState) {
|
|||||||
|
|
||||||
v.copyrightLabel = v.uiManager.NewLabel(d2resource.FontFormal12, d2resource.PaletteStatic)
|
v.copyrightLabel = v.uiManager.NewLabel(d2resource.FontFormal12, d2resource.PaletteStatic)
|
||||||
v.copyrightLabel.Alignment = d2ui.HorizontalAlignCenter
|
v.copyrightLabel.Alignment = d2ui.HorizontalAlignCenter
|
||||||
v.copyrightLabel.SetText(translateLabel(copyrightLabel, v.language, v.asset))
|
v.copyrightLabel.SetText(v.asset.TranslateLabel(copyrightLabel))
|
||||||
v.copyrightLabel.Color[0] = rgbaColor(lightBrown)
|
v.copyrightLabel.Color[0] = rgbaColor(lightBrown)
|
||||||
v.copyrightLabel.SetPosition(copyrightX, copyrightY)
|
v.copyrightLabel.SetPosition(copyrightX, copyrightY)
|
||||||
loading.Progress(thirtyPercent)
|
loading.Progress(thirtyPercent)
|
||||||
|
|
||||||
v.copyrightLabel2 = v.uiManager.NewLabel(d2resource.FontFormal12, d2resource.PaletteStatic)
|
v.copyrightLabel2 = v.uiManager.NewLabel(d2resource.FontFormal12, d2resource.PaletteStatic)
|
||||||
v.copyrightLabel2.Alignment = d2ui.HorizontalAlignCenter
|
v.copyrightLabel2.Alignment = d2ui.HorizontalAlignCenter
|
||||||
v.copyrightLabel2.SetText(translateLabel(allRightsReservedLabel, v.language, v.asset))
|
v.copyrightLabel2.SetText(v.asset.TranslateLabel(allRightsReservedLabel))
|
||||||
v.copyrightLabel2.Color[0] = rgbaColor(lightBrown)
|
v.copyrightLabel2.Color[0] = rgbaColor(lightBrown)
|
||||||
v.copyrightLabel2.SetPosition(copyright2X, copyright2Y)
|
v.copyrightLabel2.SetPosition(copyright2X, copyright2Y)
|
||||||
|
|
||||||
@ -414,17 +341,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(v.asset.TranslateLabel(tcpIPOptionsLabel))
|
||||||
|
|
||||||
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(v.asset.TranslateLabel(tcpIPEnterHostIPLabel), 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(v.asset.TranslateLabel(tcpIPYourIPLabel) + "\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)
|
||||||
|
|
||||||
@ -473,20 +400,20 @@ func (v *MainMenu) createLogos(loading d2screen.LoadingState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *MainMenu) createButtons(loading d2screen.LoadingState) {
|
func (v *MainMenu) createButtons(loading d2screen.LoadingState) {
|
||||||
v.exitDiabloButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, translateLabel(exitLabel, v.language, v.asset))
|
v.exitDiabloButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, v.asset.TranslateLabel(exitLabel))
|
||||||
v.exitDiabloButton.SetPosition(exitDiabloBtnX, exitDiabloBtnY)
|
v.exitDiabloButton.SetPosition(exitDiabloBtnX, exitDiabloBtnY)
|
||||||
v.exitDiabloButton.OnActivated(func() { v.onExitButtonClicked() })
|
v.exitDiabloButton.OnActivated(func() { v.onExitButtonClicked() })
|
||||||
|
|
||||||
v.creditsButton = v.uiManager.NewButton(d2ui.ButtonTypeShort, translateLabel(creditsLabel, v.language, v.asset))
|
v.creditsButton = v.uiManager.NewButton(d2ui.ButtonTypeShort, v.asset.TranslateLabel(creditsLabel))
|
||||||
v.creditsButton.SetPosition(creditBtnX, creditBtnY)
|
v.creditsButton.SetPosition(creditBtnX, creditBtnY)
|
||||||
v.creditsButton.OnActivated(func() { v.onCreditsButtonClicked() })
|
v.creditsButton.OnActivated(func() { v.onCreditsButtonClicked() })
|
||||||
|
|
||||||
v.cinematicsButton = v.uiManager.NewButton(d2ui.ButtonTypeShort, translateLabel(cinematicsLabel, v.language, v.asset))
|
v.cinematicsButton = v.uiManager.NewButton(d2ui.ButtonTypeShort, v.asset.TranslateLabel(cinematicsLabel))
|
||||||
v.cinematicsButton.SetPosition(cineBtnX, cineBtnY)
|
v.cinematicsButton.SetPosition(cineBtnX, cineBtnY)
|
||||||
v.cinematicsButton.OnActivated(func() { v.onCinematicsButtonClicked() })
|
v.cinematicsButton.OnActivated(func() { v.onCinematicsButtonClicked() })
|
||||||
loading.Progress(seventyPercent)
|
loading.Progress(seventyPercent)
|
||||||
|
|
||||||
v.singlePlayerButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, translateLabel(singlePlayerLabel, v.language, v.asset))
|
v.singlePlayerButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, v.asset.TranslateLabel(singlePlayerLabel))
|
||||||
v.singlePlayerButton.SetPosition(singlePlayerBtnX, singlePlayerBtnY)
|
v.singlePlayerButton.SetPosition(singlePlayerBtnX, singlePlayerBtnY)
|
||||||
v.singlePlayerButton.OnActivated(func() { v.onSinglePlayerClicked() })
|
v.singlePlayerButton.OnActivated(func() { v.onSinglePlayerClicked() })
|
||||||
|
|
||||||
@ -499,11 +426,11 @@ func (v *MainMenu) createButtons(loading d2screen.LoadingState) {
|
|||||||
v.mapTestButton.OnActivated(func() { v.onMapTestClicked() })
|
v.mapTestButton.OnActivated(func() { v.onMapTestClicked() })
|
||||||
|
|
||||||
v.btnTCPIPCancel = v.uiManager.NewButton(d2ui.ButtonTypeMedium,
|
v.btnTCPIPCancel = v.uiManager.NewButton(d2ui.ButtonTypeMedium,
|
||||||
translateLabel(cancelLabel, v.language, v.asset))
|
v.asset.TranslateLabel(cancelLabel))
|
||||||
v.btnTCPIPCancel.SetPosition(tcpBtnX, tcpBtnY)
|
v.btnTCPIPCancel.SetPosition(tcpBtnX, tcpBtnY)
|
||||||
v.btnTCPIPCancel.OnActivated(func() { v.onTCPIPCancelClicked() })
|
v.btnTCPIPCancel.OnActivated(func() { v.onTCPIPCancelClicked() })
|
||||||
|
|
||||||
v.btnServerIPCancel = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, translateLabel(cancelLabel, v.language, v.asset))
|
v.btnServerIPCancel = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateLabel(cancelLabel))
|
||||||
v.btnServerIPCancel.SetPosition(srvCancelBtnX, srvCancelBtnY)
|
v.btnServerIPCancel.SetPosition(srvCancelBtnX, srvCancelBtnY)
|
||||||
v.btnServerIPCancel.OnActivated(func() { v.onBtnTCPIPCancelClicked() })
|
v.btnServerIPCancel.OnActivated(func() { v.onBtnTCPIPCancelClicked() })
|
||||||
|
|
||||||
@ -517,24 +444,24 @@ func (v *MainMenu) createButtons(loading d2screen.LoadingState) {
|
|||||||
|
|
||||||
func (v *MainMenu) createMultiplayerMenuButtons() {
|
func (v *MainMenu) createMultiplayerMenuButtons() {
|
||||||
v.multiplayerButton = v.uiManager.NewButton(d2ui.ButtonTypeWide,
|
v.multiplayerButton = v.uiManager.NewButton(d2ui.ButtonTypeWide,
|
||||||
translateLabel(otherMultiplayerLabel, v.language, v.asset))
|
v.asset.TranslateLabel(otherMultiplayerLabel))
|
||||||
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, v.asset.TranslateLabel(tcpIPGameLabel))
|
||||||
v.networkTCPIPButton.SetPosition(tcpNetBtnX, tcpNetBtnY)
|
v.networkTCPIPButton.SetPosition(tcpNetBtnX, tcpNetBtnY)
|
||||||
v.networkTCPIPButton.OnActivated(func() { v.onNetworkTCPIPClicked() })
|
v.networkTCPIPButton.OnActivated(func() { v.onNetworkTCPIPClicked() })
|
||||||
|
|
||||||
v.networkCancelButton = v.uiManager.NewButton(d2ui.ButtonTypeWide,
|
v.networkCancelButton = v.uiManager.NewButton(d2ui.ButtonTypeWide,
|
||||||
translateLabel(cancelLabel, v.language, v.asset))
|
v.asset.TranslateLabel(cancelLabel))
|
||||||
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, v.asset.TranslateLabel(tcpIPHostGameLabel))
|
||||||
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, v.asset.TranslateLabel(tcpIPJoinGameLabel))
|
||||||
v.btnTCPIPJoinGame.SetPosition(tcpJoinBtnX, tcpJoinBtnY)
|
v.btnTCPIPJoinGame.SetPosition(tcpJoinBtnX, tcpJoinBtnY)
|
||||||
v.btnTCPIPJoinGame.OnActivated(func() { v.onTCPIPJoinGameClicked() })
|
v.btnTCPIPJoinGame.OnActivated(func() { v.onTCPIPJoinGameClicked() })
|
||||||
}
|
}
|
||||||
@ -790,5 +717,5 @@ func (v *MainMenu) getLocalIP() string {
|
|||||||
|
|
||||||
v.Warning("no IPv4 Address could be found")
|
v.Warning("no IPv4 Address could be found")
|
||||||
|
|
||||||
return translateLabel(ipNotFoundLabel, v.language, v.asset)
|
return v.asset.TranslateLabel(ipNotFoundLabel)
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,6 @@ func CreateSelectHeroClass(
|
|||||||
ui *d2ui.UIManager,
|
ui *d2ui.UIManager,
|
||||||
connectionType d2clientconnectiontype.ClientConnectionType,
|
connectionType d2clientconnectiontype.ClientConnectionType,
|
||||||
l d2util.LogLevel,
|
l d2util.LogLevel,
|
||||||
lang string,
|
|
||||||
connectionHost string,
|
connectionHost string,
|
||||||
) (*SelectHeroClass, error) {
|
) (*SelectHeroClass, error) {
|
||||||
playerStateFactory, err := d2hero.NewHeroStateFactory(asset)
|
playerStateFactory, err := d2hero.NewHeroStateFactory(asset)
|
||||||
@ -304,7 +303,6 @@ func CreateSelectHeroClass(
|
|||||||
uiManager: ui,
|
uiManager: ui,
|
||||||
HeroStateFactory: playerStateFactory,
|
HeroStateFactory: playerStateFactory,
|
||||||
InventoryItemFactory: inventoryItemFactory,
|
InventoryItemFactory: inventoryItemFactory,
|
||||||
language: lang,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selectHeroClass.Logger = d2util.NewLogger()
|
selectHeroClass.Logger = d2util.NewLogger()
|
||||||
@ -345,7 +343,6 @@ type SelectHeroClass struct {
|
|||||||
navigator d2interface.Navigator
|
navigator d2interface.Navigator
|
||||||
|
|
||||||
*d2util.Logger
|
*d2util.Logger
|
||||||
language string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnLoad loads the resources for the Select Hero Class screen
|
// OnLoad loads the resources for the Select Hero Class screen
|
||||||
@ -419,7 +416,7 @@ func (v *SelectHeroClass) createLabels() {
|
|||||||
halfFontWidth := fontWidth / half
|
halfFontWidth := fontWidth / half
|
||||||
|
|
||||||
v.headingLabel.SetPosition(headingX-halfFontWidth, headingY)
|
v.headingLabel.SetPosition(headingX-halfFontWidth, headingY)
|
||||||
v.headingLabel.SetText(translateLabel(selectHeroClassLabel, v.language, v.asset))
|
v.headingLabel.SetText(v.asset.TranslateLabel(selectHeroClassLabel))
|
||||||
v.headingLabel.Alignment = d2ui.HorizontalAlignCenter
|
v.headingLabel.Alignment = d2ui.HorizontalAlignCenter
|
||||||
|
|
||||||
v.heroClassLabel = v.uiManager.NewLabel(d2resource.Font30, d2resource.PaletteUnits)
|
v.heroClassLabel = v.uiManager.NewLabel(d2resource.Font30, d2resource.PaletteUnits)
|
||||||
@ -440,7 +437,7 @@ func (v *SelectHeroClass) createLabels() {
|
|||||||
|
|
||||||
v.heroNameLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits)
|
v.heroNameLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits)
|
||||||
v.heroNameLabel.Alignment = d2ui.HorizontalAlignLeft
|
v.heroNameLabel.Alignment = d2ui.HorizontalAlignLeft
|
||||||
v.heroNameLabel.SetText(d2ui.ColorTokenize(translateLabel(charNameLabel, v.language, v.asset), d2ui.ColorTokenGold))
|
v.heroNameLabel.SetText(d2ui.ColorTokenize(v.asset.TranslateLabel(charNameLabel), d2ui.ColorTokenGold))
|
||||||
v.heroNameLabel.SetPosition(heroNameLabelX, heroNameLabelY)
|
v.heroNameLabel.SetPosition(heroNameLabelX, heroNameLabelY)
|
||||||
|
|
||||||
v.expansionCharLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits)
|
v.expansionCharLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits)
|
||||||
@ -451,7 +448,7 @@ func (v *SelectHeroClass) createLabels() {
|
|||||||
|
|
||||||
v.hardcoreCharLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits)
|
v.hardcoreCharLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits)
|
||||||
v.hardcoreCharLabel.Alignment = d2ui.HorizontalAlignLeft
|
v.hardcoreCharLabel.Alignment = d2ui.HorizontalAlignLeft
|
||||||
v.hardcoreCharLabel.SetText(d2ui.ColorTokenize(translateLabel(hardCoreLabel, v.language, v.asset), d2ui.ColorTokenGold))
|
v.hardcoreCharLabel.SetText(d2ui.ColorTokenize(v.asset.TranslateLabel(hardCoreLabel), d2ui.ColorTokenGold))
|
||||||
v.hardcoreCharLabel.SetPosition(hardcoreLabelX, hardcoreLabelY)
|
v.hardcoreCharLabel.SetPosition(hardcoreLabelX, hardcoreLabelY)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -723,7 +720,7 @@ func (v *SelectHeroClass) setDescLabels(descKey int, key 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 = v.asset.TranslateLabel(descKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
parts := d2util.SplitIntoLinesWithMaxWidth(heroDesc, heroDescCharWidth)
|
parts := d2util.SplitIntoLinesWithMaxWidth(heroDesc, heroDescCharWidth)
|
||||||
|
Loading…
Reference in New Issue
Block a user