template.txt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Dont Modify It: This is an Auto-Generated File
  2. using System;
  3. using System.Reflection;
  4. {{
  5. func get_pt
  6. $cnt = $0
  7. $format = $1
  8. $spliter = $2
  9. $result = ''
  10. for $i in (1..$cnt)
  11. $result += string.replace($format,'i',$i)
  12. if $i!=$cnt
  13. $result += $spliter
  14. end
  15. end
  16. ret $result
  17. end
  18. }}
  19. namespace com.bbbirder.unity {
  20. partial class DecoratorAttribute{
  21. {{~ for cnt in 1..12 ~}}
  22. {{~pt_gl = get_pt cnt 'Ti' ','~}}
  23. {{~pt_vl = get_pt cnt 'ti' ','~}}
  24. {{~pt_dl = get_pt cnt 'Ti _ti' ','~}}
  25. Func<{{pt_gl}},R> UniversalFunc<{{pt_gl}},R>(MethodInfo mi){
  26. {{~ for i in 1..cnt ~}}
  27. T{{i}} t{{i}} = default;
  28. {{~ end ~}}
  29. var invocation = new InvocationInfo<R>(){
  30. invoker = ()=>((Func<{{pt_gl}},R>)originFunc).Invoke({{pt_vl}}),
  31. Method = mi,
  32. argumentGetter = ()=>new object[]{ {{pt_vl}} }
  33. };
  34. return ({{pt_dl}})=>{
  35. {{~ for i in 1..cnt ~}}
  36. t{{i}} = _t{{i}};
  37. {{~ end ~}}
  38. return Decorate<R>(invocation);
  39. };
  40. }
  41. Action<{{pt_gl}}> UniversalAction<{{pt_gl}}>(MethodInfo mi){
  42. {{~ for i in 1..cnt ~}}
  43. T{{i}} t{{i}} = default;
  44. {{~ end ~}}
  45. var invocation = new InvocationInfo<object>(){
  46. invoker = ()=>{
  47. ((Action<{{pt_gl}}>)originFunc).Invoke({{pt_vl}});
  48. return null;
  49. },
  50. Method = mi,
  51. argumentGetter = ()=>new object[]{ {{pt_vl}} }
  52. };
  53. return ({{pt_dl}})=>{
  54. {{~ for i in 1..cnt ~}}
  55. t{{i}} = _t{{i}};
  56. {{~ end ~}}
  57. Decorate<object>(invocation);
  58. };
  59. }
  60. {{~ end ~}}
  61. }
  62. }