小游戏相关各种异常状态处理
This commit is contained in:
@@ -313,7 +313,10 @@ public class ButtonItemFactory {
|
||||
@Override
|
||||
public void onClick() {
|
||||
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的歌曲," : "") + "是否要将此用户踢出房间?",
|
||||
true, new DialogManager.AbsOkDialogListener() {
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -421,7 +424,10 @@ public class ButtonItemFactory {
|
||||
String nick) {
|
||||
return new ViewItem("拉入黑名单", R.drawable.icon_dialog_mark_black_list, () -> {
|
||||
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(
|
||||
"是否将" + nick + "加入黑名单?加入后他将无法进入此房间" +
|
||||
(AvRoomDataManager.get().mCurrentRoomInfo != null && AvRoomDataManager.get().isOpenKTV() ? "KTV模式下将自动删除ta的歌曲" : ""), true,
|
||||
|
@@ -927,6 +927,12 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
|
||||
@Override
|
||||
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) {
|
||||
mNobleOpenNoticeView.setVisibility(View.GONE);
|
||||
} else if (AvRoomDataManager.get().haveStartDragon) {
|
||||
|
@@ -175,7 +175,11 @@ public class RoomSettingActivity extends BaseMvpActivity<IRoomSettingView, RoomS
|
||||
*/
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
// 排麦模式的开关状态
|
||||
boolean isQueuingMicro = AvRoomDataManager.get().isQueuingMicro() || AvRoomDataManager.get().isOpenPKMode();
|
||||
binding.switchQueuingMicroMode.setVisibility(AvRoomDataManager.get().isOpenGame() ? View.GONE : View.VISIBLE);
|
||||
binding.switchQueuingMicroMode.setSelected(isQueuingMicro);
|
||||
binding.switchQueuingMicroMode.setImageResource(isQueuingMicro ?
|
||||
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 = "已准备"
|
||||
R.drawable.bg_game_status_ready
|
||||
}
|
||||
it.gameStatus == 3 -> {
|
||||
tvGameStatus.text = "游戏中"
|
||||
R.drawable.bg_game_status_playing
|
||||
}
|
||||
else -> {
|
||||
tvGameStatus.text = "未准备"
|
||||
R.drawable.bg_game_status_not_ready
|
||||
|
@@ -125,6 +125,9 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
if (SuperAdminUtil.isSuperAdmin()) {
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isOpenGame()){
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isManager() && !AvRoomDataManager.get().isCpRoom()) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
@@ -160,6 +163,9 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
if (SuperAdminUtil.isSuperAdmin()) {
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isOpenGame()){
|
||||
return;
|
||||
}
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null || roomInfo.getIsPermitRoom() != 1) {
|
||||
return;
|
||||
@@ -198,6 +204,9 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
if (SuperAdminUtil.isSuperAdmin()) {
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isOpenGame()){
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isManager() && !AvRoomDataManager.get().isCpRoom()) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
|
@@ -293,13 +293,13 @@ class GameRoomFragment() : BaseMvpFragment<IGameRoomView?, GameRoomPresenter?>()
|
||||
gameBinding.microView.bindAdapter(GameMicroViewAdapter(context))
|
||||
|
||||
gameBinding.tvShowMiniMic.setOnClickListener {
|
||||
gameBinding.microView.bindAdapter(GameMiniMicroViewAdapter(context))
|
||||
gameBinding.tvShowMiniMic.isVisible = false
|
||||
gameBinding.microView.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
width = LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
marginStart = ScreenUtil.dip2px(2f)
|
||||
marginEnd = ScreenUtil.dip2px(2f)
|
||||
}
|
||||
gameBinding.microView.bindAdapter(GameMiniMicroViewAdapter(context))
|
||||
gameBinding.tvShowMiniMic.isVisible = false
|
||||
gameBinding.microView.postDelayed({
|
||||
gameBinding.ivShowMic.isVisible = true
|
||||
gameBinding.llMicView.setBackgroundResource(R.drawable.bg_mini_mic_entrance)
|
||||
@@ -754,7 +754,7 @@ class GameRoomFragment() : BaseMvpFragment<IGameRoomView?, GameRoomPresenter?>()
|
||||
@SuppressLint("CheckResult")
|
||||
override fun onSendGiftBtnClick(
|
||||
giftInfo: GiftInfo, micMemberInfos: List<MicMemberInfo>,
|
||||
number: Int, msg: String, isKnap: Boolean,
|
||||
number: Int, msg: String?, isKnap: Boolean,
|
||||
isWholdMic: Boolean, callback: SenGiftCallback
|
||||
) {
|
||||
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.xchat_android_constants.XChatConstants;
|
||||
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.GiftReceiveInfo;
|
||||
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 -> {
|
||||
if (gameMainBinding.rvGame.getVisibility() == View.VISIBLE) {
|
||||
gameMainBinding.rvGame.setVisibility(View.GONE);
|
||||
} else {
|
||||
if (AvRoomDataManager.get().isGamePlaying()) {
|
||||
SingleToastUtil.showToast("游戏中不可以切换游戏或玩法!");
|
||||
} else {
|
||||
gameMainBinding.rvGame.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
gameAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
if (AvRoomDataManager.get().isGamePlaying()) {
|
||||
SingleToastUtil.showToast("游戏中不可以切换游戏或玩法!");
|
||||
}
|
||||
GameInfo gameInfo = gameAdapter.getItem(position);
|
||||
if (gameInfo != null) {
|
||||
int type;
|
||||
@@ -529,6 +537,11 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
|
||||
ButtonItem buttonItem1 = new ButtonItem("退出房间", new ButtonItem.OnClickListener() {
|
||||
@Override
|
||||
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()) {
|
||||
getDialogManager().showOkCancelDialog("KTV模式下退出房间会移除您已点的所有歌曲,确定进行此操作?", false,
|
||||
() -> ((AVRoomActivity) getActivity()).toBack());
|
||||
@@ -563,7 +576,12 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
|
||||
ButtonItem buttonItem2 = new ButtonItem("最小化房间", new ButtonItem.OnClickListener() {
|
||||
@Override
|
||||
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() {
|
||||
|
@@ -14,6 +14,7 @@ import com.google.gson.Gson
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
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.GameStatus
|
||||
import com.yizhuan.xchat_android_core.room.model.HomePartyModel
|
||||
import com.yizhuan.xchat_android_core.user.UserModel
|
||||
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_READY = 1
|
||||
const val STATUS_READY = 2
|
||||
|
||||
const val STATUS_PLAYING = 3
|
||||
}
|
||||
|
||||
private val TAG = "GameDelegate"
|
||||
@@ -118,6 +119,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
||||
fun updateGame(mgId: Long?) {
|
||||
if (mgId == null || mgId == 0L || mgId == mMGID || iSudFSTAPP == null) return
|
||||
mMGID = mgId
|
||||
updateMyMicQueue(GameStatus.STATUS_NOT_JOIN)
|
||||
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() {
|
||||
LogUtils.d("onGameStarted")
|
||||
if (AvRoomDataManager.get().isRoomOwner) {
|
||||
notifySelfInState(true, 0)
|
||||
notifySelfCaptainState(mUid)
|
||||
}
|
||||
}
|
||||
|
||||
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")
|
||||
when (state) {
|
||||
SudMGPMGState.MG_COMMON_PUBLIC_MESSAGE -> showToast("游戏:公屏消息")
|
||||
//SudMGPMGState.MG_COMMON_PUBLIC_MESSAGE -> showToast("游戏:公屏消息")
|
||||
SudMGPMGState.MG_COMMON_KEY_WORD_TO_HIT -> {
|
||||
showToast("游戏:关键词状态")
|
||||
if (TextUtils.isEmpty(dataJson)) {
|
||||
setKeyWord(null)
|
||||
} else {
|
||||
@@ -378,7 +374,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
||||
|
||||
try {
|
||||
val jsonObject = JSONObject(dataJson)
|
||||
val seatIndex = jsonObject.getInt("seatIndex")
|
||||
val seatIndex = jsonObject.optInt("seatIndex",-1)
|
||||
updateMyMicQueue(STATUS_NOT_READY, true, seatIndex)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
@@ -424,7 +420,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
||||
if (retCode == 100201) {
|
||||
showToast("100201: 战斗时房间不能加入")
|
||||
} else {
|
||||
showToast("mg_common_player_in 状态失败, 错误码:$retCode")
|
||||
//showToast("状态失败, 错误码:$retCode")
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -433,6 +429,9 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
||||
if (jsonObject.has("teamId")) {
|
||||
teamId = jsonObject.getInt("teamId")
|
||||
}
|
||||
if (AvRoomDataManager.get().isRoomOwner){
|
||||
notifySelfCaptainState(mUid)
|
||||
}
|
||||
//showToast("加入游戏分组:$teamId")
|
||||
} else { // 未加入
|
||||
var reason = 0
|
||||
@@ -462,7 +461,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
||||
UserModel.get().cacheLoginUserInfo
|
||||
).subscribe()
|
||||
} else if (isJoin) {
|
||||
val upPosition = AvRoomDataManager.get().findFreePosition()
|
||||
val upPosition = AvRoomDataManager.get().findGamePosition()
|
||||
if (upPosition == Int.MIN_VALUE) {
|
||||
showToast("当前游戏人数已满!")
|
||||
} else {
|
||||
@@ -535,11 +534,12 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
|
||||
return
|
||||
}
|
||||
val isPlaying = jsonObject.getBoolean("isPlaying")
|
||||
AvRoomDataManager.get().isGamePlaying = isPlaying
|
||||
if (isPlaying) {
|
||||
onGameStatusChangeListener?.onGameStart()
|
||||
updateMyMicQueue(STATUS_PLAYING)
|
||||
} else {
|
||||
onGameStatusChangeListener?.onGameEnd()
|
||||
updateMyMicQueue(STATUS_NOT_READY)
|
||||
var reason = 0
|
||||
if (jsonObject.has("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() {
|
||||
iSudFSTAPP?.startMG() //启动游戏
|
||||
|
@@ -6,6 +6,7 @@ import android.graphics.Point;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
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.CpMicroViewAdapter;
|
||||
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.OnMicroItemClickListener;
|
||||
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.room.event.ReceiveFaceEvent;
|
||||
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.Subscribe;
|
||||
@@ -60,6 +64,7 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
||||
private boolean isNeedResetMicCenterPoint = true;
|
||||
|
||||
private DatingItemDecoration datingItemDecoration;
|
||||
private OnMicroItemClickListener onMicroItemClickListener;
|
||||
|
||||
public MicroView(Context context) {
|
||||
this(context, null);
|
||||
@@ -74,8 +79,6 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
||||
init(context);
|
||||
}
|
||||
|
||||
private OnMicroItemClickListener onMicroItemClickListener;
|
||||
|
||||
public void setOnMicroItemClickListener(OnMicroItemClickListener onMicroItemClickListener) {
|
||||
this.onMicroItemClickListener = onMicroItemClickListener;
|
||||
if (recyclerView != null && recyclerView.getAdapter() instanceof BaseMicroViewAdapter) {
|
||||
@@ -147,7 +150,9 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
//高度和位置都没发生变化,就没必要要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毫秒内重复调用的)
|
||||
isNeedResetMicCenterPoint = false;
|
||||
recyclerView.post(() -> {
|
||||
@@ -206,6 +211,7 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
||||
face.setLayoutParams(params);
|
||||
}
|
||||
Point point = new Point(x, y);
|
||||
LogUtils.d("x= " + x + " y= " + y);
|
||||
centerPoints.put(micPosition, point);
|
||||
}
|
||||
|
||||
@@ -223,8 +229,8 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
||||
} else {
|
||||
bindAdapter(new MicroViewAdapter(mContext));
|
||||
}
|
||||
giftWidth = UIUtil.dip2px(mContext, 16);
|
||||
giftHeight = UIUtil.dip2px(mContext, 16);
|
||||
giftWidth = UIUtil.dip2px(mContext, 80);
|
||||
giftHeight = UIUtil.dip2px(mContext, 80);
|
||||
|
||||
faceImageViews = new SparseArray<>(10);
|
||||
dragonBarImageViews = new SparseArray<>(9);
|
||||
@@ -356,6 +362,14 @@ public class MicroView extends FrameLayout implements View.OnLayoutChangeListene
|
||||
|
||||
|
||||
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 (datingItemDecoration == null) datingItemDecoration = new DatingItemDecoration();
|
||||
recyclerView.addItemDecoration(datingItemDecoration);
|
||||
|
@@ -108,7 +108,7 @@ public class OpenRoomHelper {
|
||||
public void acceptThrowable(RoomInfo roomInfo, Throwable throwable) {
|
||||
super.acceptThrowable(roomInfo, throwable);
|
||||
if (roomInfo != null) {
|
||||
if (roomInfo.isReselect()) {
|
||||
if (roomInfo.isReselect() && type == RoomInfo.ROOMTYPE_DEFAULT) {
|
||||
activity.getDialogManager().dismissDialog();
|
||||
new CreateRoomDialog().show(activity);
|
||||
} else {
|
||||
@@ -116,7 +116,7 @@ public class OpenRoomHelper {
|
||||
if (type == RoomInfo.ROOMTYPE_DEFAULT || roomInfo.getType() == type) {
|
||||
onOpenRoomSuccess(activity, roomInfo);
|
||||
} else {
|
||||
updateRoomInfo(activity, roomInfo, type, gameId,true);
|
||||
updateRoomInfo(activity, roomInfo, type, gameId, true);
|
||||
}
|
||||
} else {
|
||||
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.updateRoomInfo(
|
||||
roomInfo.getTitle(),
|
||||
@@ -160,7 +160,7 @@ public class OpenRoomHelper {
|
||||
|
||||
@Override
|
||||
public void onSuccess(@NonNull RoomInfo roomInfo) {
|
||||
if (needOpen){
|
||||
if (needOpen) {
|
||||
openRoom(activity, roomInfo, type, gameId);
|
||||
}
|
||||
}
|
||||
|
@@ -1305,6 +1305,11 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
SingleToastUtil.showToastShort("不能踢" + name + "陛下哦");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
if (AvRoomDataManager.get().isGamePlaying(AvRoomDataManager.get().getMicPosition(uid))){
|
||||
SingleToastUtil.showToast("不可以抱正在游戏中的用户下麦!");
|
||||
return;
|
||||
}
|
||||
//ktv模式下麦
|
||||
if (AvRoomDataManager.get().isOpenKTV()) {
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#ffffffff" />
|
||||
<solid android:color="#ffffa936" />
|
||||
<solid android:color="#FFFC4F6D" />
|
||||
<corners android:radius="100dp" />
|
||||
</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
|
||||
android:id="@+id/queuing_micro_mode_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="gone"
|
||||
android:layout_height="@dimen/dp_45">
|
||||
|
||||
<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.RoomInfo;
|
||||
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.ktv.event.KtvEvent;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomModeType;
|
||||
@@ -59,13 +60,31 @@ import io.reactivex.processors.PublishProcessor;
|
||||
* @date 2017/12/11
|
||||
*/
|
||||
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
|
||||
public RoomInfo mCurrentRoomInfo;
|
||||
|
||||
public BoxSwitchVo mBoxSwitchVo;
|
||||
|
||||
public EnterChatRoomResultData mEnterChatRoomResultData;
|
||||
|
||||
/**
|
||||
* 房间创建者
|
||||
*/
|
||||
@@ -94,12 +113,6 @@ public final class AvRoomDataManager {
|
||||
* 房间所有人员
|
||||
*/
|
||||
public List<ChatRoomMember> mRoomAllMemberList;
|
||||
|
||||
/**
|
||||
* 房间所有超管
|
||||
*/
|
||||
@NonNull
|
||||
public final List<ChatRoomMember> roomSuperAdminList = new ArrayList<>();
|
||||
/**
|
||||
* 麦序位置信息:对应的位置,坑位信息(用户成员,坑位状态)
|
||||
*/
|
||||
@@ -120,7 +133,6 @@ public final class AvRoomDataManager {
|
||||
* 是否需要打开礼物特效
|
||||
*/
|
||||
public boolean mIsNeedGiftEffect = true;
|
||||
|
||||
/**
|
||||
* 自己是否操作过礼物特效
|
||||
*/
|
||||
@@ -130,7 +142,6 @@ public final class AvRoomDataManager {
|
||||
* 龙珠状态
|
||||
*/
|
||||
public boolean haveStartDragon;
|
||||
|
||||
/**
|
||||
* 房间收藏状态
|
||||
*/
|
||||
@@ -139,22 +150,30 @@ public final class AvRoomDataManager {
|
||||
* 龙珠数组
|
||||
*/
|
||||
public List<Integer> dragons;
|
||||
private Disposable subscribe;
|
||||
/**
|
||||
* 是否开启了游戏模式
|
||||
*/
|
||||
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 isFromMentoring;
|
||||
|
||||
/**
|
||||
* 嗨聊房列表
|
||||
*/
|
||||
@@ -163,31 +182,16 @@ public final class AvRoomDataManager {
|
||||
* 是否在嗨聊房
|
||||
*/
|
||||
private boolean isParty;
|
||||
|
||||
private boolean redEnvelopeOpen;
|
||||
|
||||
|
||||
// 房主基本信息
|
||||
public String nick;
|
||||
public int gender;
|
||||
public String avatar;
|
||||
|
||||
/**
|
||||
* 缓存师父的 UID
|
||||
*/
|
||||
private long masterUid;
|
||||
//房间的activity是否被销毁
|
||||
public boolean roomNoDestory;
|
||||
public List<String> phrases = new ArrayList<>(Arrays.asList("萌新求关注!", "你们在聊什么呀?", "这个怎么玩呀?", "我要上麦"));
|
||||
|
||||
public final MutableLiveData<RoomPkBean> roomPkLiveData = new MutableLiveData<>();
|
||||
|
||||
public boolean isGamePlaying;
|
||||
|
||||
|
||||
private static final class Helper {
|
||||
private static final AvRoomDataManager INSTANCE = new AvRoomDataManager();
|
||||
}
|
||||
/**
|
||||
* 公屏数据
|
||||
*/
|
||||
private List<ChatRoomMessage> chatRoomMessages = new LinkedList<>();
|
||||
private PublishProcessor<ChatRoomMessage> chatRoomMsgProcessor = PublishProcessor.create();
|
||||
|
||||
private AvRoomDataManager() {
|
||||
mRoomManagerList = new ArrayList<>();
|
||||
@@ -202,6 +206,10 @@ public final class AvRoomDataManager {
|
||||
observerChatRoomMessage();
|
||||
}
|
||||
|
||||
public static AvRoomDataManager get() {
|
||||
return Helper.INSTANCE;
|
||||
}
|
||||
|
||||
public void release() {
|
||||
IMNetEaseManager.get().release();
|
||||
AudioEngineManager.get().leaveChannel();
|
||||
@@ -212,10 +220,6 @@ public final class AvRoomDataManager {
|
||||
LogUtils.d("---------清除AvRoomDataManager数据完成---------");
|
||||
}
|
||||
|
||||
public static AvRoomDataManager get() {
|
||||
return Helper.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取麦上队列信息
|
||||
*
|
||||
@@ -226,7 +230,6 @@ public final class AvRoomDataManager {
|
||||
return mMicQueueMemberMap.get(micPosition);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取麦上队列信息
|
||||
*
|
||||
@@ -450,7 +453,6 @@ public final class AvRoomDataManager {
|
||||
return mCurrentRoomInfo != null && mCurrentRoomInfo.getUid() == AuthModel.get().getCurrentUid();
|
||||
}
|
||||
|
||||
|
||||
void removeManagerMember(String account) {
|
||||
if (ListUtils.isListEmpty(mRoomManagerList) || TextUtils.isEmpty(account)) return;
|
||||
ListIterator<ChatRoomMember> iterator = mRoomManagerList.listIterator();
|
||||
@@ -486,7 +488,6 @@ public final class AvRoomDataManager {
|
||||
return mCurrentRoomInfo != null && mCurrentRoomInfo.getRoomModeType() == RoomModeType.OPEN_ANOTHER_PK_MODE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否是房间管理员
|
||||
*
|
||||
@@ -554,21 +555,6 @@ public final class AvRoomDataManager {
|
||||
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去获取当前用户在麦上的位置
|
||||
*
|
||||
@@ -605,7 +591,7 @@ public final class AvRoomDataManager {
|
||||
*/
|
||||
public int findFreePosition() {
|
||||
int size;
|
||||
if (mMicQueueMemberMap != null && (size = mMicQueueMemberMap.size()) > 0) {
|
||||
if (mMicQueueMemberMap != null && (size = mMicQueueMemberMap.size()) >= 0) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
int key = mMicQueueMemberMap.keyAt(i);
|
||||
RoomQueueInfo roomQueueInfo = mMicQueueMemberMap.valueAt(i);
|
||||
@@ -617,6 +603,54 @@ public final class AvRoomDataManager {
|
||||
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
|
||||
*/
|
||||
@@ -738,14 +772,6 @@ public final class AvRoomDataManager {
|
||||
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() {
|
||||
return chatRoomMsgProcessor;
|
||||
}
|
||||
@@ -966,11 +990,6 @@ public final class AvRoomDataManager {
|
||||
return mCurrentRoomInfo == null ? 0 : mCurrentRoomInfo.getUid();
|
||||
}
|
||||
|
||||
/**
|
||||
* 表示自己是否在队列中
|
||||
*/
|
||||
public boolean myIsInQueue = false;
|
||||
|
||||
/**
|
||||
* true表示具有KTV权限
|
||||
*/
|
||||
@@ -1154,4 +1173,8 @@ public final class AvRoomDataManager {
|
||||
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(),
|
||||
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()) {
|
||||
Map<String, String> attr = new HashMap<>(2);
|
||||
|
@@ -720,7 +720,7 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
||||
*/
|
||||
@Override
|
||||
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)) {
|
||||
return UserModel.get().getUserInfo(uid)
|
||||
.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 {
|
||||
String tmpTitle = userInfo.getNick() + "的房间";
|
||||
return mRoomService.openRoom(userInfo.getUid(), AuthModel.get().getTicket(),
|
||||
type, tmpTitle, roomDesc, backPic, rewardId)
|
||||
type, tmpTitle, roomDesc, backPic, rewardId, gameId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
@@ -736,7 +736,7 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
||||
});
|
||||
}
|
||||
return mRoomService.openRoom(uid, AuthModel.get().getTicket(),
|
||||
type, title, roomDesc, backPic, rewardId)
|
||||
type, title, roomDesc, backPic, rewardId, gameId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
@@ -766,7 +766,7 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
||||
}
|
||||
|
||||
public Single<List<BannerInfo>> getRoomBanner() {
|
||||
return mRoomService.getActionDialog("2",AvRoomDataManager.get().getRoomId())
|
||||
return mRoomService.getActionDialog("2", AvRoomDataManager.get().getRoomId())
|
||||
.singleOrError()
|
||||
.compose(RxHelper.singleMainResult());
|
||||
}
|
||||
@@ -905,7 +905,8 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
||||
@Field("title") String title,
|
||||
@Field("roomDesc") String roomDesc,
|
||||
@Field("backPic") String backPic,
|
||||
@Field("rewardId") String rewardId);
|
||||
@Field("rewardId") String rewardId,
|
||||
@Field("mgId") long mgId);
|
||||
|
||||
/**
|
||||
* 更新房间设置信息
|
||||
|
@@ -51,6 +51,7 @@ public class MicMemberInfo {
|
||||
* 0 未加入游戏
|
||||
* 1 加入游戏未准备
|
||||
* 2 加入游戏已准备
|
||||
* 3 游戏中...
|
||||
*/
|
||||
private int gameStatus;
|
||||
|
||||
|
Reference in New Issue
Block a user