コード例 #1
0
        public void Awake()
        {
            if (Interlocked.Exchange(ref awoken, 1) == 1)
            {
                Logger.LogError("A second instance of RogueLibs was awakened, so it was terminated immediately.");
                return;
            }
            Logger.LogInfo($"Running RogueLibs v{RogueLibs.CompiledSemanticVersion}.");
            Stopwatch sw = new Stopwatch();

            sw.Start();

            RogueFramework.Plugin = this;
            RogueFramework.Logger = Logger;

            Patcher = new RoguePatcher(this);
#if DEBUG
            Patcher.EnableStopwatch = true;
#endif
            PatchAbilities();
            PatchCharacterCreation();
            PatchItems();
            PatchMisc();
            PatchScrollingMenu();
            PatchSprites();
            PatchTraitsAndStatusEffects();
            PatchUnlocks();
            PatchAgents();
#if DEBUG
            Patcher.SortResults();
            Patcher.LogResults();
#endif
            sw.Stop();
            Logger.LogDebug($"RogueLibs took {sw.ElapsedMilliseconds,5:#####} ms to load.");
        }
コード例 #2
0
        protected void MakePatches()
        {
            RoguePatcher patcher = new RoguePatcher(this, GetType());

            patcher.Postfix(typeof(ScrollingMenu), "MakeButtonsVisible");

            patcher.Postfix(typeof(NameDB), "GetName");
            patcher.Postfix(typeof(ScrollingMenu), "SortUnlocks");
            patcher.Postfix(typeof(ScrollingMenu), "PushedButton");

            patcher.Prefix(typeof(ObjectMult), "ShowChatCommand");

            patcher.Postfix(typeof(InvItem), "SetupDetails");
            patcher.Postfix(typeof(InvItem), "LoadItemSprite");
            patcher.Postfix(typeof(ItemFunctions), "UseItem");
            patcher.Postfix(typeof(ItemFunctions), "TargetObject");
            patcher.Postfix(typeof(ItemFunctions), "CombineItems");

            patcher.Postfix(typeof(GameResources), "SetupDics");
            patcher.Postfix(typeof(RandomSelection), "LoadRandomness");

            patcher.Postfix(typeof(InvSlot), "SetColor");

            patcher.Postfix(typeof(ObjectMultAgent), "convertIntToSpecialAbility");
            patcher.Postfix(typeof(ObjectMultAgent), "convertSpecialAbilityToInt");

            patcher.Postfix(typeof(StatusEffects), "SpecialAbilityInterfaceCheck2");
            patcher.Postfix(typeof(StatusEffects), "RechargeSpecialAbility2");
            patcher.Postfix(typeof(StatusEffects), "GiveSpecialAbility");
            patcher.Postfix(typeof(StatusEffects), "PressedSpecialAbility");
            patcher.Postfix(typeof(StatusEffects), "HeldSpecialAbility");
            patcher.Postfix(typeof(StatusEffects), "ReleasedSpecialAbility");

            patcher.Postfix(typeof(SpecialAbilityIndicator), "ShowIndicator", new Type[] { typeof(PlayfieldObject), typeof(string), typeof(string) });
        }