[Modify]夺宝精灵的精灵分解和精灵试炼功能完善
@@ -4,7 +4,6 @@ import android.util.SparseArray
|
||||
import androidx.core.util.forEach
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.mob.moblink.beans.ServerData.Res
|
||||
import com.yizhuan.erban.base.BaseViewModel
|
||||
import com.yizhuan.erban.base.Event
|
||||
import com.yizhuan.erban.treasurefairy.event.UpdateDataEvent
|
||||
@@ -55,7 +54,8 @@ class FairyViewModel : BaseViewModel() {
|
||||
val sendFairyRecordLiveData: LiveData<ListResult<SendFairyInfo>> = _sendFairyRecordLiveData
|
||||
|
||||
private val _compoundFairyInfosLiveData = MutableLiveData<SparseArray<FairyInfo>?>()
|
||||
val compoundFairyInfosLiveData: MutableLiveData<SparseArray<FairyInfo>?> = _compoundFairyInfosLiveData
|
||||
val compoundFairyInfosLiveData: MutableLiveData<SparseArray<FairyInfo>?> =
|
||||
_compoundFairyInfosLiveData
|
||||
|
||||
private val _testResultLiveData = MutableLiveData<Event<FairyInfo>?>()
|
||||
val testResultLiveData: MutableLiveData<Event<FairyInfo>?> = _testResultLiveData
|
||||
@@ -63,17 +63,22 @@ class FairyViewModel : BaseViewModel() {
|
||||
private val _testLegendResultLiveData = MutableLiveData<Event<FairyInfo>?>()
|
||||
val testLegendResultLiveData: MutableLiveData<Event<FairyInfo>?> = _testLegendResultLiveData
|
||||
|
||||
private val _resolveResultLiveData = MutableLiveData<Event<ResolveInfo>?>()
|
||||
val resolveResultLiveData: MutableLiveData<Event<ResolveInfo>?> = _resolveResultLiveData
|
||||
|
||||
private val _testRecordLiveData = MutableLiveData<ListResult<TestFairyRecordInfo>>()
|
||||
val testRecordLiveData: LiveData<ListResult<TestFairyRecordInfo>> = _testRecordLiveData
|
||||
|
||||
private val _exchangeGiftListLiveData = MutableLiveData<List<ExchangeGiftInfo>?>()
|
||||
val exchangeGiftListLiveData: MutableLiveData<List<ExchangeGiftInfo>?> = _exchangeGiftListLiveData
|
||||
val exchangeGiftListLiveData: MutableLiveData<List<ExchangeGiftInfo>?> =
|
||||
_exchangeGiftListLiveData
|
||||
|
||||
private val _exchangeGiftLiveData = MutableLiveData<Event<ExchangeGiftInfo>>()
|
||||
val exchangeGiftLiveData: LiveData<Event<ExchangeGiftInfo>> = _exchangeGiftLiveData
|
||||
|
||||
private val _debrisExchangeListLiveData = MutableLiveData<List<ExchangeGiftInfo>?>()
|
||||
val debrisExchangeListLiveData: MutableLiveData<List<ExchangeGiftInfo>?> = _debrisExchangeListLiveData
|
||||
val debrisExchangeListLiveData: MutableLiveData<List<ExchangeGiftInfo>?> =
|
||||
_debrisExchangeListLiveData
|
||||
|
||||
private val _debrisExchangeLiveData = MutableLiveData<Event<ExchangeGiftInfo>>()
|
||||
val debrisExchangeLiveData: LiveData<Event<ExchangeGiftInfo>> = _debrisExchangeLiveData
|
||||
@@ -262,20 +267,21 @@ class FairyViewModel : BaseViewModel() {
|
||||
_compoundFairyInfosLiveData.value = null
|
||||
_testLegendResultLiveData.value = null
|
||||
_testResultLiveData.value = null
|
||||
_resolveResultLiveData.value = null
|
||||
val myFairyInfo = _myFairyInfoLiveData.value
|
||||
myFairyInfo?.lowElves?.forEach {
|
||||
it.selectedNum = 0
|
||||
}
|
||||
myFairyInfo?.middleElves?.forEach {
|
||||
myFairyInfo?.highElves?.forEach {
|
||||
it.selectedNum = 0
|
||||
}
|
||||
_myFairyInfoLiveData.value = myFairyInfo
|
||||
}
|
||||
|
||||
fun addTestFairy(fairyInfo: FairyInfo) {
|
||||
fun addTestFairy(fairyInfo: FairyInfo, size: Int) {
|
||||
val array = _compoundFairyInfosLiveData.value ?: SparseArray()
|
||||
|
||||
if (array.size() >= 3) {
|
||||
if (array.size() >= size) {
|
||||
"試煉爐已滿!".toast()
|
||||
} else {
|
||||
if (fairyInfo.elfNum == 0) {
|
||||
@@ -317,9 +323,9 @@ class FairyViewModel : BaseViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
fun oneKeyAdd(fairyInfos: List<FairyInfo>) {
|
||||
fun oneKeyAdd(fairyInfos: List<FairyInfo>, size: Int) {
|
||||
val compoundFairyInfos = _compoundFairyInfosLiveData.value ?: SparseArray()
|
||||
var needNum = 3 - compoundFairyInfos.size()
|
||||
var needNum = size - compoundFairyInfos.size()
|
||||
if (needNum == 0) {
|
||||
"試煉爐已滿!".toast()
|
||||
return
|
||||
@@ -331,7 +337,7 @@ class FairyViewModel : BaseViewModel() {
|
||||
compoundFairyInfos.put(nextIndex(compoundFairyInfos), it)
|
||||
}
|
||||
}
|
||||
if (needNum <= 3 && needNum != 0) {
|
||||
if (needNum <= size && needNum != 0) {
|
||||
"精靈數量不足".toast()
|
||||
return
|
||||
}
|
||||
@@ -346,21 +352,27 @@ class FairyViewModel : BaseViewModel() {
|
||||
fairyInfos.get(1) == null -> {
|
||||
1
|
||||
}
|
||||
else -> {
|
||||
fairyInfos.get(2) == null -> {
|
||||
2
|
||||
}
|
||||
fairyInfos.get(3) == null -> {
|
||||
3
|
||||
}
|
||||
else -> {
|
||||
4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun testFairy(level: Int): Boolean {
|
||||
val fairyInfos = _compoundFairyInfosLiveData.value ?: SparseArray()
|
||||
if (fairyInfos.size() != 3) {
|
||||
if (fairyInfos.size() != 5) {
|
||||
"精靈數量不足".toast()
|
||||
return false
|
||||
}
|
||||
safeLaunch(
|
||||
onError = {
|
||||
if (level == MyFairyItemView.EPIC) {
|
||||
if (level == MyFairyItemView.LEGEND) {
|
||||
_testLegendResultLiveData.value = null
|
||||
} else {
|
||||
_testResultLiveData.value = null
|
||||
@@ -375,7 +387,7 @@ class FairyViewModel : BaseViewModel() {
|
||||
}
|
||||
fairyTestParam.level = level
|
||||
val result = TreasureFairyModel.testFairy(fairyTestParam)
|
||||
(if (level == MyFairyItemView.EPIC) {
|
||||
(if (level == MyFairyItemView.LEGEND) {
|
||||
_testLegendResultLiveData
|
||||
} else {
|
||||
_testResultLiveData
|
||||
@@ -386,6 +398,30 @@ class FairyViewModel : BaseViewModel() {
|
||||
return true
|
||||
}
|
||||
|
||||
fun resolveFairy(): Boolean {
|
||||
val fairyInfos = _compoundFairyInfosLiveData.value ?: SparseArray()
|
||||
if (fairyInfos.size() != 1) {
|
||||
"精靈數量不足".toast()
|
||||
return false
|
||||
}
|
||||
safeLaunch(
|
||||
onError = {
|
||||
_resolveResultLiveData.value = null
|
||||
it.message.toast()
|
||||
},
|
||||
block = {
|
||||
val fairyTestParam = FairyResolveParam()
|
||||
fairyInfos.forEach { _, value ->
|
||||
fairyTestParam.expendList.add(Compound(value.elfId, 1))
|
||||
}
|
||||
val result = TreasureFairyModel.resolveFairy(fairyTestParam)
|
||||
_resolveResultLiveData.value = result?.let { Event(it[0]) }
|
||||
getMyFairyInfo()
|
||||
}
|
||||
)
|
||||
return true
|
||||
}
|
||||
|
||||
fun getTestFairyRecordList(
|
||||
page: Int,
|
||||
pageSize: Int
|
||||
|
@@ -0,0 +1,25 @@
|
||||
package com.yizhuan.erban.treasurefairy.adapter
|
||||
|
||||
import android.widget.ImageView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.ui.utils.load
|
||||
import com.yizhuan.xchat_android_core.treasurefairy.FairyInfo
|
||||
import java.util.*
|
||||
|
||||
class ResolveFairyAdapter :
|
||||
BaseQuickAdapter<FairyInfo, BaseViewHolder>(R.layout.treasure_fairy_item_resolve_fairy) {
|
||||
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: FairyInfo) {
|
||||
helper.getView<ImageView>(R.id.iv_fairy_icon).load(item.elfPicUrl)
|
||||
helper.setText(R.id.tv_fairy_num, "${item.selectedNum}/${item.elfNum}")
|
||||
helper.setText(R.id.tv_fairy_name, item.elfName)
|
||||
helper.setBackgroundRes(
|
||||
R.id.ll_root,
|
||||
if (item.selectedNum > 0) R.drawable.treasure_fairy_bg_test_fairy_item_select else 0
|
||||
)
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package com.yizhuan.erban.treasurefairy.adapter
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.xchat_android_core.treasurefairy.ResolveInfo
|
||||
|
||||
class ResolveFairyResultAdapter :
|
||||
BaseQuickAdapter<ResolveInfo, BaseViewHolder>(R.layout.treasure_fairy_item_forest_prize_single_resolve) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: ResolveInfo) {
|
||||
helper.setText(R.id.tv_prize_name, "x${item.pieceNum}")
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
package com.yizhuan.erban.treasurefairy.dialog
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.WindowManager
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.yizhuan.erban.base.BaseDialog
|
||||
import com.yizhuan.erban.databinding.TreasureFairyDialogResolveFairyResultBinding
|
||||
import com.yizhuan.erban.databinding.TreasureFairyDialogTestFairyResultBinding
|
||||
import com.yizhuan.erban.treasurefairy.FairyViewModel
|
||||
import com.yizhuan.erban.treasurefairy.adapter.ResolveFairyResultAdapter
|
||||
import com.yizhuan.erban.treasurefairy.adapter.TestFairyResultAdapter
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
import com.yizhuan.xchat_android_core.treasurefairy.FairyInfo
|
||||
import com.yizhuan.xchat_android_core.treasurefairy.ResolveInfo
|
||||
|
||||
class ResolveFairyResultDialog : BaseDialog<TreasureFairyDialogResolveFairyResultBinding>() {
|
||||
|
||||
private lateinit var rvDelegate: RVDelegate<ResolveInfo>
|
||||
private lateinit var prizeAdapter: ResolveFairyResultAdapter
|
||||
|
||||
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
override var height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
override var gravity = Gravity.CENTER
|
||||
private val viewModel: FairyViewModel by activityViewModels()
|
||||
|
||||
companion object {
|
||||
fun newInstance(resolveInfo: ResolveInfo): ResolveFairyResultDialog {
|
||||
val args = Bundle()
|
||||
args.putSerializable("resolveInfo",resolveInfo)
|
||||
val fragment = ResolveFairyResultDialog()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private val resolveInfo by lazy { requireArguments().getSerializable("resolveInfo") as ResolveInfo }
|
||||
@SuppressLint("CheckResult")
|
||||
override fun init() {
|
||||
binding?.tvClose?.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
prizeAdapter = ResolveFairyResultAdapter()
|
||||
rvDelegate = RVDelegate.Builder<ResolveInfo>()
|
||||
.setAdapter(prizeAdapter)
|
||||
.setRecyclerView(binding?.recyclerView)
|
||||
.setLayoutManager(
|
||||
LinearLayoutManager(context)
|
||||
)
|
||||
.build()
|
||||
|
||||
rvDelegate.setNewData(arrayListOf(resolveInfo))
|
||||
viewModel.cleanTestParam()
|
||||
}
|
||||
|
||||
}
|
@@ -58,7 +58,7 @@ class TestFairyDialog : BaseDialog<TreasureFairyDialogTestFairyBinding>() {
|
||||
childFragmentManager,
|
||||
listOf(
|
||||
TestFairyFragment.newInstance(MyFairyItemView.BASE),
|
||||
TestFairyFragment.newInstance(MyFairyItemView.EPIC)
|
||||
TestFairyFragment.newInstance(MyFairyItemView.LEGEND)
|
||||
)
|
||||
)
|
||||
viewModel.getMyFairyInfo()
|
||||
|
@@ -10,7 +10,9 @@ import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.common.EmptyViewHelper
|
||||
import com.yizhuan.erban.databinding.TreasureFairyFragmentTestFairyBinding
|
||||
import com.yizhuan.erban.treasurefairy.FairyViewModel
|
||||
import com.yizhuan.erban.treasurefairy.adapter.ResolveFairyAdapter
|
||||
import com.yizhuan.erban.treasurefairy.adapter.TestFairyAdapter
|
||||
import com.yizhuan.erban.treasurefairy.dialog.ResolveFairyResultDialog
|
||||
import com.yizhuan.erban.treasurefairy.dialog.TestFairyResultDialog
|
||||
import com.yizhuan.erban.treasurefairy.view.MyFairyItemView
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
@@ -19,7 +21,6 @@ import com.yizhuan.xchat_android_core.treasurefairy.FairyInfo
|
||||
|
||||
class TestFairyFragment : BaseViewBindingFragment<TreasureFairyFragmentTestFairyBinding>() {
|
||||
|
||||
|
||||
companion object {
|
||||
fun newInstance(fairyType: Int): TestFairyFragment {
|
||||
val args = Bundle()
|
||||
@@ -34,6 +35,7 @@ class TestFairyFragment : BaseViewBindingFragment<TreasureFairyFragmentTestFairy
|
||||
private val viewModel: FairyViewModel by activityViewModels()
|
||||
private lateinit var rvDelegate: RVDelegate<FairyInfo>
|
||||
private lateinit var testFairyAdapter: TestFairyAdapter
|
||||
private lateinit var resolveFairyAdapter: ResolveFairyAdapter
|
||||
|
||||
private val showResultRunnable = Runnable {
|
||||
if (canShowResult) {
|
||||
@@ -51,44 +53,78 @@ class TestFairyFragment : BaseViewBindingFragment<TreasureFairyFragmentTestFairy
|
||||
resultNotShowed = true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得精灵碎片
|
||||
*/
|
||||
private val showResolveResultRunnable = Runnable {
|
||||
if (canShowResult) {
|
||||
canShowResult = false
|
||||
binding.ivBegin.isEnabled = true
|
||||
viewModel.resolveResultLiveData.value?.peekContent()?.let {
|
||||
ResolveFairyResultDialog.newInstance(it).show(context)
|
||||
}
|
||||
} else {
|
||||
resultNotShowed = true
|
||||
}
|
||||
}
|
||||
private var canShowResult = false
|
||||
private var resultNotShowed = false
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun init() {
|
||||
val fairyViews = listOf(binding.ivFairy0, binding.ivFairy1, binding.ivFairy2)
|
||||
val fairyViews = listOf(
|
||||
binding.ivFairy0,
|
||||
binding.ivFairy1,
|
||||
binding.ivFairy2,
|
||||
binding.ivFairy3,
|
||||
binding.ivFairy4
|
||||
)
|
||||
val fairyResolveViews = listOf(binding.ivFairy3)
|
||||
testFairyAdapter = TestFairyAdapter()
|
||||
resolveFairyAdapter = ResolveFairyAdapter()
|
||||
rvDelegate = RVDelegate.Builder<FairyInfo>()
|
||||
.setAdapter(testFairyAdapter)
|
||||
.setEmptyView(EmptyViewHelper.createEmptyTextViewNoImage(
|
||||
.setAdapter(if(fairyType == MyFairyItemView.BASE) resolveFairyAdapter else testFairyAdapter)
|
||||
.setEmptyView(
|
||||
EmptyViewHelper.createEmptyTextViewNoImage(
|
||||
context,
|
||||
getString(R.string.fairy_no_further_data_is_available)
|
||||
))
|
||||
)
|
||||
)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.setLayoutManager(GridLayoutManager(context, 3, LinearLayoutManager.VERTICAL, false))
|
||||
.setLayoutManager(GridLayoutManager(context, if(fairyType == MyFairyItemView.BASE) 6 else 3 , LinearLayoutManager.VERTICAL, false))
|
||||
.build()
|
||||
|
||||
viewModel.myFairyInfoLiveData.observe(viewLifecycleOwner) {
|
||||
val fairyInfos = it?.let {
|
||||
when (fairyType) {
|
||||
MyFairyItemView.EPIC -> {
|
||||
it.middleElves
|
||||
MyFairyItemView.LEGEND -> {
|
||||
it.highElves
|
||||
}
|
||||
else -> {
|
||||
it.lowElves
|
||||
}
|
||||
}
|
||||
}
|
||||
if(fairyType == MyFairyItemView.BASE) {
|
||||
val list = mutableListOf<FairyInfo>()
|
||||
it?.lowElves?.take(3)?.let { it1 -> list.addAll(it1) }
|
||||
it?.highElves?.take(3)?.let { it2 -> list.addAll(it2) }
|
||||
rvDelegate.setNewData(list)
|
||||
} else {
|
||||
rvDelegate.setNewData(fairyInfos?.take(3))
|
||||
}
|
||||
}
|
||||
|
||||
if (fairyType == MyFairyItemView.EPIC) {
|
||||
binding.tvTips.text = "點擊投入試煉傳說精靈"
|
||||
resolveFairyAdapter.setOnItemClickListener { _, _, position ->
|
||||
resolveFairyAdapter.getItem(position)?.let {
|
||||
viewModel.addTestFairy(it, 1)
|
||||
}
|
||||
}
|
||||
|
||||
testFairyAdapter.setOnItemClickListener { _, _, position ->
|
||||
testFairyAdapter.getItem(position)?.let {
|
||||
viewModel.addTestFairy(it)
|
||||
viewModel.addTestFairy(it, 5)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,20 +133,46 @@ class TestFairyFragment : BaseViewBindingFragment<TreasureFairyFragmentTestFairy
|
||||
viewModel.minusTestFairy(index)
|
||||
}
|
||||
}
|
||||
fairyResolveViews.forEachIndexed { index, imageView ->
|
||||
imageView.setOnClickListener {
|
||||
viewModel.minusTestFairy(index)
|
||||
}
|
||||
}
|
||||
binding.tvReset.setOnClickListener {
|
||||
viewModel.cleanTestParam()
|
||||
}
|
||||
binding.tvOneKeyAdd.setOnClickListener {
|
||||
viewModel.oneKeyAdd(testFairyAdapter.data)
|
||||
if (fairyType == MyFairyItemView.BASE) {
|
||||
viewModel.oneKeyAdd(resolveFairyAdapter.data, 1)
|
||||
} else {
|
||||
viewModel.oneKeyAdd(testFairyAdapter.data, 5)
|
||||
}
|
||||
}
|
||||
|
||||
if (fairyType == MyFairyItemView.BASE) {
|
||||
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.setBackgroundResource(R.drawable.treasure_fairy_bg_resolve_fairy_begin)
|
||||
binding.tvTips.text = "點擊投入需要分解的精靈"
|
||||
} else {
|
||||
binding.viewBgAnim.setBackgroundResource(R.drawable.treasure_fairy_bg_test_fairy_anim_epic)
|
||||
binding.viewBgTop.setBackgroundResource(R.drawable.treasure_fairy_bg_test_fairy)
|
||||
binding.ivBegin.setBackgroundResource(R.drawable.treasure_fairy_bg_test_fairy_begin)
|
||||
binding.tvTips.text = "點擊投入試煉傳說精靈"
|
||||
}
|
||||
|
||||
binding.ivBegin.setOnClickListener {
|
||||
if (viewModel.testFairy(fairyType)) {
|
||||
if (fairyType == MyFairyItemView.BASE) {
|
||||
if (viewModel.resolveFairy()) {
|
||||
binding.animView.startPlay(
|
||||
requireContext().assets,
|
||||
"vap/test_fairy_anim_epic.mp4"
|
||||
)
|
||||
binding.ivBegin.isEnabled = false
|
||||
canShowResult = false
|
||||
binding.ivBegin.postDelayed(showResolveResultRunnable, 1800)
|
||||
}
|
||||
} else if (viewModel.testFairy(fairyType)) {
|
||||
binding.animView.startPlay(
|
||||
requireContext().assets,
|
||||
if (fairyType == MyFairyItemView.BASE) {
|
||||
@@ -146,7 +208,30 @@ class TestFairyFragment : BaseViewBindingFragment<TreasureFairyFragmentTestFairy
|
||||
binding.ivBegin.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
//分解碎片
|
||||
viewModel.resolveResultLiveData.observe(viewLifecycleOwner) {
|
||||
it?.getContentIfNotHandled()?.let {
|
||||
canShowResult = true
|
||||
if (resultNotShowed) {
|
||||
showResultRunnable.run()
|
||||
}
|
||||
} ?: run {
|
||||
binding.ivBegin.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.compoundFairyInfosLiveData.observe(viewLifecycleOwner) {
|
||||
if (fairyType == MyFairyItemView.BASE) {
|
||||
fairyResolveViews.forEachIndexed { index, imageView ->
|
||||
it?.get(index)?.elfPicUrl?.let { elfPicUrl ->
|
||||
imageView.load(elfPicUrl)
|
||||
} ?: run {
|
||||
imageView.setImageDrawable(null)
|
||||
}
|
||||
}
|
||||
resolveFairyAdapter.notifyDataSetChanged()
|
||||
} else {
|
||||
fairyViews.forEachIndexed { index, imageView ->
|
||||
it?.get(index)?.elfPicUrl?.let { elfPicUrl ->
|
||||
imageView.load(elfPicUrl)
|
||||
@@ -157,5 +242,6 @@ class TestFairyFragment : BaseViewBindingFragment<TreasureFairyFragmentTestFairy
|
||||
testFairyAdapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
BIN
app/src/main/res/drawable-xhdpi/ic_debris_default.png
Normal file
After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 153 KiB |
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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:id="@+id/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="281dp"
|
||||
android:layout_height="285dp"
|
||||
android:background="@drawable/treasure_fairy_bg_forest_prize_single"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.6" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="53dp"
|
||||
android:text="恭喜獲得碎片"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:includeFontPadding="false"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_close"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_close"
|
||||
android:layout_width="104dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginBottom="42dp"
|
||||
android:background="@drawable/treasure_fairy_bg_forest_prize_close"
|
||||
android:gravity="center"
|
||||
android:text="關 閉"
|
||||
android:textColor="#ff008573"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/treasure_fairy_bg_test_fairy"
|
||||
app:layout_constraintDimensionRatio="750:585"
|
||||
app:layout_constraintDimensionRatio="750:555"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -21,11 +21,11 @@
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:background="@drawable/treasure_fairy_bg_test_fairy_anim_epic"
|
||||
app:layout_constraintDimensionRatio="684:490"
|
||||
app:layout_constraintDimensionRatio="684:452"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_top"
|
||||
app:layout_constraintWidth_percent="0.91" />
|
||||
app:layout_constraintWidth_percent="0.912" />
|
||||
|
||||
<com.tencent.qgame.animplayer.AnimView
|
||||
android:id="@+id/anim_view"
|
||||
@@ -42,10 +42,10 @@
|
||||
android:layout_height="60dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_anim"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg_anim"
|
||||
app:layout_constraintHorizontal_bias="0.105"
|
||||
app:layout_constraintHorizontal_bias="0.04"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg_anim"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_anim"
|
||||
app:layout_constraintVertical_bias="0.74" />
|
||||
app:layout_constraintVertical_bias="0.18" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_fairy_1"
|
||||
@@ -53,28 +53,50 @@
|
||||
android:layout_height="60dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_anim"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg_anim"
|
||||
app:layout_constraintHorizontal_bias="0.96"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg_anim"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_anim"
|
||||
app:layout_constraintVertical_bias="0.85" />
|
||||
app:layout_constraintVertical_bias="0.18" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_fairy_2"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_anim"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg_anim"
|
||||
app:layout_constraintHorizontal_bias="0.892"
|
||||
app:layout_constraintHorizontal_bias="0.10"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg_anim"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_anim"
|
||||
app:layout_constraintVertical_bias="0.745" />
|
||||
app:layout_constraintVertical_bias="0.82" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_fairy_3"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
app:layout_constraintHorizontal_bias="0.51"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_anim"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg_anim"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg_anim"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_anim"
|
||||
app:layout_constraintVertical_bias="0.94" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_fairy_4"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_anim"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_bg_anim"
|
||||
app:layout_constraintHorizontal_bias="0.90"
|
||||
app:layout_constraintStart_toStartOf="@id/view_bg_anim"
|
||||
app:layout_constraintTop_toTopOf="@id/view_bg_anim"
|
||||
app:layout_constraintVertical_bias="0.82" />
|
||||
|
||||
<View
|
||||
android:id="@+id/iv_begin"
|
||||
android:layout_width="142dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/treasure_fairy_bg_test_fairy_begin"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_bg_top"
|
||||
android:background="@drawable/treasure_fairy_bg_test_fairy_begin"
|
||||
app:layout_constraintTop_toBottomOf="@+id/view_bg_anim"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_prize_icon"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="65dp"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_debris_default" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_prize_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="5dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:text="@string/fairy_fairy_ball"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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="58dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="1dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="1dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@drawable/treasure_fairy_bg_test_fairy_item_unselect"
|
||||
tools:layout_width="58dp">
|
||||
|
||||
<View
|
||||
android:id="@+id/ll_root"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/treasure_fairy_bg_test_fairy_item_select"
|
||||
android:gravity="center"
|
||||
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="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="3dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.67" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_fairy_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="2dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:text="精靈球"
|
||||
android:textColor="#1F5764"
|
||||
android:textSize="@dimen/sp_13"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_fairy_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_fairy_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_11"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_fairy_name"
|
||||
tools:text="1/5" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@@ -4,9 +4,9 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="66dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@drawable/treasure_fairy_bg_test_fairy_item_unselect"
|
||||
tools:layout_width="65dp">
|
||||
|
@@ -0,0 +1,5 @@
|
||||
package com.yizhuan.xchat_android_core.treasurefairy
|
||||
|
||||
data class FairyResolveParam(
|
||||
val expendList: MutableList<Compound> = arrayListOf()
|
||||
)
|
@@ -2,8 +2,8 @@ package com.yizhuan.xchat_android_core.treasurefairy
|
||||
|
||||
data class MyFairyInfo(
|
||||
val highElves: ArrayList<FairyInfo>? = null,
|
||||
val lowElves: ArrayList<FairyInfo>? = null,
|
||||
val middleElves: ArrayList<FairyInfo>? = null,
|
||||
val lowElves: ArrayList<FairyInfo>? = null,
|
||||
val avatar: String = "",
|
||||
val nick: String = "",
|
||||
val chipNum: Int
|
||||
|
@@ -0,0 +1,8 @@
|
||||
package com.yizhuan.xchat_android_core.treasurefairy
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
data class ResolveInfo(
|
||||
val elfLevel: Int = 0,
|
||||
val pieceNum: Int = 0
|
||||
) : Serializable
|
@@ -69,6 +69,10 @@ object TreasureFairyModel {
|
||||
api.testFairy(fairyTestParam)
|
||||
}
|
||||
|
||||
suspend fun resolveFairy(resolveParam: FairyResolveParam): List<ResolveInfo>? = launchRequest {
|
||||
api.resolveFairy(resolveParam)
|
||||
}
|
||||
|
||||
suspend fun getTestFairyRecordList(
|
||||
page: Int,
|
||||
pageSize: Int
|
||||
@@ -216,6 +220,12 @@ object TreasureFairyModel {
|
||||
@POST("act/seize-treasure/elf/compound")
|
||||
suspend fun testFairy(@Body fairyTestParam: FairyTestParam): ServiceResult<FairyInfo>
|
||||
|
||||
/**
|
||||
* 分解礼物
|
||||
*/
|
||||
@POST("act/seize-treasure/elf/salvage")
|
||||
suspend fun resolveFairy(@Body resolveParam: FairyResolveParam): ServiceResult<List<ResolveInfo>>
|
||||
|
||||
/**
|
||||
* 合成礼物记录
|
||||
*
|
||||
|