コード例 #1
0
        private void TypeBinder(string prefix)
        {
            var categoryField = GetType()
                                .GetFields(BindingFlags.NonPublic | BindingFlags.Instance)
                                .First(x => x.Name == $@"{prefix}Catagory");

            var bonusField = GetType()
                             .GetFields(BindingFlags.NonPublic | BindingFlags.Instance)
                             .First(x => x.Name == $@"_{prefix}Type");

            var category = categoryField.GetValue(this) as ComboBox;
            var type     = bonusField.GetValue(this) as ComboBox;

            if (type == null || category == null)
            {
                return;
            }

            switch (category.SelectedIndex)
            {
            case 0:
                ComboboxService.BindBonusAll(type);
                break;

            case 1:
                ComboboxService.BindBonusStats(type);
                break;

            case 2:
                ComboboxService.BindBonusStatCap(type);
                break;

            case 3:
                ComboboxService.BindBonusResists(type);
                break;

            case 4:
                ComboboxService.BindBonusResistCap(type);
                break;

            case 5:
                ComboboxService.BindBonusSkills(type);
                break;

            case 6:
                ComboboxService.BindBonusFocus(type);
                break;

            case 7:
                ComboboxService.BindBonusToa(type);
                break;

            case 8:
                ComboboxService.BindBonusOther(type);
                break;

            case 9:
                ComboboxService.BindBonusMythical(type);
                break;
            }
        }