예제 #1
0
        public static void PreparePrefabDatabase()
        {
            var originPrefabFiles = PrefabDatabase.prefabFiles;

            if (originPrefabFiles.Count == 0)
            {
                PrefabDatabase.LoadPrefabDatabase(SNUtils.prefabDatabaseFilename);
            }
        }
예제 #2
0
        private static void EnsureDefaultDistributions()
        {
            if (!File.Exists(DefaultDistributions))
            {
                PrefabDatabase.LoadPrefabDatabase(SNUtils.prefabDatabaseFilename);
            }
            {
                SortedDictionary <string, List <BiomeData> > defaultDistributions = new SortedDictionary <string, List <BiomeData> >();
                LootDistributionData data = LootDistributionData.Load("Balance/EntityDistributions");
                foreach (KeyValuePair <string, SrcData> pair in data.srcDistribution)
                {
                    if (WorldEntityDatabase.TryGetInfo(pair.Key, out WorldEntityInfo info))
                    {
                        if (info.techType != TechType.None)
                        {
                            defaultDistributions[info.techType.AsString()] = pair.Value.distribution;
                        }
                    }
                }

                using (StreamWriter writer = new StreamWriter(DefaultDistributions))
                {
                    writer.Write(JsonConvert.SerializeObject(defaultDistributions, Formatting.Indented, new JsonConverter[] {
                        new StringEnumConverter()
                        {
#if SUBNAUTICA_STABLE
                            CamelCaseText = true,
#else
                            NamingStrategy = new CamelCaseNamingStrategy(),
#endif
                            AllowIntegerValues = true
                        },

                        new TechTypeConverter()
                    }));
                }
            }
        }