public static List <SimpleEncounterData> Parse(string path)
    {
        var res = new List <SimpleEncounterData>();

        using (BinaryReader b = new BinaryReader(File.Open(path, FileMode.Open)))
        {
            while (b.BaseStream.Position != b.BaseStream.Length)
            {
                var m = new SimpleEncounterData();
                for (int i = 0; i < 4; ++i)
                {
                    var codes = new short[8];
                    for (int j = 0; j < 8; ++j)
                    {
                        codes[j] = Convert.ToInt16(b.ReadByte());
                    }
                    m.ChoiceCodes[i] = codes;
                }
                ;

                for (int i = 0; i < 4; ++i)
                {
                    var args = new short[8];
                    for (int j = 0; j < 8; ++j)
                    {
                        args[j] = b.ReadInt16().SwapBytes();
                    }
                    m.ChoiceArgs[i] = args;
                }

                for (int i = 0; i < 4; ++i)
                {
                    m.ChoiceResultIndex[i] = Convert.ToInt16(b.ReadByte());
                }

                m.CanBackout = b.ReadByte();
                m.MaxTimes   = b.ReadByte();
                m.Unknown    = b.ReadInt16().SwapBytes();
                m.Prompt     = b.ReadInt16().SwapBytes();

                for (int i = 0; i < 4; ++i)
                {
                    m.OptionTexts[i] = RawText.Parse(b, 79).ToString();
                }

                res.Add(m);
            }
        }



        return(res);
    }
Beispiel #2
0
    public static void LoadScenario()
    {
        var path = Application.dataPath + "/Resources/Scenarios/City Of Bywater/";

        GameData.LevelData         = LevelData.Parse(path + "Data LD");
        GameData.ScenarioData      = ScenarioData.Parse(path + "City of Bywater");
        GameData.SolidSpecial      = Solid.Parse(path + "Data Solids");
        GameData.ActionPoints      = ActionPointData.Parse(path + "Data DD");
        GameData.ActionPointsExtra = ActionPointData.Parse(path + "Data ED3");
        GameData.Strings           = String.Parse(path + "Data SD2");
        GameData.SimpleEncounter   = SimpleEncounterData.Parse(path + "Data ED");
        GameData.ExtraCodes        = ExtraCode.Parse(path + "Data EDCD");
        GameData.LevelMetaData     = LevelMetaData.Parse(path + "Data RD");

        GameData.x     = GameData.ScenarioData.StartX;
        GameData.y     = GameData.ScenarioData.StartY;
        GameData.level = GameData.ScenarioData.StartLevel;
    }
 public SimpleEncounter(short id)
 {
     Data = GameData.SimpleEncounter[id];
 }
 public SimpleEncounter(SimpleEncounterData simpleEncounter)
 {
     Data = simpleEncounter;
 }