public override void _Process(float delta) { if (Orphanage.GetChildCount() > 0) { Orphanage.MouseFilter = MouseFilterEnum.Ignore; QuincyItem item = (QuincyItem)Orphanage.GetChild(0); item.MouseFilter = MouseFilterEnum.Ignore; } }
private void AddItemInstanceToSlot(QuincySlot slot, Item item) { var scene = (PackedScene)ResourceLoader.Load("res://QuincyItem.tscn"); QuincyItem qItem = (QuincyItem)scene.Instance(); slot.AddChild(qItem); slot.Item = qItem; slot.Item.SetItem(item); qItem.Theme = (Theme)ResourceLoader.Load("res://TextureRect.tres"); }
private void _on_TextureRect_gui_input(InputEvent @event) { if (@event is InputEventMouseButton button && button.Pressed && button.ButtonIndex == 1) { if (orphanage.GetChildCount() > 0) { QuincyItem item = (QuincyItem)orphanage.GetChild(0); if (ItemTypes.Contains(item.Item.Type)) { item.Drag = false; item.RectGlobalPosition = Vector2.Zero; orphanage.RemoveChild(item); AddChild(item); TextureRect rect = (TextureRect)GetChild(1).GetChild(0); rect.MouseFilter = MouseFilterEnum.Pass; } } } }