Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.87 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Reflection;
  4. using ICities;
  5. using UnityEngine;
  6.  
  7. namespace UnlimitedMoneyMod
  8. {
  9.     public class UnlimitedMoney : MarshalByRefObject, IUserMod
  10.     {
  11.         public void OnLoad()
  12.         {
  13. Debug.Log("OnLoad" + AppDomain.CurrentDomain.FriendlyName);
  14.             using (StreamWriter file = new System.IO.StreamWriter("Assemblies.txt"))
  15.             {
  16.                  Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
  17.                  foreach (Assembly assembly in assemblies)
  18.                  {
  19.                       file.WriteLine(assembly.FullName);
  20.                  }
  21.                  file.WriteLine("");
  22.                  foreach (Assembly assembly in assemblies)
  23.                  {
  24.                       file.WriteLine(assembly.FullName);
  25.                       if (assembly != null)
  26.                       {
  27.                            Type[] types;
  28.                            try
  29.                            {
  30.                                 types = assembly.GetTypes();
  31.                            }
  32.                            catch (ReflectionTypeLoadException ex)
  33.                            {
  34.                                 types = ex.Types;
  35.                            }
  36.                            foreach (Type subType in types)
  37.                            {
  38.                                 file.WriteLine("   " + subType.Name);
  39.                                 if(assembly.FullName.equals(“ColossalManaged”)){
  40.                                         MemberInfo[] Members = subType.GetMembers();
  41.  
  42.  
  43.                                         foreach (MemberInfo NextMember in Members)
  44.                                         {
  45.                                                 file.WriteLine(“         “  +  NextMember.DeclaringType +  “ " +  NextMember.MemberType +  “  " + NextMember.Name);
  46.  
  47.  
  48.                                          }
  49.                                 }
  50.                            }
  51.                       }
  52.                  }
  53.             }
  54.         }
  55.  
  56.         public void OnUnload()
  57.         {
  58.         }
  59.  
  60.         public string Name
  61.         {
  62.             get { return "Unlimited Money"; }
  63.         }
  64.  
  65.         public string Description
  66.         {
  67.             get { return "Money never runs out"; }
  68.         }
  69.     }
  70.  
  71.     public class UnlimitedMoneyEconomy : EconomyExtensionBase
  72.     {
  73.  
  74.         public override long OnUpdateMoneyAmount(long internalMoneyAmount)
  75.         {
  76.             return long.MaxValue;
  77.         }
  78.  
  79.         public override bool OverrideDefaultPeekResource
  80.         {
  81.             get { return true; }
  82.         }
  83.  
  84.         public override int OnPeekResource(EconomyResource resource, int amount)
  85.         {
  86.             return amount;
  87.         }
  88.  
  89.     }
  90.  
  91.     /*
  92.     public class UnlimitedMoney : MarshalByRefObject, IEconomy
  93.     {
  94.  
  95.          public long StartingMoney()
  96.          {
  97.               Debug.Log("UnlimitedMoney.StartingMoney " + System.AppDomain.CurrentDomain.FriendlyName);
  98.               return long.MaxValue;
  99.          }
  100.  
  101.          public long GetLastCashAmount(long current)
  102.          {
  103.               return 50000;
  104.          }
  105.  
  106.          public Economy.Resource GetOverrides()
  107.          {
  108.               return Economy.Resource.ConstructionCost |
  109.                      Economy.Resource.LoanAmount |
  110.                      Economy.Resource.LandPrice |
  111.                      Economy.Resource.RewardAmount |
  112.                      Economy.Resource.BailoutAmount |
  113.                      Economy.Resource.RefundAmount;
  114.          }
  115.  
  116.          public int PeekResource(ICities.Economy.Resource resource, int amount)
  117.          {
  118.               return amount;
  119.          }
  120.  
  121.          public int FetchResource(ICities.Economy.Resource resource, int amount)
  122.          {
  123.               return amount;
  124.          }
  125.  
  126.          public int AddResource(ICities.Economy.Resource resource, int amount)
  127.          {
  128.               return 0;
  129.          }
  130.  
  131.          public void OnCreate()
  132.          {
  133.  
  134.          }
  135.  
  136.          public void OnUpdate(ITerrain terrain)
  137.          {
  138.               if (Input.GetKeyDown(KeyCode.F7))
  139.               {
  140.                    Debug.Log("UnlimitedMoney.OnCreate " + System.AppDomain.CurrentDomain.FriendlyName);
  141.                    byte[] b = new byte[1081 * 1081 * 2];
  142.                    for (int z = 0; z <= 1080; ++z)
  143.                    {
  144.                         int srcIndex = z * (1080 + 1) * 2;
  145.                         for (int x = 0; x <= 1080; ++x)
  146.                         {
  147.                              ushort s = (ushort)(((x % 256) + 40) * 60);
  148.                              b[srcIndex++] = (byte)(s & 0xFF);
  149.                              b[srcIndex++] = (byte)(s >> 8);
  150.                         }
  151.                    }
  152.                    terrain.OnCreate(b);
  153.               }
  154.          }
  155.  
  156.          public void OnRelease()
  157.          {
  158.          }
  159.     }*/
  160. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement