protected override void OnViewPartLoaded()
    {
        base.OnViewPartLoaded();
        ShowCharacter();
        OwnerView.PageBox.gameObject.SetActive(false);

        m_UIScrollRect = FindComponent <UIScrollRect>("Content/Scroller");
        ProduceDialogBasePanel produceDialogBasePanel = OwnerView as ProduceDialogBasePanel;

        if (produceDialogBasePanel.CloseByEsc)
        {
            //State.GetPage(0).ListSelection = new Vector2Int(0, 0);
            m_UIScrollRect.SetSelection(new Vector2Int(0, 0));
            produceDialogBasePanel.CloseByEsc = false;
        }
        switch (produceDialogBasePanel.CurrentProduceType)
        {
        case ProduceType.HeavyWeapon:
        case ProduceType.Reformer:
        case ProduceType.Device:
        case ProduceType.Ship:
            m_UIScrollRect.CellListPadding = new RectOffset(0,
                                                            m_UIScrollRect.CellListPadding.right,
                                                            m_UIScrollRect.CellListPadding.top,
                                                            m_UIScrollRect.CellListPadding.bottom);
            break;

        case ProduceType.Chip:
            m_UIScrollRect.CellListPadding = new RectOffset(170,
                                                            m_UIScrollRect.CellListPadding.right,
                                                            m_UIScrollRect.CellListPadding.top,
                                                            m_UIScrollRect.CellListPadding.bottom);
            break;

        default:
            break;
        }
    }
Пример #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();
    }