コード例 #1
0
    public static void ReadByteConfig()
    {
        StaticCnf.Clear();
        byte[]       bytes  = ResManager.instance.LoadByte(CnfConst.DATA_BYTE_NAME);
        MemoryStream ms     = new MemoryStream(bytes);
        BinaryReader br     = new BinaryReader(ms);
        int          length = 0;

        length = br.ReadInt32();
        Dictionary <int, BuffCnf> buffcnf = new Dictionary <int, BuffCnf>();

        for (int i = 0; i < length; i++)
        {
            BuffCnf tmp = new BuffCnf();
            tmp.ToByteRead(br);
            buffcnf.Add(tmp.id, tmp);
        }
        StaticCnf.Add(buffcnf);

        length = br.ReadInt32();
        Dictionary <int, BuffEffectCnf> buffeffectcnf = new Dictionary <int, BuffEffectCnf>();

        for (int i = 0; i < length; i++)
        {
            BuffEffectCnf tmp = new BuffEffectCnf();
            tmp.ToByteRead(br);
            buffeffectcnf.Add(tmp.id, tmp);
        }
        StaticCnf.Add(buffeffectcnf);

        length = br.ReadInt32();
        Dictionary <int, HeroInfoCnf> heroinfocnf = new Dictionary <int, HeroInfoCnf>();

        for (int i = 0; i < length; i++)
        {
            HeroInfoCnf tmp = new HeroInfoCnf();
            tmp.ToByteRead(br);
            heroinfocnf.Add(tmp.id, tmp);
        }
        StaticCnf.Add(heroinfocnf);

        length = br.ReadInt32();
        Dictionary <int, SpellInfoCnf> spellinfocnf = new Dictionary <int, SpellInfoCnf>();

        for (int i = 0; i < length; i++)
        {
            SpellInfoCnf tmp = new SpellInfoCnf();
            tmp.ToByteRead(br);
            spellinfocnf.Add(tmp.id, tmp);
        }
        StaticCnf.Add(spellinfocnf);
        ms.Flush();
        ms.Close();
        br.Close();
        ms.Dispose();
    }