Beispiel #1
0
        public static string GetChatFellowTallentSkillQualityPic(int skillid)
        {
            Tab_CabalFellowTallentSkill tabSkill = TableManager.GetCabalFellowTallentSkillByID(skillid, 0);

            if (tabSkill == null)
            {
                return("white-jinengkuang");
            }

            switch ((FELLOWTALLENTSKILL)tabSkill.Quality)
            {
            case FELLOWTALLENTSKILL.WHITE:
                return("white-jinengkuang");

            case FELLOWTALLENTSKILL.GREEN:
                return("green-jinengkuang");

            case FELLOWTALLENTSKILL.BLUE:
                return("bule-jinengkuang");

            case FELLOWTALLENTSKILL.PURPLE:
                return("purple-jinengkuang");

            case FELLOWTALLENTSKILL.ORANGE:
                return("orange-jinengkuang");

            default:
                return("white-jinengkuang");
            }
        }
Beispiel #2
0
        public static int GetFellowTalentSkillNewLevel(int skillid, ref int addexp)
        {
            int nSkillId = skillid;

            int loopmax = 20;

            for (int i = 0; i < loopmax; i++)
            {
                Tab_CabalFellowTallentSkill tabSkill = TableManager.GetCabalFellowTallentSkillByID(nSkillId, 0);
                if (tabSkill == null)
                {
                    break;
                }

                // 满级
                if (tabSkill.NextSkillId == GlobeVar.INVALID_ID)
                {
                    addexp = Mathf.Min(addexp, tabSkill.LevelUpExp);
                    break;
                }

                if (addexp < tabSkill.LevelUpExp)
                {
                    break;
                }

                addexp  -= tabSkill.LevelUpExp;
                nSkillId = tabSkill.NextSkillId;
            }

            return(nSkillId);
        }
Beispiel #3
0
    void OnFriendFellowPress()
    {
        if (false == GameManager.gameManager.PlayerDataPool.FriendBreedingFellowInfo.IsValid())
        {
            return;
        }

        Tab_CabalFellowAttr tabFellow = TableManager.GetCabalFellowAttrByID(GameManager.gameManager.PlayerDataPool.FriendBreedingFellowInfo.DataId, 0);

        if (tabFellow == null)
        {
            return;
        }

        Tab_CabalFellowTallentSkill tabTalent = TableManager.GetCabalFellowTallentSkillByID(GameManager.gameManager.PlayerDataPool.FriendBreedingFellowInfo.TalentSkill, 0);

        if (tabTalent == null)
        {
            return;
        }

        m_PartnerAttrWindow.SetActive(true);
        m_PartnerAttrWindow.transform.localPosition = new Vector3(200, 0, 0);

        m_PartnerAttr_HeadIcon.spriteName      = tabFellow.Icon;
        m_PartnerAttr_Quality.spriteName       = FellowTool.GetFellowQualityFrame(GameManager.gameManager.PlayerDataPool.FriendBreedingFellowInfo.Quality);
        m_PartnerAttr_Name.text                = GameManager.gameManager.PlayerDataPool.FriendBreedingFellowInfo.Name;
        m_PartnerAttr_Lucky.text               = GameManager.gameManager.PlayerDataPool.FriendBreedingFellowInfo.Lucky.ToString();
        m_PartnerAttr_Level.text               = GameManager.gameManager.PlayerDataPool.FriendBreedingFellowInfo.Level.ToString();
        m_PartnerAttr_TalentIcon.spriteName    = tabTalent.Icon;
        m_PartnerAttr_TalentQuality.spriteName = FellowTool.GetFellowTallentSkillQualityPic(tabTalent.Id);
        m_PartnerAttr_TalentName.text          = tabTalent.Name;
        m_PartnerAttr_TalentDesc.text          = tabTalent.SkillDesc;
    }
Beispiel #4
0
    public void updateTalentRemindPoint(int skillid)
    {
        Tab_CabalFellowTallentSkill tabTalentSkill = TableManager.GetCabalFellowTallentSkillByID(skillid, 0);

        if (tabTalentSkill == null)
        {
            return;
        }
        int needTalentBookId = tabTalentSkill.SkillBook;

        if (tabTalentSkill.NextSkillId != GlobeVar.INVALID_ID)
        {
            if (GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(needTalentBookId) > 0)
            {
                m_RemindPoint.gameObject.SetActive(true);
            }
            else
            {
                m_RemindPoint.gameObject.SetActive(false);
            }
        }
        else
        {
            m_RemindPoint.gameObject.SetActive(false);
        }
    }
Beispiel #5
0
    void OnPlayerFellowPress()
    {
        if (m_BabyFellow == null)
        {
            return;
        }

        Tab_CabalFellowTallentSkill tabTalent = null;

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

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

            tabTalent = tabTallentSkill;
            break;
        }

        if (tabTalent == null)
        {
            return;
        }

        m_PartnerAttrWindow.SetActive(true);
        m_PartnerAttrWindow.transform.localPosition = new Vector3(-200, 0, 0);

        m_PartnerAttr_HeadIcon.spriteName      = m_BabyFellow.GetIcon();
        m_PartnerAttr_Quality.spriteName       = FellowTool.GetFellowQualityFrame(m_BabyFellow.Quality);
        m_PartnerAttr_Name.text                = m_BabyFellow.Name;
        m_PartnerAttr_Lucky.text               = m_BabyFellow.Lucky.ToString();
        m_PartnerAttr_Level.text               = m_BabyFellow.Level.ToString();
        m_PartnerAttr_TalentIcon.spriteName    = tabTalent.Icon;
        m_PartnerAttr_TalentQuality.spriteName = FellowTool.GetFellowTallentSkillQualityPic(tabTalent.Id);
        m_PartnerAttr_TalentName.text          = tabTalent.Name;
        m_PartnerAttr_TalentDesc.text          = tabTalent.SkillDesc;
    }
    public void InitTallentSkill(int skillid)
    {
        Tab_CabalFellowTallentSkill tabSkill = TableManager.GetCabalFellowTallentSkillByID(skillid, 0);

        if (tabSkill == null)
        {
            return;
        }

        m_TallentSkillId = skillid;
        m_ElementSkillId = GlobeVar.INVALID_ID;

        m_SkillIcon.spriteName = tabSkill.Icon;
        //取消品质
        //m_QualityPic.spriteName = FellowTool.GetChatFellowTallentSkillQualityPic(skillid);
        m_TallentBgPic.gameObject.SetActive(true);
        //  m_LevelLabel.text = tabSkill.Level.ToString();
    }
    public void InitTallentSkill(int skillid)
    {
        Tab_CabalFellowTallentSkill tabSkill = TableManager.GetCabalFellowTallentSkillByID(skillid, 0);

        if (tabSkill == null)
        {
            return;
        }

        m_TallentSkillId = skillid;
        m_ElementSkillId = GlobeVar.INVALID_ID;

        m_NameLabel.text       = tabSkill.Name;
        m_LevelLabel.text      = "LV" + tabSkill.Level.ToString();
        m_DescLabel.text       = tabSkill.SkillDesc;
        m_SkillIcon.spriteName = tabSkill.Icon;
        //m_QualityPic.spriteName = FellowTool.GetFellowTallentSkillQualityPic(skillid);
    }
    /// <summary>
    /// 填充天赋技能数据
    /// </summary>
    /// <param name="skillid"></param>
    /// <param name="curexp"></param>
    public void InitTallentSkill(int skillid, int curexp)//天赋和技能公用一个,所以加个标识区分 true为天赋 false技能
    {
        m_bTallent = true;
        Tab_CabalFellowTallentSkill tabSkill = TableManager.GetCabalFellowTallentSkillByID(skillid, 0);

        if (tabSkill == null)
        {
            return;
        }
        HideDetail(null);         //切换宠物时 隐藏Tip
        m_TallentSkillId        = skillid;
        m_ElementSkillId        = GlobeVar.INVALID_ID;
        sprSkillIcon.spriteName = tabSkill.Icon;
        lblSkillName.text       = tabSkill.Name;
        lblSkillDesc.text       = tabSkill.SkillDesc;
        if (PartnerFrameLogic.Instance() != null)
        {
            PartnerFrameLogic.Instance().UpdateDevelopRemindPoint();
        }
    }
Beispiel #9
0
    public void InitTallentSkill(int skillid, int curexp)
    {
        Tab_CabalFellowTallentSkill tabSkill = TableManager.GetCabalFellowTallentSkillByID(skillid, 0);

        if (tabSkill == null)
        {
            return;
        }

        m_TallentSkillId = skillid;
        m_ElementSkillId = GlobeVar.INVALID_ID;

        m_NameLabel.text = tabSkill.Name;
        m_NameLabel.gameObject.SetActive(true);

        m_ExpLabel.text = tabSkill.NextSkillId != GlobeVar.INVALID_ID ? StrDictionary.GetClientDictionaryString("#{10321}", curexp, tabSkill.LevelUpExp) : "MAX";
        m_ExpLabel.gameObject.SetActive(true);

        m_SkillIcon.spriteName = tabSkill.Icon;
        m_SkillIcon.gameObject.SetActive(true);

        m_QualityPic.spriteName = FellowTool.GetFellowTallentSkillQualityPic(skillid);

        m_LevelLabel.text = "LV" + tabSkill.Level.ToString();
        m_LevelLabel.gameObject.SetActive(true);

        m_LockSprite.SetActive(false);
        m_FlagLabel.gameObject.SetActive(false);

        if (m_LevelUpButton != null)
        {
            m_LevelUpButton.SetActive(tabSkill.NextSkillId != GlobeVar.INVALID_ID);
        }

        updateTalentRemindPoint(skillid);
        if (PartnerFrameLogic.Instance() != null)
        {
            PartnerFrameLogic.Instance().UpdateDevelopRemindPoint();
        }
    }
    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();
        }
    }
Beispiel #13
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);
    }