1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-18 02:16:23 -05:00

Merge pull request #985 from gucio321/hotfix

level-up buttons tooltips
This commit is contained in:
Tim Sarbin 2020-12-18 12:21:51 -05:00 committed by GitHub
commit 719480e95b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -69,6 +69,8 @@ func (ui *UIManager) NewTooltip(font,
boxEnabled: true,
}
res.manager = ui
// cannot use ui.addWidget, because
// some tooltips could be covered by another widgets
ui.addTooltip(res)
return res

View File

@ -188,14 +188,25 @@ func (h *HUD) Load() {
h.loadCustomWidgets()
h.loadUIButtons()
// nolint:gomnd // dividing by 2 (const)
h.addStatsButton = h.uiManager.NewButton(d2ui.ButtonTypeAddSkill, "")
h.addStatsButton.SetPosition(addStatsButtonX, addStatsButtonY)
h.addStatsButton.SetVisible(false)
bw, bh := h.addStatsButton.GetSize()
statsTooltip := h.uiManager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, d2ui.TooltipXCenter, d2ui.TooltipYTop)
statsTooltip.SetPosition(addStatsButtonX+bw/2, addStatsButtonY-bh/2)
statsTooltip.SetText(h.asset.TranslateString("strlvlup"))
h.addStatsButton.SetTooltip(statsTooltip)
h.panelGroup.AddWidget(h.addStatsButton)
h.addSkillButton = h.uiManager.NewButton(d2ui.ButtonTypeAddSkill, "")
h.addSkillButton.SetPosition(addSkillButtonX, addSkillButtonY)
h.addSkillButton.SetVisible(false)
bw, bh = h.addSkillButton.GetSize()
skillTooltip := h.uiManager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, d2ui.TooltipXCenter, d2ui.TooltipYTop)
skillTooltip.SetPosition(addSkillButtonX+bw/2, addSkillButtonY-bh/2)
skillTooltip.SetText(h.asset.TranslateString("strnewskl"))
h.addSkillButton.SetTooltip(skillTooltip)
h.panelGroup.AddWidget(h.addSkillButton)
h.panelGroup.SetVisible(true)