/// <summary>
        ///     Adds a new rule to the end of the list and selects it.
        /// </summary>
        private void AddRule()
        {
            HltbRule newRule = new HltbRule(GlobalStrings.AutoCatUserScore_NewRuleName, 0, 0,
                                            (TimeType)cmbTimeType.SelectedItem);

            ruleList.Add(newRule);
            lstRules.SelectedIndex = lstRules.Items.Count - 1;
        }
        /// <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;
            }

            HltbRule mainItem = ruleList[mainIndex];

            ruleList[mainIndex]  = ruleList[alterIndex];
            ruleList[alterIndex] = mainItem;
            if (selectMoved)
            {
                lstRules.SelectedIndex = alterIndex;
            }
        }
示例#3
0
        private bool CheckRule(HltbRule 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)));
        }