LuckyBoxSProxy.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. ActivityOpenCfg activityOpenCfg = ActivityOpenCfgArray.Instance.GetCfg(ActivityDataManager.Instance.actLuckyBoxId);
  16. if (activityOpenCfg != null && activityOpenCfg.paramsArr[0] == luckyBoxId)
  17. {
  18. ActivityDataManager.Instance.allPlayTimes += response.Times;
  19. }
  20. LuckyBoxDataManager.Instance.times = response.Times;
  21. // LuckyBoxDataManager.Instance.luckyBoxIndex = response.LuckyBoxId;
  22. LuckyBoxDataManager.Instance.RewardList = ItemUtil.CreateItemDataList(response.bonusList);
  23. return true;
  24. }
  25. }
  26. return false;
  27. }
  28. //请求轮换抽奖活动信息
  29. public static async ETTask<int> ReqGetLuckyBoxRotatingInfo()
  30. {
  31. S2C_GetLuckyBoxRotatingInfo response = null;
  32. response = (S2C_GetLuckyBoxRotatingInfo)await MessageHelper.SendToServer(new C2S_GetLuckyBoxRotatingInfo() { });
  33. if (response != null)
  34. {
  35. if (response.Error == ErrorCode.ERR_Success)
  36. {
  37. LuckyBoxDataManager.Instance.RotatingId = response.RotatingId;
  38. return response.RotatingId;
  39. }
  40. }
  41. return 0;
  42. }
  43. }
  44. }