示例#1
0
        public override void Entry(IModHelper helper)
        {
            Instance = this;
            helper.Events.Display.RenderedHud += Display_RenderedHud;
            helper.Events.GameLoop.SaveLoaded += GameLoop_SaveLoaded;

            try
            {
                config = this.Helper.Data.ReadJsonFile <ModConfig>("config.json") ?? ModConfigDefaultConfig.CreateDefaultConfig("config.json");
                config = ModConfigDefaultConfig.UpdateConfigToLatest(config, "config.json");
            }
            catch  //Really the only time this is going to error is when going from old version to new version of the config file or there is a bad config file
            {
                config = ModConfigDefaultConfig.UpdateConfigToLatest(config, "config.json") ?? ModConfigDefaultConfig.CreateDefaultConfig("config.json");
            }
        }
示例#2
0
        public override void Entry(IModHelper helper)
        {
            Instance = this;
            helper.Events.Display.RenderedHud += Display_RenderedHud;

            try
            {
                config = this.Helper.Data.ReadJsonFile <ModConfig>("config.json") ?? ModConfigDefaultConfig.CreateDefaultConfig("config.json");
                config = ModConfigDefaultConfig.UpdateConfigToLatest(config, "config.json");
            }
            catch  //Really the only time this is going to error is when going from old version to new version of the config file or there is a bad config file
            {
                config = ModConfigDefaultConfig.UpdateConfigToLatest(config, "config.json") ?? ModConfigDefaultConfig.CreateDefaultConfig("config.json");
            }

            if (!helper.Translation.GetTranslations().Any())
            {
                this.Monitor.Log("The translation files in this mod's i18n folder seem to be missing. The mod will still work, but you'll see 'missing translation' messages. Try reinstalling the mod to fix this.", LogLevel.Warn);
            }

            ConfigStaticTranslationStrings();
        }