示例#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();
    }
示例#2
0
    public static void ReadLocalConfig()
    {
        StaticCnf.Clear();
        int length = 0;
        Dictionary <string, BaseCsvInfo> csv_infos = CnfHelper.LoadFileContent();
        BaseCsvInfo info = null;

        info = csv_infos["BuffCnf"];
        Dictionary <int, BuffCnf> buffcnf = new Dictionary <int, BuffCnf>();

        length = info._datas.Count;
        for (int i = 0; i < length; i++)
        {
            BuffCnf tmp = new BuffCnf();
            tmp.ToLocalRead(info._datas[i]);
            buffcnf.Add(tmp.id, tmp);
        }
        StaticCnf.Add(buffcnf);

        info = csv_infos["BuffEffectCnf"];
        Dictionary <int, BuffEffectCnf> buffeffectcnf = new Dictionary <int, BuffEffectCnf>();

        length = info._datas.Count;
        for (int i = 0; i < length; i++)
        {
            BuffEffectCnf tmp = new BuffEffectCnf();
            tmp.ToLocalRead(info._datas[i]);
            buffeffectcnf.Add(tmp.id, tmp);
        }
        StaticCnf.Add(buffeffectcnf);

        info = csv_infos["HeroInfoCnf"];
        Dictionary <int, HeroInfoCnf> heroinfocnf = new Dictionary <int, HeroInfoCnf>();

        length = info._datas.Count;
        for (int i = 0; i < length; i++)
        {
            HeroInfoCnf tmp = new HeroInfoCnf();
            tmp.ToLocalRead(info._datas[i]);
            heroinfocnf.Add(tmp.id, tmp);
        }
        StaticCnf.Add(heroinfocnf);

        info = csv_infos["SpellInfoCnf"];
        Dictionary <int, SpellInfoCnf> spellinfocnf = new Dictionary <int, SpellInfoCnf>();

        length = info._datas.Count;
        for (int i = 0; i < length; i++)
        {
            SpellInfoCnf tmp = new SpellInfoCnf();
            tmp.ToLocalRead(info._datas[i]);
            spellinfocnf.Add(tmp.id, tmp);
        }
        StaticCnf.Add(spellinfocnf);
    }
示例#3
0
 public void ClickToByte(EButton button)
 {
     StaticCnf.Clear();
     ConfigManager.ReadLocalConfig();
     ConfigManager.WriteByteConfig();
 }