ketura

AppendPrepend

Sep 22nd, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.13 KB | None | 0 0
  1. ///////////////////////////////
  2. //                           //
  3. //  APPEND FUNCTION EXAMPLE  //
  4. //                           //
  5. ///////////////////////////////
  6. using System;
  7.  
  8. namespace RenegadeCore
  9. {
  10.     public partial class StartingStats
  11.     {
  12.         public static readonly List<StatInfo> SpeciesStats;
  13.  
  14.         static StartingStats()
  15.         {
  16.             SpeciesStats = new List<StatInfo>()
  17.             {
  18.                 new StatInfo("HP")
  19.                 new StatInfo("ATK")
  20.             };
  21.         }
  22.     }
  23. }
  24.  
  25.  
  26. namespace AwesomeMod
  27. {
  28.     public partial class StartingStats
  29.     {
  30.         [AppendFunction]
  31.         static StartingStats()
  32.         {
  33.             SpeciesStats.Add(new StatInfo("DEF"));
  34.         }
  35.     }
  36. }
  37.  
  38. //results in:
  39. using System;
  40.  
  41. namespace RenegadeCore
  42. {
  43.     public partial class StartingStats
  44.     {
  45.         public static readonly List<StatInfo> SpeciesStats;
  46.  
  47.         static StartingStats()
  48.         {
  49.             SpeciesStats = new List<StatInfo>()
  50.             {
  51.                 new StatInfo("HP")
  52.                 new StatInfo("ATK")
  53.             };
  54.  
  55.             //>>>>Added by AwesomeMod<<<<//
  56.             SpeciesStats.Add(new StatInfo("DEF"));
  57.         }
  58.     }
  59. }
  60.  
  61.  
  62. ////////////////////////////////
  63. //                            //
  64. //  PREPEND FUNCTION EXAMPLE  //
  65. //                            //
  66. ////////////////////////////////
  67. using System;
  68.  
  69. namespace RenegadeCore
  70. {
  71.     public partial class StartingStats
  72.     {
  73.         public static readonly List<StatInfo> SpeciesStats;
  74.  
  75.         static StartingStats()
  76.         {
  77.             SpeciesStats = new List<StatInfo>()
  78.             {
  79.                 new StatInfo("HP")
  80.                 new StatInfo("ATK")
  81.             };
  82.         }
  83.     }
  84. }
  85.  
  86.  
  87. namespace AwesomeMod
  88. {
  89.     public partial class StartingStats
  90.     {
  91.         [PrependFunction]
  92.         static StartingStats()
  93.         {
  94.             //Fixing some stupid timing bug.  If this isn't here, it causes a crash every tenth run.
  95.             Thread.Wait(100);
  96.         }
  97.     }
  98. }
  99.  
  100. //results in:
  101. using System;
  102.  
  103. namespace RenegadeCore
  104. {
  105.     public partial class StartingStats
  106.     {
  107.         public static readonly List<StatInfo> SpeciesStats;
  108.  
  109.         static StartingStats()
  110.         {
  111.             //>>>>Added by AwesomeMod<<<<//
  112.             //Fixing some stupid timing bug.  If this isn't here, it causes a crash every tenth run.
  113.             Thread.Wait(100);
  114.             SpeciesStats = new List<StatInfo>()
  115.             {
  116.                 new StatInfo("HP")
  117.                 new StatInfo("ATK")
  118.             };
  119.         }
  120.     }
  121. }
Advertisement
Add Comment
Please, Sign In to add comment