public void SetData(Fellow fellow)
    {
        sprHead.spriteName        = fellow.GetIcon();
        sprHeadQuality.spriteName = FellowTool.GetFellowQualityFrame(fellow.Quality);
        lblName.text         = fellow.Name;
        lblLv.text           = fellow.Level.ToString();
        sprTalent.spriteName = FellowTool.GetFellowElementPic(fellow.ElementAttr);
        lblType.text         = FellowTool.GetFellowTypeText(fellow.GetFellowType(), fellow.GetEvolveLevel());

        if (fellow.IsBabyFellow())
        {
            skillArea.SetActive(false);
            m_cloneArea.SetActive(true);
            SetStarState(false);
            SetCloneInfo(fellow);
        }
        else
        {
            skillArea.SetActive(true);
            m_cloneArea.SetActive(false);
            SetStarState(true);
            SetSkills(fellow);
        }
        UpdateFellowInfo_CurStar(fellow);
    }
    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();
    }
예제 #3
0
    void UpdateChooseFellowInfo(bool forward)
    {
        FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer;

        if (container == null)
        {
            return;
        }

        List <Fellow> babylist = FellowTool.FellowCanBreedingFilter(container);

        if (babylist.Count <= 0)
        {
            return;
        }

        Fellow updatefellow = null;

        if (forward)
        {
            for (int i = (m_FellowIndexBuffer + 1) % babylist.Count; i < babylist.Count; i++)
            {
                Fellow fellow = babylist[i];
                if (false == fellow.IsValid())
                {
                    continue;
                }

                if (m_BabyFellowBuffer == null)
                {
                    updatefellow        = fellow;
                    m_FellowIndexBuffer = i;
                    break;
                }
                else
                {
                    if (fellow.Guid != m_BabyFellowBuffer.Guid)
                    {
                        updatefellow        = fellow;
                        m_FellowIndexBuffer = i;
                        break;
                    }
                }
            }
        }
        else
        {
            for (int i = (m_FellowIndexBuffer + babylist.Count - 1) % babylist.Count; i >= 0; i--)
            {
                Fellow fellow = babylist[i];
                if (false == fellow.IsValid())
                {
                    continue;
                }

                if (m_BabyFellowBuffer == null)
                {
                    updatefellow        = fellow;
                    m_FellowIndexBuffer = i;
                    break;
                }
                else
                {
                    if (fellow.Guid != m_BabyFellowBuffer.Guid)
                    {
                        updatefellow        = fellow;
                        m_FellowIndexBuffer = i;
                        break;
                    }
                }
            }
        }

        if (updatefellow == null || false == updatefellow.IsValid() || false == updatefellow.IsBabyFellow())
        {
            return;
        }

//         m_PartnerChooseIcon.spriteName = updatefellow.GetIcon();
//         m_PartnerChooseNameLabel.text = updatefellow.Name;
//         m_PartnerChooseLevelLabel.text = "LV" + updatefellow.Level.ToString();
//         m_PartnerChooseCombatValueLabel.text = updatefellow.GetCombatValue().ToString();
//         m_PartnerChooseProcreateLabel.text = updatefellow.ProcreateCount.ToString();
//         m_PartnerChooseLuckyLabel.text = updatefellow.Lucky.ToString();

        m_BabyFellowBuffer = updatefellow;
    }