コード例 #1
0
 /// <summary>
 /// Initializes the needed classes for the mod.
 /// </summary>
 private void InitializeClasses()
 {
     PackHelper    = new ContentPackHelper(this);
     Dresser       = new DresserHandler(this, Config);
     PlayerLoader  = new CharacterLoader(this, PackHelper, Dresser);
     MenuPatcher   = new SaveLoadMenuPatcher(this, PlayerLoader);
     HarmonyHelper = new HarmonyHelper(this);
 }
コード例 #2
0
        /// <summary>
        /// Glam Menu's Constructor.
        /// </summary>
        /// <param name="entry">Instance of <see cref="ModEntry"/></param>
        /// <param name="packHelper">Instance of <see cref="ContentPackHelper"/></param>
        /// <param name="dresser">Instance of <see cref="DresserHandler"/></param>
        /// <param name="playerLoader">Instance of <seealso cref="CharacterLoader"/></param>
        public GlamMenu(ModEntry entry, ModConfig config, ContentPackHelper packHelper, DresserHandler dresser, CharacterLoader playerLoader, PlayerChanger changer)
            : base((int)Utility.getTopLeftPositionForCenteringOnScreen(712, 712, 0, 0).X, (int)Utility.getTopLeftPositionForCenteringOnScreen(712, 712, 0, 0).Y - IClickableMenu.borderWidth, 712, 712, false)
        {
            Entry          = entry;
            Config         = config;
            PackHelper     = packHelper;
            Dresser        = dresser;
            PlayerLoader   = playerLoader;
            PlayerChanger  = changer;
            MenuComponents = new GlamMenuComponents(Entry, this, packHelper);

            CheckPlayerForHat();
            MenuComponents.SetUpMenuComponents();
        }
コード例 #3
0
        /// <summary>The mods entry point.</summary>>
        /// <param name="helper">SMAPI's mod helper</param>
        public override void Entry(IModHelper helper)
        {
            //Load the config
            Config = helper.ReadConfig <ModConfig>();

            //Initialize classes
            PackHelper   = new ContentPackHelper(this);
            Dresser      = new DresserHandler(this, Config);
            PlayerLoader = new CharacterLoader(this, PackHelper, Dresser);
            MenuPatcher  = new SaveLoadMenuPatcher(this, PlayerLoader);

            //Set up the events
            helper.Events.Input.ButtonPressed      += OnButtonPressed;
            helper.Events.GameLoop.GameLaunched    += OnGameLaunched;
            helper.Events.GameLoop.SaveLoaded      += OnSaveLoaded;
            helper.Events.GameLoop.ReturnedToTitle += OnReturnedToTitle;

            //Check if SpaceCore is Installed
            IsSpaceCoreInstalled = Helper.ModRegistry.IsLoaded("spacechase0.SpaceCore");
            Monitor.Log($"Space Core Installed: {IsSpaceCoreInstalled}", LogLevel.Trace);

            //Check if Customize Anywhere is installed
            IsCustomizeAnywhereInstalled = Helper.ModRegistry.IsLoaded("Cherry.CustomizeAnywhere");
            Monitor.Log($"Customize AnyWhere Installed: {IsCustomizeAnywhereInstalled}", LogLevel.Trace);

            //if it's installed then register the extended tilesheets
            if (IsSpaceCoreInstalled)
            {
                Monitor.Log("Reflecting into SpaceCore", LogLevel.Trace);
                SpaceCoreHackery();
            }

            //Initialized the LoadSaveMenu Patcher
            MenuPatcher.Init();

            //Conduct the Harmony Patch
            Harmony = HarmonyInstance.Create(this.ModManifest.UniqueID);
            CommenceHarmonyPatch();

            //Add the ContentLoader class to the AssetLoader List
            helper.Content.AssetLoaders.Add(new ContentLoader(this, PackHelper));
        }