Skip to content

Commit

Permalink
ui adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
liqMix committed Jul 1, 2024
1 parent f317a0f commit 5a7ed89
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
5 changes: 4 additions & 1 deletion internal/game/gamebuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ func (s *GameStateBuild) Begin(g *Game) {
}
g.ui.equipmentPanel.buyButton.text.SetText(fmt.Sprintf("Random Loot\n%dgp", s.EquipmentCost()))
g.ui.equipmentPanel.buyButton.Enable()

g.ui.equipmentPanel.sortButton.Enable()
g.ui.equipmentPanel.autoEquipButton.Enable()
g.ui.equipmentPanel.onItemClick = func(which int) {
g.ui.equipmentPanel.list.selected = which
s.selectedEquipment = which
Expand Down Expand Up @@ -316,7 +317,9 @@ func (s *GameStateBuild) End(g *Game) {
g.ui.roomInfoPanel.hidden = true
g.ui.roomPanel.buyButton.disabled = true
g.ui.dudePanel.buyButton.disabled = true
g.ui.equipmentPanel.autoEquipButton.disabled = true
g.ui.equipmentPanel.buyButton.disabled = true
g.ui.equipmentPanel.sortButton.disabled = true
g.ui.dudeInfoPanel.equipmentDetails.sellButton.hidden = true
g.ui.dudeInfoPanel.equipmentDetails.swapButton.hidden = true
}
Expand Down
7 changes: 7 additions & 0 deletions internal/game/gamepre.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ func (s *GameStatePre) Begin(g *Game) {

// Init inventory
g.equipment = make([]*Equipment, 0)
g.ui.equipmentPanel.SetEquipment(g.equipment)

// Init dudes
g.dudes = make([]*Dude, 0)
g.ui.dudeInfoPanel.SetDude(nil)
g.ui.dudePanel.SetDudes(g.dudes)
g.ui.dudeInfoPanel.equipmentDetails.SetEquipment(nil)

// Init audio tick
g.audioController.PlayRoomTracks()
Expand Down
12 changes: 7 additions & 5 deletions internal/game/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (ui *UI) Layout(o *UIOptions) {
)
ui.bossPanel.panel.SetPosition(
float64(o.Width)/2-ui.bossPanel.panel.Width()/2,
float64(o.Height)/8-ui.bossPanel.panel.Height()/2,
float64(o.Height)/8-ui.bossPanel.panel.Height()/2+4*o.Scale,
)
ui.bossPanel.panel.padding = 3 * o.Scale
ui.bossPanel.Layout(o)
Expand Down Expand Up @@ -1439,10 +1439,12 @@ func (ep *EquipmentPanel) Draw(o *render.Options) {
if ep.showDetails {
ep.details.Draw(o)
}
ep.autoEquipButton.Draw(o)
ep.buyButton.Draw(o)
ep.sortButton.Draw(o)

ep.buyButton.Draw(o)
if ep.equipment != nil && len(ep.equipment) != 0 {
ep.autoEquipButton.Draw(o)
ep.sortButton.Draw(o)
}
}

type EquipmentDetailsPanel struct {
Expand Down Expand Up @@ -1973,7 +1975,7 @@ func (bp *BossPanel) Layout(o *UIOptions) {
bp.text.Layout(nil, o)
bp.panel.Layout(nil, o)
// Force text's position
bp.text.SetPosition(bp.panel.X()+bp.panel.Width()/2-bp.text.Width()/2, bp.panel.Y()+bp.panel.Height()/2-bp.text.Height()/2-3)
bp.text.SetPosition(bp.panel.X()+bp.panel.Width()/2-bp.text.Width()/2, bp.panel.Y()+bp.panel.Height()/2-bp.text.Height()/2-3+4*o.Scale)
}

func (bp *BossPanel) Update(o *UIOptions) {
Expand Down

0 comments on commit 5a7ed89

Please sign in to comment.