TheaterType.cs (1969B)
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 System; 16 using System.Collections.Generic; 17 18 namespace MobiusEditor.Model 19 { 20 public class TheaterType 21 { 22 public sbyte ID { get; private set; } 23 24 public string Name { get; private set; } 25 26 public IEnumerable<string> Tilesets { get; private set; } 27 28 public TheaterType(sbyte id, string name, IEnumerable<string> tilesets) 29 { 30 ID = id; 31 Name = name; 32 Tilesets = tilesets; 33 } 34 35 public override bool Equals(object obj) 36 { 37 if (obj is TheaterType) 38 { 39 return this == obj; 40 } 41 else if (obj is sbyte) 42 { 43 return ID == (sbyte)obj; 44 } 45 else if (obj is string) 46 { 47 return string.Equals(Name, obj as string, StringComparison.OrdinalIgnoreCase); 48 } 49 50 return base.Equals(obj); 51 } 52 53 public override int GetHashCode() 54 { 55 return ID.GetHashCode(); 56 } 57 58 public override string ToString() 59 { 60 return Name; 61 } 62 } 63 }