public override void OnInteracted(LocalPlayer toucher) { int item_id = inventory_data.item_id; UGUIInventoryItemConfig info = GameSettings.GetInventoryItemConfig(item_id); int max_stack = info.max_stack; EInventoryOperateResult result = toucher.inventory.TryAddItem(item_id, ref inventory_data.count, max_stack); Debug.Log("Pick up result " + result); if (result == EInventoryOperateResult.Success) { GameObject.Destroy(this.gameObject); } }
public void TakeOut(UGUIInventoryItemConfig item_info, int short_cut_index) { //不管三七二十一,先收起旧的 PutAway(); active_swift_inventory_index = short_cut_index; if (item_info != null) { for (int i = 0; i < swift_inventory_takeout_handler.Count; i++) { if (swift_inventory_takeout_handler[i].OnTakeOut(item_info, this) == true) { break; } } } }
void OnPressShootCut(int short_cut_index) { if (local_player.OnSwiftInventoryUpdate == null) { local_player.OnSwiftInventoryUpdate = LoadInventory; } InventoryItemData item_data = inventory_data[short_cut_index]; if (item_data != null && item_data.count > 0) { UGUIInventoryItemConfig item_config = GameSettings.GetInventoryItemConfig(item_data.item_id); local_player.TakeOut(item_config as BuildingBlockConfig, short_cut_index); } else { local_player.TakeOut(null, short_cut_index); } }
public bool OnTakeOut(UGUIInventoryItemConfig item_config, LocalPlayer local_player) { if (item_config.GetType() == typeof(BuildingBlockConfig)) { GameObject gobj = GameObject.Instantiate(item_config.prefab); BuildingBlockParams bbp = local_player.building_block_params; BuildingObject bo = gobj.GetComponent <BuildingObject>(); BuildingBlockConfig bbi = item_config as BuildingBlockConfig; if (bo != null && bbi != null) { bbp.placing_building_detector.AttachPendingDropBuilding(bo, bbi); bbp.building_block_orb_distance = bbi.drop_orb_distance; } } return(false); }
public bool OnTakeOut(UGUIInventoryItemConfig item_config, LocalPlayer local_player) { return(false); }