feat:完善提前中端结果展示
This commit is contained in:
30
core/src/main/java/com/chwl/core/bean/game/GameResultBean.kt
Normal file
30
core/src/main/java/com/chwl/core/bean/game/GameResultBean.kt
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.chwl.core.bean.game
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import java.io.Serializable
|
||||
import java.math.BigDecimal
|
||||
|
||||
@Keep
|
||||
class GameResultBean : Serializable {
|
||||
var rank: Int? = null
|
||||
var uid: Long? = null
|
||||
var avatar: String? = null
|
||||
var nick: String? = null
|
||||
var winNum: Double? = null
|
||||
var isWin: Boolean? = null
|
||||
var isEscaped: Boolean? = null
|
||||
|
||||
fun getScoreStr(): String {
|
||||
val number = winNum ?: return "0"
|
||||
try {
|
||||
val bigDecimal = BigDecimal.valueOf(number)
|
||||
val coinsStr = bigDecimal.stripTrailingZeros().toPlainString()
|
||||
if (number > 0) {
|
||||
return "+$coinsStr"
|
||||
}
|
||||
return coinsStr
|
||||
} catch (e: Exception) {
|
||||
return number.toString()
|
||||
}
|
||||
}
|
||||
}
|
@@ -8,7 +8,6 @@ class GameRoomData : Serializable {
|
||||
val mgId: String? = null
|
||||
val gameRoomIcon: String? = null
|
||||
val configJson: String? = null
|
||||
val gameSelectCfg: String? = null
|
||||
val scores: MutableList<Double>? = null
|
||||
|
||||
// 匹配状态(0:匹配中、1:匹配成功、2:游戏结束、3:匹配失败)
|
||||
|
@@ -0,0 +1,26 @@
|
||||
package com.chwl.core.bean.game
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.chwl.library.utils.json.JsonUtils
|
||||
|
||||
@Keep
|
||||
class SudGameConfigBean {
|
||||
private val app_common_game_setting_select_info: HashMap<String, Any>? = null
|
||||
|
||||
private val ui: HashMap<String, Any>? = null
|
||||
|
||||
fun getGameSettingSelectConfigStr(): String? {
|
||||
return JsonUtils.toJson(app_common_game_setting_select_info)
|
||||
}
|
||||
|
||||
fun getGameConfigStr(): String? {
|
||||
val uiMap = ui
|
||||
if (uiMap.isNullOrEmpty()) {
|
||||
return null
|
||||
}
|
||||
return JsonUtils.toJson(ConfigModel(uiMap))
|
||||
}
|
||||
|
||||
@Keep
|
||||
private data class ConfigModel(var ui: HashMap<String, Any>)
|
||||
}
|
@@ -11,7 +11,6 @@ abstract class BaseRoomInfo<T> : Serializable {
|
||||
|
||||
val chatRoomId: Long? = null
|
||||
|
||||
// 云信ID
|
||||
val roomId: Long? = null
|
||||
|
||||
val roomMics: MutableList<RoomMicBean>? = null
|
||||
|
@@ -2,13 +2,19 @@ package com.chwl.core.im.custom.bean
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.alibaba.fastjson.JSONObject
|
||||
import com.chwl.core.bean.game.GameRoomInfo
|
||||
import com.chwl.library.utils.json.JsonUtils
|
||||
import com.google.gson.Gson
|
||||
|
||||
@Keep
|
||||
class GameForcedEndAttachment : CustomAttachment {
|
||||
|
||||
var msgData: GameForcedEndMsgBean? = null
|
||||
|
||||
constructor() : super()
|
||||
constructor(first: Int, second: Int) : super(first, second)
|
||||
|
||||
override fun parseData(data: JSONObject?) {
|
||||
msgData = JsonUtils.fromJson(data?.toJSONString(), GameForcedEndMsgBean::class.java)
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.chwl.core.im.custom.bean
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.chwl.core.bean.game.GameResultBean
|
||||
|
||||
@Keep
|
||||
class GameForcedEndMsgBean {
|
||||
val results: List<GameResultBean>? = null
|
||||
val matchStatus: Int? = null
|
||||
}
|
@@ -3,6 +3,7 @@ package com.chwl.core.im.custom.bean
|
||||
import androidx.annotation.Keep
|
||||
import com.alibaba.fastjson.JSONObject
|
||||
import com.chwl.core.bean.game.GameRoomInfo
|
||||
import com.chwl.library.utils.json.JsonUtils
|
||||
import com.google.gson.Gson
|
||||
|
||||
@Keep
|
||||
@@ -13,10 +14,6 @@ class GameQueueChangedAttachment : CustomAttachment {
|
||||
constructor(first: Int, second: Int) : super(first, second)
|
||||
|
||||
override fun parseData(data: JSONObject?) {
|
||||
try {
|
||||
gameInfo = Gson().fromJson(data?.toJSONString(), GameRoomInfo::class.java)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
gameInfo = JsonUtils.fromJson(data?.toJSONString(), GameRoomInfo::class.java)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user