ActivityMessageEvents.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. namespace KairoEngine.Core
  6. {
  7. public class ActivityMessageEvents
  8. {
  9. #region SimpleMessage
  10. public static event System.Action<string> OnActivityMessage;
  11. public static void Send(string text)
  12. {
  13. if(OnActivityMessage != null)
  14. {
  15. OnActivityMessage(text);
  16. }
  17. }
  18. #endregion
  19. #region TimedMessage
  20. public static event System.Action<string, float> OnTimedActivityMessage;
  21. public static void Send(string text, float time)
  22. {
  23. if(OnTimedActivityMessage != null)
  24. {
  25. OnTimedActivityMessage(text, time);
  26. }
  27. }
  28. #endregion
  29. #region StickyMessage
  30. public static event System.Action<string, bool> OnStickyActivityMessage;
  31. public static void Send(string text, bool sticky)
  32. {
  33. if(OnStickyActivityMessage != null)
  34. {
  35. OnStickyActivityMessage(text, sticky);
  36. }
  37. }
  38. #endregion
  39. #region FullMessage
  40. public static event System.Action<string, string, string, string, Sprite, float, bool, bool, Action, string, string, string> OnFullMessage;
  41. public static void Send(string text, string id, string group, string prefab, Sprite icon, float time, bool sticky, bool hideOnClick,
  42. Action action, string tooltipHeader = "", string tooltipBody = "", string tooltipType = "")
  43. {
  44. if(OnFullMessage != null)
  45. {
  46. OnFullMessage(text, id, group, prefab, icon, time, sticky, hideOnClick, action, tooltipHeader, tooltipBody, tooltipType);
  47. }
  48. }
  49. #endregion
  50. #region UpdateMessage
  51. public static event System.Action<string, string, Sprite, float, bool, bool, Action, string, string, string> OnUpdateActivityMessage;
  52. public static void Update(string id, string newText, Sprite newIcon, float newTime, bool sticky, bool hideOnClick,
  53. Action newAction, string tooltipHeader = "", string tooltipBody = "", string tooltipType = "")
  54. {
  55. if(OnUpdateActivityMessage != null)
  56. {
  57. OnUpdateActivityMessage(id, newText, newIcon, newTime, sticky, hideOnClick, newAction, tooltipHeader, tooltipBody, tooltipType);
  58. }
  59. }
  60. #endregion
  61. #region RemoveMessage
  62. public static event System.Action<string> OnRemoveActivityMessage;
  63. public static void Remove(string text)
  64. {
  65. if(OnRemoveActivityMessage != null)
  66. {
  67. OnRemoveActivityMessage(text);
  68. }
  69. }
  70. #endregion
  71. }
  72. }