拼ui 一些业务逻辑x实现
This commit is contained in:
@@ -83,15 +83,8 @@ public sealed class PlayerEconomyLedger : MonoBehaviour
|
||||
InitializeIfNeeded();
|
||||
boundPlayerData = playerData;
|
||||
|
||||
if (!loadedFromSave)
|
||||
{
|
||||
payload.coins = Mathf.Max(0, playerData.Coins);
|
||||
payload.material = Mathf.Max(0, playerData.Material);
|
||||
SaveNow();
|
||||
loadedFromSave = true;
|
||||
}
|
||||
|
||||
SyncToPlayerData();
|
||||
GlobalAchievementService.EnsureInstance().ReportCurrentCoins(payload.coins);
|
||||
NotifyEconomyChanged();
|
||||
}
|
||||
|
||||
@@ -128,6 +121,7 @@ public sealed class PlayerEconomyLedger : MonoBehaviour
|
||||
InitializeIfNeeded();
|
||||
long next = (long)payload.coins + amount;
|
||||
payload.coins = next > int.MaxValue ? int.MaxValue : (int)next;
|
||||
GlobalAchievementService.EnsureInstance().ReportCoinsEarned(amount);
|
||||
SaveNow();
|
||||
}
|
||||
|
||||
@@ -175,6 +169,7 @@ public sealed class PlayerEconomyLedger : MonoBehaviour
|
||||
InitializeIfNeededForSave();
|
||||
PlayerEconomyStorage.TrySave(payload);
|
||||
SyncToPlayerData();
|
||||
GlobalAchievementService.EnsureInstance().ReportCurrentCoins(payload.coins);
|
||||
NotifyEconomyChanged();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user