StorageSProxy.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Collections.Generic;
  2. using ET;
  3. using GFGGame;
  4. namespace GFGGame
  5. {
  6. public class StorageSProxy
  7. {
  8. //存储
  9. public static async ETTask<bool> ReqSetClientValue(int key, int value)
  10. {
  11. M2C_SetClientValue response = null;
  12. response = (M2C_SetClientValue)await MessageHelper.SendToServer(new C2M_SetClientValue() { Key = key, Value = value });
  13. if (response != null)
  14. {
  15. if (response.Error == ErrorCode.ERR_Success)
  16. {
  17. StorageDataManager.Instance.InitStorageInfo(response.Key, response.Value);
  18. return true;
  19. }
  20. }
  21. return false;
  22. }
  23. //获取
  24. public static async ETTask ReqGetClientValues()
  25. {
  26. M2C_GetClientValues response = null;
  27. response = (M2C_GetClientValues)await MessageHelper.SendToServer(new C2M_GetClientValues() { });
  28. if (response != null)
  29. {
  30. if (response.Error == ErrorCode.ERR_Success)
  31. {
  32. for (int i = 0; i < response.Ks.Count; i++)
  33. {
  34. StorageDataManager.Instance.InitStorageInfo(response.Ks[i], response.Vs[i]);
  35. }
  36. }
  37. }
  38. }
  39. }
  40. }