示例#1
0
    /// <summary>
    /// 初始化装备格子
    /// </summary>
    /// <param name="pos"></param>
    public void InitEquipGrid(GameCmd.EquipPos pos)
    {
        m_emEPos = pos;
        bool visible = (m_emEPos != GameCmd.EquipPos.EquipPos_SoulOne &&
                        m_emEPos != GameCmd.EquipPos.EquipPos_SoulTwo &&
                        m_emEPos != GameCmd.EquipPos.EquipPos_None);

        if (null != m_tsStrengthen && m_tsStrengthen.gameObject.activeSelf != visible)
        {
            m_tsStrengthen.gameObject.SetActive(visible);
        }
        SetPreView(EquipDefine.GetEquipPartIcon(pos));
    }
示例#2
0
    /// <summary>
    /// 刷新
    /// </summary>
    private void UpdateStrengthen()
    {
        if (m_emSelectInlayPos == GameCmd.EquipPos.EquipPos_None)
        {
            return;
        }
        bool isMax = emgr.IsGridStrengthenMax(m_emSelectInlayPos);

        if (null != m_label_ActiveSuitLvTxt)
        {
            m_label_ActiveSuitLvTxt.text = emgr.ActiveStrengthenSuitLv.ToString();
        }
        if (null != m_strengthen)
        {
            bool equipGrid = false;
            uint equipId   = 0;

            if (emgr.IsEquipPos(m_emSelectInlayPos, out equipId))
            {
                equipGrid = true;
            }
            equipGrid = equipGrid && !isMax;
            if (m_strengthen.gameObject.active != equipGrid)
            {
                m_strengthen.SetVisible(equipGrid);
            }

            if (equipGrid)
            {
                m_strengthen.SetGridData(equipId);
            }
        }

        if (null != m_label_StrengthenPosName)
        {
            m_label_StrengthenPosName.text = string.Format("{0}.部位", EquipDefine.GetEquipPosName(m_emSelectInlayPos));
        }

        if (null != m_sprite_StrengthenPosIcon)
        {
            m_sprite_StrengthenPosIcon.spriteName = EquipDefine.GetEquipPartIcon(m_emSelectInlayPos);
            m_sprite_StrengthenPosIcon.MakePixelPerfect();
        }

        //强化属性提升
        bool enable = !isMax;

        EquipDefine.LocalGridStrengthenData next = (enable)? emgr.GetNextStrengthDataByPos(m_emSelectInlayPos) : null;
        if (null != m_label_StrengthenCurLv)
        {
            if (m_label_StrengthenCurLv.gameObject.activeSelf != enable)
            {
                m_label_StrengthenCurLv.gameObject.SetActive(enable);
            }
            if (enable)
            {
                m_label_StrengthenCurLv.text = string.Format("强化 {0}级", emgr.GetGridStrengthenLvByPos(m_emSelectInlayPos));
            }
        }

        if (null != m_label_StrengthenTargetLv)
        {
            if (m_label_StrengthenTargetLv.gameObject.activeSelf != enable)
            {
                m_label_StrengthenTargetLv.gameObject.SetActive(enable);
            }
            if (enable)
            {
                m_label_StrengthenTargetLv.text = string.Format("强化 {0}级", emgr.GetGridStrengthenLvByPos(m_emSelectInlayPos) + 1);
            }
        }


        if (null != m_label_StrengthenMaxLv)
        {
            if (m_label_StrengthenMaxLv.gameObject.activeSelf != isMax)
            {
                m_label_StrengthenMaxLv.gameObject.SetActive(isMax);
            }
            if (isMax)
            {
                m_label_RefineMaxLv.text = string.Format("强化 {0}级", emgr.GetGridStrengthenLvByPos(m_emSelectInlayPos));;
            }
        }

        List <EquipDefine.EquipBasePropertyData> curBaseProData  = (null != StrengthenData) ? StrengthenData.BaseProp : null;
        List <EquipDefine.EquipBasePropertyData> nextBaseProData = (enable) ?
                                                                   emgr.GetNextStrengthDataByPos(m_emSelectInlayPos).BaseProp : null;

        Transform content        = null;
        Transform max            = null;
        bool      propertyenable = false;

        if (null != m_trans_StrengthenEquipProperty1)
        {
            propertyenable = (null != curBaseProData) && (curBaseProData.Count > 0) ||
                             (null != nextBaseProData) && (nextBaseProData.Count > 0);
            if (m_trans_StrengthenEquipProperty1.gameObject.activeSelf != propertyenable)
            {
                m_trans_StrengthenEquipProperty1.gameObject.SetActive(propertyenable);
            }

            if (propertyenable)
            {
                content = m_trans_StrengthenEquipProperty1.Find("Content");
                max     = m_trans_StrengthenEquipProperty1.Find("Max");

                if (content.gameObject.activeSelf != enable)
                {
                    content.gameObject.SetActive(enable);
                }
                if (enable)
                {
                    content.Find("Name").GetComponent <UILabel>().text
                        = ((null != curBaseProData && curBaseProData.Count > 0) ? curBaseProData[0].Name : nextBaseProData[0].Name);
                    content.Find("CurValue").GetComponent <UILabel>().text
                        = "+" + ((null != curBaseProData && curBaseProData.Count > 0) ? curBaseProData[0].ToString() : "0");
                    content.Find("TargetValue").GetComponent <UILabel>().text = "+" + nextBaseProData[0].ToString();
                }
                if (max.gameObject.activeSelf == enable)
                {
                    max.gameObject.SetActive(!enable);
                }

                if (!enable)
                {
                    max.Find("AttrTxt").GetComponent <UILabel>().text = string.Format("{0} +{1}"
                                                                                      , curBaseProData[0].Name
                                                                                      , curBaseProData[0]);
                }
            }
        }

        if (null != m_trans_StrengthenEquipProperty2)
        {
            propertyenable = (null != curBaseProData) && (curBaseProData.Count > 1) ||
                             (null != nextBaseProData) && (nextBaseProData.Count > 1);
            if (m_trans_StrengthenEquipProperty2.gameObject.activeSelf != propertyenable)
            {
                m_trans_StrengthenEquipProperty2.gameObject.SetActive(propertyenable);
            }

            if (propertyenable)
            {
                content = m_trans_StrengthenEquipProperty2.Find("Content");
                max     = m_trans_StrengthenEquipProperty2.Find("Max");

                if (content.gameObject.activeSelf != enable)
                {
                    content.gameObject.SetActive(enable);
                }
                if (enable)
                {
                    content.Find("Name").GetComponent <UILabel>().text
                        = ((null != curBaseProData && curBaseProData.Count > 1) ? curBaseProData[1].Name : nextBaseProData[1].Name);
                    content.Find("CurValue").GetComponent <UILabel>().text
                        = "+" + ((null != curBaseProData && curBaseProData.Count > 1) ? curBaseProData[1].ToString() : "0");
                    content.Find("TargetValue").GetComponent <UILabel>().text = "+" + nextBaseProData[1].ToString();
                }
                if (max.gameObject.activeSelf == enable)
                {
                    max.gameObject.SetActive(!enable);
                }

                if (!enable)
                {
                    max.Find("AttrTxt").GetComponent <UILabel>().text = string.Format("{0} +{1}"
                                                                                      , curBaseProData[1].Name
                                                                                      , curBaseProData[1]);
                }
            }
        }

        if (null != m_trans_StrengthenMax)
        {
            if (m_trans_StrengthenMax.gameObject.activeSelf != isMax)
            {
                m_trans_StrengthenMax.gameObject.SetActive(isMax);
            }
        }

        //设置消耗材料
        SetStrengthenCostMaterial();
        //设置消耗钱币
        SetStrengthenCost();
        RefreshBtnState();
    }
示例#3
0
    public void SetGridViewData(GameCmd.EquipPos pos, bool inlay = false)
    {
        this.data = pos;
        if (null != m_labName)
        {
            m_labName.text = string.Format("{0}.部位", EquipDefine.GetEquipPosName(this.data));
        }

        if (null != gemHoleContent && gemHoleContent.activeSelf != inlay)
        {
            gemHoleContent.gameObject.SetActive(inlay);
        }

        if (null != m_labStrengthenDes && m_labStrengthenDes.gameObject.activeSelf == inlay)
        {
            m_labStrengthenDes.gameObject.SetActive(!inlay);
        }
        uint StrengthenLv = 0;

        if (!inlay)
        {
            StrengthenLv            = DataManager.Manager <EquipManager>().GetGridStrengthenLvByPos(this.data);
            m_labStrengthenDes.text = string.Format("强化 {0}级"
                                                    , StrengthenLv);
        }

        uint equipId = 0;
        bool equip   = DataManager.Manager <EquipManager>().IsEquipPos(this.data, out equipId);

        ResetInfoGrid(equip);
        if (equip)
        {
            Equip itemData = DataManager.Manager <ItemManager>().GetBaseItemByQwThisId <Equip>(equipId);
            SetIcon(true, itemData.Icon);
            SetBorder(true, itemData.BorderIcon);
            SetBindMask(itemData.IsBind);

            uint particleID = DataManager.Manager <EquipManager>().GetEquipParticleIDByStrengthenLevel(StrengthenLv);
            AddParticle(particleID);
        }
        else
        {
            if (particle != null)
            {
                particle.ReleaseParticle();
            }
        }
        if (null != icon)
        {
            if (icon.gameObject.activeSelf == equip)
            {
                icon.gameObject.SetActive(equip);
            }
            if (!equip)
            {
                string iconName = EquipDefine.GetEquipPartIcon(this.data);
                UIManager.GetAtlasAsyn(iconName, ref m_bgIcon, () =>
                {
                    if (null != icon)
                    {
                        icon.atlas = null;
                    }
                }, icon);
            }
        }
        bool match = false;

        if (inlay)
        {
            for (EquipManager.EquipGridIndexType i = EquipManager.EquipGridIndexType.First; i < EquipManager.EquipGridIndexType.Max; i++)
            {
                if (DataManager.Manager <ForgingManager>().EquipPosCanInlay(this.data, i))
                {
                    match = true;
                }
            }
        }
        else
        {
            match = DataManager.Manager <ForgingManager>().JudgeEquipPosCanStrengthen(this.data);
        }
        SetRedPointStatus(match);
    }