删除H5游戏相关代码
This commit is contained in:
@@ -65,8 +65,6 @@ import com.yizhuan.xchat_android_core.im.custom.bean.CarAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.DatingAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.DatingPublishAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.GameAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.GameRespondAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.GiftAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.GiftBatchAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.InAppSharingFamilyAttachment;
|
||||
@@ -121,10 +119,6 @@ import com.yizhuan.xchat_android_core.room.bean.LeaveModeAttachment;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.exception.AntiSpamHitException;
|
||||
import com.yizhuan.xchat_android_core.room.face.DynamicFaceModel;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameEvent;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameInfo;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameRespondEvent;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameResultInfo;
|
||||
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg;
|
||||
import com.yizhuan.xchat_android_core.room.ktv.bean.MusicInfo;
|
||||
import com.yizhuan.xchat_android_core.room.ktv.event.KtvEvent;
|
||||
@@ -1076,41 +1070,7 @@ public final class IMNetEaseManager {
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_GAME:
|
||||
GameInfo gameInfo = ((GameAttachment) msg.getAttachment()).getGameInfo().getGameInfo();
|
||||
switch (second) {
|
||||
case CustomAttachment.CUSTOM_MSG_GAME_SELECT:
|
||||
RxBus.get().post(new GameEvent().setType(GameEvent.SELECT_GAME).setGameInfo(gameInfo));
|
||||
addMessages(msg);
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_GAME_PREPARE:
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_GAME_START:
|
||||
RxBus.get().post(new GameEvent().setType(GameEvent.START_GAME).setGameInfo(gameInfo));
|
||||
addMessages(msg);
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_GAME_END:
|
||||
GameResultInfo.ResultBean resultBean = ((GameAttachment) msg.getAttachment()).getGameInfo().getGameResultInfo();
|
||||
RxBus.get().post(new GameEvent().setType(GameEvent.GAME_END).setResultInfo(resultBean));
|
||||
addMessages(msg);
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_GAME_CANCEL_PREPARE:
|
||||
// addMessages(msg);
|
||||
RxBus.get().post(new GameEvent().setType(GameEvent.CANCEL_PREPARE).setGameInfo(gameInfo));
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_GAME_OPEN:
|
||||
addMessages(msg);
|
||||
RxBus.get().post(new GameEvent().setType(GameEvent.OPEN_GAME_MODEL).setGameInfo(gameInfo));
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_GAME_CLOSE:
|
||||
addMessages(msg);
|
||||
RxBus.get().post(new GameEvent().setType(GameEvent.CLOSE_GAME_MODEL).setGameInfo(gameInfo));
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_GAME_AI_ENTER:
|
||||
addMessages(msg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case CUSTOM_MSG_QUEUING_MIC:
|
||||
switch (second) {
|
||||
case CUSTOM_MSG_SUB_QUEUING_MIC_MODE_CLOSE:
|
||||
@@ -1215,11 +1175,6 @@ public final class IMNetEaseManager {
|
||||
addMessages(msg);
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_GAME_RESPOND:
|
||||
GameRespondAttachment respondAttachment = (GameRespondAttachment) msg.getAttachment();
|
||||
RxBus.get().post(new GameRespondEvent(respondAttachment.getImGameInfo(), second, msg.getFromAccount()));
|
||||
// if (second == CustomAttachment.CUSTOM_MSG_GAME_RESPOND_ACCEPT) {
|
||||
// addMessages(msg);
|
||||
// }
|
||||
break;
|
||||
case CustomAttachment.CUSTOM_MSG_SIGN_IN:
|
||||
if (second == CustomAttachment.CUSTOM_MSG_SUB_CARVE_UP_GOLD_SECOND_LEVEL) {
|
||||
|
@@ -352,20 +352,10 @@ public class CustomAttachParser implements MsgAttachmentParser {
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case CUSTOM_MSG_GAME:
|
||||
attachment = new GameAttachment(CUSTOM_MSG_GAME, second);
|
||||
break;
|
||||
case CUSTOM_MSG_IM_GAME:
|
||||
attachment = new ImGameAttachment(CUSTOM_MSG_IM_GAME, second);
|
||||
break;
|
||||
case CUSTOM_MSG_IM_TIP:
|
||||
attachment = new ImTipAttachment(CUSTOM_MSG_IM_TIP, second);
|
||||
break;
|
||||
case CUSTOM_MSG_GAME_RESPOND:
|
||||
attachment = new GameRespondAttachment(CUSTOM_MSG_GAME_RESPOND, second);
|
||||
break;
|
||||
|
||||
case CUSTOM_MSG_MENTORING_RELATIONSHIP:
|
||||
switch (second) {
|
||||
case CustomAttachment.CUSTOM_MSG_SUB_MENTORING_RELATIONSHIP_MISSION_ONE_MASTER:
|
||||
|
@@ -1,40 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.im.custom.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameAttachInfo;
|
||||
|
||||
public class GameAttachment extends CustomAttachment {
|
||||
private GameAttachInfo gameInfo;
|
||||
|
||||
public GameAttachInfo getGameInfo() {
|
||||
return gameInfo;
|
||||
}
|
||||
|
||||
public void setGameInfo(GameAttachInfo gameInfo) {
|
||||
this.gameInfo = gameInfo;
|
||||
}
|
||||
|
||||
public GameAttachment(int first, int second) {
|
||||
super(first, second);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void parseData(JSONObject data) {
|
||||
super.parseData(data);
|
||||
gameInfo = new Gson().fromJson(data.toJSONString(), GameAttachInfo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject packData() {
|
||||
String jsonStr = new Gson().toJson(gameInfo);
|
||||
return JSONObject.parseObject(jsonStr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GameAttachment{" +
|
||||
"gameInfo=" + gameInfo +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.im.custom.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.yizhuan.xchat_android_core.im.game.ImGameInfo;
|
||||
|
||||
public class GameRespondAttachment extends CustomAttachment {
|
||||
|
||||
private ImGameInfo imGameInfo;
|
||||
|
||||
public ImGameInfo getImGameInfo() {
|
||||
return imGameInfo;
|
||||
}
|
||||
|
||||
public void setImGameInfo(ImGameInfo imGameInfo) {
|
||||
this.imGameInfo = imGameInfo;
|
||||
}
|
||||
|
||||
public GameRespondAttachment(int first, int second) {
|
||||
super(first, second);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject packData() {
|
||||
String jsonStr = new Gson().toJson(imGameInfo);
|
||||
return JSONObject.parseObject(jsonStr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void parseData(JSONObject data) {
|
||||
super.parseData(data);
|
||||
imGameInfo = new Gson().fromJson(data.toJSONString(), ImGameInfo.class);
|
||||
}
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.im.custom.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.yizhuan.xchat_android_core.im.game.ImGameInfo;
|
||||
|
||||
public class ImGameAttachment extends CustomAttachment {
|
||||
|
||||
private ImGameInfo imGameInfo;
|
||||
|
||||
public ImGameInfo getImGameInfo() {
|
||||
return imGameInfo;
|
||||
}
|
||||
|
||||
public void setImGameInfo(ImGameInfo imGameInfo) {
|
||||
this.imGameInfo = imGameInfo;
|
||||
}
|
||||
|
||||
public ImGameAttachment(int first, int second) {
|
||||
super(first, second);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject packData() {
|
||||
String jsonStr = new Gson().toJson(imGameInfo);
|
||||
return JSONObject.parseObject(jsonStr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void parseData(JSONObject data) {
|
||||
super.parseData(data);
|
||||
imGameInfo = new Gson().fromJson(data.toJSONString(), ImGameInfo.class);
|
||||
}
|
||||
}
|
@@ -1,8 +1,6 @@
|
||||
package com.yizhuan.xchat_android_core.im.custom.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.yizhuan.xchat_android_core.im.game.ImGameInfo;
|
||||
|
||||
public class ImTipAttachment extends CustomAttachment {
|
||||
private String msg;
|
||||
|
@@ -1,45 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.im.game;
|
||||
|
||||
public class GameNotifyInfo {
|
||||
|
||||
private DataBean data;
|
||||
private String message;
|
||||
private int first;
|
||||
private int second;
|
||||
|
||||
public DataBean getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataBean data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getFirst() {
|
||||
return first;
|
||||
}
|
||||
|
||||
public void setFirst(int first) {
|
||||
this.first = first;
|
||||
}
|
||||
|
||||
public int getSecond() {
|
||||
return second;
|
||||
}
|
||||
|
||||
public void setSecond(int second) {
|
||||
this.second = second;
|
||||
}
|
||||
|
||||
public static class DataBean {
|
||||
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.im.game;
|
||||
|
||||
import com.yizhuan.xchat_android_core.room.game.GameResultInfo;
|
||||
|
||||
public class GameResultEvent {
|
||||
public GameResultInfo.ResultBean resultBean;
|
||||
|
||||
public GameResultEvent(GameResultInfo.ResultBean resultBean) {
|
||||
this.resultBean = resultBean;
|
||||
}
|
||||
}
|
@@ -1,158 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.im.game;
|
||||
|
||||
import com.yizhuan.xchat_android_core.room.game.GameInfo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.realm.RealmObject;
|
||||
import io.realm.annotations.PrimaryKey;
|
||||
|
||||
public class ImGameInfo extends RealmObject implements Serializable {
|
||||
public static final int TIMEING = 1;//倒计时
|
||||
public static final int ACCEPTED = 2;//已接受
|
||||
public static final int INVALID = 3;//已失效
|
||||
|
||||
private long startTime;
|
||||
private int time;
|
||||
// 1,正常。2已接受
|
||||
private int status;
|
||||
private long winerUid;
|
||||
private long startUid;
|
||||
private long acceptUid;
|
||||
private GameInfo gameInfo;
|
||||
|
||||
@PrimaryKey
|
||||
private String uuId;
|
||||
private String gameUrl;
|
||||
|
||||
private String nick;
|
||||
|
||||
public String getNick() {
|
||||
return nick;
|
||||
}
|
||||
|
||||
public long getAcceptUid() {
|
||||
return acceptUid;
|
||||
}
|
||||
|
||||
public ImGameInfo setAcceptUid(long acceptUid) {
|
||||
try {
|
||||
this.acceptUid = acceptUid;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ImGameInfo setNick(String nick) {
|
||||
try {
|
||||
this.nick = nick;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUuId() {
|
||||
return uuId;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public ImGameInfo setTime(int time) {
|
||||
try {//realm数据库问题
|
||||
this.time = time;
|
||||
return this;
|
||||
} catch (Exception e) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public ImGameInfo setUuId(String uuId) {
|
||||
try {
|
||||
this.uuId = uuId;
|
||||
return this;
|
||||
} catch (Exception e) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public ImGameInfo setStartTime(long startTime) {
|
||||
try {
|
||||
this.startTime = startTime;
|
||||
return this;
|
||||
} catch (Exception e) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public GameInfo getGameInfo() {
|
||||
return gameInfo;
|
||||
}
|
||||
|
||||
public ImGameInfo setGameInfo(GameInfo gameInfo) {
|
||||
try {
|
||||
this.gameInfo = gameInfo;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public ImGameInfo setStatus(int status) {
|
||||
try {
|
||||
this.status = status;
|
||||
return this;
|
||||
} catch (Exception e) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public String getGameUrl() {
|
||||
return gameUrl;
|
||||
}
|
||||
|
||||
public long getStartUid() {
|
||||
return startUid;
|
||||
}
|
||||
|
||||
public ImGameInfo setStartUid(long startUid) {
|
||||
try {
|
||||
this.startUid = startUid;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ImGameInfo setGameUrl(String gameUrl) {
|
||||
try {
|
||||
this.gameUrl = gameUrl;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getWinerUid() {
|
||||
return winerUid;
|
||||
}
|
||||
|
||||
public ImGameInfo setWinerUid(long winerUid) {
|
||||
this.winerUid = winerUid;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ImGameInfo{" +
|
||||
"startTime=" + startTime +
|
||||
", gameInfo=" + gameInfo +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -1,373 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.im.game;
|
||||
|
||||
import android.os.CountDownTimer;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nimlib.sdk.NIMClient;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.netease.nimlib.sdk.msg.MsgService;
|
||||
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
|
||||
import com.netease.nimlib.sdk.msg.model.CustomNotification;
|
||||
import com.netease.nimlib.sdk.msg.model.IMMessage;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.GameRespondAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.ImGameAttachment;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.music.bean.LocalMusicInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameInfo;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameUrlInfo;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.realm.Realm;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public class ImGameMode {
|
||||
public static int TIME = 60;//游戏链接有效期
|
||||
public static int gameFrequency = 60;//游戏发起间隔时间
|
||||
public static boolean gameSwitch = true;//游戏开关
|
||||
|
||||
private ImGameInfo imGameInfo;
|
||||
public boolean inRoom;
|
||||
private int pubHallCutTime;
|
||||
private int cutTime;
|
||||
private int roomTime;
|
||||
|
||||
private Api api;
|
||||
|
||||
public int getRoomTime() {
|
||||
return roomTime;
|
||||
}
|
||||
|
||||
public int getCutTime() {
|
||||
return cutTime;
|
||||
}
|
||||
|
||||
public int getPubHallCutTime() {
|
||||
return pubHallCutTime;
|
||||
}
|
||||
|
||||
public ImGameInfo getImGameInfo() {
|
||||
return imGameInfo;
|
||||
}
|
||||
|
||||
public void setImGameInfo(ImGameInfo imGameInfo) {
|
||||
this.imGameInfo = imGameInfo;
|
||||
}
|
||||
|
||||
private ImGameMode() {
|
||||
api = RxNet.create(Api.class);
|
||||
}
|
||||
|
||||
private static class GameModelHelper {
|
||||
private static ImGameMode instance = new ImGameMode();
|
||||
}
|
||||
|
||||
public static ImGameMode get() {
|
||||
return GameModelHelper.instance;
|
||||
}
|
||||
|
||||
public boolean isValid(ImGameInfo imGameInfo) {
|
||||
return imGameInfo.getStatus() == ImGameInfo.TIMEING
|
||||
&& imGameInfo.getStartTime() + TIME * 1000 > System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public static void addToMsgList(ImGameInfo imGameInfo) {
|
||||
Realm mRealm = Realm.getDefaultInstance();
|
||||
mRealm.beginTransaction();
|
||||
mRealm.copyToRealmOrUpdate(imGameInfo);
|
||||
mRealm.commitTransaction();
|
||||
}
|
||||
|
||||
public static ImGameInfo queryGameMsgInfo(String uuid) {
|
||||
try {
|
||||
Realm mRealm = Realm.getDefaultInstance();
|
||||
ImGameInfo localMusicInfos = mRealm.where(ImGameInfo.class).equalTo("uuId", uuid).findFirst();
|
||||
return localMusicInfos;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Single<GameUrlInfo> getGameUrl(long uid,
|
||||
String name,
|
||||
long receiveUid,
|
||||
String receiveName,
|
||||
String gameId,
|
||||
String channelId,
|
||||
String msgId) {
|
||||
return api.getGameUrl(uid, name, receiveUid, receiveName, gameId, channelId, msgId)
|
||||
.compose(RxHelper.singleMainResultNoToast())
|
||||
;
|
||||
}
|
||||
|
||||
public Single<GameUrlInfo> getWatchGameUrl(String gameId,
|
||||
String channelId,
|
||||
String msgId) {
|
||||
return api.getWatchGameUrl(AuthModel.get().getCurrentUid(), gameId, channelId, msgId)
|
||||
.compose(RxHelper.singleMainResult(true));
|
||||
}
|
||||
|
||||
public Single<String> cancelGame(String uuId) {
|
||||
return api.cancelGame(AuthModel.get().getCurrentUid(), uuId)
|
||||
.compose(RxHelper.singleMainResult());
|
||||
}
|
||||
|
||||
public Single<String> getShareImg(int result) {
|
||||
return api.getShareImg(UserModel.get().getCacheLoginUserInfo().getAvatar(),
|
||||
UserModel.get().getCacheLoginUserInfo().getErbanNo(),
|
||||
UserModel.get().getCacheLoginUserInfo().getNick(),
|
||||
result)
|
||||
.compose(RxHelper.singleMainResult(true));
|
||||
}
|
||||
|
||||
public Single<List<GameInfo>> getUserLikeGames(long uid) {
|
||||
return api.gameUserLikeGames(uid)
|
||||
.compose(RxHelper.singleMainResult());
|
||||
}
|
||||
|
||||
public void sendRoomSponsorGameMsg(GameInfo gameInfo) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
ImGameAttachment attachment = new ImGameAttachment(CustomAttachment.CUSTOM_MSG_IM_GAME, CustomAttachment.CUSTOM_MSG_IM_REQUST_GAME);
|
||||
attachment.setImGameInfo(new ImGameInfo()
|
||||
.setStartTime(System.currentTimeMillis())
|
||||
.setGameInfo(gameInfo)
|
||||
.setTime(ImGameMode.TIME)
|
||||
.setNick(UserModel.get().getCacheLoginUserInfo().getNick())
|
||||
.setStatus(ImGameInfo.TIMEING));
|
||||
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
// 聊天室id
|
||||
roomInfo.getRoomId() + "",
|
||||
attachment
|
||||
);
|
||||
//发送消息
|
||||
IMNetEaseManager.get()
|
||||
.sendChatRoomMessage(message, new CallBack<ChatRoomMessage>() {
|
||||
@Override
|
||||
public void onSuccess(ChatRoomMessage data) {
|
||||
// 插入到公屏上
|
||||
IMNetEaseManager.get().addMessagesImmediately(data);
|
||||
startRoomCountTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
LogUtil.e(code + "sendCancelPrepare" + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void sendRoomGameReponseMsg(String url, IMMessage imMessage, CallBack<ChatRoomMessage> callBack) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
GameRespondAttachment attachment = new GameRespondAttachment(CustomAttachment.CUSTOM_MSG_GAME_RESPOND, CustomAttachment.CUSTOM_MSG_GAME_RESPOND_ACCEPT);
|
||||
attachment.setImGameInfo(new ImGameInfo()
|
||||
.setUuId(imMessage.getUuid())
|
||||
.setGameUrl(url)
|
||||
.setNick(UserModel.get().getCacheLoginUserInfo().getNick())
|
||||
.setStartUid(JavaUtil.str2long(imMessage.getFromAccount()))
|
||||
.setStatus(ImGameInfo.ACCEPTED));
|
||||
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
// 聊天室id
|
||||
roomInfo.getRoomId() + "",
|
||||
attachment
|
||||
);
|
||||
//发送消息
|
||||
IMNetEaseManager.get()
|
||||
.sendChatRoomMessage(message, callBack);
|
||||
}
|
||||
|
||||
public void sendRoomGameCancelMsg(IMMessage imMessage) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
GameRespondAttachment attachment = new GameRespondAttachment(CustomAttachment.CUSTOM_MSG_GAME_RESPOND, CustomAttachment.CUSTOM_MSG_GAME_RESPOND_CANCEL);
|
||||
attachment.setImGameInfo(new ImGameInfo()
|
||||
.setUuId(imMessage.getUuid())
|
||||
.setStartUid(JavaUtil.str2long(imMessage.getFromAccount()))
|
||||
.setNick(UserModel.get().getCacheLoginUserInfo().getNick())
|
||||
.setStatus(ImGameInfo.INVALID));
|
||||
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
// 聊天室id
|
||||
roomInfo.getRoomId() + "",
|
||||
attachment
|
||||
);
|
||||
//发送消息
|
||||
IMNetEaseManager.get()
|
||||
.sendChatRoomMessage(message, new CallBack<ChatRoomMessage>() {
|
||||
@Override
|
||||
public void onSuccess(ChatRoomMessage data) {
|
||||
resetTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消发起的游戏
|
||||
* @return
|
||||
*/
|
||||
public boolean exitCancelGame(boolean needSendMsg) {
|
||||
boolean isGameing = false;
|
||||
int size = AvRoomDataManager.get().getChatRoomMessages().size();
|
||||
for (int i = size - 1; i >= (size > 100 ? size - 100 : 0); i--) {
|
||||
IMMessage imMessage = AvRoomDataManager.get().getChatRoomMessages().get(i);
|
||||
if (imMessage.getAttachment() instanceof ImGameAttachment) {
|
||||
ImGameInfo imGameInfo = ((ImGameAttachment) imMessage.getAttachment()).getImGameInfo();
|
||||
if (imGameInfo.getStartTime() + ImGameMode.TIME * 1000 > System.currentTimeMillis()
|
||||
&& imMessage.getFromAccount().equals(AuthModel.get().getCurrentUid() + "")
|
||||
&& imGameInfo.getStatus() == ImGameInfo.TIMEING) {
|
||||
ImGameAttachment attachment = new ImGameAttachment(CustomAttachment.CUSTOM_MSG_IM_GAME, CustomAttachment.CUSTOM_MSG_IM_REQUST_GAME);
|
||||
if (needSendMsg) {
|
||||
imGameInfo.setStatus(ImGameInfo.INVALID);
|
||||
attachment.setImGameInfo(imGameInfo);
|
||||
imMessage.setAttachment(attachment);
|
||||
sendRoomGameCancelMsg(imMessage);
|
||||
}
|
||||
isGameing = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isGameing;
|
||||
}
|
||||
|
||||
public void sendNotify(String acount, int type) {
|
||||
// 发送自定义系统通知通知对方状态改变
|
||||
CustomNotification notification = new CustomNotification();
|
||||
notification.setSessionId(acount);
|
||||
notification.setSessionType(SessionTypeEnum.P2P);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("gameType", type);
|
||||
notification.setContent(json.toString());
|
||||
|
||||
NIMClient.getService(MsgService.class).sendCustomNotification(notification);
|
||||
}
|
||||
|
||||
private CountDownTimer timer;
|
||||
|
||||
public void startCountTime() {
|
||||
timer = new CountDownTimer(gameFrequency * 1000, 1000) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
cutTime = (int) (millisUntilFinished / 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
cutTime = 0;
|
||||
}
|
||||
};
|
||||
timer.start();
|
||||
}
|
||||
|
||||
private CountDownTimer pubtimer;
|
||||
private CountDownTimer roomtimer;
|
||||
|
||||
public void startPubCountTime() {
|
||||
pubtimer = new CountDownTimer(gameFrequency * 1000, 1000) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
pubHallCutTime = (int) (millisUntilFinished / 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
pubHallCutTime = 0;
|
||||
}
|
||||
};
|
||||
pubtimer.start();
|
||||
}
|
||||
|
||||
public void startRoomCountTime() {
|
||||
roomtimer = new CountDownTimer(gameFrequency * 1000, 1000) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
roomTime = (int) (millisUntilFinished / 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
roomTime = 0;
|
||||
}
|
||||
};
|
||||
roomtimer.start();
|
||||
}
|
||||
|
||||
public void resetTime() {
|
||||
pubHallCutTime = 0;
|
||||
cutTime = 0;
|
||||
roomTime=0;
|
||||
if (pubtimer != null) {
|
||||
pubtimer.cancel();
|
||||
}
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
}
|
||||
if (roomtimer != null) {
|
||||
roomtimer.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
interface Api {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("game/v1/gameInfo/getGameUrlV2")
|
||||
Single<ServiceResult<GameUrlInfo>> getGameUrl(@Field("uid") long uid,
|
||||
@Field("name") String name,
|
||||
@Field("receiveUid") long receiveUid,
|
||||
@Field("receiveName") String receiveName,
|
||||
@Field("gameId") String gameId,
|
||||
@Field("channelId") String channelId,
|
||||
@Field("messageId") String messageId);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("game/v2/gameInvite/cancel")
|
||||
Single<ServiceResult<String>> cancelGame(@Field("uid") long uid,
|
||||
@Field("msgIds") String msgIds);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("game/v1/gameInfo/watchGameUrlV2")
|
||||
Single<ServiceResult<GameUrlInfo>> getWatchGameUrl(@Field("uid") long roomUid,
|
||||
@Field("gameId") String gameId,
|
||||
@Field("channelId") String channelId,
|
||||
@Field("messageId") String messageId);
|
||||
|
||||
/**
|
||||
* @param gameResult 游戏结果 1-胜利 2-失败 3-平局
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("picture/getSharePicture")
|
||||
Single<ServiceResult<String>> getShareImg(@Field("avatar") String avatar,
|
||||
@Field("erbanNo") long erbanNo,
|
||||
@Field("nick") String nick,
|
||||
@Field("gameResult") int gameResult);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("game/v4/match/gameUserLikes")
|
||||
Single<ServiceResult<List<GameInfo>>> gameUserLikeGames(@Field("uid") long uid);
|
||||
|
||||
}
|
||||
}
|
@@ -15,14 +15,12 @@ import com.yizhuan.xchat_android_core.DemoCache;
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.certification.CertificationModel;
|
||||
import com.yizhuan.xchat_android_core.im.game.ImGameMode;
|
||||
import com.yizhuan.xchat_android_core.initial.bean.BoxInfo;
|
||||
import com.yizhuan.xchat_android_core.initial.bean.InitInfo;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleDataManager;
|
||||
import com.yizhuan.xchat_android_core.public_chat_hall.manager.PublicChatHallDataManager;
|
||||
import com.yizhuan.xchat_android_core.room.face.DynamicFaceModel;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameModel;
|
||||
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils;
|
||||
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
||||
import com.yizhuan.xchat_android_core.withdraw.WithdrawModel;
|
||||
@@ -241,14 +239,6 @@ public class InitialModel extends BaseModel implements IInitialModel {
|
||||
if (initInfo.getCertificationType() > 0) {
|
||||
CertificationModel.get().setCertificationType(initInfo.getCertificationType());
|
||||
}
|
||||
if (initInfo.getGameTime() > 0) {
|
||||
ImGameMode.TIME = initInfo.getGameTime();
|
||||
}
|
||||
if (initInfo.getGameFrequency() > 0) {
|
||||
ImGameMode.gameFrequency = initInfo.getGameFrequency();
|
||||
}
|
||||
ImGameMode.gameSwitch = initInfo.isGameSwitch();
|
||||
GameModel.RANK_SWITCH = initInfo.isGameRankSwitch();
|
||||
|
||||
// 注册时是否显示图片验证码
|
||||
this.captchaSwitch = initInfo.isCaptchaSwitch();
|
||||
|
@@ -28,7 +28,6 @@ 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.GameModel;
|
||||
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;
|
||||
@@ -203,7 +202,6 @@ public final class AvRoomDataManager {
|
||||
|
||||
public void release() {
|
||||
IMNetEaseManager.get().release();
|
||||
GameModel.get().clear();
|
||||
AudioEngineManager.get().leaveChannel();
|
||||
clear();
|
||||
chatRoomDataRelease();
|
||||
@@ -959,11 +957,6 @@ public final class AvRoomDataManager {
|
||||
return mCurrentRoomInfo == null ? 0 : mCurrentRoomInfo.getRoomId();
|
||||
}
|
||||
|
||||
public int getGameStatus() {
|
||||
return mCurrentRoomInfo == null || mCurrentRoomInfo.roomGame == null ? 0 : mCurrentRoomInfo.roomGame.status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 房主的uid
|
||||
*/
|
||||
|
@@ -4,8 +4,6 @@ package com.yizhuan.xchat_android_core.room.bean;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.yizhuan.xchat_android_core.room.game.GameInfo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -104,8 +102,6 @@ public class RoomInfo implements Parcelable,Serializable {
|
||||
|
||||
public boolean isOpenGame;
|
||||
|
||||
public GameInfo roomGame;
|
||||
|
||||
public BoxSwitchVo boxSwitchVo;
|
||||
|
||||
private String singingMusicName;
|
||||
|
@@ -1,9 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
public class AiPlayEndEvent {
|
||||
public long aiUid;
|
||||
|
||||
public AiPlayEndEvent(long aiUid) {
|
||||
this.aiUid = aiUid;
|
||||
}
|
||||
}
|
@@ -1,4 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
public class CancelGameEvent {
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
public class ChangeGameEvent {
|
||||
|
||||
public ChangeGameEvent() {
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
public class ChangeUserEvent {
|
||||
public GameInfo gameInfo;
|
||||
|
||||
public ChangeUserEvent(GameInfo gameInfo) {
|
||||
this.gameInfo = gameInfo;
|
||||
}
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
public class GameAttachInfo {
|
||||
public GameInfo gameInfo;
|
||||
public String nick;
|
||||
public GameResultInfo.ResultBean gameResultInfo;
|
||||
|
||||
public GameInfo getGameInfo() {
|
||||
return gameInfo;
|
||||
}
|
||||
|
||||
public GameAttachInfo setGameInfo(GameInfo gameInfo) {
|
||||
this.gameInfo = gameInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNick() {
|
||||
return nick;
|
||||
}
|
||||
|
||||
public GameAttachInfo setNick(String nick) {
|
||||
this.nick = nick;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GameResultInfo.ResultBean getGameResultInfo() {
|
||||
return gameResultInfo;
|
||||
}
|
||||
|
||||
public GameAttachInfo setGameResultInfo(GameResultInfo.ResultBean gameResultInfo) {
|
||||
this.gameResultInfo = gameResultInfo;
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
public class GameEvent {
|
||||
public static final int SELECT_GAME = 1;
|
||||
public static final int CANCEL_PREPARE = 2;
|
||||
public static final int OPEN_GAME_MODEL = 3;
|
||||
public static final int CLOSE_GAME_MODEL = 4;
|
||||
public static final int START_GAME = 5;
|
||||
public static final int GAME_END = 6;
|
||||
public static final int SELF_PREPARE = 7;
|
||||
private int type;
|
||||
private GameInfo gameInfo;
|
||||
private GameResultInfo.ResultBean resultInfo;
|
||||
public GameEvent() {
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public GameEvent setType(int type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GameInfo getGameInfo() {
|
||||
return gameInfo;
|
||||
}
|
||||
|
||||
public GameEvent setGameInfo(GameInfo gameInfo) {
|
||||
this.gameInfo = gameInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GameResultInfo.ResultBean getResultInfo() {
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
public GameEvent setResultInfo(GameResultInfo.ResultBean resultInfo) {
|
||||
this.resultInfo = resultInfo;
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -1,114 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.realm.RealmObject;
|
||||
|
||||
public class GameInfo extends RealmObject implements Serializable {
|
||||
|
||||
/**
|
||||
* gameId : doushouqi
|
||||
* gameName : 斗兽棋
|
||||
* gameChannel : shanggekeji
|
||||
* gameIcon : https://img.wduoo.com/FtwoBu1vZc-MOaQeth9IKJvxtrmk?imageslim
|
||||
* domain : http://www.9gge.com/proj/lianliankan/
|
||||
*/
|
||||
|
||||
private String gameId;
|
||||
private String gameName;
|
||||
private String gameChannel;
|
||||
private String gameIcon;
|
||||
private String domain;
|
||||
private String tagIcon;
|
||||
private String platform;
|
||||
private String gamePicture;
|
||||
|
||||
public String getGamePicture() {
|
||||
return gamePicture;
|
||||
}
|
||||
|
||||
public void setGamePicture(String gamePicture) {
|
||||
this.gamePicture = gamePicture;
|
||||
}
|
||||
|
||||
public String getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
public void setPlatform(String platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
//游戏进行的状态
|
||||
public int status;
|
||||
public long uid;
|
||||
public long startUid;
|
||||
public GameInfo() {
|
||||
}
|
||||
|
||||
public String getGameId() {
|
||||
return gameId;
|
||||
}
|
||||
|
||||
public void setGameId(String gameId) {
|
||||
this.gameId = gameId;
|
||||
}
|
||||
|
||||
public String getGameName() {
|
||||
return gameName;
|
||||
}
|
||||
|
||||
public void setGameName(String gameName) {
|
||||
this.gameName = gameName;
|
||||
}
|
||||
|
||||
public String getGameChannel() {
|
||||
return gameChannel;
|
||||
}
|
||||
|
||||
public void setGameChannel(String gameChannel) {
|
||||
this.gameChannel = gameChannel;
|
||||
}
|
||||
|
||||
public String getGameIcon() {
|
||||
return gameIcon;
|
||||
}
|
||||
|
||||
public void setGameIcon(String gameIcon) {
|
||||
this.gameIcon = gameIcon;
|
||||
}
|
||||
|
||||
public String getTagIcon() {
|
||||
return tagIcon;
|
||||
}
|
||||
|
||||
public void setTagIcon(String tagIcon) {
|
||||
this.tagIcon = tagIcon;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
public void setDomain(String domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GameInfo{" +
|
||||
"gameId='" + gameId + '\'' +
|
||||
", uid='" + uid + '\'' +
|
||||
", startUid='" + startUid + '\'' +
|
||||
", gameName='" + gameName + '\'' +
|
||||
", gameChannel='" + gameChannel + '\'' +
|
||||
", gameIcon='" + gameIcon + '\'' +
|
||||
", domain='" + domain + '\'' +
|
||||
", status='" + status + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
@@ -1,162 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
|
||||
public class GameMatchInfo {
|
||||
|
||||
/**
|
||||
* data : {"player1":{"nick":"。。。","uid":905092,"gender":1,"startMatchTime":1547538866298,"avatar":"https://image.zhongjialx.com/Ft4vnfeGMzstNmrSG66sLllVp07I?imageslim"},"player2":{"nick":"自己还支付宝","uid":901305,"gender":2,"avatar":"https://image.zhongjialx.com/FtvHQ37HkZL0CICWEC16t9loG-Nu?imageslim"},"roomId":60222100,"aiUid":901305}
|
||||
* message : match-game
|
||||
* first : 29
|
||||
* second : 293
|
||||
*/
|
||||
|
||||
private DataBean data;
|
||||
private String message;
|
||||
private int first;
|
||||
private int second;
|
||||
|
||||
public DataBean getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataBean data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getFirst() {
|
||||
return first;
|
||||
}
|
||||
|
||||
public void setFirst(int first) {
|
||||
this.first = first;
|
||||
}
|
||||
|
||||
public int getSecond() {
|
||||
return second;
|
||||
}
|
||||
|
||||
public void setSecond(int second) {
|
||||
this.second = second;
|
||||
}
|
||||
|
||||
public static class DataBean {
|
||||
/**
|
||||
* player1 : {"nick":"。。。","uid":905092,"gender":1,"startMatchTime":1547538866298,"avatar":"https://image.zhongjialx.com/Ft4vnfeGMzstNmrSG66sLllVp07I?imageslim"}
|
||||
* player2 : {"nick":"自己还支付宝","uid":901305,"gender":2,"avatar":"https://image.zhongjialx.com/FtvHQ37HkZL0CICWEC16t9loG-Nu?imageslim"}
|
||||
* roomId : 60222100
|
||||
* aiUid : 901305
|
||||
*/
|
||||
|
||||
private PlayerBean player1;
|
||||
private PlayerBean player2;
|
||||
private int roomUid;
|
||||
private int aiUid;
|
||||
|
||||
public PlayerBean getPlayer1() {
|
||||
return player1;
|
||||
}
|
||||
|
||||
public void setPlayer1(PlayerBean player1) {
|
||||
this.player1 = player1;
|
||||
}
|
||||
|
||||
public PlayerBean getPlayer2() {
|
||||
return player2;
|
||||
}
|
||||
|
||||
public void setPlayer2(PlayerBean player2) {
|
||||
this.player2 = player2;
|
||||
}
|
||||
|
||||
public int getRoomId() {
|
||||
return roomUid;
|
||||
}
|
||||
|
||||
public void setRoomId(int roomId) {
|
||||
this.roomUid = roomId;
|
||||
}
|
||||
|
||||
public int getAiUid() {
|
||||
return aiUid;
|
||||
}
|
||||
|
||||
public void setAiUid(int aiUid) {
|
||||
this.aiUid = aiUid;
|
||||
}
|
||||
|
||||
public static class PlayerBean {
|
||||
/**
|
||||
* nick : 。。。
|
||||
* uid : 905092
|
||||
* gender : 1
|
||||
* startMatchTime : 1547538866298
|
||||
* avatar : https://image.zhongjialx.com/Ft4vnfeGMzstNmrSG66sLllVp07I?imageslim
|
||||
*/
|
||||
|
||||
private String nick;
|
||||
private int uid;
|
||||
private int gender;
|
||||
private long startMatchTime;
|
||||
private String avatar;
|
||||
private String gameUrl;
|
||||
|
||||
public String getGameUrl() {
|
||||
return gameUrl;
|
||||
}
|
||||
|
||||
public void setGameUrl(String gameUrl) {
|
||||
this.gameUrl = gameUrl;
|
||||
}
|
||||
|
||||
public String getNick() {
|
||||
return nick;
|
||||
}
|
||||
|
||||
public void setNick(String nick) {
|
||||
this.nick = nick;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(int gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public long getStartMatchTime() {
|
||||
return startMatchTime;
|
||||
}
|
||||
|
||||
public void setStartMatchTime(long startMatchTime) {
|
||||
this.startMatchTime = startMatchTime;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,499 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.GameAttachment;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
import com.yizhuan.xchat_android_library.rxbus.RxBus;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public class GameModel extends BaseModel {
|
||||
public static final int NO_STATUS = 1;//无状态
|
||||
public static final int SELECTING = 2;//选择游戏中
|
||||
public static final int PREPARING = 3;//准备中
|
||||
public static final int PREPARED = 4;
|
||||
public static final int PLAYING = 5;//游戏中
|
||||
|
||||
public static boolean RANK_SWITCH = true;
|
||||
|
||||
private Api api;
|
||||
private List<GameInfo> gameInfos;
|
||||
private GameInfo gameInfo;
|
||||
|
||||
public Api getApi() {
|
||||
return api;
|
||||
}
|
||||
|
||||
private GameModel() {
|
||||
api = RxNet.create(Api.class);
|
||||
}
|
||||
|
||||
private static class GameModelHelper {
|
||||
private static GameModel instance = new GameModel();
|
||||
}
|
||||
|
||||
public void setGameInfo(GameInfo gameInfo) {
|
||||
this.gameInfo = gameInfo;
|
||||
}
|
||||
|
||||
public String getGameId(){
|
||||
return gameInfo==null?"":gameInfo.getGameId();
|
||||
}
|
||||
|
||||
public String getGameName() {
|
||||
return gameInfo == null ? "" : gameInfo.getGameName();
|
||||
}
|
||||
|
||||
public static GameModel get() {
|
||||
return GameModelHelper.instance;
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
gameInfos = null;
|
||||
}
|
||||
|
||||
public boolean cannAddPool(){
|
||||
int freePosition = AvRoomDataManager.get().findFreePosition();
|
||||
try {
|
||||
return freePosition <= 0
|
||||
&& !AvRoomDataManager.get().mMicQueueMemberMap.get(freePosition).mRoomMicInfo.isMicLock()
|
||||
&& TextUtils.isEmpty(AvRoomDataManager.get().mCurrentRoomInfo.getLimitType())
|
||||
&& TextUtils.isEmpty(AvRoomDataManager.get().mCurrentRoomInfo.getRoomPwd());
|
||||
}catch (Exception e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean needRemovePool(){
|
||||
return AvRoomDataManager.get().isCpRoom()
|
||||
&& AvRoomDataManager.get().isRoomOwner()
|
||||
&& AvRoomDataManager.get().gameModel
|
||||
&& AvRoomDataManager.get().findFreePosition()>0;
|
||||
}
|
||||
|
||||
public void sendOpenGame() {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
GameAttachment gameAttachment = new GameAttachment(CustomAttachment.CUSTOM_MSG_GAME, CustomAttachment.CUSTOM_MSG_GAME_OPEN);
|
||||
gameAttachment.setGameInfo(new GameAttachInfo());
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
// 聊天室id
|
||||
roomInfo.getRoomId() + "",
|
||||
gameAttachment
|
||||
);
|
||||
//发送消息
|
||||
IMNetEaseManager.get()
|
||||
.sendChatRoomMessage(message, new CallBack<ChatRoomMessage>() {
|
||||
@Override
|
||||
public void onSuccess(ChatRoomMessage data) {
|
||||
IMNetEaseManager.get().addMessagesImmediately(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
LogUtil.e(code + "sendCancelPrepare" + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void sendCloseGame() {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
GameAttachment gameAttachment = new GameAttachment(CustomAttachment.CUSTOM_MSG_GAME, CustomAttachment.CUSTOM_MSG_GAME_CLOSE);
|
||||
gameAttachment.setGameInfo(new GameAttachInfo());
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
// 聊天室id
|
||||
roomInfo.getRoomId() + "",
|
||||
gameAttachment
|
||||
);
|
||||
//发送消息
|
||||
IMNetEaseManager.get()
|
||||
.sendChatRoomMessage(message, new CallBack<ChatRoomMessage>() {
|
||||
@Override
|
||||
public void onSuccess(ChatRoomMessage data) {
|
||||
// 插入到公屏上
|
||||
IMNetEaseManager.get().addMessagesImmediately(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
LogUtil.e(code + "sendCancelPrepare" + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void selectGameEnd(GameInfo gameInfo) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null || gameInfo == null) return;
|
||||
GameAttachment gameAttachment = new GameAttachment(CustomAttachment.CUSTOM_MSG_GAME, CustomAttachment.CUSTOM_MSG_GAME_SELECT);
|
||||
gameAttachment.setGameInfo(new GameAttachInfo().setGameInfo(gameInfo).setNick(UserModel.get().getCacheLoginUserInfo().getNick()));
|
||||
|
||||
// gameAttachment.nick = UserModel.get().getCacheLoginUserInfo().getNick();
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
// 聊天室id
|
||||
roomInfo.getRoomId() + "",
|
||||
gameAttachment
|
||||
);
|
||||
//发送消息
|
||||
IMNetEaseManager.get()
|
||||
.sendChatRoomMessage(message, new CallBack<ChatRoomMessage>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(ChatRoomMessage data) {
|
||||
IMNetEaseManager.get().addMessagesImmediately(data);
|
||||
RxBus.get().post(new GameEvent().setType(GameEvent.SELF_PREPARE).setGameInfo(gameInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void sendCancelPrepare() {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
GameAttachment gameAttachment = new GameAttachment(CustomAttachment.CUSTOM_MSG_GAME, CustomAttachment.CUSTOM_MSG_GAME_CANCEL_PREPARE);
|
||||
gameAttachment.setGameInfo(new GameAttachInfo());
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
// 聊天室id
|
||||
roomInfo.getRoomId() + "",
|
||||
gameAttachment
|
||||
);
|
||||
//发送消息
|
||||
IMNetEaseManager.get()
|
||||
.sendChatRoomMessage(message, new CallBack<ChatRoomMessage>() {
|
||||
@Override
|
||||
public void onSuccess(ChatRoomMessage data) {
|
||||
RxBus.get().post(new GameEvent().setType(GameEvent.CANCEL_PREPARE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
LogUtil.e(code + "sendCancelPrepare" + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void sendAiEnterMsg(String nick) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
GameAttachment gameAttachment = new GameAttachment(CustomAttachment.CUSTOM_MSG_GAME, CustomAttachment.CUSTOM_MSG_GAME_AI_ENTER);
|
||||
gameAttachment.setGameInfo(new GameAttachInfo().setNick(nick));
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
// 聊天室id
|
||||
roomInfo.getRoomId() + "",
|
||||
gameAttachment
|
||||
);
|
||||
IMNetEaseManager.get()
|
||||
.sendChatRoomMessage(message, new CallBack<ChatRoomMessage>() {
|
||||
@Override
|
||||
public void onSuccess(ChatRoomMessage data) {
|
||||
IMNetEaseManager.get().addMessages(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void sendGameStartMsg(GameInfo gameInfo) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null || gameInfo == null) return;
|
||||
GameAttachment gameAttachment = new GameAttachment(CustomAttachment.CUSTOM_MSG_GAME, CustomAttachment.CUSTOM_MSG_GAME_START);
|
||||
gameAttachment.setGameInfo(new GameAttachInfo().setGameInfo(gameInfo).setNick(UserModel.get().getCacheLoginUserInfo().getNick()));
|
||||
// gameAttachment.nick = ;
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
// 聊天室id
|
||||
roomInfo.getRoomId() + "",
|
||||
gameAttachment
|
||||
);
|
||||
//发送消息
|
||||
IMNetEaseManager.get()
|
||||
.sendChatRoomMessage(message, new CallBack<ChatRoomMessage>() {
|
||||
@Override
|
||||
public void onSuccess(ChatRoomMessage data) {
|
||||
IMNetEaseManager.get().addMessages(data);
|
||||
RxBus.get().post(new GameEvent().setType(GameEvent.START_GAME).setGameInfo(gameInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
LogUtil.e(code + "==" + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Single<String> addPool(String gameId) {
|
||||
|
||||
return api.addPoolForRoom(AvRoomDataManager.get().getRoomUid(),AvRoomDataManager.get().getRoomId(), gameId)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.compose(RxHelper.handleStringData())
|
||||
.doOnError(throwable -> SingleToastUtil.showToast(throwable.getMessage()));
|
||||
}
|
||||
|
||||
public Single<String> removePool(String gameId) {
|
||||
return api.removePoolForRoom(AvRoomDataManager.get().getRoomUid(),AvRoomDataManager.get().getRoomId(), gameId)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.compose(RxHelper.handleStringData());
|
||||
}
|
||||
|
||||
public Single<String> changeGameModel(long uid, boolean status) {
|
||||
return api.changeGameModel(uid, status)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.compose(RxHelper.handleStringData())
|
||||
.doOnError(throwable -> SingleToastUtil.showToast(throwable.getMessage()));
|
||||
}
|
||||
|
||||
public Single<String> updateGameStatus(long uid, int status, String gameId, String gameName) {
|
||||
return updateGameStatus(uid, status, gameId, gameName, true);
|
||||
}
|
||||
|
||||
public Single<String> updateGameStatus(long uid, int status, String gameId, String gameName, boolean showLoad) {
|
||||
return api.updateGameStatus(uid, status, gameId, gameName, AuthModel.get().getCurrentUid())
|
||||
.compose(RxHelper.singleMainResult(showLoad))
|
||||
;
|
||||
}
|
||||
|
||||
public Single<GameUrlInfo> getGameUrl(long roomId, String gameId, String gameChane,long aiUid) {
|
||||
return api.getGameUrl(AuthModel.get().getCurrentUid(),
|
||||
UserModel.get().getCurrentUserInfo().blockingGet().getNick(),
|
||||
roomId, gameId, gameChane,aiUid)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.compose(RxHelper.handleBeanData());
|
||||
}
|
||||
|
||||
public Single<GameUrlInfo> getWatchGameUrl(long uid, String gameId, String gameChane) {
|
||||
long leftUid=0;
|
||||
long rightUid = 0;
|
||||
RoomQueueInfo roomQueueInfo = AvRoomDataManager.get().getRoomQueueMemberInfoByMicPosition(-1);
|
||||
if (roomQueueInfo!=null && roomQueueInfo.mChatRoomMember!=null){
|
||||
leftUid = JavaUtil.str2long(roomQueueInfo.mChatRoomMember.getAccount());
|
||||
}
|
||||
RoomQueueInfo roomQueueInfo1 = AvRoomDataManager.get().getRoomQueueMemberInfoByMicPosition(0);
|
||||
if (roomQueueInfo1!=null && roomQueueInfo1.mChatRoomMember!=null){
|
||||
rightUid = JavaUtil.str2long(roomQueueInfo1.mChatRoomMember.getAccount());
|
||||
}
|
||||
return api.getWatchGameUrl(AuthModel.get().getCurrentUid(),
|
||||
uid, gameId, gameChane,leftUid,rightUid)
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.compose(RxHelper.handleBeanData());
|
||||
}
|
||||
|
||||
public Single<GameInfo> getGameInfoById(String gameId) {
|
||||
if (gameInfos != null) {
|
||||
for (int i = 0; i < gameInfos.size(); i++) {
|
||||
if (gameId.equals(gameInfos.get(i).getGameId())) {
|
||||
return Single.just(gameInfos.get(i)).observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
}
|
||||
}
|
||||
return api.getGameList(AvRoomDataManager.get().getRoomUid(), 1, 20)
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.flatMap(gameInfos -> {
|
||||
for (int i = 0; i < gameInfos.size(); i++) {
|
||||
if (gameId.equals(gameInfos.get(i).getGameId())) {
|
||||
return Single.just(gameInfos.get(i));
|
||||
}
|
||||
}
|
||||
return Single.error(new Throwable("游戏不存在"));
|
||||
});
|
||||
}
|
||||
|
||||
public Single<List<GameInfo>> getGameList(long uid) {
|
||||
if (gameInfos != null && gameInfos.size()!=0) {
|
||||
return Single.just(gameInfos).observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
return api.getGameList(uid, 1, 20)
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.doOnSuccess(gameInfos -> {
|
||||
Iterator<GameInfo> iterator = gameInfos.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
GameInfo gameInfo = iterator.next();
|
||||
if (!"all".equals(gameInfo.getPlatform()) && !"android".equals(gameInfo.getPlatform())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
GameModel.this.gameInfos = gameInfos;
|
||||
});
|
||||
}
|
||||
|
||||
public Single<List<GameInfo>> getHomeGameList() {
|
||||
return api.getHomeGameList(AuthModel.get().getCurrentUid(), 1, 20)
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.doOnSuccess(gameInfos -> {
|
||||
Iterator<GameInfo> iterator = gameInfos.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
GameInfo gameInfo = iterator.next();
|
||||
if (!"all".equals(gameInfo.getPlatform()) && !"android".equals(gameInfo.getPlatform())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Single<List<BannerInfo>> getBanner(int type) {
|
||||
return api.getGameBanner(type)
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
;
|
||||
}
|
||||
|
||||
public Single<GameRankInfo> getGameRank() {
|
||||
return api.getGameRank(AuthModel.get().getCurrentUid())
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.flatMap(gameRankInfo -> {
|
||||
if (!"all".equals(gameRankInfo.getPlatform()) && !"android".equals(gameRankInfo.getPlatform())) {
|
||||
gameRankInfo.getList().clear();
|
||||
}
|
||||
return Single.just(gameRankInfo);
|
||||
});
|
||||
}
|
||||
|
||||
public Single<String> saveGameResult(String json, String msgId) {
|
||||
return api.saveGameResult(msgId, json)
|
||||
.compose(RxHelper.handleStringData());
|
||||
}
|
||||
|
||||
public Single<List<String>> getGameFace() {
|
||||
return api.getGameFace()
|
||||
.compose(RxHelper.singleMainResult());
|
||||
}
|
||||
|
||||
public boolean prepareGame() {
|
||||
if (AvRoomDataManager.get().isCpRoom() &&
|
||||
AvRoomDataManager.get().isOpenGame() &&
|
||||
!TextUtils.isEmpty(GameModel.get().getGameId())) {
|
||||
if (AvRoomDataManager.get().mCurrentRoomInfo.getRoomGame() != null
|
||||
&& AvRoomDataManager.get().mCurrentRoomInfo.getRoomGame().startUid == AuthModel.get().getCurrentUid()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public interface Api {
|
||||
/**
|
||||
* @param roomUid 房主uid
|
||||
* @param gameStatus true 开启
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("room/openOrCloseGame")
|
||||
Single<ServiceResult<String>> changeGameModel(@Field("roomUid") long roomUid,
|
||||
@Field("gameStatus") boolean gameStatus);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param roomUid
|
||||
* @param status {@link GameModel.SELECTING}
|
||||
* @param gameId
|
||||
* @param gameName
|
||||
* @param startUid
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("room/updateGameStatus")
|
||||
Single<ServiceResult<String>> updateGameStatus(@Field("roomUid") long roomUid,
|
||||
@Field("status") int status,
|
||||
@Field("gameId") String gameId,
|
||||
@Field("gameName") String gameName,
|
||||
@Field("startUid") long startUid);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("room/addPoolForRoom")
|
||||
Single<ServiceResult<String>> addPoolForRoom(@Field("uid") long roomUid,
|
||||
@Field("roomId") long roomId,
|
||||
@Field("gameId") String gameId);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("room/removePoolForRoom")
|
||||
Single<ServiceResult<String>> removePoolForRoom(@Field("uid") long roomUid,
|
||||
@Field("roomId") long roomId,
|
||||
@Field("gameId") String gameId);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("game/v1/gameInfo/pk1v1")
|
||||
Single<ServiceResult<List<GameInfo>>> getGameList(@Field("uid") long uid,
|
||||
@Field("pageNum") int pageNum,
|
||||
@Field("pageSize") int pageSize);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("game/v1/gameInfo/list")
|
||||
Single<ServiceResult<List<GameInfo>>> getHomeGameList(@Field("uid") long uid,
|
||||
@Field("pageNum") int pageNum,
|
||||
@Field("pageSize") int pageSize);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("game/v1/gameInfo/getGameUrl")
|
||||
Single<ServiceResult<GameUrlInfo>> getGameUrl(@Field("uid") long uid,
|
||||
@Field("name") String name,
|
||||
@Field("roomId") long roomId,
|
||||
@Field("gameId") String gameId,
|
||||
@Field("channelId") String channelId,
|
||||
@Field("aiUId") long aiUId);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("game/v1/gameInfo/watchGameUrl")
|
||||
Single<ServiceResult<GameUrlInfo>> getWatchGameUrl(@Field("uid") long roomUid,
|
||||
@Field("roomId") long roomId,
|
||||
@Field("gameId") String gameId,
|
||||
@Field("channelId") String channelId,
|
||||
@Field("uidLeft") long uidLeft,
|
||||
@Field("uidRight") long uidRight);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("game/v1/gameResult/saveGameResult")
|
||||
Single<ServiceResult<String>> saveGameResult(@Field("messageId") String messageId, @Field("gameResult") String result);
|
||||
|
||||
/**
|
||||
* @param bannerType 3顶部banner 4声控福利
|
||||
* @return
|
||||
*/
|
||||
@GET("banner/gameFirstPage")
|
||||
Single<ServiceResult<List<BannerInfo>>> getGameBanner(@Query("bannerType") int bannerType);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("game/v2/rank/list")
|
||||
Single<ServiceResult<GameRankInfo>> getGameRank(@Field("uid") long uid);
|
||||
|
||||
@POST("face/getGameFace")
|
||||
Single<ServiceResult<List<String>>> getGameFace();
|
||||
}
|
||||
}
|
@@ -1,112 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GameRankInfo {
|
||||
|
||||
/**
|
||||
* internal : 5
|
||||
* list : [{"gameId":"lianliankan","gameName":"连连看","userList":[{"avatar":"https://image.zhongjialx.com/FnEnF_OjqKJOBTzEXZ9VL_aJa5ie?imageslim","nick":"今朝丶","type":"2"},{"avatar":"https://image.zhongjialx.com/FnEnF_OjqKJOBTzEXZ9VL_aJa5ie?imageslim","nick":"今朝丶","type":"2"}]},{"gameId":"doushouqi","gameName":"斗兽棋","userList":[]},{"gameId":"feidao","gameName":"快刀手","userList":[]},{"gameId":"quxiaoxiao","gameName":"趣消消","userList":[{"avatar":"https://image.zhongjialx.com/FjmDBU4Vqqebi3zIaouwlFmpdYCr?imageslim","nick":"aaaaa","type":"2"},{"avatar":"https://image.zhongjialx.com/FjmDBU4Vqqebi3zIaouwlFmpdYCr?imageslim","nick":"aaaaa","type":"2"}]},{"gameId":"sushedazuozhan","gameName":"宿舍大作战","userList":[]},{"gameId":"wuziqi","gameName":"五子棋","userList":[]}]
|
||||
*/
|
||||
|
||||
private int internal;
|
||||
private String platform;
|
||||
|
||||
public String getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
public void setPlatform(String platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
private List<ListBean> list;
|
||||
|
||||
public int getInternal() {
|
||||
return internal;
|
||||
}
|
||||
|
||||
public void setInternal(int internal) {
|
||||
this.internal = internal;
|
||||
}
|
||||
|
||||
public List<ListBean> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<ListBean> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public static class ListBean {
|
||||
/**
|
||||
* gameId : lianliankan
|
||||
* gameName : 连连看
|
||||
* userList : [{"avatar":"https://image.zhongjialx.com/FnEnF_OjqKJOBTzEXZ9VL_aJa5ie?imageslim","nick":"今朝丶","type":"2"},{"avatar":"https://image.zhongjialx.com/FnEnF_OjqKJOBTzEXZ9VL_aJa5ie?imageslim","nick":"今朝丶","type":"2"}]
|
||||
*/
|
||||
|
||||
private String gameId;
|
||||
private String gameName;
|
||||
private List<UserListBean> userList;
|
||||
|
||||
public String getGameId() {
|
||||
return gameId;
|
||||
}
|
||||
|
||||
public void setGameId(String gameId) {
|
||||
this.gameId = gameId;
|
||||
}
|
||||
|
||||
public String getGameName() {
|
||||
return gameName;
|
||||
}
|
||||
|
||||
public void setGameName(String gameName) {
|
||||
this.gameName = gameName;
|
||||
}
|
||||
|
||||
public List<UserListBean> getUserList() {
|
||||
return userList;
|
||||
}
|
||||
|
||||
public void setUserList(List<UserListBean> userList) {
|
||||
this.userList = userList;
|
||||
}
|
||||
|
||||
public static class UserListBean {
|
||||
/**
|
||||
* avatar : https://image.zhongjialx.com/FnEnF_OjqKJOBTzEXZ9VL_aJa5ie?imageslim
|
||||
* nick : 今朝丶
|
||||
* type : 2
|
||||
*/
|
||||
|
||||
private String avatar;
|
||||
private String nick;
|
||||
private String type;
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getNick() {
|
||||
return nick;
|
||||
}
|
||||
|
||||
public void setNick(String nick) {
|
||||
this.nick = nick;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
import com.yizhuan.xchat_android_core.im.game.ImGameInfo;
|
||||
|
||||
public class GameRespondEvent {
|
||||
public ImGameInfo imGameInfo;
|
||||
public int second;
|
||||
public String fromAcount;
|
||||
|
||||
public GameRespondEvent(ImGameInfo imGameInfo, int second, String uid) {
|
||||
this.imGameInfo = imGameInfo;
|
||||
this.second = second;
|
||||
this.fromAcount = uid;
|
||||
}
|
||||
|
||||
}
|
@@ -1,233 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GameResultInfo {
|
||||
public static final String DRAW="draw";
|
||||
public static final String NOT_DRAW="not_draw";
|
||||
|
||||
|
||||
/**
|
||||
* timestamp : 1547457484
|
||||
* nonstr : h1w2D7IJMw
|
||||
* sign : ec6c8cea750bfe110d4b5e3f0d43ca1de204222f
|
||||
* result : {"gameId":"lianliankan","pkType":"pk_1v1","roomId":905092,"userCount":2,"playerCount":2,"watcherCount":0,"channelId":"shanggekeji","resultType":"not_draw","duration":53,"users":[{"uid":905092,"name":"。。。","ai":false},{"uid":901259,"name":"漂泊的贤者沟沟壑壑","ai":false}],"winners":[{"uid":905092,"name":"。。。","ai":false}],"failers":[{"uid":901259,"name":"漂泊的贤者沟沟壑壑","ai":false}]}
|
||||
*/
|
||||
|
||||
private int timestamp;
|
||||
private String nonstr;
|
||||
private String sign;
|
||||
private ResultBean result;
|
||||
|
||||
public int getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(int timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public String getNonstr() {
|
||||
return nonstr;
|
||||
}
|
||||
|
||||
public void setNonstr(String nonstr) {
|
||||
this.nonstr = nonstr;
|
||||
}
|
||||
|
||||
public String getSign() {
|
||||
return sign;
|
||||
}
|
||||
|
||||
public void setSign(String sign) {
|
||||
this.sign = sign;
|
||||
}
|
||||
|
||||
public ResultBean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ResultBean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public static class ResultBean {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResultBean{" +
|
||||
"gameId='" + gameId + '\'' +
|
||||
", pkType='" + pkType + '\'' +
|
||||
", roomId=" + roomId +
|
||||
", userCount=" + userCount +
|
||||
", playerCount=" + playerCount +
|
||||
", watcherCount=" + watcherCount +
|
||||
", channelId='" + channelId + '\'' +
|
||||
", resultType='" + resultType + '\'' +
|
||||
", duration=" + duration +
|
||||
", users=" + users +
|
||||
", winners=" + winners +
|
||||
", failers=" + failers +
|
||||
'}';
|
||||
}
|
||||
|
||||
/**
|
||||
* gameId : lianliankan
|
||||
* pkType : pk_1v1
|
||||
* roomId : 905092
|
||||
* userCount : 2
|
||||
* playerCount : 2
|
||||
* watcherCount : 0
|
||||
* channelId : shanggekeji
|
||||
* resultType : not_draw
|
||||
* duration : 53
|
||||
* users : [{"uid":905092,"name":"。。。","ai":false},{"uid":901259,"name":"漂泊的贤者沟沟壑壑","ai":false}]
|
||||
* winners : [{"uid":905092,"name":"。。。","ai":false}]
|
||||
* failers : [{"uid":901259,"name":"漂泊的贤者沟沟壑壑","ai":false}]
|
||||
*/
|
||||
|
||||
private String gameId;
|
||||
private String pkType;
|
||||
private int roomId;
|
||||
private int userCount;
|
||||
private int playerCount;
|
||||
private int watcherCount;
|
||||
private String channelId;
|
||||
private String resultType;
|
||||
private int duration;
|
||||
private List<UsersBean> users;
|
||||
private List<UsersBean> winners;
|
||||
private List<UsersBean> failers;
|
||||
|
||||
public String getGameId() {
|
||||
return gameId;
|
||||
}
|
||||
|
||||
public void setGameId(String gameId) {
|
||||
this.gameId = gameId;
|
||||
}
|
||||
|
||||
public String getPkType() {
|
||||
return pkType;
|
||||
}
|
||||
|
||||
public void setPkType(String pkType) {
|
||||
this.pkType = pkType;
|
||||
}
|
||||
|
||||
public int getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(int roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
public int getUserCount() {
|
||||
return userCount;
|
||||
}
|
||||
|
||||
public void setUserCount(int userCount) {
|
||||
this.userCount = userCount;
|
||||
}
|
||||
|
||||
public int getPlayerCount() {
|
||||
return playerCount;
|
||||
}
|
||||
|
||||
public void setPlayerCount(int playerCount) {
|
||||
this.playerCount = playerCount;
|
||||
}
|
||||
|
||||
public int getWatcherCount() {
|
||||
return watcherCount;
|
||||
}
|
||||
|
||||
public void setWatcherCount(int watcherCount) {
|
||||
this.watcherCount = watcherCount;
|
||||
}
|
||||
|
||||
public String getChannelId() {
|
||||
return channelId;
|
||||
}
|
||||
|
||||
public void setChannelId(String channelId) {
|
||||
this.channelId = channelId;
|
||||
}
|
||||
|
||||
public String getResultType() {
|
||||
return resultType;
|
||||
}
|
||||
|
||||
public void setResultType(String resultType) {
|
||||
this.resultType = resultType;
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public List<UsersBean> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(List<UsersBean> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
public List<UsersBean> getWinners() {
|
||||
return winners;
|
||||
}
|
||||
|
||||
public void setWinners(List<UsersBean> winners) {
|
||||
this.winners = winners;
|
||||
}
|
||||
|
||||
public List<UsersBean> getFailers() {
|
||||
return failers;
|
||||
}
|
||||
|
||||
public void setFailers(List<UsersBean> failers) {
|
||||
this.failers = failers;
|
||||
}
|
||||
|
||||
public static class UsersBean {
|
||||
/**
|
||||
* uid : 905092
|
||||
* name : 。。。
|
||||
* ai : false
|
||||
*/
|
||||
|
||||
private long uid;
|
||||
private String name;
|
||||
private boolean ai;
|
||||
|
||||
public long getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(long uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isAi() {
|
||||
return ai;
|
||||
}
|
||||
|
||||
public void setAi(boolean ai) {
|
||||
this.ai = ai;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
public class GameUidInfo {
|
||||
/**
|
||||
* uidLeft : 111
|
||||
* uidRight : 22222
|
||||
*/
|
||||
|
||||
private long uidLeft;
|
||||
private long uidRight;
|
||||
|
||||
public long getUidLeft() {
|
||||
return uidLeft;
|
||||
}
|
||||
|
||||
public void setUidLeft(long uidLeft) {
|
||||
this.uidLeft = uidLeft;
|
||||
}
|
||||
|
||||
public long getUidRight() {
|
||||
return uidRight;
|
||||
}
|
||||
|
||||
public void setUidRight(long uidRight) {
|
||||
this.uidRight = uidRight;
|
||||
}
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.room.game;
|
||||
|
||||
public class GameUrlInfo {
|
||||
/**
|
||||
* url : http://www.9gge.com/proj/lianliankan/index.html?timestamp=1509710152&nonstr=YLXaell5ZO&sign=e14c9643118482b4cd0c83c53c7f9b0120e74977&post_data=%7B%22roomId%22%3A%221%22%2C%22channelId%22%3A%22shangge%22%2C%22gameId%22%3A%22lianliankan%22%2C%22player%22%3A
|
||||
*/
|
||||
|
||||
private String url;
|
||||
private String receiveGameUrl;//被邀请人游戏地址
|
||||
private String gameUrl;//发起人游戏地址
|
||||
|
||||
public String getReceiveGameUrl() {
|
||||
return receiveGameUrl;
|
||||
}
|
||||
|
||||
public void setReceiveGameUrl(String receiveGameUrl) {
|
||||
this.receiveGameUrl = receiveGameUrl;
|
||||
}
|
||||
|
||||
public String getGameUrl() {
|
||||
return gameUrl;
|
||||
}
|
||||
|
||||
public void setGameUrl(String gameUrl) {
|
||||
this.gameUrl = gameUrl;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
}
|
@@ -20,7 +20,6 @@ import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo;
|
||||
import com.yizhuan.xchat_android_core.decoration.headwear.bean.HeadWearInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.im.game.ImGameMode;
|
||||
import com.yizhuan.xchat_android_core.level.UserLevelVo;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
@@ -37,7 +36,6 @@ import com.yizhuan.xchat_android_core.room.bean.RoomWelcomeConfig;
|
||||
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.SimplePartyRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.event.RoomInfoEvent;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameModel;
|
||||
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg;
|
||||
import com.yizhuan.xchat_android_core.room.model.inteface.IAvRoomModel;
|
||||
import com.yizhuan.xchat_android_core.room.pk.model.PkModel;
|
||||
@@ -315,15 +313,7 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//云信退出聊天室,清除房间数据
|
||||
if (ImGameMode.get().exitCancelGame(true)
|
||||
|| GameModel.get().prepareGame()) {
|
||||
Single.timer(500, TimeUnit.MILLISECONDS)
|
||||
.subscribe(aLong -> quitRoom(roomId));
|
||||
} else {
|
||||
quitRoom(roomId);
|
||||
}
|
||||
quitRoom(roomId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user