コード例 #1
0
        public static BattleTest GetInstance(int id)
        {
            BattleTest ret = null;

            if (!gdsDic.TryGetValue(id, out ret))
            {
                Logger.LogError("BattleTest 未找到,id:" + id);
            }
            return(ret);
        }
コード例 #2
0
        public static void Parse(string content)
        {
            Clear();
            int headEndIndex = GDSParseUtils.GetCharIndex(content, GDSParseUtils.ObjectSeparator, GDSParseUtils.DataBeginLineIndex);

            if (headEndIndex < 0)
            {
                Logger.LogError("数据文件头缺少结束符'\'n");
                return;
            }
            int curIndex = headEndIndex + 1;

            if (content.Length <= curIndex)
            {
                Logger.LogWarning("数据内容为空,请注意");
                return;
            }
            GDSParseUtils.ParseLine(delegate() {
                BattleTest data = new BattleTest();
                data.id         = GDSParseUtils.ParseInt(content, ref curIndex);
                GDSParseUtils.MoveNextVariable(content, ref curIndex);
                data.camp = GDSParseUtils.ParseInt(content, ref curIndex);
                GDSParseUtils.MoveNextVariable(content, ref curIndex);
                data.life = GDSParseUtils.ParseInt(content, ref curIndex);
                GDSParseUtils.MoveNextVariable(content, ref curIndex);
                data.speed = GDSParseUtils.ParseInt(content, ref curIndex);
                GDSParseUtils.MoveNextVariable(content, ref curIndex);
                data.attack = GDSParseUtils.ParseInt(content, ref curIndex);
                GDSParseUtils.MoveNextVariable(content, ref curIndex);
                data.attackRange = GDSParseUtils.ParseInt(content, ref curIndex);
                GDSParseUtils.MoveNextVariable(content, ref curIndex);
                data.borthPos = BorthPos.Parse(content, ref curIndex);
                GDSParseUtils.MoveNextVariable(content, ref curIndex);
                GDSParseUtils.ParseArray(delegate() {
                    data.skillList.Add(GDSParseUtils.ParseInt(content, ref curIndex));
                }, content, ref curIndex);
                gdsDic.Add(data.id, data);
            }, content, ref curIndex);
            OutPut();
        }