mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-10 22:36:23 -05:00
code cleanup
This commit is contained in:
parent
3f8dcf2232
commit
d302263ac1
@ -303,7 +303,7 @@ func (v *Game) bindGameControls() error {
|
||||
|
||||
var err error
|
||||
v.gameControls, err = d2player.NewGameControls(v.asset, v.renderer, player, v.gameClient.MapEngine,
|
||||
v.escapeMenu, v.mapRenderer, v, v.terminal, v.uiManager, v.guiManager, v.keyMap, v.logLevel, v.gameClient.IsSinglePlayer())
|
||||
v.escapeMenu, v.mapRenderer, v, v.terminal, v.uiManager, v.keyMap, v.logLevel, v.gameClient.IsSinglePlayer())
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2math/d2vector"
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2gui"
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2hero"
|
||||
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2interface"
|
||||
@ -124,7 +123,6 @@ func NewGameControls(
|
||||
inputListener inputCallbackListener,
|
||||
term d2interface.Terminal,
|
||||
ui *d2ui.UIManager,
|
||||
guiManager *d2gui.GuiManager,
|
||||
keyMap *KeyMap,
|
||||
l d2util.LogLevel,
|
||||
isSinglePlayer bool,
|
||||
@ -405,10 +403,7 @@ func (g *GameControls) OnKeyDown(event d2interface.KeyEvent) bool {
|
||||
case d2enum.HoldRun:
|
||||
g.hud.onToggleRunButton(true)
|
||||
case d2enum.ToggleHelpScreen:
|
||||
g.hud.miniPanel.openDisabled()
|
||||
|
||||
g.HelpOverlay.Toggle()
|
||||
g.updateLayout()
|
||||
g.toggleHelpOverlay()
|
||||
default:
|
||||
return false
|
||||
}
|
||||
@ -468,7 +463,7 @@ func (g *GameControls) onEscKey() {
|
||||
}
|
||||
|
||||
if g.HelpOverlay.IsOpen() {
|
||||
g.HelpOverlay.Toggle()
|
||||
g.HelpOverlay.Close()
|
||||
|
||||
escHandled = true
|
||||
}
|
||||
@ -624,11 +619,13 @@ func (g *GameControls) OnMouseButtonDown(event d2interface.MouseEvent) bool {
|
||||
}
|
||||
|
||||
func (g *GameControls) toggleHeroStatsPanel() {
|
||||
if !g.HelpOverlay.IsOpen() {
|
||||
g.questLog.Close()
|
||||
g.heroStatsPanel.Toggle()
|
||||
g.hud.miniPanel.SetMovedRight(g.heroStatsPanel.IsOpen())
|
||||
g.updateLayout()
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GameControls) onCloseHeroStatsPanel() {
|
||||
g.hud.miniPanel.SetMovedRight(g.heroStatsPanel.IsOpen())
|
||||
@ -636,23 +633,35 @@ func (g *GameControls) onCloseHeroStatsPanel() {
|
||||
}
|
||||
|
||||
func (g *GameControls) toggleQuestLog() {
|
||||
if !g.HelpOverlay.IsOpen() {
|
||||
g.heroStatsPanel.Close()
|
||||
g.questLog.Toggle()
|
||||
g.hud.miniPanel.SetMovedRight(g.questLog.IsOpen())
|
||||
g.updateLayout()
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GameControls) onCloseQuestLog() {
|
||||
g.hud.miniPanel.SetMovedRight(g.questLog.IsOpen())
|
||||
g.updateLayout()
|
||||
}
|
||||
|
||||
func (g *GameControls) toggleHelpOverlay() {
|
||||
if !g.inventory.IsOpen() && !g.skilltree.IsOpen() && !g.heroStatsPanel.IsOpen() && !g.questLog.IsOpen() {
|
||||
g.hud.miniPanel.openDisabled()
|
||||
g.HelpOverlay.Toggle()
|
||||
g.updateLayout()
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GameControls) toggleInventoryPanel() {
|
||||
if !g.HelpOverlay.IsOpen() {
|
||||
g.skilltree.Close()
|
||||
g.inventory.Toggle()
|
||||
g.hud.miniPanel.SetMovedLeft(g.inventory.IsOpen())
|
||||
g.updateLayout()
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GameControls) onCloseInventory() {
|
||||
g.hud.miniPanel.SetMovedLeft(g.inventory.IsOpen())
|
||||
@ -660,11 +669,13 @@ func (g *GameControls) onCloseInventory() {
|
||||
}
|
||||
|
||||
func (g *GameControls) toggleSkilltreePanel() {
|
||||
if !g.HelpOverlay.IsOpen() {
|
||||
g.inventory.Close()
|
||||
g.skilltree.Toggle()
|
||||
g.hud.miniPanel.SetMovedLeft(g.skilltree.IsOpen())
|
||||
g.updateLayout()
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GameControls) onCloseSkilltree() {
|
||||
g.hud.miniPanel.SetMovedLeft(g.skilltree.IsOpen())
|
||||
|
@ -103,12 +103,6 @@ func NewQuestLog(asset *d2asset.AssetManager,
|
||||
24: 0,
|
||||
25: 0,
|
||||
26: 0,
|
||||
27: 0,
|
||||
28: 0,
|
||||
29: 0,
|
||||
30: 0,
|
||||
31: 0,
|
||||
32: 1,
|
||||
}
|
||||
|
||||
var quests [d2enum.ActsNumber]*d2ui.WidgetGroup
|
||||
|
Loading…
Reference in New Issue
Block a user