From 20f2649b653af2f7e3eb31408452712bde5db2fd Mon Sep 17 00:00:00 2001 From: "M. Sz" Date: Thu, 28 Jan 2021 11:20:59 +0100 Subject: [PATCH] asset manager: merged TranslateLabel to TranslateString --- d2common/d2enum/numeric_labels.go | 2 +- d2core/d2asset/asset_manager.go | 34 ++++++++++---------- d2core/d2ui/button.go | 4 +-- d2game/d2gamescreen/character_select.go | 10 +++--- d2game/d2gamescreen/cinematics.go | 4 +-- d2game/d2gamescreen/credits.go | 2 +- d2game/d2gamescreen/main_menu.go | 40 ++++++++++++------------ d2game/d2gamescreen/select_hero_class.go | 12 +++---- 8 files changed, 54 insertions(+), 54 deletions(-) diff --git a/d2common/d2enum/numeric_labels.go b/d2common/d2enum/numeric_labels.go index eb2253b6..8d8bd62c 100644 --- a/d2common/d2enum/numeric_labels.go +++ b/d2common/d2enum/numeric_labels.go @@ -1,6 +1,6 @@ package d2enum -// there are labels for "numeric labels (see AssetManager.TranslateLabel) +// there are labels for "numeric labels (see AssetManager.TranslateString) const ( RepairAll = iota _ diff --git a/d2core/d2asset/asset_manager.go b/d2core/d2asset/asset_manager.go index d6f0b3dd..99678238 100644 --- a/d2core/d2asset/asset_manager.go +++ b/d2core/d2asset/asset_manager.go @@ -64,17 +64,18 @@ const ( type AssetManager struct { *d2util.Logger *d2loader.Loader - tables []d2tbl.TextDictionary - dt1s d2interface.Cache - ds1s d2interface.Cache - cofs d2interface.Cache - dccs d2interface.Cache - animations d2interface.Cache - fonts d2interface.Cache - palettes d2interface.Cache - transforms d2interface.Cache - Records *d2records.RecordManager - language string + tables []d2tbl.TextDictionary + dt1s d2interface.Cache + ds1s d2interface.Cache + cofs d2interface.Cache + dccs d2interface.Cache + animations d2interface.Cache + fonts d2interface.Cache + palettes d2interface.Cache + transforms d2interface.Cache + Records *d2records.RecordManager + language string + languageModifier int } // SetLogLevel sets the log level for the asset manager, record manager, and file loader @@ -141,6 +142,7 @@ func (am *AssetManager) LoadLanguage(languagePath string) string { am.Infof("Language: %s", language) am.language = language + am.languageModifier = d2resource.GetLabelModifier(language) return language } @@ -287,7 +289,8 @@ func (am *AssetManager) LoadStringTable(tablePath string) (d2tbl.TextDictionary, } // TranslateString returns the translation of the given string. The string is retrieved from -// the loaded string tables. +// the loaded string tables. If input value is int (e.g. from d2enum/numeric_labels.go) +// output string is translation for # + input func (am *AssetManager) TranslateString(input interface{}) string { var key string @@ -296,6 +299,8 @@ func (am *AssetManager) TranslateString(input interface{}) string { key = s case fmt.Stringer: key = s.String() + case int: + key = fmt.Sprintf("#%d", d2enum.BaseLabelNumbers(s+am.languageModifier)) } for idx := range am.tables { @@ -309,11 +314,6 @@ func (am *AssetManager) TranslateString(input interface{}) string { return key } -// TranslateLabel translates the label taking into account its shift in the table -func (am *AssetManager) TranslateLabel(label int) string { - return am.TranslateString(fmt.Sprintf("#%d", d2enum.BaseLabelNumbers(label+d2resource.GetLabelModifier(am.language)))) -} - // LoadPaletteTransform loads a palette transform file func (am *AssetManager) LoadPaletteTransform(path string) (*d2pl2.PL2, error) { if pl2, found := am.transforms.Retrieve(path); found { diff --git a/d2core/d2ui/button.go b/d2core/d2ui/button.go index f3614941..f02e635d 100644 --- a/d2core/d2ui/button.go +++ b/d2core/d2ui/button.go @@ -923,7 +923,7 @@ func (v *Button) createTooltip() { t.SetText(v.manager.asset.TranslateString("strClose")) case buttonTooltipOk: t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom) - t.SetText(v.manager.asset.TranslateLabel(d2enum.OKLabel)) + t.SetText(v.manager.asset.TranslateString(d2enum.OKLabel)) case buttonTooltipBuy: t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom) t.SetText(v.manager.asset.TranslateString("NPCPurchaseItems")) @@ -935,7 +935,7 @@ func (v *Button) createTooltip() { t.SetText(v.manager.asset.TranslateString("NPCRepairItems")) case buttonTooltipRepairAll: t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom) - t.SetText(v.manager.asset.TranslateLabel(d2enum.RepairAll)) + t.SetText(v.manager.asset.TranslateString(d2enum.RepairAll)) case buttonTooltipLeftArrow: t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom) t.SetText(v.manager.asset.TranslateString("KeyLeft")) diff --git a/d2game/d2gamescreen/character_select.go b/d2game/d2gamescreen/character_select.go index feecc61a..0ea37a7a 100644 --- a/d2game/d2gamescreen/character_select.go +++ b/d2game/d2gamescreen/character_select.go @@ -229,7 +229,7 @@ func (v *CharacterSelect) loadHeroTitle() { func (v *CharacterSelect) loadDeleteCharConfirm() { v.deleteCharConfirmLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits) - lines := strings.Join(d2util.SplitIntoLinesWithMaxWidth(v.asset.TranslateLabel(d2enum.DelCharConfLabel), 29), "\n") + lines := strings.Join(d2util.SplitIntoLinesWithMaxWidth(v.asset.TranslateString(d2enum.DelCharConfLabel), 29), "\n") v.deleteCharConfirmLabel.SetText(lines) v.deleteCharConfirmLabel.Alignment = d2ui.HorizontalAlignCenter deleteConfirmX, deleteConfirmY := 400, 185 @@ -282,23 +282,23 @@ func (v *CharacterSelect) createButtons(loading d2screen.LoadingState) { v.deleteCharButton.OnActivated(func() { v.onDeleteCharButtonClicked() }) v.deleteCharButton.SetPosition(deleteCharBtnX, deleteCharBtnY) - v.exitButton = v.uiManager.NewButton(d2ui.ButtonTypeMedium, v.asset.TranslateLabel(d2enum.ExitLabel)) + v.exitButton = v.uiManager.NewButton(d2ui.ButtonTypeMedium, v.asset.TranslateString(d2enum.ExitLabel)) v.exitButton.SetPosition(exitBtnX, exitBtnY) v.exitButton.OnActivated(func() { v.onExitButtonClicked() }) loading.Progress(twentyPercent) - v.deleteCharCancelButton = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateLabel(d2enum.NoLabel)) + v.deleteCharCancelButton = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateString(d2enum.NoLabel)) v.deleteCharCancelButton.SetPosition(deleteCancelX, deleteCancelY) v.deleteCharCancelButton.SetVisible(false) v.deleteCharCancelButton.OnActivated(func() { v.onDeleteCharacterCancelClicked() }) - v.deleteCharOkButton = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateLabel(d2enum.YesLabel)) + v.deleteCharOkButton = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateString(d2enum.YesLabel)) v.deleteCharOkButton.SetPosition(deleteOkX, deleteOkY) v.deleteCharOkButton.SetVisible(false) v.deleteCharOkButton.OnActivated(func() { v.onDeleteCharacterConfirmClicked() }) - v.okButton = v.uiManager.NewButton(d2ui.ButtonTypeMedium, v.asset.TranslateLabel(d2enum.OKLabel)) + v.okButton = v.uiManager.NewButton(d2ui.ButtonTypeMedium, v.asset.TranslateString(d2enum.OKLabel)) v.okButton.SetPosition(okBtnX, okBtnY) v.okButton.OnActivated(func() { v.onOkButtonClicked() }) } diff --git a/d2game/d2gamescreen/cinematics.go b/d2game/d2gamescreen/cinematics.go index de3c95e6..e6fe6fd8 100644 --- a/d2game/d2gamescreen/cinematics.go +++ b/d2game/d2gamescreen/cinematics.go @@ -97,14 +97,14 @@ func (v *Cinematics) OnLoad(_ d2screen.LoadingState) { v.cinematicsLabel = v.uiManager.NewLabel(d2resource.Font30, d2resource.PaletteStatic) v.cinematicsLabel.Alignment = d2ui.HorizontalAlignCenter - v.cinematicsLabel.SetText(v.asset.TranslateLabel(d2enum.SelectCinematicLabel)) + v.cinematicsLabel.SetText(v.asset.TranslateString(d2enum.SelectCinematicLabel)) v.cinematicsLabel.Color[0] = d2util.Color(lightBrown) v.cinematicsLabel.SetPosition(cinematicsLabelX, cinematicsLabelY) } func (v *Cinematics) createButtons() { v.cinematicsExitBtn = v.uiManager.NewButton(d2ui.ButtonTypeMedium, - v.asset.TranslateString(v.asset.TranslateLabel(d2enum.CancelLabel))) + v.asset.TranslateString(v.asset.TranslateString(d2enum.CancelLabel))) v.cinematicsExitBtn.SetPosition(cinematicsExitBtnX, cinematicsExitBtnY) v.cinematicsExitBtn.OnActivated(func() { v.onCinematicsExitBtnClicked() }) diff --git a/d2game/d2gamescreen/credits.go b/d2game/d2gamescreen/credits.go index eae3714f..d94b4720 100644 --- a/d2game/d2gamescreen/credits.go +++ b/d2game/d2gamescreen/credits.go @@ -106,7 +106,7 @@ func (v *Credits) OnLoad(loading d2screen.LoadingState) { v.creditsBackground.SetPosition(creditsX, creditsY) loading.Progress(twentyPercent) - v.exitButton = v.uiManager.NewButton(d2ui.ButtonTypeMedium, v.asset.TranslateLabel(d2enum.ExitLabel)) + v.exitButton = v.uiManager.NewButton(d2ui.ButtonTypeMedium, v.asset.TranslateString(d2enum.ExitLabel)) v.exitButton.SetPosition(charSelExitBtnX, charSelExitBtnY) v.exitButton.OnActivated(func() { v.onExitButtonClicked() }) loading.Progress(fourtyPercent) diff --git a/d2game/d2gamescreen/main_menu.go b/d2game/d2gamescreen/main_menu.go index 388275b9..238d073d 100644 --- a/d2game/d2gamescreen/main_menu.go +++ b/d2game/d2gamescreen/main_menu.go @@ -255,14 +255,14 @@ func (v *MainMenu) createMainMenuLabels(loading d2screen.LoadingState) { v.copyrightLabel = v.uiManager.NewLabel(d2resource.FontFormal12, d2resource.PaletteStatic) v.copyrightLabel.Alignment = d2ui.HorizontalAlignCenter - v.copyrightLabel.SetText(v.asset.TranslateLabel(d2enum.CopyrightLabel)) + v.copyrightLabel.SetText(v.asset.TranslateString(d2enum.CopyrightLabel)) v.copyrightLabel.Color[0] = d2util.Color(lightBrown) v.copyrightLabel.SetPosition(copyrightX, copyrightY) loading.Progress(thirtyPercent) v.copyrightLabel2 = v.uiManager.NewLabel(d2resource.FontFormal12, d2resource.PaletteStatic) v.copyrightLabel2.Alignment = d2ui.HorizontalAlignCenter - v.copyrightLabel2.SetText(v.asset.TranslateLabel(d2enum.AllRightsReservedLabel)) + v.copyrightLabel2.SetText(v.asset.TranslateString(d2enum.AllRightsReservedLabel)) v.copyrightLabel2.Color[0] = d2util.Color(lightBrown) v.copyrightLabel2.SetPosition(copyright2X, copyright2Y) @@ -284,24 +284,24 @@ func (v *MainMenu) createMultiplayerLabels() { v.tcpIPOptionsLabel = v.uiManager.NewLabel(d2resource.Font42, d2resource.PaletteUnits) v.tcpIPOptionsLabel.SetPosition(tcpOptionsX, tcpOptionsY) v.tcpIPOptionsLabel.Alignment = d2ui.HorizontalAlignCenter - v.tcpIPOptionsLabel.SetText(v.asset.TranslateLabel(d2enum.TCPIPOptionsLabel)) + v.tcpIPOptionsLabel.SetText(v.asset.TranslateString(d2enum.TCPIPOptionsLabel)) v.tcpJoinGameLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits) v.tcpJoinGameLabel.Alignment = d2ui.HorizontalAlignCenter - v.tcpJoinGameLabel.SetText(strings.Join(d2util.SplitIntoLinesWithMaxWidth(v.asset.TranslateLabel(d2enum.TCPIPEnterHostIPLabel), 27), "\n")) + v.tcpJoinGameLabel.SetText(strings.Join(d2util.SplitIntoLinesWithMaxWidth(v.asset.TranslateString(d2enum.TCPIPEnterHostIPLabel), 27), "\n")) v.tcpJoinGameLabel.Color[0] = d2util.Color(gold) v.tcpJoinGameLabel.SetPosition(joinGameX, joinGameY) v.machineIP = v.uiManager.NewLabel(d2resource.Font24, d2resource.PaletteUnits) v.machineIP.Alignment = d2ui.HorizontalAlignCenter - v.machineIP.SetText(v.asset.TranslateLabel(d2enum.TCPIPYourIPLabel) + "\n" + v.getLocalIP()) + v.machineIP.SetText(v.asset.TranslateString(d2enum.TCPIPYourIPLabel) + "\n" + v.getLocalIP()) v.machineIP.Color[0] = d2util.Color(lightYellow) v.machineIP.SetPosition(machineIPX, machineIPY) v.hostTipLabel = v.uiManager.NewLabel(d2resource.FontFormal12, d2resource.PaletteUnits) v.hostTipLabel.Alignment = d2ui.HorizontalAlignCenter v.hostTipLabel.SetText(d2ui.ColorTokenize(strings.Join(d2util.SplitIntoLinesWithMaxWidth( - v.asset.TranslateLabel(d2enum.TipHostLabel), 36), + v.asset.TranslateString(d2enum.TipHostLabel), 36), "\n"), d2ui.ColorTokenGold)) v.hostTipLabel.SetPosition(tipX, tipY) v.hostTipLabel.SetVisible(false) @@ -309,7 +309,7 @@ func (v *MainMenu) createMultiplayerLabels() { v.joinTipLabel = v.uiManager.NewLabel(d2resource.FontFormal12, d2resource.PaletteUnits) v.joinTipLabel.Alignment = d2ui.HorizontalAlignCenter v.joinTipLabel.SetText(d2ui.ColorTokenize(strings.Join(d2util.SplitIntoLinesWithMaxWidth( - v.asset.TranslateLabel(d2enum.TipJoinLabel), 36), + v.asset.TranslateString(d2enum.TipJoinLabel), 36), "\n"), d2ui.ColorTokenGold)) v.joinTipLabel.SetPosition(tipX, tipY) v.joinTipLabel.SetVisible(false) @@ -353,20 +353,20 @@ func (v *MainMenu) createLogos(loading d2screen.LoadingState) { } func (v *MainMenu) createMainMenuButtons(loading d2screen.LoadingState) { - v.exitDiabloButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, v.asset.TranslateLabel(d2enum.ExitGameLabel)) + v.exitDiabloButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, v.asset.TranslateString(d2enum.ExitGameLabel)) v.exitDiabloButton.SetPosition(exitDiabloBtnX, exitDiabloBtnY) v.exitDiabloButton.OnActivated(func() { v.onExitButtonClicked() }) - v.creditsButton = v.uiManager.NewButton(d2ui.ButtonTypeShort, v.asset.TranslateLabel(d2enum.CreditsLabel)) + v.creditsButton = v.uiManager.NewButton(d2ui.ButtonTypeShort, v.asset.TranslateString(d2enum.CreditsLabel)) v.creditsButton.SetPosition(creditBtnX, creditBtnY) v.creditsButton.OnActivated(func() { v.onCreditsButtonClicked() }) - v.cinematicsButton = v.uiManager.NewButton(d2ui.ButtonTypeShort, v.asset.TranslateLabel(d2enum.CinematicsLabel)) + v.cinematicsButton = v.uiManager.NewButton(d2ui.ButtonTypeShort, v.asset.TranslateString(d2enum.CinematicsLabel)) v.cinematicsButton.SetPosition(cineBtnX, cineBtnY) v.cinematicsButton.OnActivated(func() { v.onCinematicsButtonClicked() }) loading.Progress(seventyPercent) - v.singlePlayerButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, v.asset.TranslateLabel(d2enum.SinglePlayerLabel)) + v.singlePlayerButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, v.asset.TranslateString(d2enum.SinglePlayerLabel)) v.singlePlayerButton.SetPosition(singlePlayerBtnX, singlePlayerBtnY) v.singlePlayerButton.OnActivated(func() { v.onSinglePlayerClicked() }) @@ -379,15 +379,15 @@ func (v *MainMenu) createMainMenuButtons(loading d2screen.LoadingState) { v.mapTestButton.OnActivated(func() { v.onMapTestClicked() }) v.btnTCPIPCancel = v.uiManager.NewButton(d2ui.ButtonTypeMedium, - v.asset.TranslateLabel(d2enum.CancelLabel)) + v.asset.TranslateString(d2enum.CancelLabel)) v.btnTCPIPCancel.SetPosition(tcpBtnX, tcpBtnY) v.btnTCPIPCancel.OnActivated(func() { v.onTCPIPCancelClicked() }) - v.btnServerIPCancel = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateLabel(d2enum.CancelLabel)) + v.btnServerIPCancel = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateString(d2enum.CancelLabel)) v.btnServerIPCancel.SetPosition(srvCancelBtnX, srvCancelBtnY) v.btnServerIPCancel.OnActivated(func() { v.onBtnTCPIPCancelClicked() }) - v.btnServerIPOk = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateLabel(d2enum.OKLabel)) + v.btnServerIPOk = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateString(d2enum.OKLabel)) v.btnServerIPOk.SetPosition(srvOkBtnX, srvOkBtnY) v.btnServerIPOk.OnActivated(func() { v.onBtnTCPIPOkClicked() }) loading.Progress(eightyPercent) @@ -395,26 +395,26 @@ func (v *MainMenu) createMainMenuButtons(loading d2screen.LoadingState) { func (v *MainMenu) createMultiplayerMenuButtons() { v.multiplayerButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, - v.asset.TranslateLabel(d2enum.OtherMultiplayerLabel)) + v.asset.TranslateString(d2enum.OtherMultiplayerLabel)) v.multiplayerButton.SetPosition(multiplayerBtnX, multiplayerBtnY) v.multiplayerButton.OnActivated(func() { v.onMultiplayerClicked() }) - v.networkTCPIPButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, v.asset.TranslateLabel(d2enum.TCPIPGameLabel)) + v.networkTCPIPButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, v.asset.TranslateString(d2enum.TCPIPGameLabel)) v.networkTCPIPButton.SetPosition(tcpNetBtnX, tcpNetBtnY) v.networkTCPIPButton.OnActivated(func() { v.onNetworkTCPIPClicked() }) v.networkCancelButton = v.uiManager.NewButton(d2ui.ButtonTypeWide, - v.asset.TranslateLabel(d2enum.CancelLabel)) + v.asset.TranslateString(d2enum.CancelLabel)) v.networkCancelButton.SetPosition(networkCancelBtnX, networkCancelBtnY) v.networkCancelButton.OnActivated(func() { v.onNetworkCancelClicked() }) - v.btnTCPIPHostGame = v.uiManager.NewButton(d2ui.ButtonTypeWide, v.asset.TranslateLabel(d2enum.TCPIPHostGameLabel)) + v.btnTCPIPHostGame = v.uiManager.NewButton(d2ui.ButtonTypeWide, v.asset.TranslateString(d2enum.TCPIPHostGameLabel)) v.btnTCPIPHostGame.SetPosition(tcpHostBtnX, tcpHostBtnY) v.btnTCPIPHostGame.OnActivated(func() { v.onTCPIPHostGameClicked() }) v.btnTCPIPHostGame.OnHoverStart(func() { v.hostTipLabel.SetVisible(true) }) v.btnTCPIPHostGame.OnHoverEnd(func() { v.hostTipLabel.SetVisible(false) }) - v.btnTCPIPJoinGame = v.uiManager.NewButton(d2ui.ButtonTypeWide, v.asset.TranslateLabel(d2enum.TCPIPJoinGameLabel)) + v.btnTCPIPJoinGame = v.uiManager.NewButton(d2ui.ButtonTypeWide, v.asset.TranslateString(d2enum.TCPIPJoinGameLabel)) v.btnTCPIPJoinGame.SetPosition(tcpJoinBtnX, tcpJoinBtnY) v.btnTCPIPJoinGame.OnActivated(func() { v.onTCPIPJoinGameClicked() }) v.btnTCPIPJoinGame.OnHoverStart(func() { v.joinTipLabel.SetVisible(true) }) @@ -672,5 +672,5 @@ func (v *MainMenu) getLocalIP() string { v.Warning("no IPv4 Address could be found") - return v.asset.TranslateLabel(d2enum.IPNotFoundLabel) + return v.asset.TranslateString(d2enum.IPNotFoundLabel) } diff --git a/d2game/d2gamescreen/select_hero_class.go b/d2game/d2gamescreen/select_hero_class.go index 0f9efed6..c6591d5c 100644 --- a/d2game/d2gamescreen/select_hero_class.go +++ b/d2game/d2gamescreen/select_hero_class.go @@ -416,7 +416,7 @@ func (v *SelectHeroClass) createLabels() { halfFontWidth := fontWidth / half v.headingLabel.SetPosition(headingX-halfFontWidth, headingY) - v.headingLabel.SetText(v.asset.TranslateLabel(d2enum.SelectHeroClassLabel)) + v.headingLabel.SetText(v.asset.TranslateString(d2enum.SelectHeroClassLabel)) v.headingLabel.Alignment = d2ui.HorizontalAlignCenter v.heroClassLabel = v.uiManager.NewLabel(d2resource.Font30, d2resource.PaletteUnits) @@ -437,7 +437,7 @@ func (v *SelectHeroClass) createLabels() { v.heroNameLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits) v.heroNameLabel.Alignment = d2ui.HorizontalAlignLeft - v.heroNameLabel.SetText(d2ui.ColorTokenize(v.asset.TranslateLabel(d2enum.CharNameLabel), d2ui.ColorTokenGold)) + v.heroNameLabel.SetText(d2ui.ColorTokenize(v.asset.TranslateString(d2enum.CharNameLabel), d2ui.ColorTokenGold)) v.heroNameLabel.SetPosition(heroNameLabelX, heroNameLabelY) v.expansionCharLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits) @@ -447,16 +447,16 @@ func (v *SelectHeroClass) createLabels() { v.hardcoreCharLabel = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits) v.hardcoreCharLabel.Alignment = d2ui.HorizontalAlignLeft - v.hardcoreCharLabel.SetText(d2ui.ColorTokenize(v.asset.TranslateLabel(d2enum.HardCoreLabel), d2ui.ColorTokenGold)) + v.hardcoreCharLabel.SetText(d2ui.ColorTokenize(v.asset.TranslateString(d2enum.HardCoreLabel), d2ui.ColorTokenGold)) v.hardcoreCharLabel.SetPosition(hardcoreLabelX, hardcoreLabelY) } func (v *SelectHeroClass) createButtons() { - v.exitButton = v.uiManager.NewButton(d2ui.ButtonTypeMedium, v.asset.TranslateLabel(d2enum.ExitLabel)) + v.exitButton = v.uiManager.NewButton(d2ui.ButtonTypeMedium, v.asset.TranslateString(d2enum.ExitLabel)) v.exitButton.SetPosition(selHeroExitBtnX, selHeroExitBtnY) v.exitButton.OnActivated(func() { v.onExitButtonClicked() }) - v.okButton = v.uiManager.NewButton(d2ui.ButtonTypeMedium, v.asset.TranslateLabel(d2enum.OKLabel)) + v.okButton = v.uiManager.NewButton(d2ui.ButtonTypeMedium, v.asset.TranslateString(d2enum.OKLabel)) v.okButton.SetPosition(selHeroOkBtnX, selHeroOkBtnY) v.okButton.OnActivated(func() { v.onOkButtonClicked() }) v.okButton.SetVisible(false) @@ -719,7 +719,7 @@ func (v *SelectHeroClass) setDescLabels(descKey int, key string) { if key != "" { heroDesc = v.asset.TranslateString(key) } else { - heroDesc = v.asset.TranslateLabel(descKey) + heroDesc = v.asset.TranslateString(descKey) } parts := d2util.SplitIntoLinesWithMaxWidth(heroDesc, heroDescCharWidth)