[Modify]修改夺宝精灵bug
This commit is contained in:
@@ -6,12 +6,14 @@ import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.yizhuan.erban.base.BaseViewModel
|
||||
import com.yizhuan.erban.base.Event
|
||||
import com.yizhuan.erban.treasurefairy.event.UpdateDataEvent
|
||||
import com.yizhuan.erban.treasurefairy.view.MyFairyItemView
|
||||
import com.yizhuan.xchat_android_core.bean.response.ListResult
|
||||
import com.yizhuan.xchat_android_core.gift.bean.SimpleUserInfo
|
||||
import com.yizhuan.xchat_android_core.treasurefairy.*
|
||||
import com.yizhuan.xchat_android_core.utils.net.ServerException
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
class FairyViewModel : BaseViewModel() {
|
||||
|
||||
@@ -232,6 +234,7 @@ class FairyViewModel : BaseViewModel() {
|
||||
TreasureFairyModel.sendFairy(elfId, targetUid)
|
||||
_sendFairyLiveData.value = Event(true)
|
||||
"贈送成功!".toast()
|
||||
EventBus.getDefault().post(UpdateDataEvent())
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -324,7 +327,7 @@ class FairyViewModel : BaseViewModel() {
|
||||
compoundFairyInfos.put(nextIndex(compoundFairyInfos), it)
|
||||
}
|
||||
}
|
||||
if (needNum == 3) {
|
||||
if (needNum <= 3 && needNum != 0) {
|
||||
"精靈數量不足".toast()
|
||||
return
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ class MyFairyRecordAdapter :
|
||||
val isSend = item.type == 2
|
||||
helper.setText(
|
||||
R.id.tv_content,
|
||||
"${if (isSend) "你" else item.targetNick}贈送${if (isSend) "" else "了你"}一張“${item.elfName}”精靈卡"
|
||||
"${if (isSend) "你" else item.targetNick}贈送${if (isSend) item.targetNick else "了你"}一張“${item.elfName}”精靈卡"
|
||||
)
|
||||
}
|
||||
|
||||
|
@@ -11,9 +11,13 @@ import com.yizhuan.erban.avroom.adapter.RoomVPAdapter
|
||||
import com.yizhuan.erban.base.BaseDialog
|
||||
import com.yizhuan.erban.databinding.TreasureFairyDialogMyFairyBinding
|
||||
import com.yizhuan.erban.treasurefairy.FairyViewModel
|
||||
import com.yizhuan.erban.treasurefairy.event.UpdateDataEvent
|
||||
import com.yizhuan.erban.treasurefairy.fragment.MyFairyFragment
|
||||
import com.yizhuan.erban.treasurefairy.view.MyFairyItemView
|
||||
import com.yizhuan.xchat_android_core.DemoCache
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
class MyFairyDialog : BaseDialog<TreasureFairyDialogMyFairyBinding>() {
|
||||
|
||||
@@ -33,6 +37,8 @@ class MyFairyDialog : BaseDialog<TreasureFairyDialogMyFairyBinding>() {
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun init() {
|
||||
EventBus.getDefault().register(this)
|
||||
|
||||
binding.ivBack.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
@@ -70,4 +76,14 @@ class MyFairyDialog : BaseDialog<TreasureFairyDialogMyFairyBinding>() {
|
||||
viewModel.getMyFairyInfo()
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onUpdateDataEvent(event: UpdateDataEvent?) {
|
||||
viewModel.getMyFairyInfo()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
|
||||
}
|
@@ -44,10 +44,10 @@ class MyFairySendDialog : BaseDialog<TreasureFairyDialogMyFairySendBinding>() {
|
||||
binding.ivFairyIcon.load(fairyInfo.elfPicUrl)
|
||||
binding.tvContent.text =
|
||||
SpannableBuilder()
|
||||
.append(if (isSend) "確定贈送”" else "確定向", ForegroundColorSpan(Color.WHITE))
|
||||
.append("${userInfo.nick}", ForegroundColorSpan("#FEF8AA".toColorInt()))
|
||||
.append(if (isSend) "確定贈送" else "確定向", ForegroundColorSpan(Color.WHITE))
|
||||
.append("\"${userInfo.nick}\"", ForegroundColorSpan("#FEF8AA".toColorInt()))
|
||||
.append(
|
||||
"”${if (isSend) "" else "索要"}1張“${fairyInfo.elfName}”精靈卡嗎?",
|
||||
"\"${if (isSend) "" else "索要"}1張“${fairyInfo.elfName}”精靈卡嗎?",
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.build()
|
||||
|
@@ -0,0 +1,8 @@
|
||||
package com.yizhuan.erban.treasurefairy.event;
|
||||
|
||||
/**
|
||||
* 更新我的精灵数据
|
||||
* Created by wushaocheng on 2023/3/13.
|
||||
*/
|
||||
public class UpdateDataEvent {
|
||||
}
|
@@ -28,6 +28,7 @@ class MyFairyFragment : BaseViewBindingFragment<TreasureFairyFragmentMyFairyBind
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun init() {
|
||||
|
||||
val fairyItems = arrayListOf(
|
||||
binding.fairyItem0,
|
||||
binding.fairyItem1,
|
||||
|
@@ -26,7 +26,7 @@
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginEnd="50dp"
|
||||
android:gravity="center"
|
||||
android:text="記錄"
|
||||
android:text="@string/fairy_record"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
||||
|
@@ -5094,18 +5094,19 @@
|
||||
<string name="fairy_epic_call">史詩召喚</string>
|
||||
<string name="fairy_legend_call">傳說召喚</string>
|
||||
<string name="fairy_fairy_ball">精靈球</string>
|
||||
<string name="fairy_primary_forest">初級森林</string>
|
||||
<string name="fairy_epic_forest">史詩森林</string>
|
||||
<string name="fairy_legend_forest">傳說森林</string>
|
||||
<string name="fairy_primary_forest">初級猛獁森林</string>
|
||||
<string name="fairy_epic_forest">史詩猛獁森林</string>
|
||||
<string name="fairy_legend_forest">傳說猛獁森林</string>
|
||||
<string name="fairy_default_signature">我是個默認簽名</string>
|
||||
<string name="fairy_you">你</string>
|
||||
<string name="fairy_give">贈送</string>
|
||||
<string name="fairy_current_lucky_value">當前幸運值:</string>
|
||||
<string name="fairy_catch_with_a_beginner_ball">使用初級球有一定幾率抓到史詩精靈</string>
|
||||
<string name="fairy_catch_with_a_beginner_ball">使用初級球有一定幾率抓到初級精靈</string>
|
||||
<string name="fairy_make_an_arrest">抓捕一次</string>
|
||||
<string name="fairy_primary_faerie_ball">(初級精靈球X1)</string>
|
||||
<string name="fairy_primary_faerie_ball_ten">(初級精靈球X10)</string>
|
||||
<string name="fairy_ten_arrests">抓捕十次</string>
|
||||
<string name="fairy_click_examine"><![CDATA[点击查看>>]]></string>
|
||||
<string name="fairy_record">記錄</string>
|
||||
|
||||
</resources>
|
Reference in New Issue
Block a user