精灵夺宝:增加公屏和飘屏
BIN
app/src/main/assets/svga/all_fairy.svga
Normal file
@@ -36,6 +36,7 @@ import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mango.core.initial.InitialModel;
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nimlib.sdk.NIMSDK;
|
||||
import com.netease.nimlib.sdk.Observer;
|
||||
@@ -408,7 +409,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
mVsNobleOpen = findViewById(R.id.vs_noble_open_notice);
|
||||
vsTaskTips = findViewById(R.id.vs_task_tips);
|
||||
viewpager = findViewById(R.id.fragment_container);
|
||||
|
||||
InitialModel.get().getFairyOpenInfo();
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(this::onRoomEventReceive);
|
||||
|
@@ -56,6 +56,7 @@ public class RoomPlayDialog extends BottomSheetDialog {
|
||||
PullRadishActivity.start(context);
|
||||
dismiss();
|
||||
});
|
||||
binding.llFairy.setVisibility(GoldBoxHelper.isShowFairy() ? View.VISIBLE : View.GONE);
|
||||
binding.llFairy.setOnClickListener(v -> {
|
||||
HomeFairyActivity.start(context);
|
||||
dismiss();
|
||||
|
@@ -452,6 +452,15 @@ public class BottomView extends FrameLayout implements View.OnClickListener {
|
||||
});
|
||||
}
|
||||
}
|
||||
if (GoldBoxHelper.isShowFairy()) {
|
||||
showPlayEntrance = true;
|
||||
if (DemoCache.readShowFairyTip()) {
|
||||
iconPlay.post(() -> {
|
||||
showPlayTipsPopup(iconPlay);
|
||||
DemoCache.saveShowFairyTip(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
iconPlay.setVisibility(showPlayEntrance ? VISIBLE : GONE);
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,21 @@
|
||||
package com.mango.moshen.avroom.widget;
|
||||
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAIRY;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GIFT_COMPOUND;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_KITCHEN;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ME;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_CONVERT_L1;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_CONVERT_L2;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_CONVERT_L3;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_BALL_L1;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_BALL_L2;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_BALL_L3;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_GIFT_L1;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_GIFT_L2;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_GIFT_L3;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_GIFT_L4;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_GIFT_L5;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_FANS_TEAM_JOIN;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_GIFT_COMPOUND;
|
||||
import static com.mango.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_WISH_LIST;
|
||||
@@ -42,9 +54,14 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
|
||||
import com.mango.core.im.custom.bean.FairyMsgAttachment;
|
||||
import com.mango.core.im.custom.bean.RoomKitchenAttachment;
|
||||
import com.mango.core.im.custom.bean.WishListAttachment;
|
||||
import com.mango.core.room.wishlist.WishListModel;
|
||||
import com.mango.core.treasurefairy.FairyMsgInfo;
|
||||
import com.mango.core.utils.StringExtensionKt;
|
||||
import com.mango.moshen.treasure_box.widget.GoldBoxHelper;
|
||||
import com.mango.moshen.treasurefairy.HomeFairyActivity;
|
||||
import com.mango.moshen.utils.MsgBuilder;
|
||||
import com.netease.nim.uikit.business.uinfo.UserInfoHelper;
|
||||
import com.netease.nim.uikit.common.ui.span.RadiusBackgroundSpan;
|
||||
@@ -984,6 +1001,8 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
} else if (first == CUSTOM_MSG_KITCHEN) {
|
||||
setKitchenMsg(chatRoomMessage, tvContent);
|
||||
} else if (first == CUSTOM_MSG_FAIRY) {
|
||||
setFairyMsg(chatRoomMessage, tvContent);
|
||||
} else {
|
||||
tvContent.setTextColor(Color.WHITE);
|
||||
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
|
||||
@@ -997,6 +1016,74 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private void setFairyMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
||||
if (chatRoomMessage.getAttachment() instanceof FairyMsgAttachment) {
|
||||
FairyMsgAttachment attachment = (FairyMsgAttachment) chatRoomMessage.getAttachment();
|
||||
FairyMsgInfo fairyMsgInfo = attachment.getFairyMsgInfo();
|
||||
if (fairyMsgInfo == null) return;
|
||||
SpannableBuilder builder = null;
|
||||
switch (attachment.getSecond()) {
|
||||
case CUSTOM_MSG_SUB_DRAW_GIFT_L1:
|
||||
case CUSTOM_MSG_SUB_DRAW_GIFT_L2:
|
||||
case CUSTOM_MSG_SUB_DRAW_BALL_L1:
|
||||
builder = builderDrawMsg(tvContent, fairyMsgInfo, "厉害了!");
|
||||
break;
|
||||
case CUSTOM_MSG_SUB_DRAW_GIFT_L3:
|
||||
case CUSTOM_MSG_SUB_DRAW_GIFT_L4:
|
||||
case CUSTOM_MSG_SUB_DRAW_GIFT_L5:
|
||||
case CUSTOM_MSG_SUB_DRAW_BALL_L2:
|
||||
case CUSTOM_MSG_SUB_DRAW_BALL_L3:
|
||||
builder = builderDrawMsg(tvContent, fairyMsgInfo, "好运爆棚!");
|
||||
break;
|
||||
case CUSTOM_MSG_SUB_CONVERT_L1:
|
||||
builder = builderConvertMsg(tvContent, fairyMsgInfo, "初级召唤");
|
||||
break;
|
||||
case CUSTOM_MSG_SUB_CONVERT_L2:
|
||||
builder = builderConvertMsg(tvContent, fairyMsgInfo, "史诗召唤");
|
||||
break;
|
||||
case CUSTOM_MSG_SUB_CONVERT_L3:
|
||||
builder = builderConvertMsg(tvContent, fairyMsgInfo, "传说召唤");
|
||||
break;
|
||||
}
|
||||
|
||||
if (builder != null) {
|
||||
if (GoldBoxHelper.isShowFairy()) {
|
||||
builder.append(" 去参加!", new OriginalDrawStatusClickSpan(Color.parseColor("#FFBC51")) {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
|
||||
}
|
||||
});
|
||||
tvContent.setOnClickListener(v -> HomeFairyActivity.start(mContext));
|
||||
} else {
|
||||
tvContent.setOnClickListener(null);
|
||||
}
|
||||
tvContent.setText(builder.build());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private SpannableBuilder builderConvertMsg(TextView textView, @NonNull FairyMsgInfo fairyMsgInfo, String type) {
|
||||
return new SpannableBuilder(textView)
|
||||
.append("厉害了!", new ForegroundColorSpan(whiteColor))
|
||||
.append(StringExtensionKt.subAndReplaceDot(fairyMsgInfo.getNick(), 7), new ForegroundColorSpan(roomTipNickColor))
|
||||
.append("在夺宝精灵中 " + type, new ForegroundColorSpan(whiteColor))
|
||||
.append(fairyMsgInfo.getRewardShowValue() + "钻" + fairyMsgInfo.getRewardName(), new ForegroundColorSpan(roomTipColor));
|
||||
}
|
||||
|
||||
private SpannableBuilder builderDrawMsg(TextView textView, @NonNull FairyMsgInfo fairyMsgInfo, String desc) {
|
||||
SpannableBuilder builder = new SpannableBuilder(textView)
|
||||
.append(desc, new ForegroundColorSpan(whiteColor))
|
||||
.append(StringExtensionKt.subAndReplaceDot(fairyMsgInfo.getNick(), 7), new ForegroundColorSpan(roomTipNickColor))
|
||||
.append(" 在夺宝精灵中获得 ", new ForegroundColorSpan(whiteColor))
|
||||
.append(fairyMsgInfo.getRewardName(), new ForegroundColorSpan(Color.WHITE));
|
||||
if (fairyMsgInfo.getRewardNum() > 1) {
|
||||
builder.append(" x" + fairyMsgInfo.getRewardNum(), new ForegroundColorSpan(roomTipNickColor));
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
private void setKitchenMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
||||
if (chatRoomMessage.getAttachment() instanceof RoomKitchenAttachment) {
|
||||
RoomKitchenAttachment attachment = (RoomKitchenAttachment) chatRoomMessage.getAttachment();
|
||||
|
@@ -132,6 +132,10 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
private var kitchenSVGADisposable: Disposable? = null
|
||||
private val kitchenMessagesSVGA: MutableList<ChatRoomMessage> by lazy { ArrayList() }
|
||||
|
||||
private var fairyAnimation: Animation? = null
|
||||
private var fairyDisposable: Disposable? = null
|
||||
private val fairyMessages: MutableList<Pair<Int, ChatRoomMessage>> by lazy { ArrayList() }
|
||||
|
||||
private var isSvgaPlaying = false
|
||||
|
||||
private var isHideCarEffect = false
|
||||
@@ -228,6 +232,14 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
}
|
||||
RoomEvent.KITCHEN_ROOM -> addKitchenNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.KITCHEN_ALL_ROOM -> addKitchenNotifyBySVGA(roomEvent.chatRoomMessage)
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L4,
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L5,
|
||||
RoomEvent.FAIRY_CONVERT_L1,
|
||||
RoomEvent.FAIRY_CONVERT_L2,
|
||||
RoomEvent.FAIRY_CONVERT_L3 -> addFairyNotify(
|
||||
roomEvent.event,
|
||||
roomEvent.chatRoomMessage
|
||||
)
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
@@ -614,7 +626,8 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
private fun showKitchenNotify(chatRoomMessage: ChatRoomMessage) {
|
||||
val attachment = chatRoomMessage.attachment as RoomKitchenAttachment
|
||||
val textView =
|
||||
LayoutInflater.from(mContext).inflate(R.layout.layout_room_kitchen_notify, null) as TextView
|
||||
LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.layout_room_kitchen_notify, null) as TextView
|
||||
val text = MsgBuilder.buildKitchenMsg(attachment)
|
||||
textView.text = text.build()
|
||||
MsgBuilder.setUpKitchenClick(textView, attachment.skipUrl, attachment.needLevel)
|
||||
@@ -627,6 +640,106 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 幸运池飘屏
|
||||
*
|
||||
* @param chatRoomMessage
|
||||
*/
|
||||
private fun addFairyNotify(roomEvent: Int, chatRoomMessage: ChatRoomMessage) {
|
||||
if (binding.clNotify.visibility == GONE) {
|
||||
binding.clNotify.visibility = VISIBLE
|
||||
}
|
||||
fairyMessages.add(Pair(roomEvent, chatRoomMessage))
|
||||
if (fairyDisposable == null || fairyMessages.size == 1) {
|
||||
fairyDisposable = Observable.interval(0, PERIOD.toLong(), TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.takeWhile { fairyMessages.size > 0 }
|
||||
.subscribe {
|
||||
showFairyNotify(
|
||||
fairyMessages.removeAt(0)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showFairyNotify(pair: Pair<Int, ChatRoomMessage>) {
|
||||
val attachment = pair.second.attachment as FairyMsgAttachment
|
||||
when (pair.first) {
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L4,
|
||||
RoomEvent.FAIRY_CONVERT_L1,
|
||||
RoomEvent.FAIRY_CONVERT_L2 -> {
|
||||
val textView =
|
||||
LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.layout_room_fairy_notify, null) as TextView
|
||||
val text = MsgBuilder.buildFairyMsg(pair.first, attachment)
|
||||
textView.text = text.build()
|
||||
kitchenAnimation = AnimationUtils.loadAnimation(mContext, R.anim.anim_box_notify)
|
||||
binding.flFairyNotify.addView(textView)
|
||||
textView.startAnimation(kitchenAnimation)
|
||||
binding.flFairyNotify.postDelayed(
|
||||
{ binding.flFairyNotify.removeView(textView) },
|
||||
SHOW_TIME.toLong()
|
||||
)
|
||||
}
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L5,
|
||||
RoomEvent.FAIRY_CONVERT_L3 -> {
|
||||
showFairyNotifyBySVGA(pair)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun showFairyNotifyBySVGA(pair: Pair<Int, ChatRoomMessage>) {
|
||||
val attachment = pair.second.attachment as FairyMsgAttachment
|
||||
val text = MsgBuilder.buildFairyMsg(pair.first, attachment)
|
||||
val svgaImageView = SVGAImageView(mContext)
|
||||
svgaImageView.loops = 1
|
||||
svgaImageView.clearsAfterStop = true
|
||||
val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
||||
svgaImageView.layoutParams = params
|
||||
svgaImageView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
binding.flFairyNotify.post {
|
||||
binding.flFairyNotify.removeView(
|
||||
svgaImageView
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.flFairyNotify.addView(svgaImageView)
|
||||
shareParser().decodeFromAssets(
|
||||
"svga/all_fairy.svga",
|
||||
object : SVGAParser.ParseCompletion {
|
||||
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||
val dynamicEntity = SVGADynamicEntity()
|
||||
val textPaint = TextPaint()
|
||||
textPaint.color = Color.WHITE //字体颜色
|
||||
textPaint.textSize = 24f //字体大小
|
||||
dynamicEntity.setDynamicText(
|
||||
StaticLayout(
|
||||
text.build(),
|
||||
0,
|
||||
text.build().length,
|
||||
textPaint,
|
||||
0,
|
||||
Layout.Alignment.ALIGN_CENTER,
|
||||
1.0f,
|
||||
0.0f,
|
||||
false
|
||||
), "touming_text_name"
|
||||
)
|
||||
val drawable = SVGADrawable(videoItem, dynamicEntity)
|
||||
svgaImageView.setImageDrawable(drawable)
|
||||
svgaImageView.startAnimation()
|
||||
}
|
||||
|
||||
override fun onError() {}
|
||||
},
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 幸运池飘屏 五级 SVGA背景的
|
||||
*
|
||||
|
@@ -315,6 +315,10 @@ class FairyViewModel : BaseViewModel() {
|
||||
fun oneKeyAdd(fairyInfos: List<FairyInfo>) {
|
||||
val compoundFairyInfos = _compoundFairyInfosLiveData.value ?: SparseArray()
|
||||
var needNum = 3 - compoundFairyInfos.size()
|
||||
if (needNum == 0) {
|
||||
"试炼炉已满!".toast()
|
||||
return
|
||||
}
|
||||
fairyInfos.forEach {
|
||||
while (it.elfNum - it.selectedNum > 0 && needNum > 0) {
|
||||
it.selectedNum++
|
||||
|
@@ -7,12 +7,10 @@ import android.view.WindowManager
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mango.core.treasurefairy.ExchangeGiftInfo
|
||||
import com.mango.core.treasurefairy.FairyInfo
|
||||
import com.mango.moshen.base.BaseDialog
|
||||
import com.mango.moshen.databinding.TreasureFairyDialogTestFairyResultBinding
|
||||
import com.mango.moshen.treasurefairy.FairyViewModel
|
||||
import com.mango.moshen.treasurefairy.adapter.ExchangeFairyResultAdapter
|
||||
import com.mango.moshen.treasurefairy.adapter.TestFairyResultAdapter
|
||||
import com.mango.moshen.ui.utils.RVDelegate
|
||||
|
||||
class ExchangeFairyResultDialog : BaseDialog<TreasureFairyDialogTestFairyResultBinding>() {
|
||||
@@ -40,6 +38,10 @@ class ExchangeFairyResultDialog : BaseDialog<TreasureFairyDialogTestFairyResultB
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
val prizeInfoList = viewModel.exchangeGiftLiveData.value
|
||||
if (prizeInfoList == null) {
|
||||
dismissAllowingStateLoss()
|
||||
return
|
||||
}
|
||||
|
||||
prizeAdapter = ExchangeFairyResultAdapter()
|
||||
rvDelegate = RVDelegate.Builder<ExchangeGiftInfo>()
|
||||
@@ -50,7 +52,7 @@ class ExchangeFairyResultDialog : BaseDialog<TreasureFairyDialogTestFairyResultB
|
||||
)
|
||||
.build()
|
||||
|
||||
rvDelegate.setNewData(arrayListOf(prizeInfoList?.peekContent()))
|
||||
rvDelegate.setNewData(arrayListOf(prizeInfoList.peekContent()))
|
||||
|
||||
}
|
||||
|
||||
|
@@ -24,21 +24,21 @@ class TestFairyResultDialog : BaseDialog<TreasureFairyDialogTestFairyResultBindi
|
||||
private val viewModel: FairyViewModel by activityViewModels()
|
||||
|
||||
companion object {
|
||||
fun newInstance(): TestFairyResultDialog {
|
||||
fun newInstance(fairyInfo: FairyInfo): TestFairyResultDialog {
|
||||
val args = Bundle()
|
||||
args.putSerializable("fairyInfo",fairyInfo)
|
||||
val fragment = TestFairyResultDialog()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private val fairyInfo by lazy { requireArguments().getSerializable("fairyInfo") as FairyInfo }
|
||||
@SuppressLint("CheckResult")
|
||||
override fun init() {
|
||||
binding.tvClose.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
val prizeInfoList = viewModel.testResultLiveData.value
|
||||
|
||||
prizeAdapter = TestFairyResultAdapter()
|
||||
rvDelegate = RVDelegate.Builder<FairyInfo>()
|
||||
.setAdapter(prizeAdapter)
|
||||
@@ -48,7 +48,7 @@ class TestFairyResultDialog : BaseDialog<TreasureFairyDialogTestFairyResultBindi
|
||||
)
|
||||
.build()
|
||||
|
||||
rvDelegate.setNewData(arrayListOf(prizeInfoList?.peekContent()))
|
||||
rvDelegate.setNewData(arrayListOf(fairyInfo))
|
||||
viewModel.cleanTestParam()
|
||||
}
|
||||
|
||||
|
@@ -38,7 +38,14 @@ class TestFairyFragment : BaseViewBindingFragment<TreasureFairyFragmentTestFairy
|
||||
if (canShowResult) {
|
||||
canShowResult = false
|
||||
binding.ivBegin.isEnabled = true
|
||||
TestFairyResultDialog.newInstance().show(context)
|
||||
if (fairyType == MyFairyItemView.BASE) {
|
||||
viewModel.testResultLiveData
|
||||
} else {
|
||||
viewModel.testLegendResultLiveData
|
||||
}.value?.peekContent()?.let {
|
||||
TestFairyResultDialog.newInstance(it).show(context)
|
||||
}
|
||||
|
||||
} else {
|
||||
resultNotShowed = true
|
||||
}
|
||||
@@ -94,6 +101,7 @@ class TestFairyFragment : BaseViewBindingFragment<TreasureFairyFragmentTestFairy
|
||||
|
||||
if (fairyType == MyFairyItemView.EPIC) {
|
||||
binding.viewBgAnim.setBackgroundResource(R.drawable.treasure_fairy_bg_test_fairy_anim_legend)
|
||||
binding.viewBgTop.setBackgroundResource(R.drawable.treasure_fairy_bg_test_fairy_legend)
|
||||
}
|
||||
|
||||
binding.ivBegin.setOnClickListener {
|
||||
|
@@ -2,8 +2,16 @@ package com.mango.moshen.utils
|
||||
|
||||
import android.graphics.Color
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.widget.TextView
|
||||
import androidx.core.graphics.toColorInt
|
||||
import com.mango.core.im.custom.bean.FairyMsgAttachment
|
||||
import com.mango.core.im.custom.bean.RoomKitchenAttachment
|
||||
import com.mango.core.manager.RoomEvent
|
||||
import com.mango.core.utils.sub
|
||||
import com.mango.moshen.R
|
||||
import com.mango.moshen.ui.webview.CommonWebViewActivity
|
||||
|
||||
class MsgBuilder {
|
||||
@@ -39,5 +47,70 @@ class MsgBuilder {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun buildFairyMsg(
|
||||
roomEvent: Int,
|
||||
attachment: FairyMsgAttachment
|
||||
): SpannableBuilder {
|
||||
val builder = SpannableBuilder()
|
||||
val fairyMsgInfo = attachment.fairyMsgInfo
|
||||
when (roomEvent) {
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L4,
|
||||
RoomEvent.FAIRY_DRAW_GIFT_L5 -> {
|
||||
builder.append("好运爆棚!", ForegroundColorSpan("#8C4700".toColorInt()))
|
||||
.append(
|
||||
fairyMsgInfo.nick.sub(6),
|
||||
ForegroundColorSpan("#EC4613".toColorInt())
|
||||
)
|
||||
.append(" 在夺宝精灵中获得 ", ForegroundColorSpan("#8C4700".toColorInt()))
|
||||
.append(
|
||||
fairyMsgInfo.rewardName,
|
||||
ForegroundColorSpan("#EC4613".toColorInt())
|
||||
)
|
||||
}
|
||||
|
||||
RoomEvent.FAIRY_CONVERT_L1 -> {
|
||||
builder.append("厉害了!", ForegroundColorSpan("#8C4700".toColorInt()))
|
||||
.append(
|
||||
fairyMsgInfo.nick.sub(6),
|
||||
ForegroundColorSpan("#EC4613".toColorInt())
|
||||
)
|
||||
.append(" 在夺宝精灵中初级召唤 ", ForegroundColorSpan("#8C4700".toColorInt()))
|
||||
.append(
|
||||
"${fairyMsgInfo.rewardShowValue}钻${fairyMsgInfo.rewardName}",
|
||||
ForegroundColorSpan("#EC4613".toColorInt())
|
||||
)
|
||||
}
|
||||
RoomEvent.FAIRY_CONVERT_L2 -> {
|
||||
builder.append("厉害了!", ForegroundColorSpan("#8C4700".toColorInt()))
|
||||
.append(
|
||||
fairyMsgInfo.nick.sub(6),
|
||||
ForegroundColorSpan("#EC4613".toColorInt())
|
||||
)
|
||||
.append(" 在夺宝精灵中史诗召唤 ", ForegroundColorSpan("#8C4700".toColorInt()))
|
||||
.append(
|
||||
"${fairyMsgInfo.rewardShowValue}钻${fairyMsgInfo.rewardName}",
|
||||
ForegroundColorSpan("#EC4613".toColorInt())
|
||||
)
|
||||
}
|
||||
|
||||
RoomEvent.FAIRY_CONVERT_L3 -> {
|
||||
builder.append("厉害了!", ForegroundColorSpan("#8C4700".toColorInt()))
|
||||
.append(
|
||||
fairyMsgInfo.nick.sub(6),
|
||||
ForegroundColorSpan("#EC4613".toColorInt())
|
||||
)
|
||||
.append(" 在夺宝精灵中传说召唤 ", ForegroundColorSpan("#8C4700".toColorInt()))
|
||||
.append(
|
||||
"${fairyMsgInfo.rewardShowValue}钻${fairyMsgInfo.rewardName}",
|
||||
ForegroundColorSpan("#EC4613".toColorInt())
|
||||
)
|
||||
}
|
||||
}
|
||||
return builder
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-xhdpi/treasure_fairy_bg_notify.png
Normal file
After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 396 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@@ -5,4 +5,5 @@
|
||||
android:angle="90"
|
||||
android:endColor="#00B9AF"
|
||||
android:startColor="#006E7C" />
|
||||
<stroke android:width="1px" android:color="#F4FFC3"/>
|
||||
</shape>
|
@@ -47,7 +47,7 @@
|
||||
android:id="@+id/iv_fairy"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:src="@drawable/ic_radish_entrance" />
|
||||
android:src="@drawable/ic_fairy_entrance" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -91,6 +91,14 @@
|
||||
app:layout_constraintDimensionRatio="75:12"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_fairy_notify"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintDimensionRatio="75:12"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_svga_radish_notify"
|
||||
android:layout_width="match_parent"
|
||||
|
17
app/src/main/res/layout/layout_room_fairy_notify.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.coorchice.library.SuperTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@drawable/treasure_fairy_bg_notify"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="80dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="80dp"
|
||||
android:textSize="13sp"
|
||||
tools:layout_height="wrap_content"
|
||||
tools:text="哈哈哈哈哈哈啊哈哈啊哈哈哈哈哈哈哈哈哈哈哈" />
|
@@ -97,7 +97,8 @@
|
||||
android:background="@drawable/treasure_fairy_bg_test_fairy_record"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:lineSpacingExtra="-5dp"
|
||||
android:lineSpacingExtra="0dp"
|
||||
android:lineSpacingMultiplier="0.8"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="2dp"
|
||||
android:text="兑换记录"
|
||||
|
@@ -79,36 +79,34 @@
|
||||
android:id="@+id/view_bg_forest_base"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:background="@drawable/treasure_fairy_bg_forest_base"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_forest"
|
||||
app:layout_constraintDimensionRatio="678:522"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_forest" />
|
||||
app:layout_constraintWidth_percent="0.89" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg_forest"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:background="@drawable/treasure_fairy_bg_forest"
|
||||
app:layout_constraintDimensionRatio="740:546"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_record" />
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_record"
|
||||
app:layout_constraintWidth_percent="0.97" />
|
||||
|
||||
<com.tencent.qgame.animplayer.AnimView
|
||||
android:id="@+id/anim_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_forest"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg_forest"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg_forest"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_forest" />
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_forest_base"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg_forest_base"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg_forest_base"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_forest_base" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_previous"
|
||||
|
@@ -258,7 +258,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textColor="#ff59fdff"
|
||||
android:textSize="10sp"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toTopOf="@id/fairy_item_9"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@@ -99,7 +99,8 @@
|
||||
android:background="@drawable/treasure_fairy_bg_test_fairy_record"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:lineSpacingExtra="-5dp"
|
||||
android:lineSpacingExtra="0dp"
|
||||
android:lineSpacingMultiplier="0.8"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="2dp"
|
||||
android:text="试炼记录"
|
||||
|
@@ -32,7 +32,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.36"
|
||||
app:layout_constraintWidth_percent="0.76" />
|
||||
app:layout_constraintWidth_percent="0.70" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_fairy_name"
|
||||
@@ -44,7 +44,7 @@
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:text="精灵球"
|
||||
android:textColor="#FFE8AA"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@@ -30,26 +30,27 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.3"
|
||||
app:layout_constraintWidth_percent="0.55" />
|
||||
app:layout_constraintVertical_bias="0.325"
|
||||
app:layout_constraintWidth_percent="0.40" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_prize_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintVertical_bias="0.62"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_prize_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="我的可爱头饰(1天)" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_need_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:drawableStart="@drawable/treasure_fairy_ic_exchange_debris"
|
||||
android:gravity="center"
|
||||
android:text="3"
|
||||
|
@@ -9,16 +9,20 @@
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.mango.moshen.common.widget.CircleImageView
|
||||
android:id="@+id/iv_prize_icon"
|
||||
<FrameLayout
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
android:background="@drawable/shape_006e7c_to_00b9af"
|
||||
app:cborder_color="#F4FFC3"
|
||||
app:cborder_width="1px" />
|
||||
android:background="@drawable/shape_006e7c_to_00b9af">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_prize_icon"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="65dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_prize_name"
|
||||
|
@@ -7,16 +7,20 @@
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.mango.moshen.common.widget.CircleImageView
|
||||
android:id="@+id/iv_prize_icon"
|
||||
<FrameLayout
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:cborder_color="#F4FFC3"
|
||||
android:background="@drawable/shape_006e7c_to_00b9af"
|
||||
app:cborder_width="1px" />
|
||||
android:background="@drawable/shape_006e7c_to_00b9af">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_prize_icon"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="65dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_prize_name"
|
||||
|
@@ -39,14 +39,14 @@
|
||||
android:id="@+id/tv_fairy_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="13dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:text="x0"
|
||||
android:textColor="#FFE8AA"
|
||||
android:textSize="11dp"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_fairy_name" />
|
||||
|
@@ -39,14 +39,14 @@
|
||||
android:id="@+id/tv_fairy_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="13dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:text="精灵球"
|
||||
android:textColor="#59FDFF"
|
||||
android:textSize="11dp"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_fairy_name" />
|
||||
|
@@ -81,14 +81,14 @@
|
||||
android:id="@+id/tv_fairy_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="13dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:text="精灵球"
|
||||
android:textColor="#FFE8AA"
|
||||
android:textSize="11dp"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_fairy_name" />
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
@@ -12,16 +12,21 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/treasure_fairy_bg_test_fairy_item_select"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="132:156"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_fairy_icon"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover" />
|
||||
@@ -49,5 +54,5 @@
|
||||
android:textSize="11sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mango.core.initial.InitialModel;
|
||||
import com.mango.core.initial.bean.FairyOpenInfo;
|
||||
import com.mango.core.initial.bean.InitInfo;
|
||||
import com.mango.core.level.UserLevelVo;
|
||||
import com.mango.core.manager.AvRoomDataManager;
|
||||
@@ -64,5 +65,12 @@ public class GoldBoxHelper {
|
||||
return userInfo.getUserLevelVo().getExperLevelSeq() >= initInfo.getLinearlyPoolOpenLevel();
|
||||
}
|
||||
|
||||
public static boolean isShowFairy() {
|
||||
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
FairyOpenInfo fairyOpenInfo = InitialModel.get().getFairyOpenInfo();
|
||||
if (fairyOpenInfo == null || userInfo == null) return false;
|
||||
return userInfo.getUserLevelVo().getExperLevelSeq() >= fairyOpenInfo.getLevelLimit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 14 KiB |
@@ -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?
|
||||
)
|
||||
|