mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-18 02:16:23 -05:00
quest log disabled icon
This commit is contained in:
parent
5b4e23eb8c
commit
c6ab79c388
@ -180,7 +180,7 @@ const (
|
|||||||
|
|
||||||
blankQuestButtonXSegments = 1
|
blankQuestButtonXSegments = 1
|
||||||
blankQuestButtonYSegments = 1
|
blankQuestButtonYSegments = 1
|
||||||
blankQuestButtonDisabledFrames = -1
|
blankQuestButtonDisabledFrames = 0
|
||||||
|
|
||||||
buttonMinipanelCharacterBaseFrame = 0
|
buttonMinipanelCharacterBaseFrame = 0
|
||||||
buttonMinipanelInventoryBaseFrame = 2
|
buttonMinipanelInventoryBaseFrame = 2
|
||||||
@ -900,7 +900,7 @@ func (v *Button) prerenderStates(btnSprite *Sprite, btnLayout *ButtonLayout, lab
|
|||||||
label.SetPosition(xOffset, textY)
|
label.SetPosition(xOffset, textY)
|
||||||
label.Render(v.normalSurface)
|
label.Render(v.normalSurface)
|
||||||
|
|
||||||
if !btnLayout.HasImage || !btnLayout.AllowFrameChange {
|
if !btnLayout.AllowFrameChange {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1003,7 +1003,10 @@ func (v *Button) Render(target d2interface.Surface) {
|
|||||||
if v.toggled {
|
if v.toggled {
|
||||||
target.Render(v.toggledSurface)
|
target.Render(v.toggledSurface)
|
||||||
} else {
|
} else {
|
||||||
target.Render(v.disabledSurface)
|
// it allows to use SetEnabled(false) for non-image budons
|
||||||
|
if v.buttonLayout.HasImage {
|
||||||
|
target.Render(v.disabledSurface)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case v.toggled && v.pressed:
|
case v.toggled && v.pressed:
|
||||||
target.Render(v.pressedToggledSurface)
|
target.Render(v.pressedToggledSurface)
|
||||||
|
@ -74,7 +74,7 @@ func (s *Sprite) RenderSegmented(target d2interface.Surface, segmentsX, segments
|
|||||||
for x := 0; x < segmentsX; x++ {
|
for x := 0; x < segmentsX; x++ {
|
||||||
idx := x + y*segmentsX + frameOffset*segmentsX*segmentsY
|
idx := x + y*segmentsX + frameOffset*segmentsX*segmentsY
|
||||||
if err := s.animation.SetCurrentFrame(idx); err != nil {
|
if err := s.animation.SetCurrentFrame(idx); err != nil {
|
||||||
s.Error("SetCurrentFrame error" + err.Error())
|
s.Errorf("Error while setting frame (%d): %s", idx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
target.PushTranslation(s.x+currentX, s.y+currentY)
|
target.PushTranslation(s.x+currentX, s.y+currentY)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package d2gamescreen
|
package d2gamescreen
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image/color"
|
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -190,7 +189,7 @@ func (v *CharacterSelect) OnLoad(loading d2screen.LoadingState) {
|
|||||||
|
|
||||||
v.characterNameLabel[i] = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits)
|
v.characterNameLabel[i] = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteUnits)
|
||||||
v.characterNameLabel[i].SetPosition(offsetX, offsetY)
|
v.characterNameLabel[i].SetPosition(offsetX, offsetY)
|
||||||
v.characterNameLabel[i].Color[0] = rgbaColor(lightBrown)
|
v.characterNameLabel[i].Color[0] = d2util.Color(lightBrown)
|
||||||
|
|
||||||
offsetY += labelHeight
|
offsetY += labelHeight
|
||||||
|
|
||||||
@ -201,7 +200,7 @@ func (v *CharacterSelect) OnLoad(loading d2screen.LoadingState) {
|
|||||||
|
|
||||||
v.characterExpLabel[i] = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteStatic)
|
v.characterExpLabel[i] = v.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteStatic)
|
||||||
v.characterExpLabel[i].SetPosition(offsetX, offsetY)
|
v.characterExpLabel[i].SetPosition(offsetX, offsetY)
|
||||||
v.characterExpLabel[i].Color[0] = rgbaColor(lightGreen)
|
v.characterExpLabel[i].Color[0] = d2util.Color(lightGreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
v.refreshGameStates()
|
v.refreshGameStates()
|
||||||
@ -267,31 +266,6 @@ func (v *CharacterSelect) loadCharScrollbar() {
|
|||||||
v.charScrollbar.OnActivated(func() { v.onScrollUpdate() })
|
v.charScrollbar.OnActivated(func() { v.onScrollUpdate() })
|
||||||
}
|
}
|
||||||
|
|
||||||
func rgbaColor(rgba uint32) color.RGBA {
|
|
||||||
result := color.RGBA{}
|
|
||||||
a, b, g, r := 0, 1, 2, 3
|
|
||||||
byteWidth := 8
|
|
||||||
byteMask := 0xff
|
|
||||||
|
|
||||||
for idx := 0; idx < 4; idx++ {
|
|
||||||
shift := idx * byteWidth
|
|
||||||
component := uint8(rgba>>shift) & uint8(byteMask)
|
|
||||||
|
|
||||||
switch idx {
|
|
||||||
case a:
|
|
||||||
result.A = component
|
|
||||||
case b:
|
|
||||||
result.B = component
|
|
||||||
case g:
|
|
||||||
result.G = component
|
|
||||||
case r:
|
|
||||||
result.R = component
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *CharacterSelect) createButtons(loading d2screen.LoadingState) {
|
func (v *CharacterSelect) createButtons(loading d2screen.LoadingState) {
|
||||||
v.newCharButton = v.uiManager.NewButton(d2ui.ButtonTypeTall, strings.Join(
|
v.newCharButton = v.uiManager.NewButton(d2ui.ButtonTypeTall, strings.Join(
|
||||||
d2util.SplitIntoLinesWithMaxWidth(v.asset.TranslateString("#831"), 13), "\n"))
|
d2util.SplitIntoLinesWithMaxWidth(v.asset.TranslateString("#831"), 13), "\n"))
|
||||||
@ -411,7 +385,7 @@ func (v *CharacterSelect) Render(screen d2interface.Surface) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if v.showDeleteConfirmation {
|
if v.showDeleteConfirmation {
|
||||||
screen.DrawRect(screenWidth, screenHeight, rgbaColor(blackHalfOpacity))
|
screen.DrawRect(screenWidth, screenHeight, d2util.Color(blackHalfOpacity))
|
||||||
v.okCancelBox.RenderSegmented(screen, 2, 1, 0)
|
v.okCancelBox.RenderSegmented(screen, 2, 1, 0)
|
||||||
v.deleteCharConfirmLabel.Render(screen)
|
v.deleteCharConfirmLabel.Render(screen)
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ 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(v.asset.TranslateLabel(d2enum.SelectCinematicLabel))
|
v.cinematicsLabel.SetText(v.asset.TranslateLabel(d2enum.SelectCinematicLabel))
|
||||||
v.cinematicsLabel.Color[0] = rgbaColor(lightBrown)
|
v.cinematicsLabel.Color[0] = d2util.Color(lightBrown)
|
||||||
v.cinematicsLabel.SetPosition(cinematicsLabelX, cinematicsLabelY)
|
v.cinematicsLabel.SetPosition(cinematicsLabelX, cinematicsLabelY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,32 +239,32 @@ 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
|
||||||
v.versionLabel.SetText("OpenDiablo2 - " + v.buildInfo.Branch)
|
v.versionLabel.SetText("OpenDiablo2 - " + v.buildInfo.Branch)
|
||||||
v.versionLabel.Color[0] = rgbaColor(white)
|
v.versionLabel.Color[0] = d2util.Color(white)
|
||||||
v.versionLabel.SetPosition(versionLabelX, versionLabelY)
|
v.versionLabel.SetPosition(versionLabelX, versionLabelY)
|
||||||
|
|
||||||
v.commitLabel = v.uiManager.NewLabel(d2resource.FontFormal10, d2resource.PaletteStatic)
|
v.commitLabel = v.uiManager.NewLabel(d2resource.FontFormal10, d2resource.PaletteStatic)
|
||||||
v.commitLabel.Alignment = d2ui.HorizontalAlignLeft
|
v.commitLabel.Alignment = d2ui.HorizontalAlignLeft
|
||||||
v.commitLabel.SetText(v.buildInfo.Commit)
|
v.commitLabel.SetText(v.buildInfo.Commit)
|
||||||
v.commitLabel.Color[0] = rgbaColor(white)
|
v.commitLabel.Color[0] = d2util.Color(white)
|
||||||
v.commitLabel.SetPosition(commitLabelX, commitLabelY)
|
v.commitLabel.SetPosition(commitLabelX, commitLabelY)
|
||||||
|
|
||||||
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(v.asset.TranslateLabel(d2enum.CopyrightLabel))
|
v.copyrightLabel.SetText(v.asset.TranslateLabel(d2enum.CopyrightLabel))
|
||||||
v.copyrightLabel.Color[0] = rgbaColor(lightBrown)
|
v.copyrightLabel.Color[0] = d2util.Color(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(v.asset.TranslateLabel(d2enum.AllRightsReservedLabel))
|
v.copyrightLabel2.SetText(v.asset.TranslateLabel(d2enum.AllRightsReservedLabel))
|
||||||
v.copyrightLabel2.Color[0] = rgbaColor(lightBrown)
|
v.copyrightLabel2.Color[0] = d2util.Color(lightBrown)
|
||||||
v.copyrightLabel2.SetPosition(copyright2X, copyright2Y)
|
v.copyrightLabel2.SetPosition(copyright2X, copyright2Y)
|
||||||
|
|
||||||
v.openDiabloLabel = v.uiManager.NewLabel(d2resource.FontFormal10, d2resource.PaletteStatic)
|
v.openDiabloLabel = v.uiManager.NewLabel(d2resource.FontFormal10, d2resource.PaletteStatic)
|
||||||
v.openDiabloLabel.Alignment = d2ui.HorizontalAlignCenter
|
v.openDiabloLabel.Alignment = d2ui.HorizontalAlignCenter
|
||||||
v.openDiabloLabel.SetText("OpenDiablo2 is neither developed by, nor endorsed by Blizzard or its parent company Activision")
|
v.openDiabloLabel.SetText("OpenDiablo2 is neither developed by, nor endorsed by Blizzard or its parent company Activision")
|
||||||
v.openDiabloLabel.Color[0] = rgbaColor(lightYellow)
|
v.openDiabloLabel.Color[0] = d2util.Color(lightYellow)
|
||||||
v.openDiabloLabel.SetPosition(od2LabelX, od2LabelY)
|
v.openDiabloLabel.SetPosition(od2LabelX, od2LabelY)
|
||||||
loading.Progress(fiftyPercent)
|
loading.Progress(fiftyPercent)
|
||||||
|
|
||||||
@ -276,19 +276,19 @@ func (v *MainMenu) createLabels(loading d2screen.LoadingState) {
|
|||||||
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(strings.Join(d2util.SplitIntoLinesWithMaxWidth(v.asset.TranslateLabel(d2enum.TCPIPEnterHostIPLabel), 27), "\n"))
|
v.tcpJoinGameLabel.SetText(strings.Join(d2util.SplitIntoLinesWithMaxWidth(v.asset.TranslateLabel(d2enum.TCPIPEnterHostIPLabel), 27), "\n"))
|
||||||
v.tcpJoinGameLabel.Color[0] = rgbaColor(gold)
|
v.tcpJoinGameLabel.Color[0] = d2util.Color(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(v.asset.TranslateLabel(d2enum.TCPIPYourIPLabel) + "\n" + v.getLocalIP())
|
v.machineIP.SetText(v.asset.TranslateLabel(d2enum.TCPIPYourIPLabel) + "\n" + v.getLocalIP())
|
||||||
v.machineIP.Color[0] = rgbaColor(lightYellow)
|
v.machineIP.Color[0] = d2util.Color(lightYellow)
|
||||||
v.machineIP.SetPosition(machineIPX, machineIPY)
|
v.machineIP.SetPosition(machineIPX, machineIPY)
|
||||||
|
|
||||||
if v.errorLabel != nil {
|
if v.errorLabel != nil {
|
||||||
v.errorLabel.SetPosition(errorLabelX, errorLabelY)
|
v.errorLabel.SetPosition(errorLabelX, errorLabelY)
|
||||||
v.errorLabel.Alignment = d2ui.HorizontalAlignCenter
|
v.errorLabel.Alignment = d2ui.HorizontalAlignCenter
|
||||||
v.errorLabel.Color[0] = rgbaColor(red)
|
v.errorLabel.Color[0] = d2util.Color(red)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package d2player
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"image/color"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
|
||||||
@ -216,13 +215,13 @@ func (s *QuestLog) Load() {
|
|||||||
|
|
||||||
s.questName = s.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteStatic)
|
s.questName = s.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteStatic)
|
||||||
s.questName.Alignment = d2ui.HorizontalAlignCenter
|
s.questName.Alignment = d2ui.HorizontalAlignCenter
|
||||||
s.questName.Color[0] = rgbaColor(white)
|
s.questName.Color[0] = d2util.Color(white)
|
||||||
s.questName.SetPosition(questNameLabelX, questNameLabelY)
|
s.questName.SetPosition(questNameLabelX, questNameLabelY)
|
||||||
s.panelGroup.AddWidget(s.questName)
|
s.panelGroup.AddWidget(s.questName)
|
||||||
|
|
||||||
s.questDescr = s.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteStatic)
|
s.questDescr = s.uiManager.NewLabel(d2resource.Font16, d2resource.PaletteStatic)
|
||||||
s.questDescr.Alignment = d2ui.HorizontalAlignLeft
|
s.questDescr.Alignment = d2ui.HorizontalAlignLeft
|
||||||
s.questDescr.Color[0] = rgbaColor(white)
|
s.questDescr.Color[0] = d2util.Color(white)
|
||||||
s.questDescr.SetPosition(questDescrLabelX, questDescrLabelY)
|
s.questDescr.SetPosition(questDescrLabelX, questDescrLabelY)
|
||||||
s.panelGroup.AddWidget(s.questDescr)
|
s.panelGroup.AddWidget(s.questDescr)
|
||||||
|
|
||||||
@ -298,6 +297,8 @@ func (s *QuestLog) loadQuestIconsForAct(act int) *d2ui.WidgetGroup {
|
|||||||
|
|
||||||
button := s.uiManager.NewButton(d2ui.ButtonTypeBlankQuestBtn, "")
|
button := s.uiManager.NewButton(d2ui.ButtonTypeBlankQuestBtn, "")
|
||||||
button.SetPosition(x+questOffsetX, y+questOffsetY)
|
button.SetPosition(x+questOffsetX, y+questOffsetY)
|
||||||
|
cw := n
|
||||||
|
button.SetEnabled(!(s.questStatus[s.cordsToQuestID(act, cw)] == d2enum.QuestStatusNotStarted))
|
||||||
buttons = append(buttons, button)
|
buttons = append(buttons, button)
|
||||||
|
|
||||||
icon, err = s.makeQuestIconForAct(act, n)
|
icon, err = s.makeQuestIconForAct(act, n)
|
||||||
@ -383,7 +384,7 @@ func (s *QuestLog) setQuestLabel() {
|
|||||||
|
|
||||||
s.questName.SetText(s.asset.TranslateString(fmt.Sprintf("qstsa%dq%d", s.selectedTab+1, s.selectedQuest)))
|
s.questName.SetText(s.asset.TranslateString(fmt.Sprintf("qstsa%dq%d", s.selectedTab+1, s.selectedQuest)))
|
||||||
|
|
||||||
status := s.questStatus[s.cordsToQuestID(s.selectedTab+1, s.selectedQuest)]
|
status := s.questStatus[s.cordsToQuestID(s.selectedTab+1, s.selectedQuest)-1]
|
||||||
switch status {
|
switch status {
|
||||||
case d2enum.QuestStatusCompleted:
|
case d2enum.QuestStatusCompleted:
|
||||||
s.questDescr.SetText(
|
s.questDescr.SetText(
|
||||||
@ -393,6 +394,8 @@ func (s *QuestLog) setQuestLabel() {
|
|||||||
questDescriptionLenght),
|
questDescriptionLenght),
|
||||||
"\n"),
|
"\n"),
|
||||||
)
|
)
|
||||||
|
case d2enum.QuestStatusCompleting:
|
||||||
|
s.questDescr.SetText("")
|
||||||
case d2enum.QuestStatusNotStarted:
|
case d2enum.QuestStatusNotStarted:
|
||||||
s.questDescr.SetText("")
|
s.questDescr.SetText("")
|
||||||
default:
|
default:
|
||||||
@ -527,32 +530,6 @@ func (s *QuestLog) renderStaticPanelFrames(target d2interface.Surface) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy from character select (github.com/OpenDiablo2/OpenDiablo2/d2game/d2gamescreen/character_select.go)
|
|
||||||
func rgbaColor(rgba uint32) color.RGBA {
|
|
||||||
result := color.RGBA{}
|
|
||||||
a, b, g, r := 0, 1, 2, 3
|
|
||||||
byteWidth := 8
|
|
||||||
byteMask := 0xff
|
|
||||||
|
|
||||||
for idx := 0; idx < 4; idx++ {
|
|
||||||
shift := idx * byteWidth
|
|
||||||
component := uint8(rgba>>shift) & uint8(byteMask)
|
|
||||||
|
|
||||||
switch idx {
|
|
||||||
case a:
|
|
||||||
result.A = component
|
|
||||||
case b:
|
|
||||||
result.B = component
|
|
||||||
case g:
|
|
||||||
result.G = component
|
|
||||||
case r:
|
|
||||||
result.R = component
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *QuestLog) cordsToQuestID(act, number int) int {
|
func (s *QuestLog) cordsToQuestID(act, number int) int {
|
||||||
key := (act-1)*d2enum.NormalActQuestsNumber + number
|
key := (act-1)*d2enum.NormalActQuestsNumber + number
|
||||||
if act > d2enum.Act4 {
|
if act > d2enum.Act4 {
|
||||||
|
Loading…
Reference in New Issue
Block a user