Beispiel #1
0
    // 是否有指定技能
    public bool HaveSkill(int skillId)
    {
        if (!isCheckSkill)
        {
            return(true);
        }
        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(IDInTable);

        if (null == heroInfo)
        {
            return(false);
        }

        int needLevel = heroInfo.GetSkillNeedLevel(skillId);

        // 等级不够
        if (Level < needLevel)
        {
            return(false);
        }

        // 身上无此技能
        for (int i = 0; i < SkillItemInfoList.Length; i++)
        {
            if (SkillItemInfoList[i].m_skillID == skillId)
            {
                return(true);
            }
        }

        return(false);
    }
Beispiel #2
0
    // 更新TIPS 信息
    void UpdateTipsInfo(int skillId)
    {
        CSItem card = null;

        if (CardBag.Singleton.m_curOptinGuid.Equals(CSItemGuid.Zero))
        {
            card = CardBag.Singleton.m_cardForDetail;
        }
        else
        {
            card = CardBag.Singleton.itemBag.GetItemByGuid(CardBag.Singleton.m_curOptinGuid);
        }

        if (null == card)
        {
            return;
        }


        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(card.m_id);

        if (null == heroInfo)
        {
            return;
        }

        SkillInfo info = GameTable.SkillTableAsset.Lookup(skillId);

        if (null == info)
        {
            return;
        }
        HeroCardSkill heroSkillInfo = card.GetSkillInfo(skillId);

        CDInfo cdInfo = GameTable.CDTableAsset.Lookup(info.CoolDown);

        if (cdInfo == null)
        {
            m_tipsSkillCD.text = GetTimeString(0f);
        }
        else
        {
            m_tipsSkillCD.text = GetTimeString(cdInfo.CDTime);
        }


//        Debug.Log("m_tipsSkillDes:" + m_tipsSkillDes.height);

        int needLevel = 0;
        // tips 位置
        int offset = 50;

        needLevel = heroInfo.GetSkillNeedLevel(skillId);
        // 主动技能类型
        if (info.SkillType == (int)ENSkillType.enSkill)
        {
            offset = 100;
        }
        else
        {
            offset = 200;
        }

        // 是否有此技能
        if (!card.HaveSkill(skillId))
        {
            m_skillGetTips.text = string.Format(Localization.Get("SkillUnlockLevel"), needLevel);
            m_skillGetTips.gameObject.SetActive(true);
        }
        else
        {
            m_skillGetTips.gameObject.SetActive(false);
        }



        // 设置内容
        m_tipsSkillName.text  = info.Name;
        m_tipsSkillDes.text   = info.Description;
        m_tipsSkillLevel.text = heroSkillInfo.m_skillLevel.ToString();



        int height = 100;

        height = height + m_tipsSkillDes.height;

        int switchTipsHeight = 100;

        switchTipsHeight = switchTipsHeight + m_tipsSkillDes.height;


        m_comboItem.SetActive(false);

        for (int i = 0; i < m_comboList.Count; i++)
        {
            if (null != m_comboList[i])
            {
                GameObject.Destroy(m_comboList[i]);
            }
        }

        string strSkillType = "";

        // 终结技
        if (info.SkillConnectionType == (int)ENSkillConnectionType.enFinal)
        {
            strSkillType = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enFinalSkill).StringTypeValue;

            m_comboItem.SetActive(true);
            int minCombo = info.MinComboRequir + (int)(info.ComboRequirementParam * heroSkillInfo.m_skillLevel);
            m_comboItem.GetComponent <UILabel>().text = minCombo.ToString();
            WorldParamInfo worldInfo = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enActiveSkill);
            m_comboItem.transform.Find("ComboDes").GetComponent <UILabel>().text = Localization.Get(worldInfo.StringTypeValue);
            height = height + 60;


            Dictionary <int, string> list = GetComboList(skillId);
            int comboMax = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enMaxCombo).IntTypeValue;

            if (list != null)
            {
                int i = 1;
                foreach (KeyValuePair <int, string> item in list)
                {
                    if (i >= comboMax)
                    {
                        break;
                    }
                    GameObject copy = GameObject.Instantiate(m_comboItem) as GameObject;

                    copy.SetActive(true);
                    copy.transform.parent     = m_switchSkillTips.transform;
                    copy.name                 = copy.name + i;
                    copy.transform.localScale = Vector3.one;

                    copy.transform.localPosition = Vector3.zero;

                    copy.GetComponent <UILabel>().text = item.Key.ToString();
                    copy.transform.Find("ComboDes").GetComponent <UILabel>().text = item.Value;
                    height = height + 60;
                    i++;

                    m_comboList.Add(copy);
                }
            }
        }
        else if (info.SkillConnectionType == (int)ENSkillConnectionType.enConnect)
        {
            strSkillType = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enConectSkill).StringTypeValue;
        }
        else if (info.SkillConnectionType == (int)ENSkillConnectionType.enSpecial)
        {
            strSkillType = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enSpecialSkill).StringTypeValue;
        }


        m_tipsSkillType.GetComponent <UILabel>().text = Localization.Get(strSkillType);

        // 设置tips的 大小 主要是高度
        m_tips.GetComponent <UISprite>().height = height;

        // 设置位置
        m_tips.GetComponent <UISprite>().topAnchor.absolute = -offset;

        m_switchSkillTips.GetComponent <UILabel>().topAnchor.absolute = -switchTipsHeight;

        m_switchSkillTips.GetComponent <UIGrid>().Reposition();
    }