Example #1
0
 public void ChangeEntity(Entities.Word word)
 {
     DAL.Entity.Word w = wordHelper.GetWords().First(target => target.Id == word.Id);
     w.Text          = word.Text;
     w.LanguageId    = word.LanguageId;
     w.TranslationId = word.TranslationId;
     w.Priority      = word.Priority;
     w.Language      = languageHelper.GetLanguages().First(l => l.Id == word.LanguageId);
     w.Translation   = transHelper.GetTranslations().First(t => t.Id == word.TranslationId);
     wordHelper.ChangeEntity(w);
 }
Example #2
0
        // PUBLIC METHODS

        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            // get data frm config.json - try/catched to handle errors
            timeIn24Hours = true;
            try
            {
                this.Config = this.Helper.ReadConfig<ModConfig>();
                timeIn24Hours = this.Config.TimeIn24Hours;
            }
            catch (Exception e)
            {
                this.Monitor.Log($"There was an error with parsing config.json. 24 hour time will be used for fish info, by default.", LogLevel.Error);
            }

            // set up helper for translations
            i18n = helper.Translation;
            if (!i18n.GetTranslations().Any())
            {
                this.Monitor.Log($"There was an error in locating translation files. Please try re-installing this mod to fix this.", LogLevel.Error);
            }

            // load mod
            helper.Events.GameLoop.GameLaunched += this.OnGameLaunched;

        } // end Entry method
        private OptionsDropDown CreateTranslatedDropDown(string prefix, int xOffset, int yOffset, bool setLabel)
        {
            string          label        = setLabel ? _translation.Get(prefix) : string.Empty;
            int             prefixLength = prefix.Length + 1;
            OptionsDropDown dropDown     = new OptionsDropDown(label, 0, _fixedContentBounds.X + LabelWidth + xOffset, _fixedContentBounds.Y + yOffset);

            foreach (Translation translation in _translation.GetTranslations())
            {
                if (translation.Key.StartsWith(prefix + '.'))
                {
                    dropDown.dropDownOptions.Add(translation.Key[prefixLength..]);