游戏SDK升级,处理点击游戏座位加入游戏的情况

This commit is contained in:
huangjian
2021-12-10 13:53:27 +08:00
parent b02c8bcba4
commit e2f586a70a
6 changed files with 27 additions and 10 deletions

Binary file not shown.

View File

@@ -294,7 +294,7 @@ dependencies {
implementation files('libs/humesdk-1.0.0.aar')
implementation(name: 'SudMGP-v1.1.31.181', ext: 'aar')
implementation(name: 'SudMGP-v1.1.32.200', ext: 'aar')
// xplan flutter module
if (useFlutterAar) {

View File

@@ -80,7 +80,7 @@
<application
android:name=".application.XChatApplication"
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/app_logo"
android:label="@string/app_name"
android:largeHeap="true"

View File

@@ -5,7 +5,7 @@ package com.yizhuan.erban.avroom.game
*
*/
data class GameCfg(
val gameMode: Int = 0,
val gameMode: Int = 1,
val ui: Ui = Ui()
) {
data class Ui(
@@ -77,11 +77,12 @@ data class GameCfg(
)
data class LobbyPlayers(
val custom: Boolean = true,
val hide: Boolean = false
)
data class LobbyRule(
val hide: Boolean = false
val hide: Boolean = true
)
data class LobbySettingBtn(

View File

@@ -43,7 +43,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
}
private val TAG = "GameActivity"
private val TAG = "GameDelegate"
private var APP_CODE = ""
@@ -235,6 +235,11 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
}
override fun onGameStarted() {
LogUtils.d("onGameStarted")
if (AvRoomDataManager.get().isRoomOwner) {
notifySelfInState(true, 0)
notifySelfCaptainState(mUid)
}
}
override fun onGameDestroyed() {
@@ -368,7 +373,15 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
}
}
SudMGPMGState.APP_COMMON_SELF_CLICK_JOIN_BTN -> {
updateMyMicQueue(STATUS_NOT_READY, true)
try {
val jsonObject = JSONObject(dataJson)
val seatIndex = jsonObject.getInt("seatIndex")
updateMyMicQueue(STATUS_NOT_READY, true, seatIndex)
} catch (e: Exception) {
e.printStackTrace()
}
}
SudMGPMGState.APP_COMMON_SELF_CLICK_START_BTN -> {
notifySelfPlayingState(true)
@@ -436,11 +449,11 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
}
}
private fun updateMyMicQueue(gameStatus: Int, isJoin: Boolean = false) {
private fun updateMyMicQueue(gameStatus: Int, isJoin: Boolean = false, seatIndex: Int = -1) {
UserModel.get().cacheLoginUserInfo?.gameStatus = gameStatus
val position = AvRoomDataManager.get().getMicPosition(mUid)
if (position != AvRoomDataManager.POSITON_NOT_ON_MIC) {
if (isJoin) notifySelfInState(true)
if (isJoin) notifySelfInState(true, seatIndex)
homePartyModel.updateMyMicQueue(
position,
AvRoomDataManager.get().roomId.toString(),
@@ -457,7 +470,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
AvRoomDataManager.get().roomId.toString(),
false, object : CallBack<String> {
override fun onSuccess(data: String?) {
notifySelfInState(true)
notifySelfInState(true, seatIndex)
}
override fun onFail(code: Int, error: String?) {
@@ -552,7 +565,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
}
}
fun notifySelfInState(isIn: Boolean) {
fun notifySelfInState(isIn: Boolean, seatIndex: Int = -1) {
try {
if (!isIn) {
notifySelfReadyState(false)
@@ -562,6 +575,9 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
//状态数据
val jsonObject = JSONObject()
jsonObject.put("isIn", isIn) // true 加入游戏false 退出游戏
if (seatIndex != -1) {
jsonObject.put("seatIndex", seatIndex)
}
jsonObject.put("teamId", 1) //哪一队伍(2v2,4v4)
val dataJson = jsonObject.toString()