EventProxy.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. class EventProxy : ProxyBase<EventProxy>
  7. {
  8. public EventProxy() => opeCode = OpeCode.ope_event;
  9. /// <summary>
  10. /// 拉取新的角标通知
  11. /// </summary>
  12. /// <param name="callback"></param>
  13. public void GetNewCornerSignNotifications(Action<List<int>> callback)
  14. {
  15. Post(CmdCode.cmd_event_GetConerSignNotifications, new object[] { }, resp =>
  16. {
  17. var ret= resp.result.TryGetValue("notifications", out var jo) ? jo.ToObject<List<int>>() : new List<int>();
  18. callback?.Invoke(ret);
  19. });
  20. }
  21. /// <summary>
  22. /// 清除指定类型的角标
  23. /// </summary>
  24. /// <param name="cType">清理的种类</param>
  25. /// <param name="callback">返回最新角标信息</param>
  26. public void ClearCornerSignNotification(CornerSignType cType, Action<List<int>> callback)
  27. {
  28. Post(CmdCode.cmd_event_ClearNotifications, new object[] { cType }, resp =>
  29. {
  30. var ret = resp.result.TryGetValue("notifications", out var jo)?jo.ToObject<List<int>>() : new List<int>();
  31. callback?.Invoke(ret);
  32. });
  33. }
  34. }