SummonService.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. var request = new Kind11XiadanRequest() { param = p };
  48. NetModule.Request(request);
  49. }
  50. public void RequestSummonMwAd()
  51. {
  52. var p = new List<string>() { "act_call", "2" };
  53. var request = new Kind11XiadanRequest() { param = p };
  54. NetModule.Request(request);
  55. }
  56. public void RequestSummonSbShare()
  57. {
  58. RequestSummonShare(1);
  59. }
  60. public void RequestSummonMwShare()
  61. {
  62. RequestSummonShare(2);
  63. }
  64. private void RequestSummonShare(int type)
  65. {
  66. var param = new CallShareRwdRequest() { type = type };
  67. (param as IMessage).Context = type;
  68. NetModule.Request(param);
  69. }
  70. }
  71. }