LuckyBoxSProxy.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using ET;
  2. namespace GFGGame
  3. {
  4. public class LuckyBoxSProxy
  5. {
  6. //抽奖
  7. public static async ETTask<bool> ReqGetBonus(int luckyBoxId, int times)
  8. {
  9. M2C_DrawLuckyBox response = null;
  10. response = (M2C_DrawLuckyBox)await MessageHelper.SendToServer(new C2M_DrawLuckyBox() { LuckyBoxId = luckyBoxId, Times = times });
  11. if (response != null)
  12. {
  13. if (response.Error == ErrorCode.ERR_Success)
  14. {
  15. return false;
  16. ActivityOpenCfg activityOpenCfg = ActivityOpenCfgArray.Instance.GetCfg(ActivityDataManager.Instance.actLuckyBoxId);
  17. if (activityOpenCfg != null && activityOpenCfg.paramsArr[0] == luckyBoxId)
  18. {
  19. ActivityDataManager.Instance.allPlayTimes += response.Times;
  20. }
  21. LuckyBoxDataManager.Instance.times = response.Times;
  22. // LuckyBoxDataManager.Instance.luckyBoxIndex = response.LuckyBoxId;
  23. LuckyBoxDataManager.Instance.RewardList = ItemUtil.CreateItemDataList(response.bonusList);
  24. return true;
  25. }
  26. }
  27. return false;
  28. }
  29. //请求轮换抽奖活动信息
  30. public static async ETTask<int> ReqGetLuckyBoxRotatingInfo()
  31. {
  32. S2C_GetLuckyBoxRotatingInfo response = null;
  33. response = (S2C_GetLuckyBoxRotatingInfo)await MessageHelper.SendToServer(new C2S_GetLuckyBoxRotatingInfo() { });
  34. if (response != null)
  35. {
  36. if (response.Error == ErrorCode.ERR_Success)
  37. {
  38. LuckyBoxDataManager.Instance.RotatingId = response.RotatingId;
  39. return response.RotatingId;
  40. }
  41. }
  42. return 0;
  43. }
  44. }
  45. }