金币 现金数量 变化事件接入+1

This commit is contained in:
renhaoting 2025-11-27 14:49:15 +08:00
parent 209bb39f29
commit 3b2b78dd95
1 changed files with 6 additions and 0 deletions

View File

@ -23,6 +23,10 @@ object AccountManager {
account
}
private fun saveAccountInfo() {
SpUtil.instance().putObject(SpUtil.KEY_ACCOUNT, mAccount)
}
fun getAccount() : Account? {
return mAccount
}
@ -37,11 +41,13 @@ object AccountManager {
fun addGold(newGold: Int) {
mAccount?.goldCount += newGold
saveAccountInfo()
NotifyMan.instance().sendEvent(VididinEvents.Event_Account_Gold_Changed, null)
}
fun addCash(newCash: Float) {
mAccount?.cashCount += newCash
saveAccountInfo()
NotifyMan.instance().sendEvent(VididinEvents.Event_Account_Cash_Changed, null)
}