Beispiel #1
0
        /// <summary>
        /// 取配置表数据
        /// </summary>
        /// <param name="_strUSoundFilter">筛选字</param>
        /// <param name="_strUSoundKey">关键字</param>
        /// <param name="_schemeUSoundData">我给你赋值,避免修改原始数据</param>
        /// <returns></returns>
        public bool GetData(string _strUSoundFilter, string _strUSoundKey, ref SSchemeUSoundData _schemeUSoundData)
        {
            if (_schemeUSoundData == null)
            {
                return(false);
            }

            string tmpName = string.Empty;

            GetSoundName(_strUSoundFilter, _strUSoundKey, ref tmpName);
            return(GetData(tmpName, ref _schemeUSoundData));
        }
Beispiel #2
0
        public void Load(string strPath)
        {
            m_dicUSoundTable = new Dictionary <string, SSchemeUSoundData>();
            ScpReader reader = new ScpReader(strPath, true, 1);

            sb_USoundName = new StringBuilder();

            string tmpCurrentFilter = string.Empty;
            string tmpSoundName     = string.Empty;

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                SSchemeUSoundData sConfig = new SSchemeUSoundData();

                sConfig.USoundFilter = reader.GetString(i, (int)EUSoundConfig.USC_Filter, tmpCurrentFilter);

                if (i == 0 && sConfig.USoundFilter == string.Empty)
                {
                    Trace.LogError("配置表出错!!第一行Filter不能是空的。");
                    break;
                }
                //表当前位置与上一个位置的ViewFilter一致
                else if (sConfig.USoundFilter == string.Empty)
                {
                    sConfig.USoundFilter = tmpCurrentFilter;
                }
                //表当前位置属于另一个ViewFilter
                else if (sConfig.USoundFilter != tmpCurrentFilter)
                {
                    tmpCurrentFilter = sConfig.USoundFilter;
                }

                sConfig.USoundKey = reader.GetString(i, (int)EUSoundConfig.USC_Key, string.Empty);

                sConfig.USoundID = reader.GetInt(i, (int)EUSoundConfig.USC_ID, 0);

                GetSoundName(sConfig.USoundFilter, sConfig.USoundKey, ref tmpSoundName);

                if (m_dicUSoundTable.ContainsKey(tmpSoundName))
                {
                    Trace.LogWarning("有相同的音效名称:" + sConfig.USoundFilter + "," + sConfig.USoundKey + "表第" + i + "行");
                }
                else
                {
                    m_dicUSoundTable.Add(tmpSoundName, sConfig);
                }
            }
            reader.Dispose();
            reader       = null;
            IsConfigLoad = true;
        }
Beispiel #3
0
        /// <summary>
        /// 取配置表数据
        /// </summary>
        /// <param name="_strUSoundName">配置表名字</param>
        /// <param name="_schemeUSoundData">我给你赋值,避免修改原始数据</param>
        /// <returns></returns>
        public bool GetData(string _strUSoundName, ref SSchemeUSoundData _schemeUSoundData)
        {
            if (_schemeUSoundData == null)
            {
                return(false);
            }

            if (m_dicUSoundTable != null && m_dicUSoundTable.ContainsKey(_strUSoundName))
            {
                m_dicUSoundTable[_strUSoundName].CopyTo(ref _schemeUSoundData);
                return(true);
            }
            return(false);
        }