Exemplo n.º 1
0
        static public void loadTerrainTileTypes()
        {
            if (mTerrainTileTypes != null)
            {
                return;
            }

            //load the XML file
            string fileName = CoreGlobals.getWorkPaths().mGameDataDirectory + @"\" + mTerrainTileTypeFileName;

            if (!File.Exists(fileName))
            {
                CoreGlobals.getErrorManager().OnSimpleWarning("Error loading terrain tile types.  Can't find " + fileName);
                return;
            }

            XmlSerializer s  = new XmlSerializer(typeof(TerrainTileTypes), new Type[] { typeof(TerrainTileType) });
            Stream        st = File.OpenRead(fileName);

            mTerrainTileTypes = (TerrainTileTypes)s.Deserialize(st);

            if (mTerrainTileTypes == null)
            {
                CoreGlobals.getErrorManager().OnSimpleWarning("No terrain tile types loaded check " + fileName);
            }
        }
Exemplo n.º 2
0
        // #NOTE place new DatabaseObjectKind code here

        void InitializeDatabaseInterfaces()
        {
            DamageTypes.SetupDatabaseInterface();
            ImpactEffects.SetupDatabaseInterface();
            WeaponTypes.SetupDatabaseInterface();
            UserClasses.SetupDatabaseInterface();
            Abilities.SetupDatabaseInterface();
            Objects.SetupDatabaseInterface();
            Squads.SetupDatabaseInterface();
            Tactics.SetupDatabaseInterface();
            Techs.SetupDatabaseInterface();
            TerrainTileTypes.SetupDatabaseInterface();
            Powers.SetupDatabaseInterface();
            Civs.SetupDatabaseInterface();
            Leaders.SetupDatabaseInterface();
        }
Exemplo n.º 3
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());
            }
        }