void CreateDatabase() { db = ScriptableObject.CreateInstance <dbCommodityDataObject>(); AssetDatabase.CreateAsset(db, DATABASE_PATH); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
void LoadDatabase() { db = (dbCommodityDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH, typeof(dbCommodityDataObject)); if (db == null) { CreateDatabase(); } }
void CreateDatabase() { db = ScriptableObject.CreateInstance<dbCommodityDataObject>(); AssetDatabase.CreateAsset(db, DATABASE_PATH); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
void LoadDatabase() { db = (dbCommodityDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH, typeof(dbCommodityDataObject)); if (db == null) CreateDatabase(); }
void LoadDatabases() { dbCannons = (dbCannonDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbCannonDataItems.asset", typeof(dbCannonDataObject)); dbCargo = (dbCargoModuleDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbCargoModuleDataItems.asset", typeof(dbCargoModuleDataObject)); dbCommodity = (dbCommodityDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbCommodityDataItems.asset", typeof(dbCommodityDataObject)); dbCommodityShop = (dbCommodityShopDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbCommodityShopDataItems.asset", typeof(dbCommodityShopDataObject)); dbCrew = (dbCrewDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbCrewDataItems.asset", typeof(dbCrewDataObject)); dbEngines = (dbEngineDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbEngineDataItems.asset", typeof(dbEngineDataObject)); dbFighterBays = (dbFighterBayDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbFighterBayDataItems.asset", typeof(dbFighterBayDataObject)); dbHulls = (dbHullDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbHullDataItems.asset", typeof(dbHullDataObject)); dbJumpgates = (dbJumpgateDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbJumpgateDataItems.asset", typeof(dbJumpgateDataObject)); dbMissileLaunchers = (dbMissileLauncherDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbMissileLauncherDataItems.asset", typeof(dbMissileLauncherDataObject)); //dbNPCs = (dbNPCDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbNPCDataItems.asset", typeof(dbNPCDataObject)); dbPlating = (dbPlatingDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbPlatingDataItems.asset", typeof(dbPlatingDataObject)); dbScanners = (dbScannerDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbScannerDataItems.asset", typeof(dbScannerDataObject)); dbSectors = (dbSectorDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbSectorDataItems.asset", typeof(dbSectorDataObject)); dbShields = (dbShieldDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbShieldDataItems.asset", typeof(dbShieldDataObject)); dbStations = (dbStationDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbStationDataItems.asset", typeof(dbStationDataObject)); if (dbCannons == null) { dbCannons = ScriptableObject.CreateInstance<dbCannonDataObject>(); AssetDatabase.CreateAsset(dbCannons, DATABASE_PATH + "dbCannonDataItems.asset"); } if (dbCargo == null) { dbCargo = ScriptableObject.CreateInstance<dbCargoModuleDataObject>(); AssetDatabase.CreateAsset(dbCargo, DATABASE_PATH + "dbCargoModuleDataItems.asset"); } if (dbCommodity == null) { dbCommodity = ScriptableObject.CreateInstance<dbCommodityDataObject>(); AssetDatabase.CreateAsset(dbCommodity, DATABASE_PATH + "dbCommodityDataItems.asset"); } if (dbCommodityShop == null) { dbCommodityShop = ScriptableObject.CreateInstance<dbCommodityShopDataObject>(); AssetDatabase.CreateAsset(dbCommodityShop, DATABASE_PATH + "dbCommodityShopDataItems.asset"); } if (dbCrew == null) { dbCrew = ScriptableObject.CreateInstance<dbCrewDataObject>(); AssetDatabase.CreateAsset(dbCrew, DATABASE_PATH + "dbCrewDataItems.asset"); } if (dbEngines == null) { dbEngines = ScriptableObject.CreateInstance<dbEngineDataObject>(); AssetDatabase.CreateAsset(dbEngines, DATABASE_PATH + "dbEngineDataItems.asset"); } if (dbFighterBays == null) { dbFighterBays = ScriptableObject.CreateInstance<dbFighterBayDataObject>(); AssetDatabase.CreateAsset(dbFighterBays, DATABASE_PATH + "dbFighterBayDataItems.asset"); } if (dbHulls == null) { dbHulls = ScriptableObject.CreateInstance<dbHullDataObject>(); AssetDatabase.CreateAsset(dbHulls, DATABASE_PATH + "dbHullDataItems.asset"); } if (dbJumpgates == null) { dbJumpgates = ScriptableObject.CreateInstance<dbJumpgateDataObject>(); AssetDatabase.CreateAsset(dbJumpgates, DATABASE_PATH + "dbJumpgateDataItems.asset"); } if (dbMissileLaunchers == null) { dbMissileLaunchers = ScriptableObject.CreateInstance<dbMissileLauncherDataObject>(); AssetDatabase.CreateAsset(dbMissileLaunchers, DATABASE_PATH + "dbMissileLauncherDataItems.asset"); } //if (dbNPCs == null) //{ // dbNPCs = ScriptableObject.CreateInstance<dbNPCDataObject>(); // AssetDatabase.CreateAsset(dbNPCs, DATABASE_PATH + "dbNPCDataItems.asset"); //} if (dbPlating == null) { dbPlating = ScriptableObject.CreateInstance<dbPlatingDataObject>(); AssetDatabase.CreateAsset(dbPlating, DATABASE_PATH + "dbPlatingDataItems.asset"); } if (dbScanners == null) { dbScanners = ScriptableObject.CreateInstance<dbScannerDataObject>(); AssetDatabase.CreateAsset(dbScanners, DATABASE_PATH + "dbScannerDataItems.asset"); } if (dbSectors == null) { dbSectors = ScriptableObject.CreateInstance<dbSectorDataObject>(); AssetDatabase.CreateAsset(dbSectors, DATABASE_PATH + "dbSectorDataItems.asset"); } if (dbShields == null) { dbShields = ScriptableObject.CreateInstance<dbShieldDataObject>(); AssetDatabase.CreateAsset(dbShields, DATABASE_PATH + "dbShieldDataItems.asset"); } if (dbStations == null) { dbStations = ScriptableObject.CreateInstance<dbStationDataObject>(); AssetDatabase.CreateAsset(dbStations, DATABASE_PATH + "dbStationDataItems.asset"); } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
void LoadDatabases() { dbCannons = (dbCannonDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbCannonDataItems.asset", typeof(dbCannonDataObject)); dbCargo = (dbCargoModuleDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbCargoModuleDataItems.asset", typeof(dbCargoModuleDataObject)); dbCommodity = (dbCommodityDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbCommodityDataItems.asset", typeof(dbCommodityDataObject)); dbCommodityShop = (dbCommodityShopDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbCommodityShopDataItems.asset", typeof(dbCommodityShopDataObject)); dbCrew = (dbCrewDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbCrewDataItems.asset", typeof(dbCrewDataObject)); dbEngines = (dbEngineDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbEngineDataItems.asset", typeof(dbEngineDataObject)); dbFighterBays = (dbFighterBayDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbFighterBayDataItems.asset", typeof(dbFighterBayDataObject)); dbHulls = (dbHullDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbHullDataItems.asset", typeof(dbHullDataObject)); dbJumpgates = (dbJumpgateDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbJumpgateDataItems.asset", typeof(dbJumpgateDataObject)); dbMissileLaunchers = (dbMissileLauncherDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbMissileLauncherDataItems.asset", typeof(dbMissileLauncherDataObject)); //dbNPCs = (dbNPCDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbNPCDataItems.asset", typeof(dbNPCDataObject)); dbPlating = (dbPlatingDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbPlatingDataItems.asset", typeof(dbPlatingDataObject)); dbScanners = (dbScannerDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbScannerDataItems.asset", typeof(dbScannerDataObject)); dbSectors = (dbSectorDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbSectorDataItems.asset", typeof(dbSectorDataObject)); dbShields = (dbShieldDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbShieldDataItems.asset", typeof(dbShieldDataObject)); dbStations = (dbStationDataObject)AssetDatabase.LoadAssetAtPath(DATABASE_PATH + "dbStationDataItems.asset", typeof(dbStationDataObject)); if (dbCannons == null) { dbCannons = ScriptableObject.CreateInstance <dbCannonDataObject>(); AssetDatabase.CreateAsset(dbCannons, DATABASE_PATH + "dbCannonDataItems.asset"); } if (dbCargo == null) { dbCargo = ScriptableObject.CreateInstance <dbCargoModuleDataObject>(); AssetDatabase.CreateAsset(dbCargo, DATABASE_PATH + "dbCargoModuleDataItems.asset"); } if (dbCommodity == null) { dbCommodity = ScriptableObject.CreateInstance <dbCommodityDataObject>(); AssetDatabase.CreateAsset(dbCommodity, DATABASE_PATH + "dbCommodityDataItems.asset"); } if (dbCommodityShop == null) { dbCommodityShop = ScriptableObject.CreateInstance <dbCommodityShopDataObject>(); AssetDatabase.CreateAsset(dbCommodityShop, DATABASE_PATH + "dbCommodityShopDataItems.asset"); } if (dbCrew == null) { dbCrew = ScriptableObject.CreateInstance <dbCrewDataObject>(); AssetDatabase.CreateAsset(dbCrew, DATABASE_PATH + "dbCrewDataItems.asset"); } if (dbEngines == null) { dbEngines = ScriptableObject.CreateInstance <dbEngineDataObject>(); AssetDatabase.CreateAsset(dbEngines, DATABASE_PATH + "dbEngineDataItems.asset"); } if (dbFighterBays == null) { dbFighterBays = ScriptableObject.CreateInstance <dbFighterBayDataObject>(); AssetDatabase.CreateAsset(dbFighterBays, DATABASE_PATH + "dbFighterBayDataItems.asset"); } if (dbHulls == null) { dbHulls = ScriptableObject.CreateInstance <dbHullDataObject>(); AssetDatabase.CreateAsset(dbHulls, DATABASE_PATH + "dbHullDataItems.asset"); } if (dbJumpgates == null) { dbJumpgates = ScriptableObject.CreateInstance <dbJumpgateDataObject>(); AssetDatabase.CreateAsset(dbJumpgates, DATABASE_PATH + "dbJumpgateDataItems.asset"); } if (dbMissileLaunchers == null) { dbMissileLaunchers = ScriptableObject.CreateInstance <dbMissileLauncherDataObject>(); AssetDatabase.CreateAsset(dbMissileLaunchers, DATABASE_PATH + "dbMissileLauncherDataItems.asset"); } //if (dbNPCs == null) //{ // dbNPCs = ScriptableObject.CreateInstance<dbNPCDataObject>(); // AssetDatabase.CreateAsset(dbNPCs, DATABASE_PATH + "dbNPCDataItems.asset"); //} if (dbPlating == null) { dbPlating = ScriptableObject.CreateInstance <dbPlatingDataObject>(); AssetDatabase.CreateAsset(dbPlating, DATABASE_PATH + "dbPlatingDataItems.asset"); } if (dbScanners == null) { dbScanners = ScriptableObject.CreateInstance <dbScannerDataObject>(); AssetDatabase.CreateAsset(dbScanners, DATABASE_PATH + "dbScannerDataItems.asset"); } if (dbSectors == null) { dbSectors = ScriptableObject.CreateInstance <dbSectorDataObject>(); AssetDatabase.CreateAsset(dbSectors, DATABASE_PATH + "dbSectorDataItems.asset"); } if (dbShields == null) { dbShields = ScriptableObject.CreateInstance <dbShieldDataObject>(); AssetDatabase.CreateAsset(dbShields, DATABASE_PATH + "dbShieldDataItems.asset"); } if (dbStations == null) { dbStations = ScriptableObject.CreateInstance <dbStationDataObject>(); AssetDatabase.CreateAsset(dbStations, DATABASE_PATH + "dbStationDataItems.asset"); } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
/// <summary> /// Loads data from the Resource store into the public lists. Only need to do this once (on new or load game) /// </summary> private void LoadMasterData() { dbCannonDataObject dbCannons = (dbCannonDataObject)Resources.Load(@"AssetDatabases/dbCannonDataItems"); cannonMasterList = dbCannons.database; dbCargoModuleDataObject dbCargo = (dbCargoModuleDataObject)Resources.Load(@"AssetDatabases/dbCargoModuleDataItems"); cargoHoldMasterList = dbCargo.database; dbCommodityDataObject dbCommodities = (dbCommodityDataObject)Resources.Load(@"AssetDatabases/dbCommodityDataItems"); commodityMasterList = dbCommodities.database; dbCommodityShopDataObject dbCommodityShops = (dbCommodityShopDataObject)Resources.Load(@"AssetDatabases/dbCommodityShopDataItems"); commodityShopMasterList = dbCommodityShops.database; dbCrewDataObject dbCrew = (dbCrewDataObject)Resources.Load(@"AssetDatabases/dbCrewDataItems"); crewMasterList = dbCrew.database; dbEngineDataObject dbEngines = (dbEngineDataObject)Resources.Load(@"AssetDatabases/dbEngineDataItems"); engineMasterList = dbEngines.database; dbFighterBayDataObject dbFighterBays = (dbFighterBayDataObject)Resources.Load(@"AssetDatabases/dbFighterBayDataItems"); figherBayMasterList = dbFighterBays.database; dbHullDataObject dbHulls = (dbHullDataObject)Resources.Load(@"AssetDatabases/dbHullDataItems"); hullMasterList = dbHulls.database; dbJumpgateDataObject dbJumpgates = (dbJumpgateDataObject)Resources.Load(@"AssetDatabases/dbJumpgateDataItems"); jumpgateMasterList = dbJumpgates.database; dbMissileLauncherDataObject dbMissileLaunchers = (dbMissileLauncherDataObject)Resources.Load(@"AssetDatabases/dbMissileLauncherDataItems"); missileLauncherMasterList = dbMissileLaunchers.database; dbMerchantNPCDataObject dbMerchants = (dbMerchantNPCDataObject)Resources.Load(@"AssetDatabases/dbMerchantDataItems"); merchantMasterList = dbMerchants.database; dbPlatingDataObject dbPlating = (dbPlatingDataObject)Resources.Load(@"AssetDatabases/dbPlatingDataItems"); platingMasterList = dbPlating.database; dbScannerDataObject dbScanners = (dbScannerDataObject)Resources.Load(@"AssetDatabases/dbScannerDataItems"); scannerMasterList = dbScanners.database; dbSectorDataObject dbSectors = (dbSectorDataObject)Resources.Load(@"AssetDatabases/dbSectorDataItems"); sectorMasterList = dbSectors.database; dbShieldDataObject dbShields = (dbShieldDataObject)Resources.Load(@"AssetDatabases/dbShieldDataItems"); shieldMasterList = dbShields.database; dbStationDataObject dbStations = (dbStationDataObject)Resources.Load(@"AssetDatabases/dbStationDataItems"); stationMasterList = dbStations.database; }