Esempio n. 1
0
        public void LoadFile()
        {
            this.allFollowersAli = LoadData.LoadMissionFile("Txts/ALI.txt");
            this.allFollowersHrd = LoadData.LoadMissionFile("Txts/HRD.txt");
            DataTable  aliFollowerSkills = LoadData.LoadMissionFile("Txts/AliSkill.txt");
            DataTable  hrdFollowerSkills = LoadData.LoadMissionFile("Txts/HrdSkill.txt");
            DataRow    currentRow;
            List <int> abilityList = new List <int>();
            List <int> traitList   = new List <int>();

            // Ali
            this.listAli = new List <Follower>();
            foreach (DataRow row in this.allFollowersAli.Rows)
            {
                int quolaty;
                switch (row["初始品质"].ToString())
                {
                case "史诗": quolaty = 4; break;

                case "精良": quolaty = 3; break;

                case "优秀": quolaty = 2; break;

                default: quolaty = 2; break;
                }
                abilityList = new List <int>();
                currentRow  = aliFollowerSkills.Rows.OfType <DataRow>().First(x => x["ID"].ToString() == row["ID"].ToString());
                if (!string.IsNullOrEmpty(currentRow["应对ID"].ToString()))
                {
                    abilityList.Add(Convert.ToInt16(currentRow["应对ID"]));
                }
                traitList = new List <int>();
                if (!string.IsNullOrEmpty(currentRow["特长ID"].ToString()))
                {
                    traitList.Add(Convert.ToInt16(currentRow["特长ID"]));
                }

                this.listAli.Add(new Follower(row["ID"].ToString(), row["英文名字"].ToString(), quolaty, Convert.ToInt16(row["初始等级"]), 600, row["种族"].ToString(),
                                              Follower.GetClassByStr(row["职业"].ToString(), row["专精"].ToString()), string.Empty, 1, abilityList, traitList,
                                              row["英文名字"].ToString(), row["简体名字"].ToString(), row["繁体名字"].ToString()));
            }
            //Hrd
            this.listHrd = new List <Follower>();
            foreach (DataRow row in this.allFollowersHrd.Rows)
            {
                int quolaty;
                switch (row["初始品质"].ToString())
                {
                case "史诗": quolaty = 4; break;

                case "精良": quolaty = 3; break;

                case "优秀": quolaty = 2; break;

                default: quolaty = 2; break;
                }
                abilityList = new List <int>();
                currentRow  = hrdFollowerSkills.Rows.OfType <DataRow>().First(x => x["ID"].ToString() == row["ID"].ToString());
                if (!string.IsNullOrEmpty(currentRow["应对ID"].ToString()))
                {
                    abilityList.Add(Convert.ToInt16(currentRow["应对ID"]));
                }
                traitList = new List <int>();
                if (!string.IsNullOrEmpty(currentRow["特长ID"].ToString()))
                {
                    traitList.Add(Convert.ToInt16(currentRow["特长ID"]));
                }

                this.listHrd.Add(new Follower(row["ID"].ToString(), row["英文名字"].ToString(), quolaty, Convert.ToInt16(row["初始等级"]), 600, row["种族"].ToString(),
                                              Follower.GetClassByStr(row["职业"].ToString(), row["专精"].ToString()), string.Empty, 1, abilityList, traitList,
                                              row["英文名字"].ToString(), row["简体名字"].ToString(), row["繁体名字"].ToString()));
            }
            this.classComboBox.SelectedIndex = 0;
        }