/// <summary> /// Creates new valuator with values loaded from database /// </summary> public TraitValuator(FormGrangerMain mainForm, string valueMapId, GrangerContext context) { this.mainForm = mainForm; this.context = context; ValueMapId = valueMapId; if (valueMapId == DefaultId) { usingDefault = true; } else { RebuildValues(); context.OnTraitValuesModified += context_OnTraitValuesModified; } }
public BreedingAdvisor( [NotNull] FormGrangerMain mainForm, [NotNull] string advisorId, [NotNull] GrangerContext context, [NotNull] ILogger logger, [NotNull] DefaultBreedingEvaluatorOptions defaultBreedingEvaluatorOptions) { if (mainForm == null) { throw new ArgumentNullException(nameof(mainForm)); } if (advisorId == null) { throw new ArgumentNullException(nameof(advisorId)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (defaultBreedingEvaluatorOptions == null) { throw new ArgumentNullException(nameof(defaultBreedingEvaluatorOptions)); } this.mainForm = mainForm; this.AdvisorId = advisorId; this.context = context; this.logger = logger; IsDisabled = false; if (advisorId == DisabledId) { breedEvalutator = new DisabledBreedingEvaluator(logger); IsDisabled = true; } if (advisorId == DefaultId) { breedEvalutator = new DefaultBreedingEvaluator(logger, defaultBreedingEvaluatorOptions); } }
internal bool ShowOptions(FormGrangerMain formGrangerMain) { if (breedEvalutator != null) { if (breedEvalutator.EditOptions(formGrangerMain)) { return(true); } else { return(false); } } else { logger.Error("BreedEvalutator was null on ShowOptions"); return(false); } }
public FormCreatureViewEdit( [NotNull] FormGrangerMain mainForm, [NotNull] GrangerContext context, [NotNull] ILogger logger, [NotNull] IWurmApi wurmApi, [CanBeNull] Creature creature, CreatureViewEditOpType optype, string herdId, [NotNull] CreatureColorDefinitions creatureColorDefinitions) { if (mainForm == null) { throw new ArgumentNullException(nameof(mainForm)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (wurmApi == null) { throw new ArgumentNullException(nameof(wurmApi)); } if (creatureColorDefinitions == null) { throw new ArgumentNullException(nameof(creatureColorDefinitions)); } this.mainForm = mainForm; this.creature = creature; this.context = context; this.herdId = herdId; this.creatureColorDefinitions = creatureColorDefinitions; this.logger = logger; this.wurmApi = wurmApi; InitializeComponent(); DisableAllFields(); comboBoxServerName.Items.AddRange( wurmApi.Servers.All.Select(server => server.ServerName.Original).Cast <object>().ToArray()); List <string> list = new List <string>(); list.AddRange(this.context.Creatures.Select(x => x.Name)); list.AddRange(this.context.Creatures.Select(x => x.MotherName)); list.AddRange(this.context.Creatures.Select(x => x.FatherName)); var allCreatureNamesInDatabase = list.Distinct().Where(x => x != null).Cast <object>().ToArray(); comboBoxFather.Items.AddRange(allCreatureNamesInDatabase); comboBoxMother.Items.AddRange(allCreatureNamesInDatabase); ; comboBoxColor.Items.AddRange( creatureColorDefinitions.GetColors().Select(color => color.CreatureColorId).Cast <object>().ToArray()); comboBoxColor.Text = CreatureColor.GetDefaultColor().CreatureColorId; comboBoxAge.Items.AddRange(CreatureAge.GetColorsEnumStrArray().Cast <object>().ToArray()); comboBoxAge.Text = CreatureAge.GetDefaultAgeStr(); this.OpMode = optype; }
public override bool EditOptions(FormGrangerMain formGrangerMain) { BreedingEvaluatorDefaultConfig ui = new BreedingEvaluatorDefaultConfig(options, logger); return(ui.ShowDialogCenteredOnForm(formGrangerMain) == DialogResult.OK); }
/// <summary> /// Shows dialog window with evaluator options. /// </summary> /// <param name="formGrangerMain"></param> /// <returns></returns> public abstract bool EditOptions(FormGrangerMain formGrangerMain);
public override bool EditOptions(FormGrangerMain formGrangerMain) { MessageBox.Show("No advisor selected"); return(false); }