StorageDataManager.cs 893 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections.Generic;
  2. namespace GFGGame
  3. {
  4. public class StorageDataManager : SingletonBase<StorageDataManager>
  5. {
  6. private Dictionary<int, int> _storangeInfoById = new Dictionary<int, int>();
  7. public void Clear()
  8. {
  9. _storangeInfoById.Clear();
  10. }
  11. public void InitStorageInfo(int key, int value)
  12. {
  13. if (!_storangeInfoById.ContainsKey(key))
  14. {
  15. _storangeInfoById.Add(key, value);
  16. }
  17. _storangeInfoById[key] = value;
  18. }
  19. public int GetStorageValue(int key)
  20. {
  21. if (!_storangeInfoById.ContainsKey(key))
  22. {
  23. return 0;
  24. }
  25. return _storangeInfoById[key];
  26. }
  27. public Dictionary<int, int> GetStorangeDic()
  28. {
  29. return _storangeInfoById;
  30. }
  31. }
  32. }