示例#1
0
        public static IList<Skill> Load(IList<string> charaDirPathes)
        {
            foreach (string dpath in charaDirPathes)
            {
                var fpath = Path.Combine(dpath, "SpecialTable");
                if (!File.Exists(fpath)) continue;

                try
                {
                    using (var reader = new StreamReader(fpath, Global.Encoding))
                    {
                        var sc = new Scanner(reader);
                        var skillList = new List<Skill>();

                        while (sc.HasNext() && sc.Current() != "End")
                        {
                            var skill = new Skill {
                                name = sc.Next(),
                                scopeType = ((ScopeType)sc.NextInt32()),
                                skillType = ((SkillType)sc.NextInt32()),
                                mpCost = sc.NextInt32(),
                                range = sc.NextInt32(),
                                area = sc.NextInt32(),
                                power = sc.NextInt32(),
                                attackDependency = ((AttackDependency)sc.NextInt32()),
                                defenseDependency = ((DefenseDependency)sc.NextInt32()),
                                attackType = ((AttackType)sc.NextInt32()),
                                soundName = sc.Next(),
                                sideSize = sc.NextInt32(),
                                imageCount = sc.NextInt32(),
                            };
                            skillList.Add(skill);
                        }

                        return skillList;
                    }
                } catch (Exception)
                {
                }
            }

            return null;
        }
示例#2
0
        public List<AreaData> Load(string filepath)
        {
            Contract.Requires(File.Exists(filepath), "filepath");

            var list = new List<AreaData>();
            using (var reader = new StreamReader(filepath, Global.Encoding))
            {
                var sc = new Scanner(reader,
                    c => c == ' ' || c == ' ' || c == '\t' || c == '\r',
                    c => c == '\n');
                int id = 0;
                while (sc.HasNext() && sc.Current() != "End")
                {
                    list.Add(new AreaData(++id) {
                        Name = sc.Next(),
                        AreaType = sc.NextInt32(),
                        DefaultIncome = sc.NextInt32(),
                        NumCity = sc.NextInt32(),
                        NumWall = sc.NextInt32(),
                        NumRoad = sc.NextInt32(),
                        NeutralPower = sc.NextInt32(),
                        DefautlWallRate = sc.NextInt32(),
                        FlagLocation = new Point(
                            sc.NextInt32(),
                            sc.NextInt32()),
                        Adjacent = new[] {
                            sc.NextInt32(),
                            sc.NextInt32(),
                            sc.NextInt32(),
                            sc.NextInt32(), // 4
                            sc.NextInt32(),
                            sc.NextInt32(),
                            sc.NextInt32(),
                            sc.NextInt32(), // 8
                        },
                        MusicFileName = sc.Next(),
                    });
                    Debug.Assert(sc.LastDelimiter == '\n'); // 念のために改行が存在するかチェック
                }
            } // end using
            return list;
        }
        private static IList<MagicData> Load(string gameDirPath)
        {
            var dataDir = Path.Combine(gameDirPath, "Data");
            var magicDataFile = Path.Combine(dataDir, "MagicTable");
            var soundNameFile = Path.Combine(dataDir, "SoundFileName");

            var magicList = new List<MagicData>();

            using (var magicReader = new StreamReader(magicDataFile, Global.Encoding))
            using (var soundReader = new StreamReader(soundNameFile, Global.Encoding))
            {
                var sc = new Scanner(magicReader);
                var soundScanner = new Scanner(soundReader);

                int count = 0;
                while(sc.HasNext() && soundScanner.HasNext() && soundScanner.Current() != "End")
                {
                    // シナリオに非依存な魔法のインデックスを利用して属性を分ける
                    var element = AttackTypes.Magic[count / 8];

                    magicList.Add(new MagicData(sc.Next(), (MagicType)sc.NextInt32(),
                        new[]{
                            new MagicCore((byte)sc.NextInt32(), (byte)sc.NextInt32(), (byte)sc.NextInt32(), (byte)sc.NextInt32()),
                            new MagicCore((byte)sc.NextInt32(), (byte)sc.NextInt32(), (byte)sc.NextInt32(), (byte)sc.NextInt32()),
                            new MagicCore((byte)sc.NextInt32(), (byte)sc.NextInt32(), (byte)sc.NextInt32(), (byte)sc.NextInt32())
                        },
                        sc.Next(), element, soundScanner.Next(), "Magic" + count + ".bmp"
                    ));

                    count++;
                }
            }
            return magicList;
        }