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