Esempio n. 1
0
        public int GetTaskLevel(int nTaskID, int nTaskType, int nSubType, int nSpecificType)
        {
            int nLevel = 0;

            if (nTaskType == (int)ENTASK_TYPE.ENTASK_TYPE_CONTACT)
            {
                List <SSchemeContactTaskConfig> config = null;
                if (m_mapContactTaskConfig.TryGetValue(nSubType, out config))
                {
                    foreach (var item in config)
                    {
                        if (item.nSpecificType == nSpecificType)
                        {
                            nLevel = item.nTaskLevel;
                            break;
                        }
                    }
                }
            }
            else
            {
                SSchemeSystemTaskConfig sysConfig = null;
                if (m_mapSystemTaskConfig.TryGetValue(nTaskID, out sysConfig))
                {
                    nLevel = sysConfig.nTaskLevel;
                }
            }

            return(nLevel);
        }
Esempio n. 2
0
        // 任务脚本
        private void LoadTaskConfig(string strPath)
        {
            ScpReader reader = new ScpReader(strPath, true, 2);

            m_mapContactTaskConfig = new Dictionary <int, List <SSchemeContactTaskConfig> >();
            m_mapSystemTaskConfig  = new Dictionary <int, SSchemeSystemTaskConfig>();

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                int nType = reader.GetInt(i, (int)ETaskConfigCol.ETCC_TASK_TYPE, 0);
                if (nType == (int)ENTASK_TYPE.ENTASK_TYPE_CONTACT)
                {
                    int nSubType = reader.GetInt(i, (int)ETaskConfigCol.ETCC_SUBTYPE_ID, 0);
                    if (!m_mapContactTaskConfig.ContainsKey(nSubType))
                    {
                        List <SSchemeContactTaskConfig> listTask = new List <SSchemeContactTaskConfig>();
                        m_mapContactTaskConfig[nSubType] = listTask;
                    }
                    // 已有nSpecificType数据
                    int nSpecificType = reader.GetInt(i, (int)ETaskConfigCol.ETCC_SPECIFICTYPE_ID, 0);
                    int nIndex        = m_mapContactTaskConfig[nSubType].FindIndex(item => item.nSpecificType == nSpecificType);
                    if (nIndex >= 0)
                    {
                        continue;
                    }

                    SSchemeContactTaskConfig taskInfo = new SSchemeContactTaskConfig();
                    taskInfo.nSubType              = reader.GetInt(i, (int)ETaskConfigCol.ETCC_SUBTYPE_ID, 0);
                    taskInfo.strSubTypeName        = reader.GetString(i, (int)ETaskConfigCol.ETCC_SUBTYPE_NAME, "");
                    taskInfo.nSpecificType         = reader.GetInt(i, (int)ETaskConfigCol.ETCC_SPECIFICTYPE_ID, 0);
                    taskInfo.strSpecificTypeName   = reader.GetString(i, (int)ETaskConfigCol.ETCC_SPECIFICTYPE_NAME, "");
                    taskInfo.strPublishDescription = reader.GetString(i, (int)ETaskConfigCol.ETCC_PUBLISH_DESCRIPTION, "");
                    taskInfo.strEmotionWords       = reader.GetString(i, (int)ETaskConfigCol.ETCC_EMOTION_WORDS, "");
                    taskInfo.nTaskLevel            = reader.GetInt(i, (int)ETaskConfigCol.ECTT_TASK_LEVEL, 0);
                    m_mapContactTaskConfig[nSubType].Add(taskInfo);
                }
                else
                {
                    SSchemeSystemTaskConfig systemTaskInfo = new SSchemeSystemTaskConfig();
                    systemTaskInfo.nTaskID    = reader.GetInt(i, (int)ETaskConfigCol.ETCC_TASK_ID, 0);
                    systemTaskInfo.nTaskType  = nType;
                    systemTaskInfo.nTaskLevel = reader.GetInt(i, (int)ETaskConfigCol.ECTT_TASK_LEVEL, 0);
                    m_mapSystemTaskConfig[systemTaskInfo.nTaskID] = systemTaskInfo;
                }
            }
        }