Image loader, datetime
This commit is contained in:
BIN
Binary file not shown.
@@ -0,0 +1,39 @@
|
||||
extends Control
|
||||
class_name OwniverseEntity
|
||||
|
||||
signal entity_activated(entity)
|
||||
|
||||
const ENTITY_WIDTH = 216
|
||||
const ENTITY_HEIGHT = 256
|
||||
|
||||
@onready var texture_button: TextureButton = $TextureButton
|
||||
@onready var description: Label = $Description
|
||||
@onready var selection: TextureRect = $Selection
|
||||
|
||||
@export var entity_name: String = ""
|
||||
@export var entity_id: String = ""
|
||||
@export var entity_page: int = -1
|
||||
@export var sub_page: int = -1
|
||||
|
||||
|
||||
func set_selection(flag: bool) -> void:
|
||||
selection.visible = flag
|
||||
|
||||
|
||||
func init_button(properties: Dictionary):
|
||||
var image_path = "res://" + properties.image + properties.name + ".png"
|
||||
texture_button.texture_normal = load(image_path)
|
||||
position = Vector2i(int(properties.col) * ENTITY_WIDTH, int(properties.row) * ENTITY_HEIGHT)
|
||||
entity_id = properties.id
|
||||
entity_name = properties.name
|
||||
entity_page = int(properties.page)
|
||||
sub_page = int(properties.sub_page)
|
||||
name = properties.id
|
||||
set_selection(false)
|
||||
#print(properties)
|
||||
|
||||
|
||||
func _on_button_up() -> void:
|
||||
set_selection(true)
|
||||
entity_activated.emit(self)
|
||||
#Texture_button.texture_normal = load("res://UI/0-Forces/Inflatin.png")
|
||||
@@ -0,0 +1 @@
|
||||
uid://bxxllddlgurus
|
||||
@@ -0,0 +1,32 @@
|
||||
[gd_scene format=3 uid="uid://d3xjfxwe3w16v"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bxxllddlgurus" path="res://UI/ItemButton/item_button.gd" id="1_e6ro1"]
|
||||
[ext_resource type="Texture2D" uid="uid://56w57w6iu3np" path="res://UI/ItemButton/Selected.png" id="2_eurq3"]
|
||||
|
||||
[node name="Button" type="Control" unique_id=667620208]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 260.0
|
||||
script = ExtResource("1_e6ro1")
|
||||
|
||||
[node name="TextureButton" type="TextureButton" parent="." unique_id=1377839155]
|
||||
custom_minimum_size = Vector2(216, 216)
|
||||
layout_mode = 0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 216.0
|
||||
|
||||
[node name="Description" type="Label" parent="." unique_id=1488477178]
|
||||
custom_minimum_size = Vector2(216, 40)
|
||||
layout_mode = 0
|
||||
offset_top = 220.0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 260.0
|
||||
|
||||
[node name="Selection" type="TextureRect" parent="." unique_id=674793134]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
texture = ExtResource("2_eurq3")
|
||||
|
||||
[connection signal="button_up" from="TextureButton" to="." method="_on_button_up"]
|
||||
Reference in New Issue
Block a user