Esempio n. 1
0
        protected override void OnApply()
        {
            base.OnApply();
            if (CellData == null)
            {
                target.gameObject.SetActive(false);
            }
            else
            {
                equipmentCellData = CellData as PlayerEquipmentCellData;

                target.gameObject.SetActive(true);
                m_ImgIcon.color = Color.black;
                m_ImgIcon.GetComponent <RectTransform>().sizeDelta = GetCellSize() * 0.9f;
                m_TxtName.text = equipmentCellData.item.name;
            }
        }
Esempio n. 2
0
        private void Equip(PlayerEquipmentCellView cellView, Equipment equipment)
        {
            var nowEquipment = cellView.CellData as PlayerEquipmentCellData;

            if (nowEquipment != null)
            {
                GamePlayMgr.S.playerMgr.role.equipComponent.UnEquip(nowEquipment.equipment);
                GFrame.EventSystem.S.Send(EventID.OnAddInventory, new PlayerInventoryCellData(nowEquipment.item));
            }

            var equipCellData = new PlayerEquipmentCellData(equipment);

            ApplyCell(cellView, (int)cellView.slot, equipCellData);
            // Debug.LogError(equipment);
            GamePlayMgr.S.playerMgr.role.equipComponent.Equip(equipment);
            GFrame.EventSystem.S.Send(EventID.OnRefeshAppearance, cellView.slot, equipment, nowEquipment?.equipment);
        }
        public void Init()
        {
            PlayerEquipmentCellData cellData_Helmet    = CreateCellData(InventoryEquipSlot.Helmet);
            PlayerEquipmentCellData cellData_Torso     = CreateCellData(InventoryEquipSlot.Torso);
            PlayerEquipmentCellData cellData_Hands     = CreateCellData(InventoryEquipSlot.Hands);
            PlayerEquipmentCellData cellData_Legs      = CreateCellData(InventoryEquipSlot.Legs);
            PlayerEquipmentCellData cellData_Hips      = CreateCellData(InventoryEquipSlot.Hips);
            PlayerEquipmentCellData cellData_Shoulders = CreateCellData(InventoryEquipSlot.Shoulders);
            PlayerEquipmentCellData cellData_Back      = CreateCellData(InventoryEquipSlot.Back);
            PlayerEquipmentCellData cellData_Weapon    = CreateCellData(InventoryEquipSlot.Weapon);

            m_EquipmentViewData.InsertInventoryItem((int)InventoryEquipSlot.Helmet, cellData_Helmet);
            m_EquipmentViewData.InsertInventoryItem((int)InventoryEquipSlot.Torso, cellData_Torso);
            m_EquipmentViewData.InsertInventoryItem((int)InventoryEquipSlot.Hands, cellData_Hands);
            m_EquipmentViewData.InsertInventoryItem((int)InventoryEquipSlot.Legs, cellData_Legs);
            m_EquipmentViewData.InsertInventoryItem((int)InventoryEquipSlot.Hips, cellData_Hips);
            m_EquipmentViewData.InsertInventoryItem((int)InventoryEquipSlot.Shoulders, cellData_Shoulders);
            m_EquipmentViewData.InsertInventoryItem((int)InventoryEquipSlot.Back, cellData_Back);
            m_EquipmentViewData.InsertInventoryItem((int)InventoryEquipSlot.Weapon, cellData_Weapon);
        }