示例#1
0
 /// <summary>
 /// Load skills from the DataArrays\Skills.txt folder and store them in _library
 /// </summary>
 public static void Load()
 {
     string file = System.IO.Directory.GetCurrentDirectory() + "\\DataArrays\\Skills.txt";
     FileStream strLib = File.Open(file, FileMode.Open);
     using (StreamReader read = new StreamReader(strLib, Encoding.UTF7))
     {
         while (read.Peek() >= 0)
         {
             Skill toAdd = new Skill(read.ReadLine());
             _library.Add(toAdd.Id, toAdd);
         }
     }
 }
 private static void AddSkillToDisplay(Skill sk, int strengthMod, int dexterityMod, int constitutionMod, int intelligenceMod, int wisdomMod, int charismaMod)
 {
     if (sk != null)
     {
         ListViewItem toAdd = null;
         switch (sk.Ability)
         {
             case 0:
                 toAdd = new ListViewItem(new string[] { String.Empty, sk.Name, strengthMod > 0 ? "+ " + strengthMod.ToString() : strengthMod.ToString() });
                 StyleListViewItem(toAdd);
                 strengthSkills.Items.Add(toAdd);
                 break;
             case 1:
                 toAdd = new ListViewItem(new string[] { String.Empty, sk.Name, dexterityMod > 0 ? "+ " + dexterityMod.ToString() : dexterityMod.ToString() });
                 StyleListViewItem(toAdd);
                 dexteritySkills.Items.Add(toAdd);
                 break;
             case 2:
                 toAdd = new ListViewItem(new string[] { String.Empty, sk.Name, constitutionMod > 0 ? "+ " + constitutionMod.ToString() : constitutionMod.ToString() });
                 StyleListViewItem(toAdd);
                 constitutionSkills.Items.Add(toAdd);
                 break;
             case 3:
                 toAdd = new ListViewItem(new string[] { String.Empty, sk.Name, intelligenceMod > 0 ? "+ " + intelligenceMod.ToString() : intelligenceMod.ToString() });
                 StyleListViewItem(toAdd);
                 intelligenceSkills.Items.Add(toAdd);
                 break;
             case 4:
                 toAdd = new ListViewItem(new string[] { String.Empty, sk.Name, wisdomMod > 0 ? "+ " + wisdomMod.ToString() : wisdomMod.ToString() });
                 StyleListViewItem(toAdd);
                 wisdomSkills.Items.Add(toAdd);
                 break;
             case 5:
                 toAdd = new ListViewItem(new string[] { String.Empty, sk.Name, charismaMod > 0 ? "+ " + charismaMod.ToString() : charismaMod.ToString() });
                 StyleListViewItem(toAdd);
                 charismaSkills.Items.Add(toAdd);
                 break;
         }
     }
 }