initial shit
This commit is contained in:
28
GameShit/PlayerController/Hotbar/hotbar_slot.gd
Normal file
28
GameShit/PlayerController/Hotbar/hotbar_slot.gd
Normal file
@@ -0,0 +1,28 @@
|
||||
extends Control
|
||||
|
||||
# Pre-create flat styles to override the engine's default skin
|
||||
var active_style = StyleBoxFlat.new()
|
||||
var inactive_style = StyleBoxFlat.new()
|
||||
|
||||
func _ready():
|
||||
# Configure your exact custom colors
|
||||
active_style.bg_color = Color(0.378, 0.378, 0.378, 0.988)
|
||||
inactive_style.bg_color = Color(0.075, 0.075, 0.075, 0.988)
|
||||
|
||||
func setItem(item, isActive):
|
||||
$TextureRect.texture = item.texture
|
||||
|
||||
if isActive:
|
||||
# Force-override all basic button background states
|
||||
$Button.add_theme_stylebox_override("normal", active_style)
|
||||
$Button.add_theme_stylebox_override("hover", active_style)
|
||||
$Button.add_theme_stylebox_override("pressed", active_style)
|
||||
else:
|
||||
$Button.add_theme_stylebox_override("normal", inactive_style)
|
||||
$Button.add_theme_stylebox_override("hover", inactive_style)
|
||||
$Button.add_theme_stylebox_override("pressed", inactive_style)
|
||||
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
pass # Replace with function body.
|
||||
Reference in New Issue
Block a user