CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

UnitTypes.cs (5729B)


      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.Drawing;
     18 using System.Linq;
     19 using System.Reflection;
     20 
     21 namespace MobiusEditor.RedAlert
     22 {
     23     public static class UnitTypes
     24     {
     25         public static readonly UnitType HTank = new UnitType(0, "4tnk", "TEXT_UNIT_RA_4TNK", "USSR", true);
     26         public static readonly UnitType MTank = new UnitType(1, "3tnk", "TEXT_UNIT_RA_3TNK", "USSR", true);
     27         public static readonly UnitType MTank2 = new UnitType(2, "2tnk", "TEXT_UNIT_RA_2TNK", "Greece", true);
     28         public static readonly UnitType LTank = new UnitType(3, "1tnk", "TEXT_UNIT_RA_1TNK", "Greece", true);
     29         public static readonly UnitType APC = new UnitType(4, "apc", "TEXT_UNIT_RA_APC", "Greece");
     30         public static readonly UnitType MineLayer = new UnitType(5, "mnly", "TEXT_UNIT_RA_MNLY", "Greece");
     31         public static readonly UnitType Jeep = new UnitType(6, "jeep", "TEXT_UNIT_RA_JEEP", "Greece", true);
     32         public static readonly UnitType Harvester = new UnitType(7, "harv", "TEXT_UNIT_RA_HARV", "Greece");
     33         public static readonly UnitType Arty = new UnitType(8, "arty", "TEXT_UNIT_RA_ARTY", "Greece");
     34         public static readonly UnitType MRJammer = new UnitType(9, "mrj", "TEXT_UNIT_RA_MRJ", "Greece");
     35         public static readonly UnitType MGG = new UnitType(10, "mgg", "TEXT_UNIT_RA_MGG", "Greece");
     36         public static readonly UnitType MCV = new UnitType(11, "mcv", "TEXT_UNIT_RA_MCV", "Greece");
     37         public static readonly UnitType V2Launcher = new UnitType(12, "v2rl", "TEXT_UNIT_RA_V2RL", "USSR");
     38         public static readonly UnitType ConvoyTruck = new UnitType(13, "truk", "TEXT_UNIT_RA_TRUK", "Greece");
     39         public static readonly UnitType Ant1 = new UnitType(14, "ant1", "TEXT_UNIT_RA_ANT1", "Special");
     40         public static readonly UnitType Ant2 = new UnitType(15, "ant2", "TEXT_UNIT_RA_ANT2", "Special");
     41         public static readonly UnitType Ant3 = new UnitType(16, "ant3", "TEXT_UNIT_RA_ANT3", "Special");
     42         public static readonly UnitType Chrono = new UnitType(17, "ctnk", "TEXT_UNIT_RA_CTNK", "Greece");
     43         public static readonly UnitType Tesla = new UnitType(18, "ttnk", "TEXT_UNIT_RA_TTNK", "USSR");
     44         public static readonly UnitType MAD = new UnitType(19, "qtnk", "TEXT_UNIT_RA_QTNK", "Greece");
     45         public static readonly UnitType DemoTruck = new UnitType(20, "dtrk", "TEXT_UNIT_RA_DTRK", "USSR");
     46         public static readonly UnitType Phase = new UnitType(21, "stnk", "TEXT_UNIT_RA_STNK", "Greece", true);
     47 
     48         public static readonly UnitType Tran = new UnitType(0 | UnitTypeIDMask.Aircraft, "tran", "TEXT_UNIT_RA_TRAN", "USSR");
     49         public static readonly UnitType Badr = new UnitType(1 | UnitTypeIDMask.Aircraft, "badr", "TEXT_UNIT_RA_BADR", "USSR", false, true);
     50         public static readonly UnitType U2 = new UnitType(2 | UnitTypeIDMask.Aircraft, "u2", "TEXT_UNIT_RA_U2", "USSR", false, true);
     51         public static readonly UnitType Mig = new UnitType(3 | UnitTypeIDMask.Aircraft, "mig", "TEXT_UNIT_RA_MIG", "USSR", false, true);
     52         public static readonly UnitType Yak = new UnitType(4 | UnitTypeIDMask.Aircraft, "yak", "TEXT_UNIT_RA_YAK", "USSR", false, true);
     53         public static readonly UnitType Heli = new UnitType(5 | UnitTypeIDMask.Aircraft, "heli", "TEXT_UNIT_RA_HELI", "Greece");
     54         public static readonly UnitType Hind = new UnitType(6 | UnitTypeIDMask.Aircraft, "hind", "TEXT_UNIT_RA_HIND", "USSR");
     55 
     56         public static readonly UnitType Submarine = new UnitType(0 | UnitTypeIDMask.Vessel, "ss", "TEXT_UNIT_RA_SS", "USSR");
     57         public static readonly UnitType Destroyer = new UnitType(1 | UnitTypeIDMask.Vessel, "dd", "TEXT_UNIT_RA_DD", "Greece", true);
     58         public static readonly UnitType Cruiser = new UnitType(2 | UnitTypeIDMask.Vessel, "ca", "TEXT_UNIT_RA_CA", "Greece", true);
     59         public static readonly UnitType Transport = new UnitType(3 | UnitTypeIDMask.Vessel, "lst", "TEXT_UNIT_RA_LST", "Greece");
     60         public static readonly UnitType PTBoat = new UnitType(4 | UnitTypeIDMask.Vessel, "pt", "TEXT_UNIT_RA_PT", "Greece", true);
     61         public static readonly UnitType MissileSubmarine = new UnitType(5 | UnitTypeIDMask.Vessel, "msub", "TEXT_UNIT_RA_MSUB", "USSR");
     62         public static readonly UnitType Carrier = new UnitType(6 | UnitTypeIDMask.Vessel, "carr", "TEXT_UNIT_RA_CARR", "Greece");
     63 
     64         private static readonly UnitType[] Types;
     65 
     66         static UnitTypes()
     67         {
     68             Types =
     69                 (from field in typeof(UnitTypes).GetFields(BindingFlags.Static | BindingFlags.Public)
     70                  where field.IsInitOnly && typeof(UnitType).IsAssignableFrom(field.FieldType)
     71                  select field.GetValue(null) as UnitType).ToArray();
     72         }
     73 
     74         public static IEnumerable<UnitType> GetTypes()
     75         {
     76             return Types;
     77         }
     78     }
     79 }