Ejemplo n.º 1
0
 // 根据id获得天赋的信息
 public void GetTalentInfo(int nTalentId, ref SSchemeTalentConfig sTalentPage)
 {
     if (!IsHasTalentInfo(nTalentId, ref sTalentPage))
     {
         Trace.LogWarning("没有找到id为:" + nTalentId + "的天赋");
         sTalentPage = null;
     }
 }
Ejemplo n.º 2
0
 public int GetSingleTalentType(int nTalentId)
 {
     if (allTalentPageTable.ContainsKey(nTalentId))
     {
         SSchemeTalentConfig talentConfig = allTalentPageTable[nTalentId] as SSchemeTalentConfig;
         return(talentConfig.nTalentType);
     }
     return(0);
 }
Ejemplo n.º 3
0
        // 判断是否有该id的天赋信息
        private bool IsHasTalentInfo(int nTalentId, ref SSchemeTalentConfig sTalentPage)
        {
            bool res = false;

            if (allTalentPageTable.ContainsKey(nTalentId))
            {
                sTalentPage = allTalentPageTable[nTalentId] as SSchemeTalentConfig;
                res         = true;
            }
            return(res);
        }
Ejemplo n.º 4
0
        // 初始化csv表
        protected void InitTalentPageCsv(string stPath)
        {
            // string stSchemeAllText = File.ReadAllText(stPath);
            ScpReader reader = new ScpReader(stPath, true, 2);

            allTalentPageTable = new Hashtable();
            aTalentArray       = new int[DefaultTypeCount, DefaultLevelCount, DefaultSameLevelCount]; // 目前写死
            int nCurType        = 0;
            int nCurLevel       = 0;
            int nSameLevelIndex = 0;

            for (int i = 0; i < reader.GetRecordCount(); i++)
            {
                SSchemeTalentConfig sConfig = new SSchemeTalentConfig();
                sConfig.nId             = reader.GetInt(i, (int)Talent.EMT_ID, 0);
                sConfig.szTalentName    = reader.GetString(i, (int)Talent.EMT_NAME, "");
                sConfig.nTalentIconId   = reader.GetInt(i, (int)Talent.EMT_ICONID, 0);
                sConfig.nTalentType     = reader.GetInt(i, (int)Talent.EMT_TYPE, 0);
                sConfig.nTalentLevel    = reader.GetInt(i, (int)Talent.EMT_Level, 0);
                sConfig.nTalentAllowNum = reader.GetInt(i, (int)Talent.EMT_AllowNum, 0);
                sConfig.nMaxAddNum      = reader.GetInt(i, (int)Talent.EMT_MaxAddNum, 0);
                sConfig.szTalentArray   = reader.GetString(i, (int)Talent.EMT_EffectArray, "");

                if (sConfig.nId == 0)
                {
                    continue;
                }

                nSameLevelIndex++;
                if (nCurType != sConfig.nTalentType)
                {
                    nCurType        = sConfig.nTalentType;
                    nCurLevel       = sConfig.nTalentLevel;
                    nSameLevelIndex = 0;
                }
                if (nCurLevel != sConfig.nTalentLevel)
                {
                    // button等级层次变化的时候
                    nSameLevelIndex = 0;
                    nCurLevel       = sConfig.nTalentLevel;
                }
                aTalentArray[sConfig.nTalentType - 1, sConfig.nTalentLevel - 1, nSameLevelIndex] = sConfig.nId;
                allTalentPageTable[sConfig.nId] = sConfig;
            }
        }