[Modify]幸运塔罗新增公屏通知, 飘屏

This commit is contained in:
wzq
2023-09-15 18:31:57 +08:00
parent bfd619e8b5
commit 306e0a99a0
15 changed files with 266 additions and 39 deletions

View File

@@ -1321,13 +1321,13 @@ public final class IMNetEaseManager {
if (second == CUSTOM_MSG_LUCKY_SEA_GIFT_ROOM_NOTIFY) {
addMessages(msg);
noticeRoomEvent(msg, RoomEvent.LUCKY_SEA_GIFT_ROOM_NOTIFY);
}else if(second == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_NOTIFY){
} else if (second == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_NOTIFY) {
addMessages(msg);
noticeRoomEvent(msg, RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY);
}
break;
case ROOM_FREE_GIFT:
if(second == ROOM_FREE_GIFT_CHANGE){
if (second == ROOM_FREE_GIFT_CHANGE) {
RoomFreeGiftAttachment freeGiftAttachment = (RoomFreeGiftAttachment) attachment;
RoomFreeGiftMsgBean bean = freeGiftAttachment.getRoomFreeGiftMsgInfo();
EventBus.getDefault().post(new UpdateKnapFreeGiftDataEvent(bean));
@@ -1355,6 +1355,11 @@ public final class IMNetEaseManager {
break;
}
break;
case CUSTOM_MESS_TAROT:
if (second == CUSTOM_MESS_TAROT_INTERMEDIATE_PRIZE_WINNING
|| second == CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING) {
noticeTarot(msg, second);
}
default:
break;
}
@@ -3325,6 +3330,14 @@ public final class IMNetEaseManager {
.setChatRoomMessage(msg));
}
private void noticeTarot(ChatRoomMessage msg, int second) {
getChatRoomEventObservable()
.onNext(new RoomEvent()
.setEvent(second == CUSTOM_MESS_TAROT_INTERMEDIATE_PRIZE_WINNING
? RoomEvent.TAROT_NOTIFY : RoomEvent.TAROT_NOTIFY_SVGA)
.setChatRoomMessage(msg));
}
private void noticeRadish(ChatRoomMessage msg, int second) {
int event = second == CUSTOM_MSG_SUB_RADISH_ALL_ROOM_NOTIFY ? RoomEvent.RADISH_NOTIFY : RoomEvent.RADISH_NOTIFY_SVGA;
getChatRoomEventObservable()

View File

@@ -573,7 +573,7 @@ public class CustomAttachParser implements MsgAttachmentParser {
}
break;
case CustomAttachment.CUSTOM_MESS_TAROT:
attachment = new TarotAttachment(CustomAttachment.CUSTOM_MESS_TAROT, CustomAttachment.CUSTOM_MESS_TAROT_SUCCESS);
attachment = new TarotAttachment(CustomAttachment.CUSTOM_MESS_TAROT, second);
break;
case CustomAttachment.CUSTOM_MSG_CHAT_HINT:
attachment = new ChatHintAttachment(CustomAttachment.CUSTOM_MSG_SUB_CHAT_HINT);

View File

@@ -328,8 +328,13 @@ public class CustomAttachment implements MsgAttachment {
//推送消息
public static final int CUSTOM_MSG_PUSH_NOTIFIFICATION = 70;
public static final int CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM = 701;// 推送进入房间
public static final int CUSTOM_MESS_TAROT = 71; //塔罗牌充值消息
public static final int CUSTOM_MESS_TAROT_SUCCESS = 711; //塔罗牌充值中奖消息
public static final int CUSTOM_MESS_TAROT_JUNIOR_PRIZE_WINNING = 712; //塔罗牌初级卡中奖消息
public static final int CUSTOM_MESS_TAROT_INTERMEDIATE_PRIZE_WINNING = 713; //塔罗牌中级卡中奖消息
public static final int CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING = 714; //塔罗牌高级卡中奖消息
//相亲模式
public static final int CUSTOM_MSG_DATING = 72;
public static final int CUSTOM_MSG_SUB_DATING_SELECT = 721;

View File

@@ -258,6 +258,10 @@ public class RoomEvent {
public static final int FAIRY_CONVERT_L2 = 105;
public static final int FAIRY_CONVERT_L3 = 106;
public static final int TAROT_NOTIFY = 107;
public static final int TAROT_NOTIFY_SVGA = 108;
private int event = NONE;
private int micPosition = Integer.MIN_VALUE;
private int posState = -1;

View File

@@ -299,20 +299,17 @@ public class MonsterHuntingModel extends BaseModel implements IMonsterHuntingMod
* 注册云信全服广播接收器
*/
private void registerMonsterBroadcastMessage() {
NIMSDK.getMsgServiceObserve().observeBroadcastMessage(new Observer<BroadcastMessage>() {
@Override
public void onEvent(BroadcastMessage broadcastMessage) {
if (broadcastMessage != null) {
String contentStr = broadcastMessage.getContent();
Logger.i(ResUtil.getString(R.string.monsterhunting_model_monsterhuntingmodel_03) + contentStr);
if (TextUtils.isEmpty(contentStr)) return;
JSONObject jsonObject = JSON.parseObject(contentStr);
if (jsonObject == null) return;
if (jsonObject.containsKey("body")) {
String body = jsonObject.getString("body");
if (TextUtils.isEmpty(body)) return;
onReceivedNimBroadcastMessage(body);
}
NIMSDK.getMsgServiceObserve().observeBroadcastMessage((Observer<BroadcastMessage>) broadcastMessage -> {
if (broadcastMessage != null) {
String contentStr = broadcastMessage.getContent();
Logger.i(ResUtil.getString(R.string.monsterhunting_model_monsterhuntingmodel_03) + contentStr);
if (TextUtils.isEmpty(contentStr)) return;
JSONObject jsonObject = JSON.parseObject(contentStr);
if (jsonObject == null) return;
if (jsonObject.containsKey("body")) {
String body = jsonObject.getString("body");
if (TextUtils.isEmpty(body)) return;
onReceivedNimBroadcastMessage(body);
}
}
}, true);
@@ -357,18 +354,15 @@ public class MonsterHuntingModel extends BaseModel implements IMonsterHuntingMod
// 保留 10 秒
Single.just(data).delay(10, TimeUnit.SECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<MonsterProtocol.DataBean>() {
@Override
public void accept(MonsterProtocol.DataBean data) throws Exception {
//移除怪兽
int size = monsterList.size();
for (int i = 0; i < size; i++) {
MonsterProtocol.DataBean monsterInfos = monsterList.get(i);
if (monsterInfos.getMonsterId() == data.getMonsterId()){
monsterList.remove(i);
RxBusHelper.post(new MonsterUpdateEvent(monsterList));
break;
}
.subscribe(data1 -> {
//移除怪兽
int size = monsterList.size();
for (int i = 0; i < size; i++) {
MonsterProtocol.DataBean monsterInfos = monsterList.get(i);
if (monsterInfos.getMonsterId() == data1.getMonsterId()){
monsterList.remove(i);
RxBusHelper.post(new MonsterUpdateEvent(monsterList));
break;
}
}
});
@@ -413,6 +407,9 @@ public class MonsterHuntingModel extends BaseModel implements IMonsterHuntingMod
break;
}
}
break;
case CustomAttachment.CUSTOM_MESS_TAROT:
break;
default:
break;