mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-12-19 03:14:42 -05:00
Merged "Scripts" and "Prefabs" folders into "src"
Made a new "src" folder that will contain the source code files, like all the GDScript and scene files. Please read this for more details: https://www.gdquest.com/docs/guidelines/best-practices/godot-gdscript/ It made no sense to keep scenes separate from their scripts. More file organizing will follow soon.
This commit is contained in:
parent
5a54235604
commit
646fc19a70
63 changed files with 135 additions and 113 deletions
27
src/Palette/PaletteButton.gd
Normal file
27
src/Palette/PaletteButton.gd
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
extends Button
|
||||
signal on_drop_data
|
||||
|
||||
export var index := 0;
|
||||
export var color : Color = Color.white
|
||||
export var draggable := false
|
||||
|
||||
var drag_preview_texture = preload("res://Assets/Graphics/Palette/swatch_drag_preview.png")
|
||||
|
||||
|
||||
func get_drag_data(_position):
|
||||
var data = null
|
||||
if draggable:
|
||||
data = {source_index = index}
|
||||
var drag_icon = TextureRect.new()
|
||||
drag_icon.texture = drag_preview_texture
|
||||
drag_icon.modulate = color
|
||||
set_drag_preview(drag_icon)
|
||||
return data
|
||||
|
||||
|
||||
func can_drop_data(_position, _data) -> bool:
|
||||
return true
|
||||
|
||||
|
||||
func drop_data(_position, data) -> void:
|
||||
emit_signal("on_drop_data", data.source_index, index)
|
||||
Loading…
Add table
Add a link
Reference in a new issue