/// <summary>
 /// 点击学习技能按钮,打开学习技能UI
 /// </summary>
 void OnLearnSkillClick(GameObject go)
 {
     for (int i = 0; i < m_OldElementSkill.Length && i < Fellow.FELLOW_ELEMENTSKILL_COUNT && i < Fellow.FELLOW_ELEMENTSKILL_OPENCOUNT; i++)
     {
         int skillId = m_Fellow.GetElementSkillId(i);
         oldSkillId[i] = skillId;
         m_OldElementSkill[i].Init(skillId, i, m_Fellow.Level);
     }
     m_LearnSkillWindow.SetActive(true);
     ClearSkillLearnDialog();
     if (PartnerFrameLogic.Instance().NewPlayerGuideFlag_Step == 13)
     {
         PartnerFrameLogic.Instance().NewPlayerGuide(4);
     }
     return;
 }
 void UpdateFellowInfo_ElementSkill(Fellow fellow)
 {
     for (int i = 0; i < m_ElementSkill.Length && i < Fellow.FELLOW_ELEMENTSKILL_COUNT && i < Fellow.FELLOW_ELEMENTSKILL_OPENCOUNT; i++)
     {
         m_ElementSkill[i].InitElementSkill_Hold(fellow.GetElementSkillId(i), i, fellow.Level);
     }
 }
    void UpdateFellowInfo_Skill(Fellow fellow)
    {
        Utils.CleanGrid(m_TalentSkillGrid);
        Utils.CleanGrid(m_ElementSkillGrid);

        int index = 0;

        int nValidTalentSkillCount = 0;

        foreach (KeyValuePair <int, int> pair in fellow.TallentSkill)
        {
            int skillid = pair.Key;
            if (skillid <= 0)
            {
                break;
            }

            Tab_CabalFellowTallentSkill tabTallentSkill = TableManager.GetCabalFellowTallentSkillByID(skillid, 0);
            if (tabTallentSkill == null)
            {
                break;
            }

            string     itemName  = index < 10 ? "0" + index.ToString() : index.ToString();
            GameObject skillitem = Utils.BindObjToParent(m_PartnerSkillItem, m_TalentSkillGrid, itemName);
            if (skillitem == null || skillitem.GetComponent <PartnerSkillItemLogic>() == null)
            {
                break;
            }

            skillitem.GetComponent <PartnerSkillItemLogic>().InitTallentSkill(skillid);
            AddSkillItemListener(skillitem);
            index += 1;

            nValidTalentSkillCount += 1;
        }

        int nValidElementSkillCount = 0;

        if (false == fellow.IsBabyFellow())
        {
            for (int i = 0; i < Fellow.FELLOW_ELEMENTSKILL_COUNT && i < Fellow.FELLOW_ELEMENTSKILL_OPENCOUNT; i++)
            {
                int skillid = fellow.GetElementSkillId(i);
                if (skillid <= 0)
                {
                    continue;
                }

                Tab_CabalFellowElementSkill tabElementSkill = TableManager.GetCabalFellowElementSkillByID(skillid, 0);
                if (tabElementSkill == null)
                {
                    continue;
                }

                string     itemName  = index < 10 ? "0" + index.ToString() : index.ToString();
                GameObject skillitem = Utils.BindObjToParent(m_PartnerSkillItem, m_ElementSkillGrid, itemName);
                if (skillitem == null || skillitem.GetComponent <PartnerSkillItemLogic>() == null)
                {
                    continue;
                }

                skillitem.GetComponent <PartnerSkillItemLogic>().InitElementSkill(skillid);
                AddSkillItemListener(skillitem);
                index += 1;

                nValidElementSkillCount += 1;
            }
        }

        //int nEmptySlotCount = Fellow.FELLOW_TALLENTSKILL_OPENCOUNT + Fellow.FELLOW_ELEMENTSKILL_OPENCOUNT - nValidTalentSkillCount - nValidElementSkillCount;
        int nEmptySlotCount = Fellow.FELLOW_ELEMENTSKILL_OPENCOUNT - nValidElementSkillCount;
        int nLockSlotCount  = Fellow.FELLOW_ELEMENTSKILL_LEVELNEED.Length;

        if (false == fellow.IsBabyFellow())
        {
            for (int i = 0; i < Fellow.FELLOW_ELEMENTSKILL_LEVELNEED.Length; i++)
            {
                if (fellow.Level >= Fellow.FELLOW_ELEMENTSKILL_LEVELNEED[i])
                {
                    nLockSlotCount -= 1;
                }
            }
        }

        for (int i = 0; i < nEmptySlotCount; i++)
        {
            string     itemName  = index < 10 ? "0" + index.ToString() : index.ToString();
            GameObject skillitem = Utils.BindObjToParent(m_PartnerSkillItem, m_ElementSkillGrid, itemName);
            if (skillitem == null || skillitem.GetComponent <PartnerSkillItemLogic>() == null)
            {
                break;
            }

            skillitem.GetComponent <PartnerSkillItemLogic>().InitEmptySkill(i >= nEmptySlotCount - nLockSlotCount);
            AddSkillItemListener(skillitem);
            index += 1;
        }
        m_TalentSkillGrid.GetComponent <UIGrid>().Reposition();
        m_ElementSkillGrid.GetComponent <UIGrid>().Reposition();
    }
    void SetSkills(Fellow fellow)
    {
        Utils.CleanGrid(gridElementSkills.gameObject);
        Utils.CleanGrid(gridTalentSkills.gameObject);

        int index = 0;

        int nValidTalentSkillCount = 0;

        foreach (KeyValuePair <int, int> pair in fellow.TallentSkill)
        {
            int skillid = pair.Key;
            if (skillid <= 0)
            {
                break;
            }
            Tab_CabalFellowTallentSkill tabTallentSkill = TableManager.GetCabalFellowTallentSkillByID(skillid, 0);
            if (tabTallentSkill == null)
            {
                break;
            }
            string     itemName  = index < 10 ? "0" + index.ToString() : index.ToString();
            GameObject skillitem = Utils.BindObjToParent(skillTemplate, gridTalentSkills.gameObject, itemName);
            if (skillitem == null || skillitem.GetComponent <PartnerSkillItemLogic>() == null)
            {
                break;
            }
            skillitem.GetComponent <PartnerSkillItemLogic>().InitTallentSkill(skillid);
            index += 1;
            nValidTalentSkillCount += 1;
        }

        int nValidElementSkillCount = 0;

        for (int i = 0; i < Fellow.FELLOW_ELEMENTSKILL_COUNT && i < Fellow.FELLOW_ELEMENTSKILL_OPENCOUNT; i++)
        {
            int skillid = fellow.GetElementSkillId(i);
            if (skillid <= 0)
            {
                break;
            }
            Tab_CabalFellowElementSkill tabElementSkill = TableManager.GetCabalFellowElementSkillByID(skillid, 0);
            if (tabElementSkill == null)
            {
                break;
            }
            string     itemName  = index < 10 ? "0" + index.ToString() : index.ToString();
            GameObject skillitem = Utils.BindObjToParent(skillTemplate, gridElementSkills.gameObject, itemName);
            if (skillitem == null || skillitem.GetComponent <PartnerSkillItemLogic>() == null)
            {
                break;
            }
            skillitem.GetComponent <PartnerSkillItemLogic>().InitElementSkill(skillid);
            index += 1;
            nValidElementSkillCount += 1;
        }

        int nEmptySlotCount = Fellow.FELLOW_ELEMENTSKILL_OPENCOUNT - nValidElementSkillCount;
        int nLockSlotCount  = Fellow.FELLOW_ELEMENTSKILL_LEVELNEED.Length;

        for (int i = 0; i < Fellow.FELLOW_ELEMENTSKILL_LEVELNEED.Length; i++)
        {
            if (fellow.Level >= Fellow.FELLOW_ELEMENTSKILL_LEVELNEED[i])
            {
                nLockSlotCount -= 1;
            }
        }

        for (int i = 0; i < nEmptySlotCount; i++)
        {
            string     itemName  = index < 10 ? "0" + index.ToString() : index.ToString();
            GameObject skillitem = Utils.BindObjToParent(skillTemplate, gridElementSkills.gameObject, itemName);
            if (skillitem == null || skillitem.GetComponent <PartnerSkillItemLogic>() == null)
            {
                break;
            }

            skillitem.GetComponent <PartnerSkillItemLogic>().InitEmptySkill(i >= nEmptySlotCount - nLockSlotCount);
            index += 1;
        }
        gridTalentSkills.Reposition();
        gridElementSkills.Reposition();
    }
    public void UpdateFellow_SkillInfo(Fellow fellow)
    {
        Utils.CleanGrid(m_SkillItemGrid);

        int index = 0;

        foreach (KeyValuePair <int, int> pair in fellow.TallentSkill)
        {
            int skillid = pair.Key;
            if (skillid <= 0)
            {
                continue;
            }

            Tab_CabalFellowTallentSkill tabTallentSkill = TableManager.GetCabalFellowTallentSkillByID(skillid, 0);
            if (tabTallentSkill == null)
            {
                continue;
            }

            string     itemName  = index < 10 ? "0" + index.ToString() : index.ToString();
            GameObject skillitem = Utils.BindObjToParent(m_PartnerSkillItem, m_SkillItemGrid, itemName);
            if (skillitem == null || skillitem.GetComponent <ChatInfoLinkFellowItemLogic>() == null)
            {
                continue;
            }

            skillitem.GetComponent <ChatInfoLinkFellowItemLogic>().InitTallentSkill(skillid);

            index += 1;
        }

        for (int i = 0; i < Fellow.FELLOW_ELEMENTSKILL_COUNT && i < Fellow.FELLOW_ELEMENTSKILL_OPENCOUNT; i++)
        {
            int skillid = fellow.GetElementSkillId(i);
            if (skillid <= 0)
            {
                break;
            }

            Tab_CabalFellowElementSkill tabElementSkill = TableManager.GetCabalFellowElementSkillByID(skillid, 0);
            if (tabElementSkill == null)
            {
                break;
            }

            string     itemName  = index < 10 ? "0" + index.ToString() : index.ToString();
            GameObject skillitem = Utils.BindObjToParent(m_PartnerSkillItem, m_SkillItemGrid, itemName);
            if (skillitem == null || skillitem.GetComponent <ChatInfoLinkFellowItemLogic>() == null)
            {
                break;
            }

            skillitem.GetComponent <ChatInfoLinkFellowItemLogic>().InitElementSkill(skillid);

            index += 1;
        }

        if (m_SkillItemGrid.GetComponent <UIGrid>() != null)
        {
            m_SkillItemGrid.GetComponent <UIGrid>().Reposition();
        }
    }
Exemplo n.º 6
0
    public int GetPartnerSkillCanLevelUpCount()
    {
        //遍历伙伴容器
        FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer;

        if (container == null)
        {
            return(0);
        }
        List <Fellow> fellowlist = FellowTool.FellowSort(container);

        for (int i = 0; i < fellowlist.Count; ++i)
        {
            Fellow fellow = fellowlist[i];
            if (fellow.IsValid())
            {
                //天赋技能
                foreach (KeyValuePair <int, int> pair in fellow.TallentSkill)
                {
                    if (pair.Key != GlobeVar.INVALID_ID)
                    {
                        int talentSkillId = pair.Key;
                        Tab_CabalFellowTallentSkill tabTalentSkill = TableManager.GetCabalFellowTallentSkillByID(talentSkillId, 0);
                        if (tabTalentSkill == null)
                        {
                            return(0);
                        }
                        int needTalentBookId = tabTalentSkill.SkillBook;
                        if (tabTalentSkill.NextSkillId != GlobeVar.INVALID_ID)
                        {
                            if (GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(needTalentBookId) > 0)
                            {
                                return(1);
                            }
                        }
                        else
                        {
                            return(0);
                        }
                    }
                }
                //培养技能
                for (int j = 0; j < Fellow.FELLOW_ELEMENTSKILL_COUNT; j++)
                {
                    int fellowElementSkillId = fellow.GetElementSkillId(i);
                    int fellowLevel          = fellow.Level;
                    int index = j;
                    if (fellowElementSkillId == GlobeVar.INVALID_ID)//空位还没有开启的话
                    {
                        if (index < 0 || index >= Fellow.FELLOW_ELEMENTSKILL_LEVELNEED.Length)
                        {
                            return(0);
                        }
                        if (fellowLevel == Fellow.FELLOW_ELEMENTSKILL_LEVELNEED[index])
                        {
                            return(0);
                        }
                    }
                    else //开启了
                    {
                        Tab_CabalFellowElementSkill tabSkill = TableManager.GetCabalFellowElementSkillByID(fellowElementSkillId, 0);
                        if (tabSkill == null)
                        {
                            return(0);
                        }
                        Tab_CabalFellowElementSkill tabNextSkill = TableManager.GetCabalFellowElementSkillByID(tabSkill.NextSkillId, 0);
                        {
                            if (tabNextSkill == null)
                            {
                                return(0);
                            }
                            else
                            {
                                int packHaveBookNum      = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(tabNextSkill.NeedBookId);
                                int nextSkillNeedBookNum = tabNextSkill.NeedBookCount;
                                if (packHaveBookNum >= nextSkillNeedBookNum)
                                {
                                    return(1);
                                }
                            }
                        }
                    }
                }
            }
        }

        return(0);
    }