金币 现金数量 变化事件接入+1
This commit is contained in:
parent
209bb39f29
commit
3b2b78dd95
|
|
@ -23,6 +23,10 @@ object AccountManager {
|
||||||
account
|
account
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun saveAccountInfo() {
|
||||||
|
SpUtil.instance().putObject(SpUtil.KEY_ACCOUNT, mAccount)
|
||||||
|
}
|
||||||
|
|
||||||
fun getAccount() : Account? {
|
fun getAccount() : Account? {
|
||||||
return mAccount
|
return mAccount
|
||||||
}
|
}
|
||||||
|
|
@ -37,11 +41,13 @@ object AccountManager {
|
||||||
|
|
||||||
fun addGold(newGold: Int) {
|
fun addGold(newGold: Int) {
|
||||||
mAccount?.goldCount += newGold
|
mAccount?.goldCount += newGold
|
||||||
|
saveAccountInfo()
|
||||||
NotifyMan.instance().sendEvent(VididinEvents.Event_Account_Gold_Changed, null)
|
NotifyMan.instance().sendEvent(VididinEvents.Event_Account_Gold_Changed, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addCash(newCash: Float) {
|
fun addCash(newCash: Float) {
|
||||||
mAccount?.cashCount += newCash
|
mAccount?.cashCount += newCash
|
||||||
|
saveAccountInfo()
|
||||||
NotifyMan.instance().sendEvent(VididinEvents.Event_Account_Cash_Changed, null)
|
NotifyMan.instance().sendEvent(VididinEvents.Event_Account_Cash_Changed, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue