示例#1
0
        private void LoadEncounterLayers(string name)
        {
            foreach (string file in Directory.GetFiles($"{ModDirectory}/overrides/encounterLayers/{name.ToLower()}", "*.json", SearchOption.AllDirectories))
            {
                Main.LogDebug($"[DataManager.LoadCustomContractTypes] Loading '{file}' custom encounter layer");
                string         encounterLayer     = File.ReadAllText(file);
                EncounterLayer encounterLayerData = JsonConvert.DeserializeObject <EncounterLayer>(encounterLayer);

                MetadataDatabase.Instance.InsertOrUpdateEncounterLayer(encounterLayerData);
            }
        }
 public static EncounterLayer_MDD InsertOrUpdateEncounterLayer(this MetadataDatabase mdd, EncounterLayer encounterLayer)
 {
     mdd.Execute("INSERT OR REPLACE INTO EncounterLayer (EncounterLayerID, MapID, Name, FriendlyName, Description, BattleValue, ContractTypeID, EncounterLayerGUID, TagSetID, IncludeInBuild) values(@EncounterLayerID, @MapID, @Name, @FriendlyName, @Description, @BattleValue, @ContractTypeID, @EncounterLayerGUID, @TagSetID, @IncludeInBuild)", new {
         EncounterLayerID   = encounterLayer.EncounterLayerId,
         MapID              = encounterLayer.MapId,
         Name               = encounterLayer.Name,
         FriendlyName       = encounterLayer.FriendlyName,
         Description        = encounterLayer.Description,
         BattleValue        = encounterLayer.BattleValue,
         ContractTypeID     = encounterLayer.ContractTypeId,
         EncounterLayerGUID = encounterLayer.EncounterLayerGuid,
         TagSetID           = encounterLayer.TagSetId,
         IncludeInBuild     = encounterLayer.IncludeInBuild
     }, null, null, null);
     return(mdd.SelectEncounterLayerByID(encounterLayer.EncounterLayerId));
 }