Exemplo n.º 1
0
 /// <summary>
 /// 设置船内容显示
 /// </summary>
 /// <param name="ship"></param>
 public void SetData(IShip ship, bool isList)
 {
     Initialize();
     m_Ship = ship;
     if (isList)
     {
         UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(ship.GetTID()), TableUtil.GetItemIconImage(ship.GetTID()));
     }
     else
     {
         UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(ship.GetTID()), TableUtil.GetItemSquareIconImage(ship.GetTID()));
     }
     m_OverlyingIcon.sprite = m_IconImage.sprite;
     m_NameLabel.text       = TableUtil.GetItemName((int)ship.GetTID());
     m_LvLabel.text         = TableUtil.ShowLevel(ship.GetLv());
     m_Appoint.gameObject.SetActive(ship.GetUID() == m_ShipProxy.GetAppointWarShip().GetUID());
     m_New.gameObject.SetActive(!m_ShipProxy.MarkNew(ship));
 }
Exemplo n.º 2
0
    /// <summary>
    /// 设置船具体属性数据
    /// </summary>
    private void SetShipData()
    {
        InitShipPanel();

        m_ShipPanelEmptyRoot.SetActive(false);
        m_ShipPanelContentRoot.SetActive(true);

        UIUtil.SetIconImage(m_ShipPanelIcon, TableUtil.GetItemIconBundle(m_CurrentShip.GetTID()), TableUtil.GetItemIconImage(m_CurrentShip.GetTID()));
        m_ShipPanelNameText.text      = TableUtil.GetItemName((int)m_CurrentShip.GetTID());
        m_ShipPanelQualityImage.color = ColorUtil.ShipColor.GetColorByPrime(m_CurrentShip.GetConfig().IsPrime > 0);
        m_ShipPanelLvText.text        = "Lv." + PadLeft(m_CurrentShip.GetLv().ToString());

        uint modCount = m_CurrentShip.GetGeneralModContainer().GetCurrentSizeMax() + m_CurrentShip.GetExclusivelyModContainer().GetCurrentSizeMax();

        for (int i = 0; i < m_ShipMods.Length; i++)
        {
            m_ShipMods[i].gameObject.SetActive(i < modCount);
            m_ShipMods[i].transform.GetChild(0).GetComponent <Image>().enabled = false;
        }

        IMod[] mods = m_CurrentShip.GetGeneralModContainer().GetMods();
        if (mods != null && mods.Length > 0)
        {
            for (int i = 0; i < mods.Length; i++)
            {
                m_ShipMods[mods[i].GetPos()].transform.GetChild(0).GetComponent <Image>().enabled = true;
                m_ShipMods[mods[i].GetPos()].transform.GetChild(0).GetComponent <Image>().color   = ColorUtil.GetColorByItemQuality(mods[i].GetBaseConfig().Quality);
            }
        }
        mods = m_CurrentShip.GetExclusivelyModContainer().GetMods();
        uint GeneralModCount = m_CurrentShip.GetGeneralModContainer().GetCurrentSizeMax();

        if (mods != null && mods.Length > 0)
        {
            for (int i = 0; i < mods.Length; i++)
            {
                m_ShipMods[mods[i].GetPos() + GeneralModCount].transform.GetChild(0).GetComponent <Image>().enabled = true;
                m_ShipMods[mods[i].GetPos() + GeneralModCount].transform.GetChild(0).GetComponent <Image>().color   = ColorUtil.GetColorByItemQuality(mods[i].GetBaseConfig().Quality);
            }
        }
    }