/// <summary>
        /// 从Csv中加载条件列表
        /// </summary>
        /// <returns></returns>
        public bool LoadCoditionTableFromCsv(string fullPatch)
        {
            //如果不存在这个文件
            if (!File.Exists(fullPatch))
            {
                Trace.Error("LoadCsvCoditionTable,文件不存在:" + fullPatch);
                return(false);
            }
            List <DataTable> tableList = new List <DataTable>();

            Dictionary <string, DataTable> ta = BuildSaveFormatTable(null);

            m_IDIDAllocator.ClearIDAllocator();
            isLoadingData = true;
            if (!LoadSaveFormatTableToCsv(ref ta, fullPatch))
            {
                isLoadingData = false;
                return(false);
            }
            tableList.AddRange(ta.Values);
            DataTable table = null;
            int       index = 0;

            foreach (KeyValuePair <string, DataTable> dt in mConditionSet)
            {
                table = tableList[index];
                DeleteTableEvent(dt.Value);
                dt.Value.Clear();
                //遍历所有的行
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    string nam = table.Rows[i][0].ToString();
                    //名字不一样,跳过
                    if (!nam.Equals(dt.Key))
                    {
                        break;
                    }

                    DataRow _row = dt.Value.NewRow();
                    for (int j = 0; j < dt.Value.Columns.Count; j++)
                    {
                        _row[j] = table.Rows[i][j + 1];
                    }
                    //将这行添加到这个table
                    dt.Value.Rows.Add(_row);
                }
                AddTableEvent(dt.Value);
                index++;
            }
            m_IDIDAllocator.CalculateUnUsedID();
            isLoadingData = false;
            return(true);
        }
Exemple #2
0
 private bool LoadSpellTableFromBin(string FullPatch)
 {
     m_IDIDAllocator.ClearIDAllocator();
     //技能配置
     if (!DataTableSerializer.LoadBinToTable(ref gSpell_All_DataList, FullPatch, WrapperReflection.gAssembly.GetType("SPELL.SPELL_DATA")))
     {
         return(false);
     }
     if (gSpell_All_DataList.Rows.Count > 0)
     {
         for (int i = 0; i < gSpell_All_DataList.Rows.Count; i++)
         {
             //取出最大的ID
             uint Id = Convert.ToUInt32(gSpell_All_DataList.Rows[i][0]);
             m_IDIDAllocator.PushUsedId(Id);
         }
     }
     m_IDIDAllocator.CalculateUnUsedID();
     return(true);
 }