Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
Repozitorijs ir arhivēts. Tam var aplūkot failus un to var klonēt, bet nevar iesūtīt jaunas izmaiņas, kā arī atvērt jaunas problēmas/izmaiņu pieprasījumus.

53 rindas
1.0KB

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. public class MethodHolder
  7. {
  8. protected Action method;
  9. protected string methodName;
  10. public MethodHolder()
  11. {
  12. }
  13. public MethodHolder(Action tgtMethod)
  14. {
  15. method = tgtMethod;
  16. methodName = tgtMethod.Method.Name;
  17. }
  18. public virtual void run(object param = null)
  19. {
  20. if (method != null)
  21. method.Invoke();
  22. }
  23. public string name
  24. {
  25. get
  26. {
  27. return methodName;
  28. }
  29. }
  30. }
  31. public class MethodHolder<T> : MethodHolder
  32. {
  33. protected Action<T> methodParam;
  34. public MethodHolder(Action<T> tgtMethod)
  35. {
  36. methodParam = tgtMethod;
  37. methodName = tgtMethod.Method.Name;
  38. }
  39. public override void run(object param)
  40. {
  41. if (methodParam != null)
  42. methodParam.Invoke((T)param);
  43. }
  44. }
  45. }