SummonService.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System.Collections.Generic;
  2. using FL.Network;
  3. using XGame.Framework.Data;
  4. using XGame.Framework.Network;
  5. namespace FL.Data
  6. {
  7. public class SummonService : DataSingleton<SummonService>
  8. {
  9. /// <summary>
  10. /// 百分比
  11. /// </summary>
  12. /// <param name="val"></param>
  13. /// <returns></returns>
  14. public string GetProbability(float val)
  15. {
  16. return $"{(val * 100).ToString("F3")}%";
  17. }
  18. public void RequestSummonInto()
  19. {
  20. NetModule.Request(new CallIntoRequest());
  21. }
  22. public void RequestSummonSbOneDraw()
  23. {
  24. RequestSummonDraw(1, SummonData.Instance.SbInfo.OneDrawNum);
  25. }
  26. public void RequestSummonMwOneDraw()
  27. {
  28. RequestSummonDraw(2, SummonData.Instance.MwInfo.OneDrawNum);
  29. }
  30. public void RequestSummonSbTenDraw()
  31. {
  32. RequestSummonDraw(1, SummonData.Instance.SbInfo.TenDrawNum);
  33. }
  34. public void RequestSummonMwTenDraw()
  35. {
  36. RequestSummonDraw(2, SummonData.Instance.MwInfo.TenDrawNum);
  37. }
  38. private void RequestSummonDraw(int type, int count)
  39. {
  40. var param = new CallChoujiangRequest() { type = type, count = count };
  41. (param as IMessage).Context = type;
  42. NetModule.Request(param);
  43. }
  44. public void RequestSummonSbAd()
  45. {
  46. var p = new List<string>() { "act_call","1" };
  47. PaymentService.Instance.ReqAdvert(p, EPayActionType.SummonSbAd);
  48. }
  49. public void RequestSummonMwAd()
  50. {
  51. var p = new List<string>() { "act_call", "2" };
  52. PaymentService.Instance.ReqAdvert(p, EPayActionType.SummonMwAd);
  53. }
  54. public void RequestSummonSbShare()
  55. {
  56. RequestSummonShare(1);
  57. }
  58. public void RequestSummonMwShare()
  59. {
  60. RequestSummonShare(2);
  61. }
  62. private void RequestSummonShare(int type)
  63. {
  64. var param = new CallShareRwdRequest() { type = type };
  65. (param as IMessage).Context = type;
  66. NetModule.Request(param);
  67. }
  68. }
  69. }