Exemple #1
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);
            }
        }
    }
    public void OnRefresh(object msg)
    {
        MsgWarshipPanelState data = msg as MsgWarshipPanelState;

        m_BeforeState  = data.BeforeState;
        m_CurrentState = data.State;
        m_CurrentShip  = data.CurrentShip;
        uint count    = 0;
        uint modPosId = 0;

        switch (m_CurrentState)
        {
        case WarshipPanelState.ModMainShip:
            count = m_CurrentShip.GetGeneralModContainer().GetCurrentSizeMax()
                    + m_CurrentShip.GetExclusivelyModContainer().GetCurrentSizeMax();
            modPosId = (uint)m_CurrentShip.GetConfig().ModPosition;
            break;

        case WarshipPanelState.ModMainWeapon:
            m_CurrentWeapon      = data.CurrentWeaponData.Data;
            m_WeaponContainerUID = data.CurrentWeaponData.ContainerUID;
            m_WeaponContainerPOS = data.CurrentWeaponData.ContainerPOS;
            count = data.CurrentWeaponData.Data.GetGeneralModContainer().GetCurrentSizeMax()
                    + data.CurrentWeaponData.Data.GetExclusivelyModContainer().GetCurrentSizeMax();
            modPosId = (uint)data.CurrentWeaponData.Data.GetConfig().ModPosition;
            break;
        }
        SendViewerChange();
        //   SetTips();
        CheckModBtnCount(count, modPosId);
        if (data.CurrentModData != null)
        {
            //SelectMod(data.CurrentModData.ContainerUID, data.CurrentModData.ContainerPOS);
        }
        else
        {
            //SelectMod(m_ModCellList[0]);
        }
        State.SetTipData(null);
        EventSystem.current.SetSelectedGameObject(null);
    }
    /// <summary>
    /// 设置mod按钮list数据
    /// </summary>
    private void SetModBtnListData()
    {
        ModCellOnDeselected(null);
        switch (m_CurrentState)
        {
        case WarshipPanelState.ModMainShip:
            SetShipModOrShipEquipModData(EquipmentModL1.WarshipMod, m_CurrentShip.GetGeneralModContainer(), m_CurrentShip.GetExclusivelyModContainer());
            break;

        case WarshipPanelState.ModMainWeapon:
            SetShipModOrShipEquipModData(EquipmentModL1.WeaponMod, m_CurrentWeapon.GetGeneralModContainer(), m_CurrentWeapon.GetExclusivelyModContainer());
            break;
        }
    }