private void Update() { if (Input.GetKeyDown(KeyCode.X)) { GetID(Random.Range(2001, 2023)); } Vector2 position; RectTransformUtility.ScreenPointToLocalPointInRectangle (GameObject.Find("Bag").transform as RectTransform, Input.mousePosition, uiCamera, out position); if (isDrag) { dragItem.SetLocalPositon(position); } if (showingDec) { itemDecUI.SetLocalPosition(position); } //按下右键穿戴装备 or 使用药水 if (Input.GetMouseButtonDown(1) && dressGrid != null) { if (dressGrid.id != 0) { switch (dressGrid.info.type) { case objectType.Drug: break; case objectType.Equip: //穿戴装备 dressSuccess = Equipment._instanceEquip.DressEquipment(dressGrid.info); if (dressSuccess) { if (dressGrid.count > 1) //判断装备数量 大于1则数量减一更新显示 { dressGrid.count--; dressGrid.itemCount.text = dressGrid.count.ToString() ; } else { //如果装备数量为1 则删除图标并清空格子 Destroy(dressGrid.transform.GetChild(1).gameObject); dressGrid.Clear(); } } break; } } } }