Beispiel #1
0
 public void OnShown(object data)
 {
     if (this.fData == null)
     {
         this.fData = data as AdviceData;
     }
     this.update_list();
 }
        public void OnShown(object data)
        {
            if (fData == null)
            {
                fData = data as AdviceData;
            }

            update_list();
        }
Beispiel #3
0
        public void OnShown(object data)
        {
            if (fData == null)
            {
                fData = data as AdviceData;

                if (fData.TabulaRasa)
                {
                    InfoLbl.Text = "The following encounter templates are available. Select one to continue.";
                }
                else
                {
                    InfoLbl.Text = "The following encounter templates fit the creatures you have added to the encounter so far. Select one to continue.";
                }

                BinarySearchTree <string> bst = new BinarySearchTree <string>();
                foreach (Pair <EncounterTemplateGroup, EncounterTemplate> template in fData.Templates)
                {
                    bst.Add(template.First.Category);
                }

                List <string> cats = bst.SortedList;
                foreach (string cat in cats)
                {
                    TemplatesList.Groups.Add(cat, cat);
                }

                TemplatesList.Items.Clear();
                foreach (Pair <EncounterTemplateGroup, EncounterTemplate> template in fData.Templates)
                {
                    ListViewItem lvi = TemplatesList.Items.Add(template.First.Name + " (" + template.Second.Difficulty.ToString().ToLower() + ")");
                    lvi.Tag   = template.Second;
                    lvi.Group = TemplatesList.Groups[template.First.Category];
                }

                if (TemplatesList.Items.Count == 0)
                {
                    TemplatesList.ShowGroups = false;

                    ListViewItem lvi = TemplatesList.Items.Add("(no templates)");
                    lvi.ForeColor = SystemColors.GrayText;
                }
            }
        }
 public void OnShown(object data)
 {
     if (this.fData == null)
     {
         this.fData = data as AdviceData;
         if (!this.fData.TabulaRasa)
         {
             this.InfoLbl.Text = "The following encounter templates fit the creatures you have added to the encounter so far. Select one to continue.";
         }
         else
         {
             this.InfoLbl.Text = "The following encounter templates are available. Select one to continue.";
         }
         BinarySearchTree <string> binarySearchTree = new BinarySearchTree <string>();
         foreach (Pair <EncounterTemplateGroup, EncounterTemplate> template in this.fData.Templates)
         {
             binarySearchTree.Add(template.First.Category);
         }
         foreach (string sortedList in binarySearchTree.SortedList)
         {
             this.TemplatesList.Groups.Add(sortedList, sortedList);
         }
         this.TemplatesList.Items.Clear();
         foreach (Pair <EncounterTemplateGroup, EncounterTemplate> pair in this.fData.Templates)
         {
             ListViewItem second = this.TemplatesList.Items.Add(string.Concat(pair.First.Name, " (", pair.Second.Difficulty.ToString().ToLower(), ")"));
             second.Tag   = pair.Second;
             second.Group = this.TemplatesList.Groups[pair.First.Category];
         }
         if (this.TemplatesList.Items.Count == 0)
         {
             this.TemplatesList.ShowGroups = false;
             ListViewItem grayText = this.TemplatesList.Items.Add("(no templates)");
             grayText.ForeColor = SystemColors.GrayText;
         }
     }
 }