Пример #1
0
        public override void Load()
        {
            base.Load();

            NatureRequirePresets = new List<NatureRequirePreset>();
            DataView view = DataTable.AsDataView();

            // TODO thy ID排序不应造成变化,但row次序不同 why?
            // view.Sort = "ID";
            foreach(DataRowView rowView in view)
            {
                string category = rowView["Category"].ToString();
                int grade = int.Parse(rowView["Grade"].ToString());
                int index = grade -1;

                NatureList natureList = new NatureList();
                for(int i=1; i<=8; i++)
                {
                    ENature nature;
                    if (!Enum.TryParse<ENature>(rowView["Nature" + i].ToString(), out nature))
                        break;
                    natureList[i-1] = new NatureEnumWrap(nature);
                }

                NatureRequirePreset preset = GetNatureRequire(category);
                if(preset == null)
                {
                    preset = new NatureRequirePreset();
                    preset.Category = category;
                    NatureRequirePresets.Add(preset);
                }

                preset.Requirement.Add(natureList);
            }
        }
Пример #2
0
        private void onBtn_LoadGradePreset(object sender, RoutedEventArgs e)
        {
            NatureRequirePreset preset         = lstGradePresets.SelectedItem as NatureRequirePreset;
            DataRowView         warriorRowView = dgWarrior.SelectedItem as DataRowView;

            if (preset != null && warriorRowView != null)
            {
                warriorRowView["GradeCondition"] = preset.Requirement.ConvertToJson();
            }
        }
Пример #3
0
        public override void Load()
        {
            base.Load();

            NatureRequirePresets = new List <NatureRequirePreset>();
            DataView view = DataTable.AsDataView();

            // TODO thy ID排序不应造成变化,但row次序不同 why?
            // view.Sort = "ID";
            foreach (DataRowView rowView in view)
            {
                string category = rowView["Category"].ToString();
                int    grade    = int.Parse(rowView["Grade"].ToString());
                int    index    = grade - 1;

                NatureList natureList = new NatureList();
                for (int i = 1; i <= 8; i++)
                {
                    ENature nature;
                    if (!Enum.TryParse <ENature>(rowView["Nature" + i].ToString(), out nature))
                    {
                        break;
                    }
                    natureList[i - 1] = new NatureEnumWrap(nature);
                }

                NatureRequirePreset preset = GetNatureRequire(category);
                if (preset == null)
                {
                    preset          = new NatureRequirePreset();
                    preset.Category = category;
                    NatureRequirePresets.Add(preset);
                }

                preset.Requirement.Add(natureList);
            }
        }