Esempio n. 1
0
        /// <summary>
        /// 读取CSV配置
        /// </summary>
        public virtual bool ReadCsvConfig(string fileName, Action <CSVDocument> handler)
        {
            Log.Info("ReadCsvConfig:" + fileName);
            CSVDocument csvDocument = new CSVDocument();

            if (csvDocument.Load(m_config_path + fileName))
            {
                handler(csvDocument);
            }
            csvDocument.Clear();
            csvDocument = null;
            return(true);
        }
        private void OnLoaded(CSVDocument doc)
        {
            int totalCount = (int)doc.TableRows();

            for (int i = 0; i < totalCount; ++i)
            {
                StdPacketCDInfo info = new StdPacketCDInfo();
                info.idx  = doc.GetValue(i, "idx").ToUInt16();
                info.type = doc.GetValue(i, "type").ToByte();
                info.cd   = doc.GetValue(i, "cd").ToInt32();

                if (info.idx > 0)
                {
                    m_infos.Add(info.idx, info);
                }
            }
        }
Esempio n. 3
0
        private void OnLoad(CSVDocument doc)
        {
            int totalCount = (int)doc.TableRows();

            for (int i = 0; i < totalCount; ++i)
            {
                StdCounterInfo info = new StdCounterInfo();
                info.idx     = doc.GetValue(i, "idx").ToUInt16();
                info.value   = doc.GetValue(i, "value").ToUInt16();
                info.reset   = doc.GetValue(i, "reset").ToBool();
                info.cd_type = doc.GetValue(i, "cd_type").ToUInt16();
                string cd = doc.GetValue(i, "cd_value").ToString();
                switch (info.cd_type)
                {
                case 2:
                    info.cd_value = new Dictionary <int, int>();
                    info.cd_value.Add(0, int.Parse(cd));
                    break;

                case 3:
                    info.cd_value = new Dictionary <int, int>();

                    string[] arr_cds = cd.Split(',');
                    if (arr_cds.Length > 0)
                    {
                        for (int j = 0; j < arr_cds.Length; ++j)
                        {
                            string[] arr_cd = arr_cds[j].Split('|');
                            info.cd_value.Add(int.Parse(arr_cd[0]), int.Parse(arr_cd[1]));
                        }
                    }
                    break;
                }

                if (info.idx > 0)
                {
                    m_infos.Add(info.idx, info);
                }
            }
        }
Esempio n. 4
0
        private void OnLoad(CSVDocument doc)
        {
            int totalCount = (int)doc.TableRows();

            for (int i = 0; i < totalCount; ++i)
            {
                StdMechaInfo info = new StdMechaInfo();
                info.ID              = doc.GetValue(i, "idx").ToInt32();
                info.Type            = doc.GetValue(i, "type").ToInt32();
                info.Name            = doc.GetValue(i, "name").ToString();
                info.NameIdx         = doc.GetValue(i, "nameIdx").ToInt32();
                info.DefaultOwn      = doc.GetValue(i, "defaultOwn").ToInt32();
                info.Mano            = doc.GetValue(i, "mano").ToInt32();
                info.Damage          = doc.GetValue(i, "damage").ToInt32();
                info.Range           = doc.GetValue(i, "range").ToInt32();
                info.Detection       = doc.GetValue(i, "detection").ToInt32();
                info.Live            = doc.GetValue(i, "live").ToInt32();
                info.Assist          = doc.GetValue(i, "assist").ToInt32();
                info.MainWpn         = doc.GetValue(i, "mainWpn").ToInt32();
                info.AuxWpn          = doc.GetValue(i, "auxWpn").ToInt32();
                info.SkillId         = doc.GetValue(i, "skill").ToInt32();
                info.SPSkillId       = doc.GetValue(i, "skillSP").ToInt32();
                info.GoldPrice       = doc.GetValue(i, "goldPrice").ToFloat();
                info.SilverPrice     = doc.GetValue(i, "silverPrice").ToFloat();
                info.DiamondPrice    = doc.GetValue(i, "diamondPrice").ToFloat();
                info.SourceType      = doc.GetValue(i, "sourceType").ToInt32();
                info.SaleType        = doc.GetValue(i, "saleType").ToInt32();
                info.ItemColor       = doc.GetValue(i, "itemColor").ToInt32();
                info.IconIdx         = doc.GetValue(i, "iconIdx").ToInt32();
                info.PicPath         = doc.GetValue(i, "picPath").ToString();
                info.ModelPath       = doc.GetValue(i, "Model").ToString();
                info.MoveAudio       = doc.GetValue(i, "MoveAudio").ToInt32();
                info.DieAudio        = doc.GetValue(i, "DieAudio").ToInt32();
                info.EnterAudio      = doc.GetValue(i, "EnterAudio").ToInt32();
                info.DropAudio       = doc.GetValue(i, "DropAudio").ToInt32();
                info.DropEffect      = doc.GetValue(i, "DropEffect").ToString();
                info.DropCamera      = doc.GetValue(i, "DropCamera").ToFloat();
                info.ReviveAudio     = doc.GetValue(i, "ReviveAudio").ToInt32();
                info.GoldDiscount    = doc.GetValue(i, "goldDiscount").ToFloat();
                info.SilverDiscount  = doc.GetValue(i, "silverDiscount").ToFloat();
                info.DiamondDiscount = doc.GetValue(i, "diamondDiscount").ToFloat();
                info.AttackSpeed     = doc.GetValue(i, "attackSpeed").ToFloat();
                info.MoveSpeed       = doc.GetValue(i, "moveSpeed").ToFloat();
                info.MaxHp           = doc.GetValue(i, "hpMax").ToFloat();
                info.HpSpeed         = doc.GetValue(i, "hpSpeed").ToFloat();
                info.MaxSp           = doc.GetValue(i, "spMax").ToFloat();
                info.SpSpeed         = doc.GetValue(i, "spSpeed").ToFloat();
                info.DefVal          = doc.GetValue(i, "defVal").ToFloat();
                info.Crit            = doc.GetValue(i, "crit").ToFloat() * 10000.0f;
                info.DetRange        = doc.GetValue(i, "detRange").ToFloat();
                info.Hide            = doc.GetValue(i, "hide").ToFloat();
                info.EyeRange        = doc.GetValue(i, "eyeRange").ToFloat();
                info.eyeHide         = doc.GetValue(i, "eyeHide").ToFloat();
                info.critDamage      = doc.GetValue(i, "critDmg").ToFloat();
                info.DescIdx         = doc.GetValue(i, "descIdx").ToInt32();
                info.Desc            = doc.GetValue(i, "desc").ToString();
                info.SkinID          = doc.GetValue(i, "SkinID").ToInt32();

                if (info.ID > 0 && doc.GetValue(i, "isEnable").ToInt32() == 1)
                {
                    m_infos.Add(info.ID, info);
                }
            }
        }