コード例 #1
0
ファイル: UIGemInLayGrid.cs プロジェクト: zuojiashun/src
    /// <summary>
    /// 刷新格子数据
    /// </summary>
    public void UpdateGridData(GameCmd.EquipPos selectPos)
    {
        Reset();
        EquipManager emgr        = DataManager.Manager <EquipManager>();
        uint         inlayBaseId = 0;

        if (emgr.TryGetEquipGridInlayGem(selectPos, data, out inlayBaseId))
        {
            Gem gem = DataManager.Manager <ItemManager>()
                      .GetTempBaseItemByBaseID <Gem>(inlayBaseId, ItemDefine.ItemDataType.Gem);
            if (null != m_spIcon)
            {
                if (!m_spIcon.gameObject.activeSelf)
                {
                    m_spIcon.gameObject.SetActive(true);
                }
                UIManager.GetTextureAsyn(gem.Icon, ref m_inlayCASD, () =>
                {
                    if (null != m_spIcon)
                    {
                        m_spIcon.mainTexture = null;
                    }
                }, m_spIcon);
            }

            if (null != m_spBorder)
            {
                if (!m_spBorder.gameObject.activeSelf)
                {
                    m_spBorder.gameObject.SetActive(true);
                }
                string iconName = UIManager.GetIconName(gem.BorderIcon, true);
                UIManager.GetAtlasAsyn(iconName, ref m_borderCASD, () =>
                {
                    if (null != m_spBorder)
                    {
                        m_spBorder.atlas = null;
                    }
                }, m_spBorder);
            }

            if (null != m_labLv)
            {
                if (!m_labLv.enabled)
                {
                    m_labLv.enabled = true;
                }
                m_labLv.text = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Local_Txt_Set_4, gem.BaseData.grade);
            }
        }
        else if (emgr.IsUnlockEquipGridIndex(data))
        {
            if (null != m_tsAdd)
            {
                m_tsAdd.gameObject.SetActive(true);
            }
        }
        else
        {
            if (null != m_tsLock)
            {
                m_tsLock.gameObject.SetActive(true);
                m_labLockLv.text = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Local_Txt_Set_4
                                                                                          , emgr.GetEquipGridUnlockLevel(data));
            }
        }
        bool showRed = DataManager.Manager <ForgingManager>().EquipPosCanInlay(selectPos, this.data);

        SetRedPointStatus(showRed);
    }