* finishing up help overlay

* fixes help overlay close button,
adds hack to prevent buysellbtn from rendering all 24 unrelated frames on top of eachother
This commit is contained in:
Brendan Porter 2020-09-20 01:54:24 -05:00 committed by GitHub
parent 271673851a
commit f4d78549c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 25 deletions

View File

@ -168,7 +168,7 @@ const (
RunButton = "/data/global/ui/PANEL/runbutton.dc6"
MenuButton = "/data/global/ui/PANEL/menubutton.DC6"
GoldCoinButton = "/data/global/ui/panel/goldcoinbtn.dc6"
SquareButton = "/data/global/ui/panel/buysellbtn.dc6"
BuySellButton = "/data/global/ui/panel/buysellbtn.dc6"
ArmorPlaceholder = "/data/global/ui/PANEL/inv_armor.DC6"
BeltPlaceholder = "/data/global/ui/PANEL/inv_belt.DC6"

View File

@ -39,11 +39,12 @@ const (
ButtonTypeMinipanelMessage ButtonType = 17
ButtonTypeMinipanelQuest ButtonType = 18
ButtonTypeMinipanelMen ButtonType = 19
ButtonTypeSquareClose ButtonType = 20
)
const (
greyAlpha100 = 0x646464_ff
lightGreyAlpha75 = 0x808080_c3
greyAlpha100 = 0x646464ff
lightGreyAlpha75 = 0x808080c3
)
// ButtonLayout defines the type of buttons
@ -83,9 +84,9 @@ const (
buttonOkCancelSegmentsY = 1
buttonOkCancelDisabledFrame = -1
buttonCloseSegmentsX = 1
buttonCloseSegmentsY = 1
buttonCloseDisabledFrame = -1
buttonBuySellSegmentsX = 1
buttonBuySellSegmentsY = 1
buttonBuySellDisabledFrame = 1
buttonRunSegmentsX = 1
buttonRunSegmentsY = 1
@ -152,15 +153,16 @@ func getButtonLayouts() map[ButtonType]ButtonLayout {
FontPath: d2resource.FontRediculous,
AllowFrameChange: true,
},
ButtonTypeClose: {
XSegments: buttonCloseSegmentsX,
YSegments: buttonCloseSegmentsY,
DisabledFrame: buttonCloseDisabledFrame,
ResourceName: d2resource.SquareButton,
PaletteName: d2resource.PaletteUnits,
Toggleable: true,
FontPath: d2resource.Font30,
ButtonTypeSquareClose: {
XSegments: buttonBuySellSegmentsX,
YSegments: buttonBuySellSegmentsY,
DisabledFrame: buttonBuySellDisabledFrame,
ResourceName: d2resource.BuySellButton,
PaletteName: d2resource.PaletteUnits,
Toggleable: true,
FontPath: d2resource.Font30,
AllowFrameChange: true,
BaseFrame: 10,
},
}
}
@ -266,6 +268,13 @@ func (v *Button) renderFrames(btnSprite *Sprite, btnLayout *ButtonLayout, label
label.Render(v.pressedSurface)
}
if btnLayout.ResourceName == d2resource.BuySellButton {
// Without returning early, the button UI gets all subsequent (unrelated) frames stacked on top
// Only 2 frames from this sprite are applicable to the button in question
// The presentation is incorrect without this hack
return
}
totalButtonTypes--
if totalButtonTypes > 0 { // button has more than two types
frameOffset++

View File

@ -158,12 +158,7 @@ func (h *Overlay) Load() {
// Close
//close, _ := h.uiManager.NewSprite(d2resource.SquareButton, d2resource.PaletteSky)
//_ = close.SetCurrentFrame(0)
//close.SetPosition(685, 57)
//h.frames = append(h.frames, close)
h.closeButton = h.uiManager.NewButton(d2ui.ButtonTypeClose, "0")
h.closeButton = h.uiManager.NewButton(d2ui.ButtonTypeSquareClose, "")
h.closeButton.SetPosition(685, 25)
h.closeButton.SetVisible(false)
h.closeButton.OnActivated(func() { h.close() })
@ -173,11 +168,6 @@ func (h *Overlay) Load() {
newLabel.SetPosition(680, 60)
h.text = append(h.text, newLabel)
newLabel = h.uiManager.NewLabel(d2resource.Font30, d2resource.PaletteSky)
newLabel.SetText("0")
newLabel.SetPosition(695, 32)
h.text = append(h.text, newLabel)
// Bullets
yOffset := 60