1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-16 17:35:57 -05:00

Merge branch 'master' into fix/close_panel_viewport

This commit is contained in:
Tim Sarbin 2021-01-25 09:53:12 -05:00 committed by GitHub
commit b4e6880cca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 10 deletions

View File

@ -280,7 +280,9 @@ func (v *Game) Advance(elapsed float64) error {
v.soundEnv.Advance(elapsed)
if v.gameControls != nil {
v.gameControls.PartyPanel.UpdatePlayersList(v.gameClient.Players)
if v.gameControls.PartyPanel != nil {
v.gameControls.PartyPanel.UpdatePlayersList(v.gameClient.Players)
}
}
return nil

View File

@ -387,7 +387,7 @@ func (v *MainMenu) createMainMenuButtons(loading d2screen.LoadingState) {
v.btnServerIPCancel.SetPosition(srvCancelBtnX, srvCancelBtnY)
v.btnServerIPCancel.OnActivated(func() { v.onBtnTCPIPCancelClicked() })
v.btnServerIPOk = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateString(d2enum.OKLabel))
v.btnServerIPOk = v.uiManager.NewButton(d2ui.ButtonTypeOkCancel, v.asset.TranslateLabel(d2enum.OKLabel))
v.btnServerIPOk.SetPosition(srvOkBtnX, srvOkBtnY)
v.btnServerIPOk.OnActivated(func() { v.onBtnTCPIPOkClicked() })
loading.Progress(eightyPercent)

View File

@ -174,8 +174,6 @@ func NewGameControls(
heroStatsPanel := NewHeroStatsPanel(asset, ui, hero.Name(), hero.Class, l, hero.Stats)
PartyPanel := NewPartyPanel(asset, ui, hero.Name(), l, hero, hero.Stats, players)
questLog := NewQuestLog(asset, ui, l, audioProvider, hero.Act)
inventory, err := NewInventory(asset, ui, l, hero.Gold, inventoryRecord)
@ -208,7 +206,6 @@ func NewGameControls(
inventory: inventory,
skilltree: skilltree,
heroStatsPanel: heroStatsPanel,
PartyPanel: PartyPanel,
questLog: questLog,
HelpOverlay: helpOverlay,
keyMap: keyMap,
@ -236,6 +233,11 @@ func NewGameControls(
isSinglePlayer: isSinglePlayer,
}
if !isSinglePlayer {
PartyPanel := NewPartyPanel(asset, ui, hero.Name(), l, hero, hero.Stats, players)
gc.PartyPanel = PartyPanel
}
hud := NewHUD(asset, ui, hero, miniPanel, actionableRegions, mapEngine, l, gc, mapRenderer)
gc.hud = hud
@ -503,7 +505,10 @@ func (g *GameControls) OnMouseMove(event d2interface.MouseMoveEvent) bool {
}
g.hud.OnMouseMove(event)
g.PartyPanel.OnMouseMove(event)
if g.PartyPanel != nil {
g.PartyPanel.OnMouseMove(event)
}
return false
}
@ -562,7 +567,11 @@ func (g *GameControls) OnMouseButtonDown(event d2interface.MouseEvent) bool {
func (g *GameControls) clearLeftScreenSide() {
g.heroStatsPanel.Close()
g.PartyPanel.Close()
if g.PartyPanel != nil {
g.PartyPanel.Close()
}
g.questLog.Close()
g.hud.skillSelectMenu.ClosePanels()
g.updateLayout()
@ -681,7 +690,11 @@ func (g *GameControls) Load() {
g.inventory.Load()
g.skilltree.load()
g.heroStatsPanel.Load()
g.PartyPanel.Load()
if g.PartyPanel != nil {
g.PartyPanel.Load()
}
g.questLog.Load()
g.HelpOverlay.Load()
@ -705,7 +718,10 @@ func (g *GameControls) Advance(elapsed float64) error {
g.hud.Advance(elapsed)
g.inventory.Advance(elapsed)
g.questLog.Advance(elapsed)
g.PartyPanel.Advance(elapsed)
if g.PartyPanel != nil {
g.PartyPanel.Advance(elapsed)
}
if err := g.escapeMenu.Advance(elapsed); err != nil {
return err
@ -736,7 +752,15 @@ func (g *GameControls) updateLayout() {
}
func (g *GameControls) isLeftPanelOpen() bool {
return g.heroStatsPanel.IsOpen() || g.PartyPanel.IsOpen() || g.questLog.IsOpen() || g.inventory.moveGoldPanel.IsOpen()
var partyPanel bool
if g.PartyPanel != nil {
partyPanel = g.PartyPanel.IsOpen()
} else {
partyPanel = false
}
return g.heroStatsPanel.IsOpen() || partyPanel || g.questLog.IsOpen() || g.inventory.moveGoldPanel.IsOpen()
}
func (g *GameControls) isRightPanelOpen() bool {