Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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;
                    }
                }
            }
        }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
 public bool OnTakeOut(UGUIInventoryItemConfig item_config, LocalPlayer local_player)
 {
     return(false);
 }