精灵夺宝:增加公屏和飘屏
This commit is contained in:
@@ -1424,6 +1424,29 @@ public final class IMNetEaseManager {
|
||||
noticeRoomEvent(msg, RoomEvent.KITCHEN_ALL_ROOM);
|
||||
addMessages(msg);
|
||||
}
|
||||
break;
|
||||
case CUSTOM_MSG_FAIRY:
|
||||
if (second != CUSTOM_MSG_SUB_FAIRY_SEND && second != CUSTOM_MSG_SUB_FAIRY_ASK_FOR) {
|
||||
addMessages(msg);
|
||||
}
|
||||
switch (second) {
|
||||
case CUSTOM_MSG_SUB_DRAW_GIFT_L4:
|
||||
noticeRoomEvent(msg, RoomEvent.FAIRY_DRAW_GIFT_L4);
|
||||
break;
|
||||
case CUSTOM_MSG_SUB_DRAW_GIFT_L5:
|
||||
noticeRoomEvent(msg, RoomEvent.FAIRY_DRAW_GIFT_L5);
|
||||
break;
|
||||
case CUSTOM_MSG_SUB_CONVERT_L1:
|
||||
noticeRoomEvent(msg, RoomEvent.FAIRY_CONVERT_L1);
|
||||
break;
|
||||
case CUSTOM_MSG_SUB_CONVERT_L2:
|
||||
noticeRoomEvent(msg, RoomEvent.FAIRY_CONVERT_L2);
|
||||
break;
|
||||
case CUSTOM_MSG_SUB_CONVERT_L3:
|
||||
noticeRoomEvent(msg, RoomEvent.FAIRY_CONVERT_L3);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@@ -59,6 +59,7 @@ public class TRtcEngineHandler extends Handler {
|
||||
for (IRtcEngineEventHandler.AudioVolumeInfo speaker : speakers) {
|
||||
// 0 代表的是房主,其他代表的是uid
|
||||
long uid = speaker.uid == 0 ? rtcEngineManager.uid : speaker.uid;
|
||||
if (speaker.volume < 5) continue;
|
||||
int micPosition = AvRoomDataManager.get().getMicPosition(uid);
|
||||
// 如果是房主的话,并且房主的mic位置没有的啊,则把房主的位置设置为-1(兼容ios轻聊房光晕)
|
||||
if (uid == AvRoomDataManager.get().mCurrentRoomInfo.getUid() &&
|
||||
|
@@ -62,6 +62,7 @@ public class DemoCache {
|
||||
private static final String KEY_PM_MODE = "key_pm_mode";
|
||||
private static final String KEY_SHOW_BOX_TIP = "key_show_box_tip";
|
||||
private static final String KEY_SHOW_RADISH_TIP = "key_show_radish_tip";
|
||||
private static final String KEY_SHOW_FAIRY_TIP = "key_show_fairy_tip";
|
||||
private static final String KEY_NEW_GIFT_TYPE_TIP = "key_new_gift_type_tip";
|
||||
private static final String KEY_NEW_GIFT_TYPE_TIP_INDICATOR = "key_new_gift_type_tip_indicator";
|
||||
|
||||
@@ -369,6 +370,13 @@ public class DemoCache {
|
||||
return SettingsPref.instance().getBoolean(KEY_SHOW_RADISH_TIP + AuthModel.get().getCurrentUid(), true);
|
||||
}
|
||||
|
||||
public static void saveShowFairyTip(boolean value) {
|
||||
SettingsPref.instance().putBoolean(KEY_SHOW_FAIRY_TIP + AuthModel.get().getCurrentUid(), value);
|
||||
}
|
||||
|
||||
public static boolean readShowFairyTip() {
|
||||
return SettingsPref.instance().getBoolean(KEY_SHOW_FAIRY_TIP + AuthModel.get().getCurrentUid(), true);
|
||||
}
|
||||
public static void saveNewGiftTypeTip(boolean value) {
|
||||
SettingsPref.instance().putBoolean(KEY_NEW_GIFT_TYPE_TIP, value);
|
||||
}
|
||||
|
@@ -612,8 +612,9 @@ public class CustomAttachParser implements MsgAttachmentParser {
|
||||
if (second == CUSTOM_MSG_SUB_FAIRY_SEND ||
|
||||
second == CUSTOM_MSG_SUB_FAIRY_ASK_FOR) {
|
||||
attachment = new FairySendAttachment(first, second);
|
||||
} else {
|
||||
attachment = new FairyMsgAttachment(first, second);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
LogUtils.e("未定义的first,请现在CustomAttachParser中解析first=" + first + " second=" + second);
|
||||
|
@@ -436,6 +436,20 @@ public class CustomAttachment implements MsgAttachment {
|
||||
public static final int CUSTOM_MSG_FAIRY = 97; // 夺宝精灵
|
||||
public static final int CUSTOM_MSG_SUB_FAIRY_SEND = 9701; // 赠送小精灵
|
||||
public static final int CUSTOM_MSG_SUB_FAIRY_ASK_FOR = 9702; // 索要小精灵
|
||||
|
||||
public static final int CUSTOM_MSG_SUB_DRAW_GIFT_L1 = 9711; // 抽奖L1礼物
|
||||
public static final int CUSTOM_MSG_SUB_DRAW_GIFT_L2 = 9712; // 抽奖L2礼物
|
||||
public static final int CUSTOM_MSG_SUB_DRAW_GIFT_L3 = 9713; // 抽奖L3礼物
|
||||
public static final int CUSTOM_MSG_SUB_DRAW_GIFT_L4 = 9714; // 抽奖L4礼物
|
||||
public static final int CUSTOM_MSG_SUB_DRAW_GIFT_L5 = 9715; // 抽奖L5礼物
|
||||
|
||||
public static final int CUSTOM_MSG_SUB_DRAW_BALL_L1 = 9721; // 抽奖L1精灵球
|
||||
public static final int CUSTOM_MSG_SUB_DRAW_BALL_L2 = 9722; // 抽奖L2精灵球
|
||||
public static final int CUSTOM_MSG_SUB_DRAW_BALL_L3 = 9723; // 抽奖L3精灵球
|
||||
|
||||
public static final int CUSTOM_MSG_SUB_CONVERT_L1 = 9731; // 召唤L1
|
||||
public static final int CUSTOM_MSG_SUB_CONVERT_L2 = 9732; // 召唤L2
|
||||
public static final int CUSTOM_MSG_SUB_CONVERT_L3 = 9733; // 召唤L3
|
||||
/**
|
||||
* 自定义消息附件的类型,根据该字段区分不同的自定义消息
|
||||
*/
|
||||
|
@@ -0,0 +1,36 @@
|
||||
package com.mango.core.im.custom.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.mango.core.treasurefairy.FairyMsgInfo;
|
||||
|
||||
/**
|
||||
* Created by chenran on 2017/10/4.
|
||||
*/
|
||||
|
||||
public class FairyMsgAttachment extends CustomAttachment {
|
||||
private FairyMsgInfo fairyMsgInfo;
|
||||
|
||||
public FairyMsgAttachment(int first, int second) {
|
||||
super(first, second);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void parseData(JSONObject jsonObject) {
|
||||
fairyMsgInfo = new Gson().fromJson(jsonObject.toJSONString(), FairyMsgInfo.class);
|
||||
}
|
||||
|
||||
public FairyMsgInfo getFairyMsgInfo() {
|
||||
return fairyMsgInfo;
|
||||
}
|
||||
|
||||
public void setFairyMsgInfo(FairyMsgInfo fairyMsgInfo) {
|
||||
this.fairyMsgInfo = fairyMsgInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject packData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@@ -10,6 +10,7 @@ import com.mango.core.base.IModel;
|
||||
import com.mango.core.bean.response.ServiceResult;
|
||||
import com.mango.core.home.bean.MainTabInfo;
|
||||
import com.mango.core.initial.bean.BoxInfo;
|
||||
import com.mango.core.initial.bean.FairyOpenInfo;
|
||||
import com.mango.core.initial.bean.InitInfo;
|
||||
|
||||
import java.util.List;
|
||||
@@ -52,6 +53,11 @@ public interface IInitialModel extends IModel {
|
||||
|
||||
long getTimeDiff();
|
||||
|
||||
Single<FairyOpenInfo> requestFairyOpenInfo();
|
||||
|
||||
@Nullable
|
||||
FairyOpenInfo getFairyOpenInfo();
|
||||
|
||||
int getFindNewbieCharmLevel();
|
||||
|
||||
int getTeenagerMode();
|
||||
|
@@ -14,6 +14,8 @@ import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.bumptech.glide.request.FutureTarget;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.mango.core.auth.event.LogoutEvent;
|
||||
import com.mango.core.initial.bean.FairyOpenInfo;
|
||||
import com.mango.core.user.event.LoadLoginUserInfoEvent;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.mango.core.DemoCache;
|
||||
@@ -93,6 +95,12 @@ public class InitialModel extends BaseModel implements IInitialModel {
|
||||
*/
|
||||
private BoxInfo boxInfo;
|
||||
|
||||
/**
|
||||
* 宝箱开关,等级限制
|
||||
*/
|
||||
@Nullable
|
||||
private FairyOpenInfo fairyOpenInfo;
|
||||
|
||||
/**
|
||||
* 记录服务器与本地的时间差
|
||||
*/
|
||||
@@ -196,6 +204,12 @@ public class InitialModel extends BaseModel implements IInitialModel {
|
||||
public void onLoadLoginUserInfoEvent(LoadLoginUserInfoEvent event) {
|
||||
heartbeat();
|
||||
startApp();
|
||||
getFairyOpenInfo();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLogoutEvent(LogoutEvent event) {
|
||||
fairyOpenInfo = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -474,6 +488,25 @@ public class InitialModel extends BaseModel implements IInitialModel {
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<FairyOpenInfo> requestFairyOpenInfo() {
|
||||
return api.getFairyOpenInfo()
|
||||
.compose(RxHelper.handleCommon());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FairyOpenInfo getFairyOpenInfo() {
|
||||
if (fairyOpenInfo != null) {
|
||||
return fairyOpenInfo;
|
||||
}
|
||||
requestFairyOpenInfo()
|
||||
.doOnSuccess(fairyOpenInfo -> this.fairyOpenInfo = fairyOpenInfo)
|
||||
.subscribe();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getFindNewbieCharmLevel() {
|
||||
return findNewbieCharmLevel;
|
||||
@@ -511,5 +544,13 @@ public class InitialModel extends BaseModel implements IInitialModel {
|
||||
*/
|
||||
@GET("/app/bottomBar/getCurrentAppBottomBar")
|
||||
Single<ServiceResult<List<MainTabInfo>>> getMainTabList();
|
||||
|
||||
/**
|
||||
* 夺宝精灵开放状态
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
@GET("act/seize-treasure/status")
|
||||
Single<ServiceResult<FairyOpenInfo>> getFairyOpenInfo();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,22 @@
|
||||
package com.mango.core.initial.bean;
|
||||
|
||||
public class FairyOpenInfo {
|
||||
private int levelLimit;
|
||||
private boolean open;
|
||||
|
||||
public int getLevelLimit() {
|
||||
return levelLimit;
|
||||
}
|
||||
|
||||
public void setLevelLimit(int levelLimit) {
|
||||
this.levelLimit = levelLimit;
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
return open;
|
||||
}
|
||||
|
||||
public void setOpen(boolean open) {
|
||||
this.open = open;
|
||||
}
|
||||
}
|
@@ -255,6 +255,12 @@ public class RoomEvent {
|
||||
|
||||
public static final int KITCHEN_ALL_ROOM = 101;
|
||||
|
||||
public static final int FAIRY_DRAW_GIFT_L4 = 102;
|
||||
public static final int FAIRY_DRAW_GIFT_L5 = 103;
|
||||
public static final int FAIRY_CONVERT_L1 = 104;
|
||||
public static final int FAIRY_CONVERT_L2 = 105;
|
||||
public static final int FAIRY_CONVERT_L3 = 106;
|
||||
|
||||
private int event = NONE;
|
||||
private int micPosition = Integer.MIN_VALUE;
|
||||
private int posState = -1;
|
||||
|
@@ -0,0 +1,48 @@
|
||||
package com.mango.core.treasurefairy
|
||||
|
||||
data class FairyMsgInfo(
|
||||
/**
|
||||
* uid
|
||||
*/
|
||||
val uid: Long? = null,
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
val nick: String? = null,
|
||||
|
||||
/**
|
||||
* 所在房间uid
|
||||
*/
|
||||
val roomUid: Long? = null,
|
||||
|
||||
/**
|
||||
* 奖励类型
|
||||
*/
|
||||
val rewardType: String? = null,
|
||||
|
||||
/**
|
||||
* 奖励名称
|
||||
*/
|
||||
val rewardName: String? = null,
|
||||
|
||||
/**
|
||||
* 奖励等级
|
||||
*/
|
||||
val rewardLevel: Int? = null,
|
||||
|
||||
/**
|
||||
* 奖励数量
|
||||
*/
|
||||
val rewardNum: Int = 0,
|
||||
|
||||
/**
|
||||
* 限制等级
|
||||
*/
|
||||
val userLevelLimit: Int? = null,
|
||||
|
||||
/**
|
||||
* 展示价值
|
||||
*/
|
||||
val rewardShowValue: Int? = null
|
||||
)
|
@@ -1,7 +0,0 @@
|
||||
package com.mango.core.treasurefairy
|
||||
|
||||
data class TestResultInfo(
|
||||
val level: Int,
|
||||
val fairyInfo: FairyInfo?
|
||||
)
|
||||
|
Reference in New Issue
Block a user