@@ -3,6 +3,8 @@ package com.osudroid.ui.v2
33import com.edlplan.framework.easing.*
44import com.osudroid.data.*
55import com.osudroid.multiplayer.*
6+ import com.osudroid.multiplayer.api.RoomAPI
7+ import com.osudroid.multiplayer.api.data.PlayerStatus
68import com.osudroid.utils.ModHashMap
79import com.reco1l.andengine.*
810import com.reco1l.andengine.component.*
@@ -130,31 +132,29 @@ class GameLoaderScene(private val gameScene: GameScene, private val beatmapInfo:
130132 anchor = Anchor .BottomLeft
131133 origin = Anchor .BottomLeft
132134 x = 60f
133- y = if ( Multiplayer .isMultiplayer) - 60f else - 30f
135+ y = - 30f
134136 spacing = 30f
135137
136138 + CircularProgressBar ().apply {
137139 width = 32f
138140 height = 32f
139141 }
140142
141- if (! Multiplayer .isMultiplayer) {
142- + UITextButton ().apply {
143- text = " Back"
143+ + UITextButton ().apply {
144+ text = " Back"
144145
145- leadingIcon = UISprite ().apply {
146- textureRegion = ResourceManager .getInstance().getTexture(" back-arrow" )
147- width = 28f
148- height = 28f
149- }
150-
151- onActionUp = {
152- ResourceManager .getInstance().getSound(" click-short-confirm" )?.play()
153- cancel()
154- }
146+ leadingIcon = UISprite ().apply {
147+ textureRegion = ResourceManager .getInstance().getTexture(" back-arrow" )
148+ width = 28f
149+ height = 28f
150+ }
155151
156- onActionCancel = { ResourceManager .getInstance().getSound(" click-short" )?.play() }
152+ onActionUp = {
153+ ResourceManager .getInstance().getSound(" click-short-confirm" )?.play()
154+ cancel()
157155 }
156+
157+ onActionCancel = { ResourceManager .getInstance().getSound(" click-short" )?.play() }
158158 }
159159 }
160160
@@ -163,15 +163,18 @@ class GameLoaderScene(private val gameScene: GameScene, private val beatmapInfo:
163163 }
164164
165165 /* *
166- * Cancels loading and goes back to the song menu.
166+ * Cancels loading and goes back to the song menu, or to the multiplayer room if in multiplayer .
167167 */
168168 fun cancel () {
169+ gameScene.cancelLoading()
170+
169171 if (Multiplayer .isMultiplayer) {
172+ // Inform that the player has canceled loading.
173+ RoomAPI .setPlayerStatus(PlayerStatus .NotReady )
174+ Multiplayer .roomScene?.show()
170175 return
171176 }
172177
173- gameScene.cancelLoading()
174-
175178 val global = GlobalManager .getInstance()
176179 val songMenu = global.songMenu
177180 val selectedBeatmap = songMenu.selectedBeatmap
0 commit comments