Пример #1
0
        public Dictionary <int, List <int> > GetPartnerCanLearnSkill()
        {
            Dictionary <int, List <int> > fellowlearnskill = new Dictionary <int, List <int> >();

            for (int i = 0; i < ContainerSize; i++)
            {
                Fellow fellow = GetFellowByIndex(i);
                if (fellow != null && fellow.IsValid() && fellow.Called && !fellowlearnskill.ContainsKey(fellow.DataId))
                {
                    for (int j = 0; j < Fellow.FELLOW_ELEMENTSKILL_COUNT && j < Fellow.FELLOW_ELEMENTSKILL_OPENCOUNT; j++)
                    {
                        if (fellow.GetElementSkillId(j) == GlobeVar.INVALID_ID && j > -1 &&
                            j < Fellow.FELLOW_ELEMENTSKILL_LEVELNEED.Length && fellow.Level >= Fellow.FELLOW_ELEMENTSKILL_LEVELNEED[j])
                        {
                            List <Tab_CabalFellowElementSkillBook> books = GameManager.gameManager.PlayerDataPool.BackPack.GetSkillLearnBooksByElementType(fellow.ElementAttr);
                            if (books != null && books.Count > j && GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(books[j].Id) > 0)
                            {
                                List <int> skills;
                                if (!fellowlearnskill.TryGetValue(fellow.DataId, out skills))
                                {
                                    skills = new List <int>();
                                }
                                skills.Add(j);
                            }
                        }
                    }
                }
            }
            return(fellowlearnskill);
        }
Пример #2
0
        /// <summary>
        /// 更新伙伴
        /// </summary>
        /// <param name="slot"></param>
        /// <param name="fellow"></param>
        /// <returns></returns>
        public bool UpdateFellow(int slot, Fellow fellow)
        {
            bool bRet = false;

            if (slot >= 0 && slot < m_Fellows.Count)
            {
                m_Fellows[slot] = fellow;
                bRet            = true;
            }
            return(bRet);
        }
Пример #3
0
 public bool IsHaveBabyFellow()
 {
     for (int i = 0; i < m_Fellows.Count; ++i)
     {
         Fellow fellow = m_Fellows[i];
         if (fellow.IsValid() && fellow.IsBabyFellow())
         {
             return(true);
         }
     }
     return(false);
 }
Пример #4
0
        public static List <Fellow> FellowBabyFilter(FellowContainer container)
        {
            List <Fellow> resultList = new List <Fellow>();

            for (int i = 0; i < container.ContainerSize; i++)
            {
                Fellow fellow = container.GetFellowByIndex(i);
                if (fellow != null && fellow.IsValid() && fellow.IsBabyFellow())
                {
                    resultList.Add(container.GetFellowByIndex(i));
                }
            }
            return(resultList);
        }
Пример #5
0
        public static List <Fellow> FellowCanBreedingFilter(FellowContainer container)
        {
            List <Fellow> resultList = new List <Fellow>();

            for (int i = 0; i < container.ContainerSize; i++)
            {
                Fellow fellow = container.GetFellowByIndex(i);
                if (fellow != null && fellow.IsValid() && false == fellow.Called && fellow.IsBabyFellow() && fellow.ProcreateCount >= 1)
                {
                    resultList.Add(container.GetFellowByIndex(i));
                }
            }
            return(resultList);
        }
Пример #6
0
        /// <summary>
        /// 取得伙伴数量
        /// </summary>
        /// <returns></returns>
        public int GetFellowCount()
        {
            int count = 0;

            for (int i = 0; i < m_Fellows.Count; ++i)
            {
                Fellow fellow = m_Fellows[i];
                if (fellow.IsValid())
                {
                    ++count;
                }
            }
            return(count);
        }
Пример #7
0
        public Dictionary <int, List <int> > GetPartnerCanUpdateSkill()
        {
            Dictionary <int, List <int> > fellowupdateskill = new Dictionary <int, List <int> >();

            for (int i = 0; i < ContainerSize; i++)
            {
                Fellow fellow = GetFellowByIndex(i);
                if (fellow != null && fellow.IsValid() && !fellowupdateskill.ContainsKey(fellow.DataId))
                {
                    for (int j = 0; j < Fellow.FELLOW_ELEMENTSKILL_COUNT; j++)
                    {
                        int fellowElementSkillId = fellow.GetElementSkillId(j);
                        if (fellowElementSkillId != GlobeVar.INVALID_ID)
                        {
                            Tab_CabalFellowElementSkill tabSkill = TableManager.GetCabalFellowElementSkillByID(fellowElementSkillId, 0);
                            if (tabSkill != null)
                            {
                                Tab_CabalFellowElementSkill tabNextSkill = TableManager.GetCabalFellowElementSkillByID(tabSkill.NextSkillId, 0);
                                {
                                    if (tabNextSkill != null)
                                    {
                                        int packHaveBookNum      = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(tabNextSkill.NeedBookId);
                                        int nextSkillNeedBookNum = tabNextSkill.NeedBookCount;
                                        if (packHaveBookNum >= nextSkillNeedBookNum)
                                        {
                                            List <int> skilllist;
                                            if (!fellowupdateskill.TryGetValue(fellow.DataId, out skilllist))
                                            {
                                                skilllist = new List <int>();
                                            }
                                            skilllist.Add(fellowElementSkillId);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(fellowupdateskill);
        }
Пример #8
0
        public static List <Fellow> FellowSort(FellowContainer container)
        {
            List <Fellow> resultList = new List <Fellow>();

            for (int i = 0; i < container.ContainerSize; i++)
            {
                if (container.GetFellowByIndex(i) != null && container.GetFellowByIndex(i).IsValid())
                {
                    resultList.Add(container.GetFellowByIndex(i));
                }
            }

            for (int i = 0; i < resultList.Count; i++)
            {
                int flag = 0;
                for (int j = 0; j < (resultList.Count - i - 1); j++)
                {
                    //当前召出伙伴排前面
                    if (resultList[j + 1].Called)
                    {
                        Fellow tempFellow = resultList[j + 1];
                        resultList[j + 1] = resultList[j];
                        resultList[j]     = tempFellow;
                        flag = 1;
                    }
                    else if (resultList[j].Called == false)
                    {
                        //星级高的伙伴排前面
                        if (resultList[j + 1].StarLevel > resultList[j].StarLevel)
                        {
                            Fellow tempFellow = resultList[j + 1];
                            resultList[j + 1] = resultList[j];
                            resultList[j]     = tempFellow;
                            flag = 1;
                        }
                        else if (resultList[j + 1].StarLevel == resultList[j].StarLevel)
                        {
                            //品质高的排前面
                            if (resultList[j + 1].Quality > resultList[j].Quality)
                            {
                                Fellow tempFellow = resultList[j + 1];
                                resultList[j + 1] = resultList[j];
                                resultList[j]     = tempFellow;
                                flag = 1;
                            }
                            else if (resultList[j + 1].Quality == resultList[j].Quality)
                            {
                                //等级高的排前面
                                if (resultList[j + 1].Level > resultList[j].Level)
                                {
                                    Fellow tempFellow = resultList[j + 1];
                                    resultList[j + 1] = resultList[j];
                                    resultList[j]     = tempFellow;
                                    flag = 1;
                                }
                                else if (resultList[j + 1].Level == resultList[j].Level)
                                {
                                    //DataId大的排前面
                                    if (resultList[j + 1].DataId > resultList[j].DataId)
                                    {
                                        Fellow tempFellow = resultList[j + 1];
                                        resultList[j + 1] = resultList[j];
                                        resultList[j]     = tempFellow;
                                        flag = 1;
                                    }
                                    else if (resultList[j + 1].DataId == resultList[j].DataId)
                                    {
                                        //Guid大的排前面
                                        if (resultList[j + 1].Guid > resultList[j].Guid)
                                        {
                                            Fellow tempFellow = resultList[j + 1];
                                            resultList[j + 1] = resultList[j];
                                            resultList[j]     = tempFellow;
                                            flag = 1;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (flag == 0)
                {
                    break;
                }
            }

            return(resultList);
        }