Ejemplo n.º 1
0
 /// <summary>
 /// 刷新item数据
 /// </summary>
 /// <param name="data">数据</param>
 private void RefreshUsingItem(MsgShipDataChanged data)
 {
     if (m_Category == data.ItemType && m_ContainerUID == data.ContainerUid)
     {
         if (data.ChangeType == MsgShipDataChanged.Type.Add)
         {
             m_CurrentItemData = Parent.Data.CurrentShip.GetItem(data.ItemUid);
         }
         else if (data.ChangeType == MsgShipDataChanged.Type.Remove)
         {
             m_CurrentItemData = null;
         }
         m_CurrentSelectedItemData = null;
         RefreshCurrentAllCells();
     }
 }
Ejemplo n.º 2
0
    protected override void OnViewPartLoaded()
    {
        base.OnViewPartLoaded();
        m_UIScrollRect = FindComponent <UIScrollRect>("Content/Scroller");
        m_UIScrollRect.SetSelection(new Vector2Int(0, 0));
        ClearData();
        m_Items = new List <ItemBase>();
        switch (Parent.Data.State)
        {
        case WarshipPanelState.ListWeapon:
            m_Category        = Category.Weapon;
            m_CurrentItemData = Parent.Data.CurrentWeaponData.Data;
            m_ContainerUID    = Parent.Data.CurrentWeaponData.ContainerUID;
            m_ContainerPOS    = Parent.Data.CurrentWeaponData.ContainerPOS;
            break;

        case WarshipPanelState.ListReformer:
            m_Category        = Category.Reformer;
            m_CurrentItemData = Parent.Data.CurrentReformerData.Data;
            m_ContainerUID    = Parent.Data.CurrentReformerData.ContainerUID;
            m_ContainerPOS    = Parent.Data.CurrentReformerData.ContainerPOS;
            break;

        case WarshipPanelState.ListEquip:
            m_Category        = Category.Equipment;
            m_CurrentItemData = Parent.Data.CurrentEquipmentData.Data;
            m_ContainerUID    = Parent.Data.CurrentEquipmentData.ContainerUID;
            m_ContainerPOS    = Parent.Data.CurrentEquipmentData.ContainerPOS;
            break;

        case WarshipPanelState.ListMod:
            m_Category                  = Category.EquipmentMod;
            m_CurrentWeapon             = Parent.Data.CurrentWeaponData.Data;
            m_CurrentWeaponContainerUID = Parent.Data.CurrentWeaponData.ContainerUID;
            m_CurrentWeaponContainerPOS = Parent.Data.CurrentWeaponData.ContainerPOS;
            m_CurrentItemData           = Parent.Data.CurrentModData.Data;
            m_ContainerUID              = Parent.Data.CurrentModData.ContainerUID;
            m_ContainerPOS              = Parent.Data.CurrentModData.ContainerPOS;
            if (Parent.Data.BeforeState == WarshipPanelState.ModMainShip)
            {
                SendViewerChange(Parent.Data.CurrentShip.GetTID(), true);
            }
            else
            {
                SendViewerChange(m_CurrentWeapon.GetTID(), false);
            }
            break;
        }

        m_ItemsDic = PackageProxy.GetPackage(m_Category).Items;
        if (m_ItemsDic != null && m_ItemsDic.Count > 0)
        {
            foreach (var item in m_ItemsDic)
            {
                switch (m_Category)
                {
                case Category.Weapon when m_ContainerPOS == 0 && Parent.Data.CurrentShip.GetWarShipType() == WarshipL1.FightWarship && (item.Value as ItemWeaponVO).WeaponType1 == WeaponL1.Fighting:
                case Category.Weapon when m_ContainerPOS == 0 && Parent.Data.CurrentShip.GetWarShipType() == WarshipL1.MiningShip && (item.Value as ItemWeaponVO).WeaponType1 == WeaponL1.Mining:
                case Category.Weapon when m_ContainerPOS == 0 && Parent.Data.CurrentShip.GetWarShipType() == WarshipL1.SurveillanceShip && (item.Value as ItemWeaponVO).WeaponType1 == WeaponL1.Treasure:
                case Category.Weapon when m_ContainerPOS != 0 && (item.Value as ItemWeaponVO).WeaponType1 == WeaponL1.Fighting:
                case Category.Reformer:
                case Category.Equipment when(item.Value as ItemEquipmentVO).EquipmentType == (EquipmentL1)(m_ContainerPOS + 1):
                case Category.EquipmentMod when(item.Value as ItemModVO).ModType1 == Parent.Data.CurrentModData.ModType1 && (item.Value as ItemModVO).ModType2 == Parent.Data.CurrentModData.ModType2:
                    m_Items.Add(item.Value);

                    break;
                }
            }
        }
        AddDatas(null, m_Items.ToArray());
        ShowCharacter();
    }