private RoR2.UI.LogBook.Entry[] On_LogbookBuildPickupEntries(On.RoR2.UI.LogBook.LogBookController.orig_BuildPickupEntries orig)
        {
            var retv = orig();

            Logger.LogDebug("Processing logbook models...");
            int replacedModels = 0;

            foreach (RoR2.UI.LogBook.Entry e in retv)
            {
                if (!(e.extraData is PickupIndex))
                {
                    continue;
                }
                if (e.modelPrefab == null)
                {
                    continue;
                }
                if (e.modelPrefab.transform.Find("cardfront"))
                {
                    e.modelPrefab = PickupCatalog.GetPickupDef((PickupIndex)e.extraData).displayPrefab;
                    replacedModels++;
                }
            }
            Logger.LogDebug("Modified " + replacedModels + " logbook models.");
            return(retv);
        }
Beispiel #2
0
        private RoR2.UI.LogBook.Entry[] On_LogbookBuildPickupEntries(On.RoR2.UI.LogBook.LogBookController.orig_BuildPickupEntries orig)
        {
            var retv     = orig();
            var bplsLeft = allInstances.ToList();

            foreach (var entry in retv)
            {
                if (!(entry.extraData is PickupIndex))
                {
                    continue;
                }
                CatalogBoilerplate matchedBpl = null;
                foreach (CatalogBoilerplate bpl in bplsLeft)
                {
                    if ((PickupIndex)entry.extraData == bpl.pickupIndex)
                    {
                        matchedBpl = bpl;
                        break;
                    }
                }
                if (matchedBpl != null)
                {
                    matchedBpl.logbookEntry = entry;
                    bplsLeft.Remove(matchedBpl);
                }
            }
            return(retv);
        }