예제 #1
0
파일: Unit.cs 프로젝트: Deliagwath/FRPGC
 public Unit(string name, string id, Weapon wid, Armour aid, Stat sid)
 {
     this.Name = name;
     this.ID = id;
     this.WeaponID = wid;
     this.ArmourID = aid;
     this.StatID = sid;
 }
예제 #2
0
        public void getStats(StreamReader reader)
        {
            string line, id, currentid = "";
            string[] splitted = null;
            Difficulty diff;
            Stat stat;

            while ((line = reader.ReadLine()) != null)
            {
                splitted = line.Trim().Split(',');

                switch (int.Parse(splitted[13]))
                {
                    case (1):
                        diff = Difficulty.Easy;
                        break;

                    case (2):
                        diff = Difficulty.Medium;
                        break;

                    case (3):
                        diff = Difficulty.Hard;
                        break;

                    case (4):
                        diff = Difficulty.ScottIsBeingADick;
                        break;

                    default:
                        this.logger.logBoth(String.Format("Difficulty cannot be parsed: {0}", int.Parse(splitted[13])));
                        continue;
                }

                id = splitted[0].Trim();
                this.logger.writeLog(String.Format("Parsing {0}", id));
                stat = new Stat(id, int.Parse(splitted[1]), int.Parse(splitted[2]), int.Parse(splitted[3]), int.Parse(splitted[4]), int.Parse(splitted[5]), int.Parse(splitted[6]),
                    int.Parse(splitted[7]), int.Parse(splitted[8]), int.Parse(splitted[9]), int.Parse(splitted[10]), int.Parse(splitted[11]), int.Parse(splitted[12]), diff);
                this.stats.Add(stat);

                if (!currentid.Equals(id))
                {
                    this.unitDifficultyAttacker.Add(id, new BindingList<Stat>() { stat });
                    this.unitDifficultyDefender.Add(id, new BindingList<Stat>() { stat });
                    currentid = id;
                }
                else
                {
                    this.unitDifficultyAttacker[id].Add(stat);
                    this.unitDifficultyDefender[id].Add(stat);
                }
            }
        }