* Changement de l'UI, ajouts de l'inspecteur par carte et changement de police * Ajout d'un semblant d'exploration * Ajout de la sauvegarde des entités * Restructuration mineure de l'arborescence * Fix divers et réécriture des textes
100 lines
2.4 KiB
GDScript
100 lines
2.4 KiB
GDScript
extends Control
|
|
class_name Inspector
|
|
|
|
const FRAMED_INFO_SCENE : PackedScene = preload("res://gui/game/inspector/framed_info/framed_info.tscn")
|
|
const STAT_INFO_SCENE : PackedScene = preload("res://gui/game/inspector/stat_info/stat_info.tscn")
|
|
|
|
var info : Info = null :
|
|
set(i):
|
|
info = i
|
|
update_info(i)
|
|
|
|
func _ready():
|
|
update_info(info)
|
|
Pointer.connect("inspected_changed", _on_inspected_changed)
|
|
|
|
func _on_inspected_changed(i : Inspector.Info):
|
|
info = i
|
|
|
|
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
|
|
%Desc.visible = i.description != ""
|
|
update_framed_infos(info.framed_infos)
|
|
update_stat_info(info.stat_infos)
|
|
|
|
func update_framed_infos(framed_infos : Array[FramedInfo]):
|
|
for c in %FramedInfos.get_children() :
|
|
c.queue_free()
|
|
for i in range(len(framed_infos)):
|
|
var frame_info_object = FRAMED_INFO_SCENE.instantiate()
|
|
%FramedInfos.add_child(frame_info_object)
|
|
frame_info_object.framed_info = framed_infos[i]
|
|
|
|
func update_stat_info(stat_infos):
|
|
%StatInfos.visible = len(stat_infos) != 0
|
|
for c in %StatInfos.get_children() :
|
|
c.queue_free()
|
|
for i in range(len(stat_infos)):
|
|
var stat_inof_object = STAT_INFO_SCENE.instantiate()
|
|
%StatInfos.add_child(stat_inof_object)
|
|
stat_inof_object.stat_info = stat_infos[i]
|
|
|
|
class Info:
|
|
var title : String = ""
|
|
var texture: Texture = null
|
|
var description : String = ""
|
|
var framed_infos : Array[Inspector.FramedInfo] = []
|
|
var stat_infos = []
|
|
|
|
func _init(
|
|
_title : String = "",
|
|
_description : String = "",
|
|
_texture : Texture = null,
|
|
):
|
|
title = _title
|
|
description = _description
|
|
texture = _texture
|
|
|
|
func add_framed_info(framed_info : Inspector.FramedInfo):
|
|
framed_infos.push_front(framed_info)
|
|
|
|
func add_stat_info(s_info : Inspector.StatInfo):
|
|
stat_infos.push_front(s_info)
|
|
|
|
|
|
class FramedInfo:
|
|
var title : String
|
|
var icon: Texture
|
|
var description : String
|
|
var bg_color : Color
|
|
|
|
func _init(
|
|
_title : String = "",
|
|
_desc : String = "",
|
|
_icon : Texture = null,
|
|
_bg_color : Color = Color("0B1326")
|
|
):
|
|
title = _title
|
|
description = _desc
|
|
icon = _icon
|
|
bg_color = _bg_color
|
|
|
|
class StatInfo:
|
|
var text : String
|
|
var icon: Texture
|
|
|
|
func _init(
|
|
_text : String = "",
|
|
_icon : Texture = null,
|
|
):
|
|
text = _text
|
|
icon = _icon
|