public void OnChoosePack(int _grid) //从背包里拖动东西时调用 { PackEntity pack = PackDatabaseMgr.CheckGrid(_grid); if (pack != null) { dragPack = pack; DragView.DragInstance.CreateMouseItem(ItemDatabaseMgr.Find(dragPack.itemID).name, ItemDatabaseMgr.Find(dragPack.itemID).sprite, pack.count); } }
public void UpdatePackView(int _grid) { PackEntity waitUpdatePack = PackDatabaseMgr.CheckGrid(_grid); if (waitUpdatePack != null) { packViewList[_grid].sprite = ItemDatabaseMgr.Find(waitUpdatePack.itemID).sprite; packViewList[_grid].color = Color.white; packViewList[_grid].transform.GetChild(0).GetComponent <Text>().text = waitUpdatePack.count.ToString(); } else { packViewList[_grid].sprite = null; packViewList[_grid].color = new Color(1, 1, 1, 0); packViewList[_grid].transform.GetChild(0).GetComponent <Text>().text = ""; } }
// Update is called once per frame void Update() { foreach (PackEntity packs in PackDatabaseMgr.List().Values) { if (packs.itemID != "") { print("背包格子:" + packs.grid + "商品名字:" + ItemDatabaseMgr.Find(packs.itemID).name + "数量:" + packs.count); } } if (dragItem != null) { print("DragItem:" + dragItem.name); } if (dragPack != null) { print("DragPack:" + ItemDatabaseMgr.Find(dragPack.itemID).name); } }
public void OnChooseItem(string _uuid) //从商店里拖动开始时调用 { dragItem = ItemDatabaseMgr.Find(_uuid) as BoxItem; //找到拖动的item在Model里的数据 DragView.DragInstance.CreateMouseItem(dragItem.name, dragItem.sprite); //调用View生成鼠标实例 }