seeding-planets/gui/game/inspector/scripts/inspector.gd

35 lines
611 B
GDScript

extends Control
class_name Inspector
var info : Info = null :
set(i):
info = i
update_info(i)
func _ready():
update_info(info)
func update_info(i : Info):
if i == null:
visible = false
else :
visible = true
if i.texture:
%Texture.texture = i.texture
%Texture.visible = i.texture != null
%Title.text = i.title
%Desc.text = i.description
class Info:
var title : String
var texture: Texture
var description : String
func _init(
_title : String = "",
_description : String = "",
_texture : Texture = null,
):
title = _title
description = _description
texture = _texture