fb8a3f5658
- Introduced exact arithmetic with support for large integers and fractions in `exact.gd`, `big_integer.gd`, and `exact_value.gd`. - Implemented a comprehensive test suite in `test_exact_math.gd` to validate arithmetic operations against expected results. - Added a README in `math` directory to document the exact arithmetic system and its usage. - Ensured that all arithmetic operations maintain precision without floating-point errors, using a custom representation for large numbers. - Included methods for encoding and decoding exact values for serialization.
47 lines
1.2 KiB
GDScript
47 lines
1.2 KiB
GDScript
extends Control
|
|
class_name OwniverseItem
|
|
|
|
signal item_activated(item)
|
|
|
|
const ENTITY_WIDTH = 216
|
|
const ENTITY_HEIGHT = 256
|
|
|
|
|
|
@onready var texture_button: TextureButton = $TextureButton
|
|
@onready var description: Label = $Description
|
|
@onready var selection: TextureRect = $Selection
|
|
|
|
|
|
var item_id: String = ""
|
|
var item_name: String = ""
|
|
var item_page: int = -1
|
|
var item_sub_page: int = -1
|
|
var item_type = ""
|
|
|
|
|
|
func set_label(value) -> void:
|
|
var text: String = Global.format_number(value)
|
|
if description.text != text:
|
|
description.text = text
|
|
#description.text = str(value)
|
|
|
|
|
|
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)
|
|
item_id = properties.id
|
|
item_name = properties.name
|
|
item_page = int(properties.page)
|
|
item_sub_page = int(properties.sub_page)
|
|
name = properties.id
|
|
|
|
|
|
func _on_button_up() -> void:
|
|
set_selection(true)
|
|
item_activated.emit(self)
|