Exemple #1
0
        /// <summary>
        /// Applied to CodexCache to collect dynamic codex entries from the file system.
        /// </summary>
        private static void CollectEntries_Postfix(string folder, List <CodexEntry> __result,
                                                   string ___baseEntryPath)
        {
            // Check to see if we are loading from either the "Creatures" directory or
            // "Plants" directory
            string path = string.IsNullOrEmpty(folder) ? ___baseEntryPath : Path.Combine(
                ___baseEntryPath, folder);
            bool modified = false;

            if (path.EndsWith("Creatures"))
            {
                __result.AddRange(PCodex.LoadCreaturesEntries());
                modified = true;
            }
            if (path.EndsWith("Plants"))
            {
                __result.AddRange(PCodex.LoadPlantsEntries());
                modified = true;
            }
            if (modified)
            {
                foreach (var codexEntry in __result)
                {
                    // Fill in a default sort string if necessary
                    if (string.IsNullOrEmpty(codexEntry.sortString))
                    {
                        codexEntry.sortString = Strings.Get(codexEntry.title);
                    }
                }
                __result.Sort((x, y) => x.sortString.CompareTo(y.sortString));
            }
        }
Exemple #2
0
        /// <summary>
        /// Applied to CodexCache to collect dynamic codex sub entries from the file system.
        /// </summary>
        private static void CollectSubEntries_Postfix(List <SubEntry> __result)
        {
            int startSize = __result.Count;

            __result.AddRange(PCodex.LoadCreaturesSubEntries());
            __result.AddRange(PCodex.LoadPlantsSubEntries());
            if (__result.Count != startSize)
            {
                __result.Sort((x, y) => x.title.CompareTo(y.title));
            }
        }
 public static void OnLoad()
 {
     PUtil.InitLibrary();
     PCodex.RegisterCreatures();
 }