HouseTypes.cs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // The Command & Conquer Map Editor and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // The Command & Conquer Map Editor and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. using MobiusEditor.Model;
  15. using System.Collections.Generic;
  16. using System.Linq;
  17. using System.Reflection;
  18. namespace MobiusEditor.RedAlert
  19. {
  20. public static class HouseTypes
  21. {
  22. public static readonly HouseType Spain = new HouseType(0, "Spain", "SPAIN");
  23. public static readonly HouseType Greece = new HouseType(1, "Greece", "GREECE");
  24. public static readonly HouseType USSR = new HouseType(2, "USSR", "USSR");
  25. public static readonly HouseType England = new HouseType(3, "England", "ENGLAND");
  26. public static readonly HouseType Ukraine = new HouseType(4, "Ukraine", "UKRAINE");
  27. public static readonly HouseType Germany = new HouseType(5, "Germany", "GERMANY");
  28. public static readonly HouseType France = new HouseType(6, "France", "FRANCE");
  29. public static readonly HouseType Turkey = new HouseType(7, "Turkey", "TURKEY");
  30. public static readonly HouseType Good = new HouseType(8, "GoodGuy", "GOOD");
  31. public static readonly HouseType Bad = new HouseType(9, "BadGuy", "BAD");
  32. public static readonly HouseType Neutral = new HouseType(10, "Neutral");
  33. public static readonly HouseType Special = new HouseType(11, "Special");
  34. public static readonly HouseType Multi1 = new HouseType(12, "Multi1", "MULTI1");
  35. public static readonly HouseType Multi2 = new HouseType(13, "Multi2", "MULTI2");
  36. public static readonly HouseType Multi3 = new HouseType(14, "Multi3", "MULTI3");
  37. public static readonly HouseType Multi4 = new HouseType(15, "Multi4", "MULTI4");
  38. public static readonly HouseType Multi5 = new HouseType(16, "Multi5", "MULTI5");
  39. public static readonly HouseType Multi6 = new HouseType(17, "Multi6", "MULTI6");
  40. public static readonly HouseType Multi7 = new HouseType(18, "Multi7", "MULTI7");
  41. public static readonly HouseType Multi8 = new HouseType(19, "Multi8", "MULTI8");
  42. private static readonly HouseType[] Types;
  43. static HouseTypes()
  44. {
  45. Types =
  46. (from field in typeof(HouseTypes).GetFields(BindingFlags.Static | BindingFlags.Public)
  47. where field.IsInitOnly && typeof(HouseType).IsAssignableFrom(field.FieldType)
  48. select field.GetValue(null) as HouseType).ToArray();
  49. }
  50. public static IEnumerable<HouseType> GetTypes()
  51. {
  52. return Types;
  53. }
  54. public static string GetBasePlayer(string player)
  55. {
  56. return (USSR.Equals(player) || Ukraine.Equals(player) || Bad.Equals(player)) ? Good.Name : Bad.Name;
  57. }
  58. }
  59. }