コード例 #1
0
        void update_view()
        {
            SkillList.Items.Clear();

            ListViewItem name_lvi = SkillList.Items.Add(fChallenge.Name + ": " + fChallenge.GetXP() + " XP");

            name_lvi.Group = SkillList.Groups[0];

            ListViewItem info_lvi = SkillList.Items.Add(fChallenge.Info);

            info_lvi.Group = SkillList.Groups[0];

            if (fChallenge.MapID != Guid.Empty)
            {
                Map m = Session.Project.FindTacticalMap(fChallenge.MapID);
                if (m != null)
                {
                    MapArea ma = m.FindArea(fChallenge.MapAreaID);
                    if (ma != null)
                    {
                        string str = "Location: " + m.Name;
                        if (ma != null)
                        {
                            str += " (" + ma.Name + ")";
                        }

                        ListViewItem lvi_loc = SkillList.Items.Add(str);
                        lvi_loc.Group = SkillList.Groups[0];
                    }
                }
            }

            foreach (SkillChallengeData scd in fChallenge.Skills)
            {
                string diff = scd.Difficulty.ToString().ToLower() + " DCs";
                if (scd.DCModifier != 0)
                {
                    if (scd.DCModifier > 0)
                    {
                        diff += " +" + scd.DCModifier;
                    }
                    else
                    {
                        diff += " " + scd.DCModifier;
                    }
                }

                string str = scd.SkillName + " (" + diff + ")";
                if (scd.Details != "")
                {
                    str += ": " + scd.Details;
                }

                ListViewItem lvi = SkillList.Items.Add(str);
                lvi.Tag = scd;

                switch (scd.Type)
                {
                case SkillType.Primary:
                    lvi.Group = SkillList.Groups[1];
                    break;

                case SkillType.Secondary:
                    lvi.Group = SkillList.Groups[2];
                    break;

                case SkillType.AutoFail:
                    lvi.Group = SkillList.Groups[3];
                    break;
                }

                if ((scd.Difficulty == Difficulty.Trivial) || (scd.Difficulty == Difficulty.Extreme))
                {
                    lvi.ForeColor = Color.Red;
                }
            }

            if (SkillList.Groups[1].Items.Count == 0)
            {
                ListViewItem lvi = SkillList.Items.Add("(none)");
                lvi.Group     = SkillList.Groups[1];
                lvi.ForeColor = SystemColors.GrayText;
            }

            if (SkillList.Groups[2].Items.Count == 0)
            {
                ListViewItem lvi = SkillList.Items.Add("(none)");
                lvi.Group     = SkillList.Groups[2];
                lvi.ForeColor = SystemColors.GrayText;
            }

            SkillList.Sort();
        }