Exemplo n.º 1
0
 private void testReadIput_Click(object sender, EventArgs e)
 {
     //-----------
     //打开窗口 ,选择所有符合条件的exccl
     //----------
     if (this.openFileDialog2.ShowDialog() == DialogResult.OK)
     {
         foreach (var item in this.openFileDialog2.FileNames)
         {
             using (GameDataTableParser parser = new GameDataTableParser(item))
             {
                 StringBuilder sb = new StringBuilder();
                 while (!parser.Eof)
                 {
                     for (int i = 0; i < parser.FileNames.Length; i++)
                     {
                         string appendStr = parser.GetFileValue(parser.FileNames[i]);
                         if (appendStr != null)
                         {
                             sb.Append(appendStr);
                         }
                     }
                     sb.Append("\r\n");
                     parser.Next();
                 }
                 testTextBox.Text += sb.ToString() + "\r\n";
             }
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 加载数据
        /// </summary>
        private void LoadData()
        {
            using (GameDataTableParser parse = new GameDataTableParser(string.Format(Application.streamingAssetsPath + "/AutoLanguage/{0}", FileName)))
            {
                while (!parse.Eof)
                {
                    MakeDic(parse);

                    parse.Next();
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 加载数据
 /// </summary>
 private void LoadData()
 {
     using (GameDataTableParser parser = new GameDataTableParser(String.Format(@"E:\unityProject\MMORPG\www\Data\{0}", FileName)))
     {
         while (!parser.Eof)
         {
             TP entity = MakeEntity(parser);
             ProductEntities.Add(entity);
             Dic[entity.Id] = entity;
             parser.Next();
         }
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 加载数据
 /// </summary>
 private void LoadData()
 {
     using (GameDataTableParser parse = new GameDataTableParser(string.Format(@"D:\GameData\{0}", FileName)))
     {
         while (!parse.Eof)
         {
             //创建实体
             P p = MakeEntity(parse);
             m_List.Add(p);
             m_Dic[p.Id] = p;
             parse.Next();
         }
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 加载数据
 /// </summary>
 private void LoadData()
 {
     using (GameDataTableParser parse = new GameDataTableParser(string.Format(Application.streamingAssetsPath + "/AutoCreate/{0}", FileName)))
     {
         while (!parse.Eof)
         {
             //创建实体
             P p = MakeEntity(parse);
             m_lst.Add(p);
             m_dic[p.ID] = p;
             parse.Next();
         }
     }
 }
Exemplo n.º 6
0
    protected abstract P MakeEntity(GameDataTableParser parse);  // 子类的数据类型,自由子类知道,基类不知道的

    #endregion


    #region 加载数据
    /// <summary>
    /// 加载数据
    /// </summary>
    private void LoadData()
    {
        //1.读取文件  路径问题/先写死
        using (GameDataTableParser parse = new GameDataTableParser(string.Format(@"E:\TestU3DProject\MMORPG\www\Data\{0}", FileName)))
        {
            while (!parse.Eof)
            {
                //创建实体
                P p = MakeEntity(parse);
                m_List.Add(p);
                m_Dic[p.Id] = p;
                parse.Next();//没循环之后,转下一个
            }
        }
    }
Exemplo n.º 7
0
 /// <summary>
 /// 加载数据
 /// </summary>
 private void LoadData()
 {
     using (GameDataTableParser parser = new GameDataTableParser("DataTable/" + FileName))
     {
         while (!parser.Eof)
         {
             E e = MakeEntity(parser);
             if (!m_Dic.ContainsKey(e.Id))
             {
                 m_List.Add(e);
                 m_Dic.Add(e.Id, e);
             }
             parser.Next();
         }
     }
 }
Exemplo n.º 8
0
    /// <summary>
    /// 加载数据
    /// </summary>
    private void LoadData()
    {
        string str = System.IO.Directory.GetCurrentDirectory() + "/../../Data/LocalData//{0}";

        using (GameDataTableParser parse = new GameDataTableParser(string.Format(str, FileName)))
        {
            while (!parse.Eof)
            {
                //创建实体
                P p = MakeEntity(parse);
                m_List.Add(p);
                m_Dic[p.Id] = p;
                parse.Next();
            }
        }
    }
Exemplo n.º 9
0
    /// <summary>
    /// 读取配置表数据
    /// </summary>
    private void LoadData()
    {
        //这里只是测试用这个路径,真正在手机平台需要热更新后放在沙盒路径下
        string path = string.Format(Application.streamingAssetsPath + "/Data/{0}", FileName);

        using (GameDataTableParser parser = new GameDataTableParser(path))
        {
            while (!parser.Eof)
            {
                //获取子类实体
                P p = MakeEntity(parser);
                m_Dic.Add(p.Id, p);
                m_list.Add(p);
                //进行下一行解析
                parser.Next();
            }
        }
    }
Exemplo n.º 10
0
    protected void Load()
    {
#if UNITY_EDITOR
        string path = string.Format(Application.dataPath + "/Download/{0}/BinaryData/{1}", ConstDefine.GAME_NAME, FileName);
#else
        string path = string.Format("{0}{1}{2}", LocalFileManager.Instance.LocalFilePath, "download/binarydata/", FileName);
#endif
        using (GameDataTableParser parse = new GameDataTableParser(path))
        {
            while (!parse.Eof)
            {
                P p = MakeEntity(parse);
                m_List.Add(p);
                m_Dic[p.id] = p;
                parse.Next();
            }
        }
    }
Exemplo n.º 11
0
    /// <summary>
    /// 加载数据
    /// </summary>
    private void LoadData()
    {
        //传入data路径,将表格放到streamingassets下,游戏安装后将复制到游戏外的路径,便于以后热更新
        using (GameDataTableParser parse = new GameDataTableParser(string.Format(@"D:\Backup\Documents\GitHub\MMORPG\www\Data\{0}", FileName)))
        {
            while (!parse.Eof)
            {
                //循环读取同时进行实例化

                //创建实体(子类创建后传入)
                P p = MakeEntity(parse);

                m_List.Add(p);
                m_Dic[p.Id] = p;

                parse.Next();
            }
        }
    }
Exemplo n.º 12
0
    /// <summary>
    /// 读取,在创建对象时就把数据读取出来
    /// </summary>
    private void LoadData()
    {
        //参考streamingAsset路径:file:///data/app/com.ichgame.ichsaga-1/base.apk!/assets/AssetBundles/download\DataTable\Chapter.data
        //参考persist路径:/storage/emulated/0/Android/data/com.ichgame.ichsaga/files/download\DataTable\Chapter.data
        GameDataTableParser parser;

#if SINGLE_MODE && UNITY_EDITOR
        //TODO,这里的路径在以后热更新时做修改,现在是临时路径暂时写死
        parser = new GameDataTableParser(@"H:\IchSagaGit\IchSaga\Assets\StreamingAssets\AssetBundles\download\DataTable\" + FileName);
#elif SINGLE_MODE && UNITY_ANDROID
        parser = new GameDataTableParser(Application.persistentDataPath + @"/download\DataTable\" + FileName);
#endif
        while (!parser.Eof)
        {
            //由子类创建实体,返回来,即可知道P是哪个子类的对象
            P p = MakeEntity(parser);
            mList.Add(p);
            mDic[p.Id] = p;
            parser.Next();
        }
    }