default done loading after OnLoad finishes (#447)

This commit is contained in:
David Carrell 2020-06-24 21:41:18 -05:00 committed by GitHub
parent 44ca39ce36
commit bed386be87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 4 additions and 15 deletions

View File

@ -73,7 +73,10 @@ func Advance(elapsed float64) error {
d2gui.ShowLoadScreen(0)
d2gui.HideCursor()
singleton.loadingState = LoadingState{updates: make(chan loadingUpdate)}
go handler.OnLoad(singleton.loadingState)
go func() {
handler.OnLoad(singleton.loadingState)
singleton.loadingState.Done()
}()
singleton.currentScreen = nil
singleton.loadingScreen = singleton.nextScreen
} else {

View File

@ -23,6 +23,4 @@ func (v *BlizzardIntro) OnLoad(loading d2screen.LoadingState) {
loading.Progress(0.5)
v.videoDecoder = d2video.CreateBinkDecoder(videoBytes)
loading.Done()
return
}

View File

@ -141,8 +141,6 @@ func (v *CharacterSelect) OnLoad(loading d2screen.LoadingState) {
v.characterExpLabel[i].SetPosition(xOffset, 130+((i/2)*95))
}
v.refreshGameStates()
loading.Done()
}
func (v *CharacterSelect) onScrollUpdate() {

View File

@ -91,7 +91,6 @@ func (v *Credits) OnLoad(loading d2screen.LoadingState) {
loading.Progress(0.8)
v.creditsText = append(v.LoadContributors(), v.creditsText...)
loading.Done()
}
// Render renders the credits screen

View File

@ -44,7 +44,6 @@ func CreateGame(gameClient *d2client.GameClient) *Game {
func (v *Game) OnLoad(loading d2screen.LoadingState) {
d2audio.PlayBGM("")
loading.Done()
}
func (v *Game) OnUnload() error {

View File

@ -40,8 +40,6 @@ func (g *GuiTestMain) OnLoad(loading d2screen.LoadingState) {
layout.SetVerticalAlign(d2gui.VerticalAlignMiddle)
d2gui.SetLayout(layout)
loading.Done()
}
func (g *GuiTestMain) Render(screen d2render.Surface) error {

View File

@ -249,8 +249,6 @@ func (v *MainMenu) OnLoad(loading d2screen.LoadingState) {
}
d2input.BindHandler(v)
loading.Done()
}
func (v *MainMenu) onMapTestClicked() {

View File

@ -151,8 +151,6 @@ func (met *MapEngineTest) OnLoad(loading d2screen.LoadingState) {
met.mapRenderer = d2maprenderer.CreateMapRenderer(met.mapEngine)
loading.Progress(0.7)
met.LoadRegionByIndex(met.currentRegion, met.levelPreset, met.fileIndex)
loading.Done()
}
func (met *MapEngineTest) OnUnload() error {

View File

@ -417,8 +417,6 @@ func (v *SelectHeroClass) OnLoad(loading d2screen.LoadingState) {
v.heroRenderInfo[d2enum.HeroDruid].BackWalkSprite.PlayForward()
v.heroRenderInfo[d2enum.HeroDruid].BackWalkSprite.SetPlayLengthMs(1500)
v.heroRenderInfo[d2enum.HeroDruid].BackWalkSprite.SetPlayLoop(false)
loading.Done()
}
func (v *SelectHeroClass) OnUnload() error {