小游戏相关各种异常状态处理
This commit is contained in:
@@ -313,7 +313,10 @@ public class ButtonItemFactory {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.data_card_kickout_room_click, "资料卡片-踢出房间");
|
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.data_card_kickout_room_click, "资料卡片-踢出房间");
|
||||||
|
if (AvRoomDataManager.get().isGamePlaying(AvRoomDataManager.get().getMicPosition(account))) {
|
||||||
|
SingleToastUtil.showToast("不可以踢出在游戏中的用户!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
new DialogManager(context).showOkCancelDialog((AvRoomDataManager.get().isOpenKTV() ? "KTV模式下将自动删除ta的歌曲," : "") + "是否要将此用户踢出房间?",
|
new DialogManager(context).showOkCancelDialog((AvRoomDataManager.get().isOpenKTV() ? "KTV模式下将自动删除ta的歌曲," : "") + "是否要将此用户踢出房间?",
|
||||||
true, new DialogManager.AbsOkDialogListener() {
|
true, new DialogManager.AbsOkDialogListener() {
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
@@ -421,7 +424,10 @@ public class ButtonItemFactory {
|
|||||||
String nick) {
|
String nick) {
|
||||||
return new ViewItem("拉入黑名单", R.drawable.icon_dialog_mark_black_list, () -> {
|
return new ViewItem("拉入黑名单", R.drawable.icon_dialog_mark_black_list, () -> {
|
||||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.data_dard_join_blacklist_click, "资料卡片-加入黑名单");
|
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.data_dard_join_blacklist_click, "资料卡片-加入黑名单");
|
||||||
|
if (AvRoomDataManager.get().isGamePlaying(AvRoomDataManager.get().getMicPosition(account))) {
|
||||||
|
SingleToastUtil.showToast("不可以拉黑在游戏中的用户!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
new DialogManager(context).showOkCancelDialog(
|
new DialogManager(context).showOkCancelDialog(
|
||||||
"是否将" + nick + "加入黑名单?加入后他将无法进入此房间" +
|
"是否将" + nick + "加入黑名单?加入后他将无法进入此房间" +
|
||||||
(AvRoomDataManager.get().mCurrentRoomInfo != null && AvRoomDataManager.get().isOpenKTV() ? "KTV模式下将自动删除ta的歌曲" : ""), true,
|
(AvRoomDataManager.get().mCurrentRoomInfo != null && AvRoomDataManager.get().isOpenKTV() ? "KTV模式下将自动删除ta的歌曲" : ""), true,
|
||||||
|
@@ -927,6 +927,12 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
|
|
||||||
|
if (AvRoomDataManager.get().isGamePlaying(AvRoomDataManager.get().getMicPosition(AuthModel.get().getCurrentUid()))) {
|
||||||
|
getDialogManager().showOkCancelDialog("游戏中最小化房间默认逃跑,确定进行此操作?", false,
|
||||||
|
this::minRoomCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (mNobleOpenNoticeView != null && mNobleOpenNoticeView.getVisibility() == VISIBLE) {
|
if (mNobleOpenNoticeView != null && mNobleOpenNoticeView.getVisibility() == VISIBLE) {
|
||||||
mNobleOpenNoticeView.setVisibility(View.GONE);
|
mNobleOpenNoticeView.setVisibility(View.GONE);
|
||||||
} else if (AvRoomDataManager.get().haveStartDragon) {
|
} else if (AvRoomDataManager.get().haveStartDragon) {
|
||||||
|
@@ -175,7 +175,11 @@ public class RoomSettingActivity extends BaseMvpActivity<IRoomSettingView, RoomS
|
|||||||
*/
|
*/
|
||||||
private void initLeaveMode() {
|
private void initLeaveMode() {
|
||||||
|
|
||||||
if (AvRoomDataManager.get().isRoomOwner() && !AvRoomDataManager.get().isCpRoom() && roomInfo.getIsPermitRoom() == 1) {
|
if (AvRoomDataManager.get().isRoomOwner() &&
|
||||||
|
!AvRoomDataManager.get().isCpRoom() &&
|
||||||
|
roomInfo.getIsPermitRoom() == 1 &&
|
||||||
|
!AvRoomDataManager.get().isOpenGame()
|
||||||
|
) {
|
||||||
binding.leaveModeLayout.setVisibility(View.VISIBLE);
|
binding.leaveModeLayout.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
binding.leaveModeLayout.setVisibility(View.GONE);
|
binding.leaveModeLayout.setVisibility(View.GONE);
|
||||||
@@ -587,6 +591,7 @@ public class RoomSettingActivity extends BaseMvpActivity<IRoomSettingView, RoomS
|
|||||||
R.drawable.icon_room_set_lock_true : R.drawable.icon_room_set_lock_false);
|
R.drawable.icon_room_set_lock_true : R.drawable.icon_room_set_lock_false);
|
||||||
// 排麦模式的开关状态
|
// 排麦模式的开关状态
|
||||||
boolean isQueuingMicro = AvRoomDataManager.get().isQueuingMicro() || AvRoomDataManager.get().isOpenPKMode();
|
boolean isQueuingMicro = AvRoomDataManager.get().isQueuingMicro() || AvRoomDataManager.get().isOpenPKMode();
|
||||||
|
binding.switchQueuingMicroMode.setVisibility(AvRoomDataManager.get().isOpenGame() ? View.GONE : View.VISIBLE);
|
||||||
binding.switchQueuingMicroMode.setSelected(isQueuingMicro);
|
binding.switchQueuingMicroMode.setSelected(isQueuingMicro);
|
||||||
binding.switchQueuingMicroMode.setImageResource(isQueuingMicro ?
|
binding.switchQueuingMicroMode.setImageResource(isQueuingMicro ?
|
||||||
R.drawable.icon_room_set_lock_true : R.drawable.icon_room_set_lock_false);
|
R.drawable.icon_room_set_lock_true : R.drawable.icon_room_set_lock_false);
|
||||||
|
@@ -62,6 +62,10 @@ class GameMicroViewAdapter(context: Context?) : BaseMicroViewAdapter(context) {
|
|||||||
tvGameStatus.text = "已准备"
|
tvGameStatus.text = "已准备"
|
||||||
R.drawable.bg_game_status_ready
|
R.drawable.bg_game_status_ready
|
||||||
}
|
}
|
||||||
|
it.gameStatus == 3 -> {
|
||||||
|
tvGameStatus.text = "游戏中"
|
||||||
|
R.drawable.bg_game_status_playing
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
tvGameStatus.text = "未准备"
|
tvGameStatus.text = "未准备"
|
||||||
R.drawable.bg_game_status_not_ready
|
R.drawable.bg_game_status_not_ready
|
||||||
|
@@ -125,6 +125,9 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
|||||||
if (SuperAdminUtil.isSuperAdmin()) {
|
if (SuperAdminUtil.isSuperAdmin()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (AvRoomDataManager.get().isOpenGame()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (AvRoomDataManager.get().isManager() && !AvRoomDataManager.get().isCpRoom()) {
|
if (AvRoomDataManager.get().isManager() && !AvRoomDataManager.get().isCpRoom()) {
|
||||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||||
if (roomInfo == null) {
|
if (roomInfo == null) {
|
||||||
@@ -160,6 +163,9 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
|||||||
if (SuperAdminUtil.isSuperAdmin()) {
|
if (SuperAdminUtil.isSuperAdmin()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (AvRoomDataManager.get().isOpenGame()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||||
if (roomInfo == null || roomInfo.getIsPermitRoom() != 1) {
|
if (roomInfo == null || roomInfo.getIsPermitRoom() != 1) {
|
||||||
return;
|
return;
|
||||||
@@ -198,6 +204,9 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
|||||||
if (SuperAdminUtil.isSuperAdmin()) {
|
if (SuperAdminUtil.isSuperAdmin()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (AvRoomDataManager.get().isOpenGame()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (AvRoomDataManager.get().isManager() && !AvRoomDataManager.get().isCpRoom()) {
|
if (AvRoomDataManager.get().isManager() && !AvRoomDataManager.get().isCpRoom()) {
|
||||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||||
if (roomInfo == null) {
|
if (roomInfo == null) {
|
||||||
|
@@ -293,13 +293,13 @@ class GameRoomFragment() : BaseMvpFragment<IGameRoomView?, GameRoomPresenter?>()
|
|||||||
gameBinding.microView.bindAdapter(GameMicroViewAdapter(context))
|
gameBinding.microView.bindAdapter(GameMicroViewAdapter(context))
|
||||||
|
|
||||||
gameBinding.tvShowMiniMic.setOnClickListener {
|
gameBinding.tvShowMiniMic.setOnClickListener {
|
||||||
gameBinding.microView.bindAdapter(GameMiniMicroViewAdapter(context))
|
|
||||||
gameBinding.tvShowMiniMic.isVisible = false
|
|
||||||
gameBinding.microView.updateLayoutParams<LinearLayout.LayoutParams> {
|
gameBinding.microView.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||||
width = LinearLayout.LayoutParams.WRAP_CONTENT
|
width = LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
marginStart = ScreenUtil.dip2px(2f)
|
marginStart = ScreenUtil.dip2px(2f)
|
||||||
marginEnd = ScreenUtil.dip2px(2f)
|
marginEnd = ScreenUtil.dip2px(2f)
|
||||||
}
|
}
|
||||||
|
gameBinding.microView.bindAdapter(GameMiniMicroViewAdapter(context))
|
||||||
|
gameBinding.tvShowMiniMic.isVisible = false
|
||||||
gameBinding.microView.postDelayed({
|
gameBinding.microView.postDelayed({
|
||||||
gameBinding.ivShowMic.isVisible = true
|
gameBinding.ivShowMic.isVisible = true
|
||||||
gameBinding.llMicView.setBackgroundResource(R.drawable.bg_mini_mic_entrance)
|
gameBinding.llMicView.setBackgroundResource(R.drawable.bg_mini_mic_entrance)
|
||||||
@@ -754,7 +754,7 @@ class GameRoomFragment() : BaseMvpFragment<IGameRoomView?, GameRoomPresenter?>()
|
|||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
override fun onSendGiftBtnClick(
|
override fun onSendGiftBtnClick(
|
||||||
giftInfo: GiftInfo, micMemberInfos: List<MicMemberInfo>,
|
giftInfo: GiftInfo, micMemberInfos: List<MicMemberInfo>,
|
||||||
number: Int, msg: String, isKnap: Boolean,
|
number: Int, msg: String?, isKnap: Boolean,
|
||||||
isWholdMic: Boolean, callback: SenGiftCallback
|
isWholdMic: Boolean, callback: SenGiftCallback
|
||||||
) {
|
) {
|
||||||
val targetUids: MutableList<Long> = ArrayList()
|
val targetUids: MutableList<Long> = ArrayList()
|
||||||
|
@@ -37,6 +37,7 @@ import com.yizhuan.erban.ui.widget.ShareDialog;
|
|||||||
import com.yizhuan.erban.utils.RegexUtil;
|
import com.yizhuan.erban.utils.RegexUtil;
|
||||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||||
import com.yizhuan.xchat_android_core.Constants;
|
import com.yizhuan.xchat_android_core.Constants;
|
||||||
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
import com.yizhuan.xchat_android_core.gift.bean.GiftMultiReceiverInfo;
|
import com.yizhuan.xchat_android_core.gift.bean.GiftMultiReceiverInfo;
|
||||||
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
|
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
|
||||||
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagGifts;
|
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagGifts;
|
||||||
@@ -230,12 +231,19 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
|
|||||||
gameMainBinding.tvCurrGame.setOnClickListener(v -> {
|
gameMainBinding.tvCurrGame.setOnClickListener(v -> {
|
||||||
if (gameMainBinding.rvGame.getVisibility() == View.VISIBLE) {
|
if (gameMainBinding.rvGame.getVisibility() == View.VISIBLE) {
|
||||||
gameMainBinding.rvGame.setVisibility(View.GONE);
|
gameMainBinding.rvGame.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
if (AvRoomDataManager.get().isGamePlaying()) {
|
||||||
|
SingleToastUtil.showToast("游戏中不可以切换游戏或玩法!");
|
||||||
} else {
|
} else {
|
||||||
gameMainBinding.rvGame.setVisibility(View.VISIBLE);
|
gameMainBinding.rvGame.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gameAdapter.setOnItemClickListener((adapter, view, position) -> {
|
gameAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||||
|
if (AvRoomDataManager.get().isGamePlaying()) {
|
||||||
|
SingleToastUtil.showToast("游戏中不可以切换游戏或玩法!");
|
||||||
|
}
|
||||||
GameInfo gameInfo = gameAdapter.getItem(position);
|
GameInfo gameInfo = gameAdapter.getItem(position);
|
||||||
if (gameInfo != null) {
|
if (gameInfo != null) {
|
||||||
int type;
|
int type;
|
||||||
@@ -529,6 +537,11 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
|
|||||||
ButtonItem buttonItem1 = new ButtonItem("退出房间", new ButtonItem.OnClickListener() {
|
ButtonItem buttonItem1 = new ButtonItem("退出房间", new ButtonItem.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
|
if (AvRoomDataManager.get().isGamePlaying(AvRoomDataManager.get().getMicPosition(AuthModel.get().getCurrentUid()))){
|
||||||
|
getDialogManager().showOkCancelDialog("游戏中退出房间默认逃跑,确定进行此操作?", false,
|
||||||
|
() -> ((AVRoomActivity) getActivity()).toBack());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (AvRoomDataManager.get().isOpenKTV() && AvRoomDataManager.get().isOwnerOnMic()) {
|
if (AvRoomDataManager.get().isOpenKTV() && AvRoomDataManager.get().isOwnerOnMic()) {
|
||||||
getDialogManager().showOkCancelDialog("KTV模式下退出房间会移除您已点的所有歌曲,确定进行此操作?", false,
|
getDialogManager().showOkCancelDialog("KTV模式下退出房间会移除您已点的所有歌曲,确定进行此操作?", false,
|
||||||
() -> ((AVRoomActivity) getActivity()).toBack());
|
() -> ((AVRoomActivity) getActivity()).toBack());
|
||||||
@@ -563,7 +576,12 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
|
|||||||
ButtonItem buttonItem2 = new ButtonItem("最小化房间", new ButtonItem.OnClickListener() {
|
ButtonItem buttonItem2 = new ButtonItem("最小化房间", new ButtonItem.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
((AVRoomActivity) getActivity()).onBackPressed();
|
if (AvRoomDataManager.get().isGamePlaying(AvRoomDataManager.get().getMicPosition(AuthModel.get().getCurrentUid()))){
|
||||||
|
getDialogManager().showOkCancelDialog("游戏中最小化房间默认逃跑,确定进行此操作?", false,
|
||||||
|
() -> ((AVRoomActivity) getActivity()).toBack());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getActivity().onBackPressed();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ButtonItem buttonItem3 = new ButtonItem("举报房间", new ButtonItem.OnClickListener() {
|
ButtonItem buttonItem3 = new ButtonItem("举报房间", new ButtonItem.OnClickListener() {
|
||||||
|
@@ -14,6 +14,7 @@ import com.google.gson.Gson
|
|||||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||||
import com.yizhuan.xchat_android_core.room.game.GameModel
|
import com.yizhuan.xchat_android_core.room.game.GameModel
|
||||||
|
import com.yizhuan.xchat_android_core.room.game.GameStatus
|
||||||
import com.yizhuan.xchat_android_core.room.model.HomePartyModel
|
import com.yizhuan.xchat_android_core.room.model.HomePartyModel
|
||||||
import com.yizhuan.xchat_android_core.user.UserModel
|
import com.yizhuan.xchat_android_core.user.UserModel
|
||||||
import com.yizhuan.xchat_android_core.utils.LogUtils
|
import com.yizhuan.xchat_android_core.utils.LogUtils
|
||||||
@@ -40,7 +41,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
|||||||
const val STATUS_NOT_JOIN = 0
|
const val STATUS_NOT_JOIN = 0
|
||||||
const val STATUS_NOT_READY = 1
|
const val STATUS_NOT_READY = 1
|
||||||
const val STATUS_READY = 2
|
const val STATUS_READY = 2
|
||||||
|
const val STATUS_PLAYING = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
private val TAG = "GameDelegate"
|
private val TAG = "GameDelegate"
|
||||||
@@ -118,6 +119,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
|||||||
fun updateGame(mgId: Long?) {
|
fun updateGame(mgId: Long?) {
|
||||||
if (mgId == null || mgId == 0L || mgId == mMGID || iSudFSTAPP == null) return
|
if (mgId == null || mgId == 0L || mgId == mMGID || iSudFSTAPP == null) return
|
||||||
mMGID = mgId
|
mMGID = mgId
|
||||||
|
updateMyMicQueue(GameStatus.STATUS_NOT_JOIN)
|
||||||
loadMG(activity, mUid, mRoomID, APP_CODE, mMGID, mLanguage)
|
loadMG(activity, mUid, mRoomID, APP_CODE, mMGID, mLanguage)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,11 +239,6 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onGameStarted() {
|
override fun onGameStarted() {
|
||||||
LogUtils.d("onGameStarted")
|
|
||||||
if (AvRoomDataManager.get().isRoomOwner) {
|
|
||||||
notifySelfInState(true, 0)
|
|
||||||
notifySelfCaptainState(mUid)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onGameDestroyed() {
|
override fun onGameDestroyed() {
|
||||||
@@ -355,9 +352,8 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
|||||||
) {
|
) {
|
||||||
Log.d(TAG, "onGameStateChange state:$state--dataJson:$dataJson")
|
Log.d(TAG, "onGameStateChange state:$state--dataJson:$dataJson")
|
||||||
when (state) {
|
when (state) {
|
||||||
SudMGPMGState.MG_COMMON_PUBLIC_MESSAGE -> showToast("游戏:公屏消息")
|
//SudMGPMGState.MG_COMMON_PUBLIC_MESSAGE -> showToast("游戏:公屏消息")
|
||||||
SudMGPMGState.MG_COMMON_KEY_WORD_TO_HIT -> {
|
SudMGPMGState.MG_COMMON_KEY_WORD_TO_HIT -> {
|
||||||
showToast("游戏:关键词状态")
|
|
||||||
if (TextUtils.isEmpty(dataJson)) {
|
if (TextUtils.isEmpty(dataJson)) {
|
||||||
setKeyWord(null)
|
setKeyWord(null)
|
||||||
} else {
|
} else {
|
||||||
@@ -378,7 +374,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
val jsonObject = JSONObject(dataJson)
|
val jsonObject = JSONObject(dataJson)
|
||||||
val seatIndex = jsonObject.getInt("seatIndex")
|
val seatIndex = jsonObject.optInt("seatIndex",-1)
|
||||||
updateMyMicQueue(STATUS_NOT_READY, true, seatIndex)
|
updateMyMicQueue(STATUS_NOT_READY, true, seatIndex)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
@@ -424,7 +420,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
|||||||
if (retCode == 100201) {
|
if (retCode == 100201) {
|
||||||
showToast("100201: 战斗时房间不能加入")
|
showToast("100201: 战斗时房间不能加入")
|
||||||
} else {
|
} else {
|
||||||
showToast("mg_common_player_in 状态失败, 错误码:$retCode")
|
//showToast("状态失败, 错误码:$retCode")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -433,6 +429,9 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
|||||||
if (jsonObject.has("teamId")) {
|
if (jsonObject.has("teamId")) {
|
||||||
teamId = jsonObject.getInt("teamId")
|
teamId = jsonObject.getInt("teamId")
|
||||||
}
|
}
|
||||||
|
if (AvRoomDataManager.get().isRoomOwner){
|
||||||
|
notifySelfCaptainState(mUid)
|
||||||
|
}
|
||||||
//showToast("加入游戏分组:$teamId")
|
//showToast("加入游戏分组:$teamId")
|
||||||
} else { // 未加入
|
} else { // 未加入
|
||||||
var reason = 0
|
var reason = 0
|
||||||
@@ -462,7 +461,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
|||||||
UserModel.get().cacheLoginUserInfo
|
UserModel.get().cacheLoginUserInfo
|
||||||
).subscribe()
|
).subscribe()
|
||||||
} else if (isJoin) {
|
} else if (isJoin) {
|
||||||
val upPosition = AvRoomDataManager.get().findFreePosition()
|
val upPosition = AvRoomDataManager.get().findGamePosition()
|
||||||
if (upPosition == Int.MIN_VALUE) {
|
if (upPosition == Int.MIN_VALUE) {
|
||||||
showToast("当前游戏人数已满!")
|
showToast("当前游戏人数已满!")
|
||||||
} else {
|
} else {
|
||||||
@@ -535,11 +534,12 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
val isPlaying = jsonObject.getBoolean("isPlaying")
|
val isPlaying = jsonObject.getBoolean("isPlaying")
|
||||||
AvRoomDataManager.get().isGamePlaying = isPlaying
|
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
onGameStatusChangeListener?.onGameStart()
|
onGameStatusChangeListener?.onGameStart()
|
||||||
|
updateMyMicQueue(STATUS_PLAYING)
|
||||||
} else {
|
} else {
|
||||||
onGameStatusChangeListener?.onGameEnd()
|
onGameStatusChangeListener?.onGameEnd()
|
||||||
|
updateMyMicQueue(STATUS_NOT_READY)
|
||||||
var reason = 0
|
var reason = 0
|
||||||
if (jsonObject.has("reason")) {
|
if (jsonObject.has("reason")) {
|
||||||
reason = jsonObject.getInt("reason")
|
reason = jsonObject.getInt("reason")
|
||||||
@@ -674,6 +674,18 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isPlaying(): Boolean {
|
||||||
|
val dataJson = iSudFSTAPP?.getGameState(SudMGPMGState.MG_COMMON_PLAYER_PLAYING)
|
||||||
|
LogUtils.d(dataJson)
|
||||||
|
try {
|
||||||
|
val jsonObject = JSONObject(dataJson)
|
||||||
|
return jsonObject.getBoolean("isPlaying")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun onStart() {
|
fun onStart() {
|
||||||
iSudFSTAPP?.startMG() //启动游戏
|
iSudFSTAPP?.startMG() //启动游戏
|
||||||
|
@@ -6,6 +6,7 @@ import android.graphics.Point;
|
|||||||
import android.graphics.drawable.AnimationDrawable;
|
import android.graphics.drawable.AnimationDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Log;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
@@ -17,6 +18,8 @@ import com.yizhuan.erban.R;
|
|||||||
import com.yizhuan.erban.avroom.adapter.BaseMicroViewAdapter;
|
import com.yizhuan.erban.avroom.adapter.BaseMicroViewAdapter;
|
||||||
import com.yizhuan.erban.avroom.adapter.CpMicroViewAdapter;
|
import com.yizhuan.erban.avroom.adapter.CpMicroViewAdapter;
|
||||||
import com.yizhuan.erban.avroom.adapter.DatingMicroViewAdapter;
|
import com.yizhuan.erban.avroom.adapter.DatingMicroViewAdapter;
|
||||||
|
import com.yizhuan.erban.avroom.adapter.GameMicroViewAdapter;
|
||||||
|
import com.yizhuan.erban.avroom.adapter.GameMiniMicroViewAdapter;
|
||||||
import com.yizhuan.erban.avroom.adapter.MicroViewAdapter;
|
import com.yizhuan.erban.avroom.adapter.MicroViewAdapter;
|
||||||
import com.yizhuan.erban.avroom.adapter.OnMicroItemClickListener;
|
import com.yizhuan.erban.avroom.adapter.OnMicroItemClickListener;
|
||||||
import com.yizhuan.erban.ui.anim.AnimFactory;
|
import com.yizhuan.erban.ui.anim.AnimFactory;
|
||||||
@@ -31,6 +34,7 @@ import com.yizhuan.xchat_android_core.noble.NobleResourceType;
|
|||||||
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
||||||
import com.yizhuan.xchat_android_core.room.event.ReceiveFaceEvent;
|
import com.yizhuan.xchat_android_core.room.event.ReceiveFaceEvent;
|
||||||
import com.yizhuan.xchat_android_core.room.face.FaceReceiveInfo;
|
import com.yizhuan.xchat_android_core.room.face.FaceReceiveInfo;
|
||||||
|
import com.yizhuan.xchat_android_core.utils.LogUtils;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@@ -60,6 +64,7 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
|||||||
private boolean isNeedResetMicCenterPoint = true;
|
private boolean isNeedResetMicCenterPoint = true;
|
||||||
|
|
||||||
private DatingItemDecoration datingItemDecoration;
|
private DatingItemDecoration datingItemDecoration;
|
||||||
|
private OnMicroItemClickListener onMicroItemClickListener;
|
||||||
|
|
||||||
public MicroView(Context context) {
|
public MicroView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -74,8 +79,6 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
|||||||
init(context);
|
init(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private OnMicroItemClickListener onMicroItemClickListener;
|
|
||||||
|
|
||||||
public void setOnMicroItemClickListener(OnMicroItemClickListener onMicroItemClickListener) {
|
public void setOnMicroItemClickListener(OnMicroItemClickListener onMicroItemClickListener) {
|
||||||
this.onMicroItemClickListener = onMicroItemClickListener;
|
this.onMicroItemClickListener = onMicroItemClickListener;
|
||||||
if (recyclerView != null && recyclerView.getAdapter() instanceof BaseMicroViewAdapter) {
|
if (recyclerView != null && recyclerView.getAdapter() instanceof BaseMicroViewAdapter) {
|
||||||
@@ -147,7 +150,9 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
|||||||
@Override
|
@Override
|
||||||
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||||
//高度和位置都没发生变化,就没必要要reset了
|
//高度和位置都没发生变化,就没必要要reset了
|
||||||
if (top == oldTop && bottom == oldBottom) return;
|
LogUtils.d("top == oldTop=" + (top == oldTop) + " bottom == oldBottom=" + (bottom == oldBottom));
|
||||||
|
LogUtils.d("left= " + left + " right= " + right);
|
||||||
|
if (top == oldTop && bottom == oldBottom && left == oldLeft && right == oldRight) return;
|
||||||
if (isNeedResetMicCenterPoint) {//这里有时候会重复调用,简单处理下(都是在500毫秒内重复调用的)
|
if (isNeedResetMicCenterPoint) {//这里有时候会重复调用,简单处理下(都是在500毫秒内重复调用的)
|
||||||
isNeedResetMicCenterPoint = false;
|
isNeedResetMicCenterPoint = false;
|
||||||
recyclerView.post(() -> {
|
recyclerView.post(() -> {
|
||||||
@@ -206,6 +211,7 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
|||||||
face.setLayoutParams(params);
|
face.setLayoutParams(params);
|
||||||
}
|
}
|
||||||
Point point = new Point(x, y);
|
Point point = new Point(x, y);
|
||||||
|
LogUtils.d("x= " + x + " y= " + y);
|
||||||
centerPoints.put(micPosition, point);
|
centerPoints.put(micPosition, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,8 +229,8 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
|||||||
} else {
|
} else {
|
||||||
bindAdapter(new MicroViewAdapter(mContext));
|
bindAdapter(new MicroViewAdapter(mContext));
|
||||||
}
|
}
|
||||||
giftWidth = UIUtil.dip2px(mContext, 16);
|
giftWidth = UIUtil.dip2px(mContext, 80);
|
||||||
giftHeight = UIUtil.dip2px(mContext, 16);
|
giftHeight = UIUtil.dip2px(mContext, 80);
|
||||||
|
|
||||||
faceImageViews = new SparseArray<>(10);
|
faceImageViews = new SparseArray<>(10);
|
||||||
dragonBarImageViews = new SparseArray<>(9);
|
dragonBarImageViews = new SparseArray<>(9);
|
||||||
@@ -356,6 +362,14 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
|||||||
|
|
||||||
|
|
||||||
public void bindAdapter(BaseMicroViewAdapter adapter) {
|
public void bindAdapter(BaseMicroViewAdapter adapter) {
|
||||||
|
if (adapter instanceof GameMicroViewAdapter) {
|
||||||
|
giftWidth = UIUtil.dip2px(mContext, 60);
|
||||||
|
giftHeight = UIUtil.dip2px(mContext, 60);
|
||||||
|
}
|
||||||
|
if (adapter instanceof GameMiniMicroViewAdapter) {
|
||||||
|
giftWidth = UIUtil.dip2px(mContext, 16);
|
||||||
|
giftHeight = UIUtil.dip2px(mContext, 16);
|
||||||
|
}
|
||||||
if (adapter instanceof DatingMicroViewAdapter) {
|
if (adapter instanceof DatingMicroViewAdapter) {
|
||||||
if (datingItemDecoration == null) datingItemDecoration = new DatingItemDecoration();
|
if (datingItemDecoration == null) datingItemDecoration = new DatingItemDecoration();
|
||||||
recyclerView.addItemDecoration(datingItemDecoration);
|
recyclerView.addItemDecoration(datingItemDecoration);
|
||||||
|
@@ -108,7 +108,7 @@ public class OpenRoomHelper {
|
|||||||
public void acceptThrowable(RoomInfo roomInfo, Throwable throwable) {
|
public void acceptThrowable(RoomInfo roomInfo, Throwable throwable) {
|
||||||
super.acceptThrowable(roomInfo, throwable);
|
super.acceptThrowable(roomInfo, throwable);
|
||||||
if (roomInfo != null) {
|
if (roomInfo != null) {
|
||||||
if (roomInfo.isReselect()) {
|
if (roomInfo.isReselect() && type == RoomInfo.ROOMTYPE_DEFAULT) {
|
||||||
activity.getDialogManager().dismissDialog();
|
activity.getDialogManager().dismissDialog();
|
||||||
new CreateRoomDialog().show(activity);
|
new CreateRoomDialog().show(activity);
|
||||||
} else {
|
} else {
|
||||||
@@ -116,7 +116,7 @@ public class OpenRoomHelper {
|
|||||||
if (type == RoomInfo.ROOMTYPE_DEFAULT || roomInfo.getType() == type) {
|
if (type == RoomInfo.ROOMTYPE_DEFAULT || roomInfo.getType() == type) {
|
||||||
onOpenRoomSuccess(activity, roomInfo);
|
onOpenRoomSuccess(activity, roomInfo);
|
||||||
} else {
|
} else {
|
||||||
updateRoomInfo(activity, roomInfo, type, gameId,true);
|
updateRoomInfo(activity, roomInfo, type, gameId, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
openRoom(activity, roomInfo, type, gameId);
|
openRoom(activity, roomInfo, type, gameId);
|
||||||
@@ -134,7 +134,7 @@ public class OpenRoomHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateRoomInfo(BaseActivity activity, RoomInfo roomInfo, int type, long gameId,boolean needOpen) {
|
public static void updateRoomInfo(BaseActivity activity, RoomInfo roomInfo, int type, long gameId, boolean needOpen) {
|
||||||
RoomSettingModel roomSettingModel = new RoomSettingModel();
|
RoomSettingModel roomSettingModel = new RoomSettingModel();
|
||||||
roomSettingModel.updateRoomInfo(
|
roomSettingModel.updateRoomInfo(
|
||||||
roomInfo.getTitle(),
|
roomInfo.getTitle(),
|
||||||
@@ -160,7 +160,7 @@ public class OpenRoomHelper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(@NonNull RoomInfo roomInfo) {
|
public void onSuccess(@NonNull RoomInfo roomInfo) {
|
||||||
if (needOpen){
|
if (needOpen) {
|
||||||
openRoom(activity, roomInfo, type, gameId);
|
openRoom(activity, roomInfo, type, gameId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1305,6 +1305,11 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
|||||||
SingleToastUtil.showToastShort("不能踢" + name + "陛下哦");
|
SingleToastUtil.showToastShort("不能踢" + name + "陛下哦");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (AvRoomDataManager.get().isGamePlaying(AvRoomDataManager.get().getMicPosition(uid))){
|
||||||
|
SingleToastUtil.showToast("不可以抱正在游戏中的用户下麦!");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
//ktv模式下麦
|
//ktv模式下麦
|
||||||
if (AvRoomDataManager.get().isOpenKTV()) {
|
if (AvRoomDataManager.get().isOpenKTV()) {
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<stroke
|
<stroke
|
||||||
android:width="1dp"
|
android:width="1dp"
|
||||||
android:color="#ffffffff" />
|
android:color="#ffffffff" />
|
||||||
<solid android:color="#ffffa936" />
|
<solid android:color="#FFFC4F6D" />
|
||||||
<corners android:radius="100dp" />
|
<corners android:radius="100dp" />
|
||||||
</shape>
|
</shape>
|
||||||
|
|
||||||
|
10
app/src/main/res/drawable/bg_game_status_playing.xml
Normal file
10
app/src/main/res/drawable/bg_game_status_playing.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="#ffffffff" />
|
||||||
|
<solid android:color="#FFFFA936" />
|
||||||
|
<corners android:radius="100dp" />
|
||||||
|
</shape>
|
@@ -375,6 +375,7 @@
|
|||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/queuing_micro_mode_layout"
|
android:id="@+id/queuing_micro_mode_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_height="@dimen/dp_45">
|
android:layout_height="@dimen/dp_45">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@@ -28,6 +28,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
|
|||||||
import com.yizhuan.xchat_android_core.room.bean.BoxSwitchVo;
|
import com.yizhuan.xchat_android_core.room.bean.BoxSwitchVo;
|
||||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||||
import com.yizhuan.xchat_android_core.room.bean.SimplePartyRoomInfo;
|
import com.yizhuan.xchat_android_core.room.bean.SimplePartyRoomInfo;
|
||||||
|
import com.yizhuan.xchat_android_core.room.game.GameStatus;
|
||||||
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg;
|
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg;
|
||||||
import com.yizhuan.xchat_android_core.room.ktv.event.KtvEvent;
|
import com.yizhuan.xchat_android_core.room.ktv.event.KtvEvent;
|
||||||
import com.yizhuan.xchat_android_core.room.bean.RoomModeType;
|
import com.yizhuan.xchat_android_core.room.bean.RoomModeType;
|
||||||
@@ -59,13 +60,31 @@ import io.reactivex.processors.PublishProcessor;
|
|||||||
* @date 2017/12/11
|
* @date 2017/12/11
|
||||||
*/
|
*/
|
||||||
public final class AvRoomDataManager {
|
public final class AvRoomDataManager {
|
||||||
|
/**
|
||||||
|
* 不在麦上的位置值
|
||||||
|
*/
|
||||||
|
public final static int POSITON_NOT_ON_MIC = Integer.MIN_VALUE;
|
||||||
|
/**
|
||||||
|
* 大头麦位的位置
|
||||||
|
*/
|
||||||
|
public static final int POSITION_BOSS_MIC = -1;
|
||||||
|
/**
|
||||||
|
* VIP麦位的位置
|
||||||
|
*/
|
||||||
|
public static final int POSITION_VIP_MIC = 999;
|
||||||
|
/************************************************公屏数据****************************************************/
|
||||||
|
|
||||||
|
private final static int MAX_MESSAGE_SIZE = 2000;//公屏最多展示条数
|
||||||
|
/**
|
||||||
|
* 房间所有超管
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public final List<ChatRoomMember> roomSuperAdminList = new ArrayList<>();
|
||||||
|
public final MutableLiveData<RoomPkBean> roomPkLiveData = new MutableLiveData<>();
|
||||||
@Nullable
|
@Nullable
|
||||||
public RoomInfo mCurrentRoomInfo;
|
public RoomInfo mCurrentRoomInfo;
|
||||||
|
|
||||||
public BoxSwitchVo mBoxSwitchVo;
|
public BoxSwitchVo mBoxSwitchVo;
|
||||||
|
|
||||||
public EnterChatRoomResultData mEnterChatRoomResultData;
|
public EnterChatRoomResultData mEnterChatRoomResultData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 房间创建者
|
* 房间创建者
|
||||||
*/
|
*/
|
||||||
@@ -94,12 +113,6 @@ public final class AvRoomDataManager {
|
|||||||
* 房间所有人员
|
* 房间所有人员
|
||||||
*/
|
*/
|
||||||
public List<ChatRoomMember> mRoomAllMemberList;
|
public List<ChatRoomMember> mRoomAllMemberList;
|
||||||
|
|
||||||
/**
|
|
||||||
* 房间所有超管
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public final List<ChatRoomMember> roomSuperAdminList = new ArrayList<>();
|
|
||||||
/**
|
/**
|
||||||
* 麦序位置信息:对应的位置,坑位信息(用户成员,坑位状态)
|
* 麦序位置信息:对应的位置,坑位信息(用户成员,坑位状态)
|
||||||
*/
|
*/
|
||||||
@@ -120,7 +133,6 @@ public final class AvRoomDataManager {
|
|||||||
* 是否需要打开礼物特效
|
* 是否需要打开礼物特效
|
||||||
*/
|
*/
|
||||||
public boolean mIsNeedGiftEffect = true;
|
public boolean mIsNeedGiftEffect = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自己是否操作过礼物特效
|
* 自己是否操作过礼物特效
|
||||||
*/
|
*/
|
||||||
@@ -130,7 +142,6 @@ public final class AvRoomDataManager {
|
|||||||
* 龙珠状态
|
* 龙珠状态
|
||||||
*/
|
*/
|
||||||
public boolean haveStartDragon;
|
public boolean haveStartDragon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 房间收藏状态
|
* 房间收藏状态
|
||||||
*/
|
*/
|
||||||
@@ -139,22 +150,30 @@ public final class AvRoomDataManager {
|
|||||||
* 龙珠数组
|
* 龙珠数组
|
||||||
*/
|
*/
|
||||||
public List<Integer> dragons;
|
public List<Integer> dragons;
|
||||||
private Disposable subscribe;
|
|
||||||
/**
|
/**
|
||||||
* 是否开启了游戏模式
|
* 是否开启了游戏模式
|
||||||
*/
|
*/
|
||||||
public boolean gameModel;
|
public boolean gameModel;
|
||||||
|
// 房主基本信息
|
||||||
|
public String nick;
|
||||||
|
public int gender;
|
||||||
|
public String avatar;
|
||||||
|
//房间的activity是否被销毁
|
||||||
|
public boolean roomNoDestory;
|
||||||
|
public List<String> phrases = new ArrayList<>(Arrays.asList("萌新求关注!", "你们在聊什么呀?", "这个怎么玩呀?", "我要上麦"));
|
||||||
|
/**
|
||||||
|
* 表示自己是否在队列中
|
||||||
|
*/
|
||||||
|
public boolean myIsInQueue = false;
|
||||||
|
private Disposable subscribe;
|
||||||
/**
|
/**
|
||||||
* 一起玩 按钮开关
|
* 一起玩 按钮开关
|
||||||
*/
|
*/
|
||||||
private boolean isAllowedToPlayTogether;
|
private boolean isAllowedToPlayTogether;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否从师徒任务中跳转进来的
|
* 是否从师徒任务中跳转进来的
|
||||||
*/
|
*/
|
||||||
private boolean isFromMentoring;
|
private boolean isFromMentoring;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 嗨聊房列表
|
* 嗨聊房列表
|
||||||
*/
|
*/
|
||||||
@@ -163,31 +182,16 @@ public final class AvRoomDataManager {
|
|||||||
* 是否在嗨聊房
|
* 是否在嗨聊房
|
||||||
*/
|
*/
|
||||||
private boolean isParty;
|
private boolean isParty;
|
||||||
|
|
||||||
private boolean redEnvelopeOpen;
|
private boolean redEnvelopeOpen;
|
||||||
|
|
||||||
|
|
||||||
// 房主基本信息
|
|
||||||
public String nick;
|
|
||||||
public int gender;
|
|
||||||
public String avatar;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存师父的 UID
|
* 缓存师父的 UID
|
||||||
*/
|
*/
|
||||||
private long masterUid;
|
private long masterUid;
|
||||||
//房间的activity是否被销毁
|
/**
|
||||||
public boolean roomNoDestory;
|
* 公屏数据
|
||||||
public List<String> phrases = new ArrayList<>(Arrays.asList("萌新求关注!", "你们在聊什么呀?", "这个怎么玩呀?", "我要上麦"));
|
*/
|
||||||
|
private List<ChatRoomMessage> chatRoomMessages = new LinkedList<>();
|
||||||
public final MutableLiveData<RoomPkBean> roomPkLiveData = new MutableLiveData<>();
|
private PublishProcessor<ChatRoomMessage> chatRoomMsgProcessor = PublishProcessor.create();
|
||||||
|
|
||||||
public boolean isGamePlaying;
|
|
||||||
|
|
||||||
|
|
||||||
private static final class Helper {
|
|
||||||
private static final AvRoomDataManager INSTANCE = new AvRoomDataManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
private AvRoomDataManager() {
|
private AvRoomDataManager() {
|
||||||
mRoomManagerList = new ArrayList<>();
|
mRoomManagerList = new ArrayList<>();
|
||||||
@@ -202,6 +206,10 @@ public final class AvRoomDataManager {
|
|||||||
observerChatRoomMessage();
|
observerChatRoomMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AvRoomDataManager get() {
|
||||||
|
return Helper.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
public void release() {
|
public void release() {
|
||||||
IMNetEaseManager.get().release();
|
IMNetEaseManager.get().release();
|
||||||
AudioEngineManager.get().leaveChannel();
|
AudioEngineManager.get().leaveChannel();
|
||||||
@@ -212,10 +220,6 @@ public final class AvRoomDataManager {
|
|||||||
LogUtils.d("---------清除AvRoomDataManager数据完成---------");
|
LogUtils.d("---------清除AvRoomDataManager数据完成---------");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AvRoomDataManager get() {
|
|
||||||
return Helper.INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取麦上队列信息
|
* 获取麦上队列信息
|
||||||
*
|
*
|
||||||
@@ -226,7 +230,6 @@ public final class AvRoomDataManager {
|
|||||||
return mMicQueueMemberMap.get(micPosition);
|
return mMicQueueMemberMap.get(micPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取麦上队列信息
|
* 获取麦上队列信息
|
||||||
*
|
*
|
||||||
@@ -450,7 +453,6 @@ public final class AvRoomDataManager {
|
|||||||
return mCurrentRoomInfo != null && mCurrentRoomInfo.getUid() == AuthModel.get().getCurrentUid();
|
return mCurrentRoomInfo != null && mCurrentRoomInfo.getUid() == AuthModel.get().getCurrentUid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void removeManagerMember(String account) {
|
void removeManagerMember(String account) {
|
||||||
if (ListUtils.isListEmpty(mRoomManagerList) || TextUtils.isEmpty(account)) return;
|
if (ListUtils.isListEmpty(mRoomManagerList) || TextUtils.isEmpty(account)) return;
|
||||||
ListIterator<ChatRoomMember> iterator = mRoomManagerList.listIterator();
|
ListIterator<ChatRoomMember> iterator = mRoomManagerList.listIterator();
|
||||||
@@ -486,7 +488,6 @@ public final class AvRoomDataManager {
|
|||||||
return mCurrentRoomInfo != null && mCurrentRoomInfo.getRoomModeType() == RoomModeType.OPEN_ANOTHER_PK_MODE;
|
return mCurrentRoomInfo != null && mCurrentRoomInfo.getRoomModeType() == RoomModeType.OPEN_ANOTHER_PK_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是房间管理员
|
* 是否是房间管理员
|
||||||
*
|
*
|
||||||
@@ -554,21 +555,6 @@ public final class AvRoomDataManager {
|
|||||||
return isOnMic(AuthModel.get().getCurrentUid());
|
return isOnMic(AuthModel.get().getCurrentUid());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 不在麦上的位置值
|
|
||||||
*/
|
|
||||||
public final static int POSITON_NOT_ON_MIC = Integer.MIN_VALUE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 大头麦位的位置
|
|
||||||
*/
|
|
||||||
public static final int POSITION_BOSS_MIC = -1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VIP麦位的位置
|
|
||||||
*/
|
|
||||||
public static final int POSITION_VIP_MIC = 999;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户id去获取当前用户在麦上的位置
|
* 根据用户id去获取当前用户在麦上的位置
|
||||||
*
|
*
|
||||||
@@ -605,7 +591,7 @@ public final class AvRoomDataManager {
|
|||||||
*/
|
*/
|
||||||
public int findFreePosition() {
|
public int findFreePosition() {
|
||||||
int size;
|
int size;
|
||||||
if (mMicQueueMemberMap != null && (size = mMicQueueMemberMap.size()) > 0) {
|
if (mMicQueueMemberMap != null && (size = mMicQueueMemberMap.size()) >= 0) {
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
int key = mMicQueueMemberMap.keyAt(i);
|
int key = mMicQueueMemberMap.keyAt(i);
|
||||||
RoomQueueInfo roomQueueInfo = mMicQueueMemberMap.valueAt(i);
|
RoomQueueInfo roomQueueInfo = mMicQueueMemberMap.valueAt(i);
|
||||||
@@ -617,6 +603,54 @@ public final class AvRoomDataManager {
|
|||||||
return Integer.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取坑上没人且没上锁且最大6个坑位的位置
|
||||||
|
*/
|
||||||
|
public int findGamePosition() {
|
||||||
|
if (mMicQueueMemberMap != null && mMicQueueMemberMap.size() >= 6) {
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
int key = mMicQueueMemberMap.keyAt(i);
|
||||||
|
RoomQueueInfo roomQueueInfo = mMicQueueMemberMap.valueAt(i);
|
||||||
|
if (roomQueueInfo.mChatRoomMember == null &&
|
||||||
|
(roomQueueInfo.mRoomMicInfo != null && !roomQueueInfo.mRoomMicInfo.isMicLock())) {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Integer.MIN_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取坑上没人且没上锁且最大6个坑位的位置
|
||||||
|
*/
|
||||||
|
public boolean isGamePlaying() {
|
||||||
|
if (!isOpenGame()) return false;
|
||||||
|
if (mMicQueueMemberMap != null && mMicQueueMemberMap.size() >= 6) {
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
RoomQueueInfo roomQueueInfo = mMicQueueMemberMap.valueAt(i);
|
||||||
|
if (roomQueueInfo.mChatRoomMember != null &&
|
||||||
|
roomQueueInfo.mChatRoomMember.getGameStatus() == GameStatus.STATUS_PLAYING) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取坑上没人且没上锁且最大6个坑位的位置
|
||||||
|
*/
|
||||||
|
public boolean isGamePlaying(int micPosition) {
|
||||||
|
if (!isOpenGame()) return false;
|
||||||
|
if (mMicQueueMemberMap != null && mMicQueueMemberMap.size() >= 6) {
|
||||||
|
RoomQueueInfo roomQueueInfo = mMicQueueMemberMap.get(micPosition);
|
||||||
|
return roomQueueInfo!=null &&
|
||||||
|
roomQueueInfo.mChatRoomMember != null &&
|
||||||
|
roomQueueInfo.mChatRoomMember.getGameStatus() == GameStatus.STATUS_PLAYING;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取坑上没人的位置,排除房主的位置,也就是-1
|
* 获取坑上没人的位置,排除房主的位置,也就是-1
|
||||||
*/
|
*/
|
||||||
@@ -738,14 +772,6 @@ public final class AvRoomDataManager {
|
|||||||
return roomQueueInfo.mRoomMicInfo.isMicLock();
|
return roomQueueInfo.mRoomMicInfo.isMicLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************公屏数据****************************************************/
|
|
||||||
|
|
||||||
private final static int MAX_MESSAGE_SIZE = 2000;//公屏最多展示条数
|
|
||||||
/**
|
|
||||||
* 公屏数据
|
|
||||||
*/
|
|
||||||
private List<ChatRoomMessage> chatRoomMessages = new LinkedList<>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取聊天公屏数据
|
* 获取聊天公屏数据
|
||||||
*
|
*
|
||||||
@@ -779,8 +805,6 @@ public final class AvRoomDataManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PublishProcessor<ChatRoomMessage> chatRoomMsgProcessor = PublishProcessor.create();
|
|
||||||
|
|
||||||
public PublishProcessor<ChatRoomMessage> getChatRoomMsgProcessor() {
|
public PublishProcessor<ChatRoomMessage> getChatRoomMsgProcessor() {
|
||||||
return chatRoomMsgProcessor;
|
return chatRoomMsgProcessor;
|
||||||
}
|
}
|
||||||
@@ -966,11 +990,6 @@ public final class AvRoomDataManager {
|
|||||||
return mCurrentRoomInfo == null ? 0 : mCurrentRoomInfo.getUid();
|
return mCurrentRoomInfo == null ? 0 : mCurrentRoomInfo.getUid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 表示自己是否在队列中
|
|
||||||
*/
|
|
||||||
public boolean myIsInQueue = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* true表示具有KTV权限
|
* true表示具有KTV权限
|
||||||
*/
|
*/
|
||||||
@@ -1154,4 +1173,8 @@ public final class AvRoomDataManager {
|
|||||||
return isDatingMode() && roomQueueInfo.mChatRoomMember.isHasSelectUser();
|
return isDatingMode() && roomQueueInfo.mChatRoomMember.isHasSelectUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final class Helper {
|
||||||
|
private static final AvRoomDataManager INSTANCE = new AvRoomDataManager();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,8 @@
|
|||||||
|
package com.yizhuan.xchat_android_core.room.game;
|
||||||
|
|
||||||
|
public interface GameStatus {
|
||||||
|
int STATUS_NOT_JOIN = 0;
|
||||||
|
int STATUS_NOT_READY = 1;
|
||||||
|
int STATUS_READY = 2;
|
||||||
|
int STATUS_PLAYING = 3;
|
||||||
|
}
|
@@ -245,20 +245,6 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
|
|||||||
StatisticManager.Instance().onEventEnd(BasicConfig.INSTANCE.getAppContext(),
|
StatisticManager.Instance().onEventEnd(BasicConfig.INSTANCE.getAppContext(),
|
||||||
StatisticsProtocol.Event.EVENT_OPENROOM, "开房", attributes);
|
StatisticsProtocol.Event.EVENT_OPENROOM, "开房", attributes);
|
||||||
|
|
||||||
if (currentRoom.getType() != RoomInfo.ROOMTYPE_HOME_PARTY) {
|
|
||||||
quitRoomForOurService(new CallBack<String>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String data) {
|
|
||||||
Logger.i("通知服务端退出房间成功:" + data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFail(int code, String error) {
|
|
||||||
Logger.i("通知服务端退出房间失败:" + error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//埋点统计用户上麦时长
|
//埋点统计用户上麦时长
|
||||||
if (AvRoomDataManager.get().isOwnerOnMic()) {
|
if (AvRoomDataManager.get().isOwnerOnMic()) {
|
||||||
Map<String, String> attr = new HashMap<>(2);
|
Map<String, String> attr = new HashMap<>(2);
|
||||||
|
@@ -720,7 +720,7 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Single<RoomResult> openRoom(long uid, int type, String title, String roomDesc,
|
public Single<RoomResult> openRoom(long uid, int type, String title, String roomDesc,
|
||||||
String backPic, String rewardId,long gameId) {
|
String backPic, String rewardId, long gameId) {
|
||||||
if (TextUtils.isEmpty(title)) {
|
if (TextUtils.isEmpty(title)) {
|
||||||
return UserModel.get().getUserInfo(uid)
|
return UserModel.get().getUserInfo(uid)
|
||||||
.flatMap(new Function<UserInfo, SingleSource<RoomResult>>() {
|
.flatMap(new Function<UserInfo, SingleSource<RoomResult>>() {
|
||||||
@@ -728,7 +728,7 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
|||||||
public SingleSource<RoomResult> apply(UserInfo userInfo) throws Exception {
|
public SingleSource<RoomResult> apply(UserInfo userInfo) throws Exception {
|
||||||
String tmpTitle = userInfo.getNick() + "的房间";
|
String tmpTitle = userInfo.getNick() + "的房间";
|
||||||
return mRoomService.openRoom(userInfo.getUid(), AuthModel.get().getTicket(),
|
return mRoomService.openRoom(userInfo.getUid(), AuthModel.get().getTicket(),
|
||||||
type, tmpTitle, roomDesc, backPic, rewardId)
|
type, tmpTitle, roomDesc, backPic, rewardId, gameId)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.unsubscribeOn(Schedulers.io())
|
.unsubscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
@@ -736,7 +736,7 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
return mRoomService.openRoom(uid, AuthModel.get().getTicket(),
|
return mRoomService.openRoom(uid, AuthModel.get().getTicket(),
|
||||||
type, title, roomDesc, backPic, rewardId)
|
type, title, roomDesc, backPic, rewardId, gameId)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.unsubscribeOn(Schedulers.io())
|
.unsubscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
@@ -766,7 +766,7 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Single<List<BannerInfo>> getRoomBanner() {
|
public Single<List<BannerInfo>> getRoomBanner() {
|
||||||
return mRoomService.getActionDialog("2",AvRoomDataManager.get().getRoomId())
|
return mRoomService.getActionDialog("2", AvRoomDataManager.get().getRoomId())
|
||||||
.singleOrError()
|
.singleOrError()
|
||||||
.compose(RxHelper.singleMainResult());
|
.compose(RxHelper.singleMainResult());
|
||||||
}
|
}
|
||||||
@@ -905,7 +905,8 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
|||||||
@Field("title") String title,
|
@Field("title") String title,
|
||||||
@Field("roomDesc") String roomDesc,
|
@Field("roomDesc") String roomDesc,
|
||||||
@Field("backPic") String backPic,
|
@Field("backPic") String backPic,
|
||||||
@Field("rewardId") String rewardId);
|
@Field("rewardId") String rewardId,
|
||||||
|
@Field("mgId") long mgId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新房间设置信息
|
* 更新房间设置信息
|
||||||
|
@@ -51,6 +51,7 @@ public class MicMemberInfo {
|
|||||||
* 0 未加入游戏
|
* 0 未加入游戏
|
||||||
* 1 加入游戏未准备
|
* 1 加入游戏未准备
|
||||||
* 2 加入游戏已准备
|
* 2 加入游戏已准备
|
||||||
|
* 3 游戏中...
|
||||||
*/
|
*/
|
||||||
private int gameStatus;
|
private int gameStatus;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user