看 rv 增加的金币 times+1
This commit is contained in:
parent
02d6712928
commit
7fff655e81
|
|
@ -69,11 +69,14 @@ object AccountManager {
|
||||||
return mAccount.rvTimesGold
|
return mAccount.rvTimesGold
|
||||||
}
|
}
|
||||||
|
|
||||||
fun adjustGold(adjustNum: Long, recordBean: RecordGold): Boolean {
|
fun adjustGold(adjustNum: Long, recordBean: RecordGold, isEarnByRv: Boolean = false): Boolean {
|
||||||
if (adjustNum < 0L && Math.abs(adjustNum) > getGold()) {
|
if (adjustNum < 0L && Math.abs(adjustNum) > getGold()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
mAccount.goldCount += adjustNum
|
mAccount.goldCount += adjustNum
|
||||||
|
if (isEarnByRv) {
|
||||||
|
mAccount.rvTimesGold++
|
||||||
|
}
|
||||||
saveAccountInfo()
|
saveAccountInfo()
|
||||||
NotifyMan.instance().sendEvent(VididinEvents.Event_Account_Gold_Changed, null)
|
NotifyMan.instance().sendEvent(VididinEvents.Event_Account_Gold_Changed, null)
|
||||||
RecordsManager.instance().appendGoldRecord(recordBean)
|
RecordsManager.instance().appendGoldRecord(recordBean)
|
||||||
|
|
@ -95,11 +98,14 @@ object AccountManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun adjustCash(adjustNum: Double, recordBean: RecordCash? = null): Boolean {
|
fun adjustCash(adjustNum: Double, recordBean: RecordCash? = null, isEarnByRv: Boolean = false): Boolean {
|
||||||
if (adjustNum < 0L && Math.abs(adjustNum) > getCash()) {
|
if (adjustNum < 0L && Math.abs(adjustNum) > getCash()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
mAccount.cashCount += adjustNum
|
mAccount.cashCount += adjustNum
|
||||||
|
if (isEarnByRv) {
|
||||||
|
mAccount.rvTimesCash++
|
||||||
|
}
|
||||||
saveAccountInfo()
|
saveAccountInfo()
|
||||||
NotifyMan.instance().sendEvent(VididinEvents.Event_Account_Cash_Changed, null)
|
NotifyMan.instance().sendEvent(VididinEvents.Event_Account_Cash_Changed, null)
|
||||||
recordBean?.let {
|
recordBean?.let {
|
||||||
|
|
@ -159,7 +165,7 @@ object AccountManager {
|
||||||
if (getGold() >= costGoldNum) {
|
if (getGold() >= costGoldNum) {
|
||||||
adjustGold(-1L * costGoldNum.toInt(), RecordGold(RECORD_GOLD_MINUS_CONVERT_2_CASH, -1L * costGoldNum.toInt()))
|
adjustGold(-1L * costGoldNum.toInt(), RecordGold(RECORD_GOLD_MINUS_CONVERT_2_CASH, -1L * costGoldNum.toInt()))
|
||||||
val adjustCashNum = couldCovertCashTotal * 0.1
|
val adjustCashNum = couldCovertCashTotal * 0.1
|
||||||
adjustCash(adjustCashNum, RecordCash(RECORD_CASH_PLUS_GOLD_CONVERT, adjustCashNum.toDouble()))
|
adjustCash(adjustCashNum, RecordCash(RECORD_CASH_PLUS_GOLD_CONVERT, adjustCashNum.toDouble()), true)
|
||||||
AndroidUtil.showCustomToast(String.format(ResUtil.getString(R.string.has_claim_box_cash_hint), adjustCashNum))
|
AndroidUtil.showCustomToast(String.format(ResUtil.getString(R.string.has_claim_box_cash_hint), adjustCashNum))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ class TaskManager private constructor() {
|
||||||
|
|
||||||
VididinEvents.EVENT_AD_WATCHED_FOR_EARN_GOLD -> {
|
VididinEvents.EVENT_AD_WATCHED_FOR_EARN_GOLD -> {
|
||||||
val goldNum = VidiConst.WATCH_AD_REWARD_GOLD.toLong()
|
val goldNum = VidiConst.WATCH_AD_REWARD_GOLD.toLong()
|
||||||
AccountManager.adjustGold(goldNum, RecordGold(RECORD_GOLD_PLUS_WATCH_REWARD_AD, goldNum))
|
AccountManager.adjustGold(goldNum, RecordGold(RECORD_GOLD_PLUS_WATCH_REWARD_AD, goldNum), true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class DailySignTaskHelper : BaseTaskHelper<TaskDailySignBean, Task>() {
|
||||||
daySignState.hasWatchedAd = isByAd
|
daySignState.hasWatchedAd = isByAd
|
||||||
saveState2Sp()
|
saveState2Sp()
|
||||||
val goldNum = finalReward.toLong()
|
val goldNum = finalReward.toLong()
|
||||||
AccountManager.adjustGold(goldNum, RecordGold(RECORD_GOLD_PLUS_TASK_SIGN, goldNum))
|
AccountManager.adjustGold(goldNum, RecordGold(RECORD_GOLD_PLUS_TASK_SIGN, goldNum), true)
|
||||||
notifySignStateChanged(Pair(dayIndex, daySignState))
|
notifySignStateChanged(Pair(dayIndex, daySignState))
|
||||||
|
|
||||||
StatisticUtil.reportEvents(StatisticUtil.KEY_Daily_Sign, mapOf(
|
StatisticUtil.reportEvents(StatisticUtil.KEY_Daily_Sign, mapOf(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue