public void FillFormulaTemplate(ViewModels.RateSettings rateSettings) { FormulaTemplate = (string)Formula.Clone(); SetValueToTemplateFormula("Ур", rateSettings.Damage, rateSettings.Parameters.Damage); SetValueToTemplateFormula("Л", rateSettings.Heal, rateSettings.Parameters.Heal); SetValueToTemplateFormula("ОВ", rateSettings.Time, rateSettings.Parameters.Time); SetValueToTemplateFormula("П", rateSettings.Death, rateSettings.Parameters.Death); SetValueToTemplateFormula("М", rateSettings.Minutes, rateSettings.Parameters.Minutes); SetValueToTemplateFormula("С", rateSettings.Seconds, rateSettings.Parameters.Seconds); FormulaTemplate = FormulaTemplate.Replace("Коэфф. времени", rateSettings.RateMinSec.ToString()); FormulaTemplate = FormulaTemplate.Replace("Общий коэфф.", rateSettings.CommonRate.ToString()); }
private void SetValueToTemplateFormula(string key, int coeff, int value) { FormulaTemplate = FormulaTemplate.Replace(key, $"{coeff} * {value}"); }