小游戏坑位数量判断优化
This commit is contained in:
@@ -92,7 +92,7 @@ class GameMicroViewAdapter(context: Context?) : BaseMicroViewAdapter(context) {
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return max(AvRoomDataManager.get().mCurrentRoomInfo?.mgMicNum ?: 6, 6)
|
||||
return AvRoomDataManager.get().mgMicNum
|
||||
}
|
||||
|
||||
}
|
@@ -63,7 +63,7 @@ class GameMiniMicroViewAdapter(context: Context?) : BaseMicroViewAdapter(context
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return max(AvRoomDataManager.get().mCurrentRoomInfo?.mgMicNum ?: 6, 6)
|
||||
return AvRoomDataManager.get().mgMicNum
|
||||
}
|
||||
|
||||
|
||||
|
@@ -143,8 +143,8 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
|
||||
}
|
||||
}
|
||||
|
||||
fun isSixMic(): Boolean {
|
||||
return AvRoomDataManager.get().mCurrentRoomInfo?.mgMicNum == 6
|
||||
private fun isSixMic(): Boolean {
|
||||
return AvRoomDataManager.get().mgMicNum == AvRoomDataManager.GAME_DEF_MIC_COUNT
|
||||
}
|
||||
|
||||
override fun onSendMsgSuccess(msg: String?) {
|
||||
|
@@ -73,6 +73,12 @@ public final class AvRoomDataManager {
|
||||
* VIP麦位的位置
|
||||
*/
|
||||
public static final int POSITION_VIP_MIC = 999;
|
||||
|
||||
/**
|
||||
* 游戏房最小坑位数
|
||||
*/
|
||||
public static final int GAME_DEF_MIC_COUNT = 6;
|
||||
|
||||
/************************************************公屏数据****************************************************/
|
||||
|
||||
private final static int MAX_MESSAGE_SIZE = 2000;//公屏最多展示条数
|
||||
@@ -660,8 +666,8 @@ public final class AvRoomDataManager {
|
||||
* 获取坑上没人且没上锁且最大6个坑位的位置
|
||||
*/
|
||||
public int findGamePosition() {
|
||||
if (mMicQueueMemberMap != null && mMicQueueMemberMap.size() >= 6) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (mMicQueueMemberMap != null && mMicQueueMemberMap.size() >= getMgMicNum()) {
|
||||
for (int i = 0; i < getMgMicNum(); i++) {
|
||||
int key = mMicQueueMemberMap.keyAt(i);
|
||||
RoomQueueInfo roomQueueInfo = mMicQueueMemberMap.valueAt(i);
|
||||
if (roomQueueInfo.mChatRoomMember == null &&
|
||||
@@ -678,8 +684,8 @@ public final class AvRoomDataManager {
|
||||
*/
|
||||
public boolean isGamePlaying() {
|
||||
if (!isOpenGame()) return false;
|
||||
if (mMicQueueMemberMap != null && mMicQueueMemberMap.size() >= 6) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (mMicQueueMemberMap != null && mMicQueueMemberMap.size() >= getMgMicNum()) {
|
||||
for (int i = 0; i < getMgMicNum(); i++) {
|
||||
RoomQueueInfo roomQueueInfo = mMicQueueMemberMap.valueAt(i);
|
||||
if (roomQueueInfo.mChatRoomMember != null &&
|
||||
roomQueueInfo.mChatRoomMember.getGameStatus() == GameStatus.STATUS_PLAYING) {
|
||||
@@ -710,7 +716,7 @@ public final class AvRoomDataManager {
|
||||
*/
|
||||
public boolean isGamePlaying(int micPosition) {
|
||||
if (!isOpenGame()) return false;
|
||||
if (mMicQueueMemberMap != null && mMicQueueMemberMap.size() >= 6) {
|
||||
if (mMicQueueMemberMap != null && mMicQueueMemberMap.size() >= getMgMicNum()) {
|
||||
RoomQueueInfo roomQueueInfo = mMicQueueMemberMap.get(micPosition);
|
||||
return roomQueueInfo != null &&
|
||||
roomQueueInfo.mChatRoomMember != null &&
|
||||
@@ -719,6 +725,14 @@ public final class AvRoomDataManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 游戏坑位, 最少6个, 低于6个不支持
|
||||
*/
|
||||
public int getMgMicNum() {
|
||||
return AvRoomDataManager.get().mCurrentRoomInfo == null ? GAME_DEF_MIC_COUNT :
|
||||
Math.max(AvRoomDataManager.get().mCurrentRoomInfo.getMgMicNum(), GAME_DEF_MIC_COUNT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取坑上没人的位置,排除房主的位置,也就是-1
|
||||
*/
|
||||
|
Reference in New Issue
Block a user