PlayerHurtEventSender.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using GameWorld;
  3. using LitJson;
  4. using UnityEngine;
  5. public class PlayerHurtEventSender : DebugGuiBase
  6. {
  7. protected override string UIDebugButtonName
  8. {
  9. get
  10. {
  11. return "主角受伤";
  12. }
  13. }
  14. protected override void GUIStart()
  15. {
  16. float num = (float)Screen.width;
  17. this.GUIArea = new Rect(num / 2f - 320f, 20f, 640f, 500f);
  18. }
  19. public override void OnDebugGUI()
  20. {
  21. GUILayout.BeginArea(this.GUIArea);
  22. GUILayout.BeginVertical("box", new GUILayoutOption[0]);
  23. GUILayout.BeginHorizontal(new GUILayoutOption[]
  24. {
  25. GUILayout.Width(600f)
  26. });
  27. GUILayout.FlexibleSpace();
  28. if (GUILayout.Button("测试一下", new GUILayoutOption[]
  29. {
  30. GUILayout.Width(200f)
  31. }))
  32. {
  33. this.SendEvent();
  34. }
  35. GUILayout.FlexibleSpace();
  36. GUILayout.EndHorizontal();
  37. GUILayout.EndVertical();
  38. GUILayout.EndArea();
  39. }
  40. private void SendEvent()
  41. {
  42. PlayerHurtAtkEventArgs args = new PlayerHurtAtkEventArgs(R.Player.GameObject, base.gameObject, base.gameObject, 0, Incrementor.GetNextId(), new JsonData(), false);
  43. EventManager.PostEvent<Transform, PlayerHurtAtkEventArgs>("PlayerHurtAtk", base.transform, args);
  44. }
  45. private string effectDescription;
  46. private Rect GUIArea;
  47. }