/// <summary> /// Adds a new rule to the end of the list and selects it. /// </summary> private void AddRule() { Hltb_Rule newRule = new Hltb_Rule(GlobalStrings.AutoCatUserScore_NewRuleName, 0, 0, (TimeType)cmbTimeType.SelectedItem); ruleList.Add(newRule); lstRules.SelectedIndex = lstRules.Items.Count - 1; }
public Hltb_Rule(Hltb_Rule other) { Name = other.Name; MinHours = other.MinHours; MaxHours = other.MaxHours; TimeType = other.TimeType; }
/// <summary> /// Moves the specified rule a certain number of spots up or down in the list. Does nothing if the spot would be off /// the list. /// </summary> /// <param name="mainIndex">Index of the rule to move.</param> /// <param name="offset">Number of spots to move the rule. Negative moves up, positive moves down.</param> /// <param name="selectMoved">If true, select the moved element afterwards</param> private void MoveItem(int mainIndex, int offset, bool selectMoved) { int alterIndex = mainIndex + offset; if (mainIndex < 0 || mainIndex >= lstRules.Items.Count || alterIndex < 0 || alterIndex >= lstRules.Items.Count) { return; } Hltb_Rule mainItem = ruleList[mainIndex]; ruleList[mainIndex] = ruleList[alterIndex]; ruleList[alterIndex] = mainItem; if (selectMoved) { lstRules.SelectedIndex = alterIndex; } }
private bool CheckRule(Hltb_Rule rule, float hltbMain, float hltbExtras, float hltbCompletionist) { float hours = 0.0f; if (rule.TimeType == TimeType.Main) { hours = hltbMain; } else if (rule.TimeType == TimeType.Extras) { hours = hltbExtras; } else if (rule.TimeType == TimeType.Completionist) { hours = hltbCompletionist; } if (hours == 0.0f) { return(false); } return(hours >= rule.MinHours && (hours <= rule.MaxHours || rule.MaxHours == 0.0f)); }
public Hltb_Rule( Hltb_Rule other ) { Name = other.Name; MinHours = other.MinHours; MaxHours = other.MaxHours; TimeType = other.TimeType; }
private bool CheckRule( Hltb_Rule rule, float hltbMain, float hltbExtras, float hltbCompletionist ) { float hours = 0.0f; if (rule.TimeType == TimeType.Main) hours = hltbMain; else if (rule.TimeType == TimeType.Extras) hours = hltbExtras; else if (rule.TimeType == TimeType.Completionist) hours = hltbCompletionist; if (hours == 0.0f) return false; return ( hours >= rule.MinHours && ( hours <= rule.MaxHours || rule.MaxHours ==0.0f ) ); }
/// <summary> /// Adds a new rule to the end of the list and selects it. /// </summary> private void AddRule() { Hltb_Rule newRule = new Hltb_Rule(GlobalStrings.AutoCatUserScore_NewRuleName, 0, 0, (TimeType)cmbTimeType.SelectedItem); ruleList.Add( newRule ); lstRules.SelectedIndex = lstRules.Items.Count - 1; }