Esempio n. 1
0
    public void SetInfo(InventoryItemDTO itemDto, InventoryGridUi gridUi, EquipGrid equipGrid, bool isEquip = false)
    {
        gameObject.SetActive(true);
        InventoryInfo._instance.gameObject.SetActive(false);
        transform.SetAsLastSibling();
        this.itemDto = itemDto;
        image.sprite = Resources.Load <Sprite>("Ui/Inventory/" + itemDto.inventory.icon);
        _name.text   = itemDto.inventory.name;
        if (isEquip)
        {
            this.equipGrid  = equipGrid;
            state.text      = "【已装备】";
            buttonText.text = "卸下";
        }
        else
        {
            this.gridUi     = gridUi;
            state.text      = "【未装备】";
            buttonText.text = "装备";
        }
        att.text = "攻击+" + itemDto.attack;
        def.text = "防御+" + itemDto.def;

        arm.text = "穿甲+" + itemDto.armour;

        exeCrit.text = "免暴+" + itemDto.exemptCrit;

        crit.text = "暴击+" + itemDto.crit;

        speed.text     = "速度+" + itemDto.speed;
        sell.text      = "出售 " + itemDto.inventory.sell;
        quality.text   = "品质 " + itemDto.quality;
        starLevel.text = "星级 " + itemDto.starLevel;
        info.text      = itemDto.inventory.info;
    }
Esempio n. 2
0
    public void ReplaceEquip(SingleObjInfo info, EquipGrid equipGrid)
    {
        SingleObjInfo tempInfo = equipGrid.transform.GetChild(0).GetComponent <EquipItem>().info;

        equipGrid.ReduceProperties(tempInfo);
        Destroy(equipGrid.transform.GetChild(0).gameObject);
        equipGrid.GetEquip(info);
        UIBagManager.Instance.GetItem(tempInfo.id);
    }
Esempio n. 3
0
        private void dgEquip_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            DataGrid     dg     = sender as DataGrid;
            Point        pt     = e.GetPosition(dg);
            DataGridCell dgcell = null;

            VisualTreeHelper.HitTest(dg, null, (result) => {
                DataGridCell cell = FindVisualParent <DataGridCell>(result.VisualHit);
                if (cell != null)
                {
                    dgcell = cell;
                    return(HitTestResultBehavior.Stop);
                }
                else
                {
                    return(HitTestResultBehavior.Continue);
                }
            }, new PointHitTestParameters(pt));

            if (dgcell == null)
            {
                return;
            }
            EquipGrid   ld = dgcell.DataContext as EquipGrid;
            ContextMenu cm = new ContextMenu();

            var datalist = dg.SelectedItems.Cast <EquipGrid>().ToList <EquipGrid>();

            if (!datalist.Contains(ld))
            {
                dg.SelectedItem = ld;
                datalist        = new List <EquipGrid>()
                {
                    ld
                };
            }

            MenuItem mi = new MenuItem();

            mi.Header           = "削除";
            mi.Click           += mi_Click;
            mi.CommandParameter = datalist;
            cm.Items.Add(mi);

            ContextMenuService.SetContextMenu(dgcell, cm);
        }