Пример #1
0
        public string GetName(DatabaseObjectKind kind, int id)
        {
            Contract.Requires <ArgumentOutOfRangeException>(kind != DatabaseObjectKind.None);

            // #NOTE place new DatabaseObjectKind code here

            switch (kind)
            {
            case DatabaseObjectKind.Ability:        return(Abilities.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Civ:            return(Civs.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.DamageType:     return(DamageTypes.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.ImpactEffect: return(ImpactEffects.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Leader:         return(Leaders.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Object:         return(Objects.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.ObjectType:     return(ObjectTypes.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Power:          return(Powers.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Squad:          return(Squads.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Tactic:         return(Tactics.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Tech:           return(Techs.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.TerrainTileType: return(TerrainTileTypes.TryGetNameWithUndefined(id));

            // TODO: Should just use the Objects DBI AFAICT
            case DatabaseObjectKind.Unit:           return(TryGetNameUnit(id));

            case DatabaseObjectKind.UserClass:      return(UserClasses.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.WeaponType:     return(WeaponTypes.TryGetNameWithUndefined(id));

            default: throw new KSoft.Debug.UnreachableException(kind.ToString());
            }
        }