EDIT diverse correction/ameliorations.

This commit is contained in:
osquallo 2020-04-01 21:02:49 +02:00
parent c71b983694
commit 04fa1488d0
41 changed files with 350 additions and 116 deletions

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 520 B

View file

Before

Width:  |  Height:  |  Size: 674 B

After

Width:  |  Height:  |  Size: 674 B

View file

Before

Width:  |  Height:  |  Size: 604 B

After

Width:  |  Height:  |  Size: 604 B

View file

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 605 B

View file

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 514 B

BIN
addons/kh_window/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View file

@ -115,7 +115,6 @@ func _enter_tree():
background.patch_margin_bottom = 4
background.self_modulate = background_color
self.add_window_part( background )
# background.set_owner( self )
###
@ -174,7 +173,7 @@ func _enter_tree():
var tex_quit = ImageTexture.new()
var img_quit = Image.new()
var stream_texture = load( "res://addons/ui_window/button_quit.png")
var stream_texture = load( "res://addons/kh_window/button_quit.png")
img_quit = stream_texture.get_data()
tex_quit.create_from_image( img_quit )
quit_button.texture_normal = tex_quit
@ -193,7 +192,7 @@ func _enter_tree():
var tex_close = ImageTexture.new()
var img_close = Image.new()
var stream_texture = load("res://addons/ui_window/button_close.png")
var stream_texture = load("res://addons/kh_window/button_close.png")
img_close = stream_texture.get_data()
tex_close.create_from_image( img_close )
close_button.texture_normal = tex_close
@ -212,7 +211,7 @@ func _enter_tree():
var tex_open = ImageTexture.new()
var img_open = Image.new()
var stream_texture = load("res://addons/ui_window/button_open.png")
var stream_texture = load("res://addons/kh_window/button_open.png")
img_open = stream_texture.get_data()
tex_open.create_from_image( img_open )
open_button.texture_normal = tex_open
@ -332,15 +331,16 @@ func _enter_tree():
var tex_resize = ImageTexture.new()
var img_resize = Image.new()
var stream_texture = load("res://addons/ui_window/button_resize.png")
var stream_texture = load("res://addons/kh_window/button_resize.png")
img_resize = stream_texture.get_data()
tex_resize.create_from_image( img_resize )
resize_button.texture_normal = tex_resize
resize_button.mouse_default_cursor_shape = CURSOR_FDIAGSIZE
resize_button.action_mode = Button.ACTION_MODE_BUTTON_PRESS
# resize_button.mouse_filter = MOUSE_FILTER_STOP
footer.add_child( resize_button )
# resize_button.set_owner( footer )
resize_button.connect ( "pressed", self, "_on_Resize_pressed" )
resize_button.connect ( "button_down", self, "_on_Resize_pressed" )
###er_label.set_owner( footer )
###
@ -417,20 +417,24 @@ func get_footer():
func close():
if not is_borderless:
header_box.get_node( "header/close" ).visible = false
header_box.get_node( "header/open" ).visible = true
content_box.visible = false
footer_box.visible = false
current_rect_size = self.rect_size
if not self.is_borderless:
self.header_box.get_node( "header/close" ).visible = false
self.header_box.get_node( "header/open" ).visible = true
self.content_box.visible = false
self.footer_box.visible = false
self.current_rect_size = self.rect_size
self.rect_size = Vector2( 0, 0 )
$background.rect_size = Vector2( 0, 0 )
$background.rect_min_size = Vector2( 0, 0 )
else:
header_box.get_node( "header/close" ).visible = false
header_box.get_node( "header/open" ).visible = false
content_box.visible = false
footer_box.visible = false
current_rect_size = self.rect_size
self.header_box.get_node( "header/close" ).visible = false
self.header_box.get_node( "header/open" ).visible = false
self.content_box.visible = false
self.footer_box.visible = false
self.current_rect_size = self.rect_size
self.rect_size = Vector2( 0, 0 )
$background.rect_size = Vector2( 0, 0 )
$background.rect_min_size = Vector2( 0, 0 )
func _on_Close_pressed():

View file

@ -4,9 +4,9 @@ extends EditorPlugin
func _enter_tree():
# Initialization of the plugin goes here
# Add the new type with a name, a parent type, a script and an icon
add_custom_type("ui_window", "MarginContainer", preload("ui_window.gd"), preload("icon.png"))
add_custom_type("kh_window", "MarginContainer", preload("kh_window.gd"), preload("icon.png"))
func _exit_tree():
# Clean-up of the plugin goes here
# Always remember to remove it from the engine when deactivated
remove_custom_type("ui_window")
remove_custom_type("kh_window")

View file

@ -1,7 +1,7 @@
[plugin]
name="UI Window"
name="KH Window"
description="A custom window control."
author="Osquallo"
version="1.0.0"
script="ui_window_plugin.gd"
script="kh_window_plugin.gd"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 620 B

BIN
assets/fonts/ryzom.ttf Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/interfaces/debug_window/debug_window.gd" type="Script" id=1]
[ext_resource path="res://addons/ui_window/ui_window.gd" type="Script" id=2]
[ext_resource path="res://addons/ui_window/background_default.jpg" type="Texture" id=3]
[ext_resource path="res://addons/kh_window/kh_window.gd" type="Script" id=2]
[ext_resource path="res://addons/kh_window/background_default.jpg" type="Texture" id=3]
[node name="debug_window" type="Control"]
anchor_right = 1.0
@ -15,147 +15,146 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="ui_window" type="MarginContainer" parent="."]
margin_right = 40.0
margin_bottom = 40.0
[node name="kh_window" type="MarginContainer" parent="."]
margin_right = 128.0
margin_bottom = 128.0
mouse_filter = 1
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
title = "Debug/Tests"
background_texture = ExtResource( 3 )
min_size = Vector2( 256, 256 )
[node name="v_box_container" type="VBoxContainer" parent="ui_window"]
margin_right = 112.0
[node name="v_box_container" type="VBoxContainer" parent="kh_window"]
margin_right = 128.0
margin_bottom = 138.0
mouse_filter = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="sky_label" type="Label" parent="ui_window/v_box_container"]
margin_right = 112.0
[node name="sky_label" type="Label" parent="kh_window/v_box_container"]
margin_right = 128.0
margin_bottom = 14.0
text = "Sky:"
[node name="sky_box" type="VBoxContainer" parent="ui_window/v_box_container"]
[node name="sky_box" type="VBoxContainer" parent="kh_window/v_box_container"]
margin_top = 18.0
margin_right = 112.0
margin_right = 128.0
margin_bottom = 34.0
[node name="time_of_day" type="HBoxContainer" parent="ui_window/v_box_container/sky_box"]
margin_right = 112.0
[node name="time_of_day" type="HBoxContainer" parent="kh_window/v_box_container/sky_box"]
margin_right = 128.0
margin_bottom = 16.0
[node name="label" type="Label" parent="ui_window/v_box_container/sky_box/time_of_day"]
[node name="label" type="Label" parent="kh_window/v_box_container/sky_box/time_of_day"]
margin_top = 1.0
margin_right = 74.0
margin_bottom = 15.0
size_flags_horizontal = 10
text = "Time of day"
[node name="value" type="HSlider" parent="ui_window/v_box_container/sky_box/time_of_day"]
[node name="value" type="HSlider" parent="kh_window/v_box_container/sky_box/time_of_day"]
margin_left = 78.0
margin_right = 112.0
margin_right = 128.0
margin_bottom = 16.0
size_flags_horizontal = 3
max_value = 24.0
step = 0.1
value = 12.0
[node name="mist_label" type="Label" parent="ui_window/v_box_container"]
[node name="mist_label" type="Label" parent="kh_window/v_box_container"]
margin_top = 38.0
margin_right = 112.0
margin_right = 128.0
margin_bottom = 52.0
text = "Mist:"
[node name="mist_box" type="VBoxContainer" parent="ui_window/v_box_container"]
[node name="mist_box" type="VBoxContainer" parent="kh_window/v_box_container"]
margin_top = 56.0
margin_right = 112.0
margin_right = 128.0
margin_bottom = 72.0
[node name="mist_level" type="HBoxContainer" parent="ui_window/v_box_container/mist_box"]
margin_right = 112.0
[node name="mist_level" type="HBoxContainer" parent="kh_window/v_box_container/mist_box"]
margin_right = 128.0
margin_bottom = 16.0
[node name="label" type="Label" parent="ui_window/v_box_container/mist_box/mist_level"]
[node name="label" type="Label" parent="kh_window/v_box_container/mist_box/mist_level"]
margin_top = 1.0
margin_right = 63.0
margin_bottom = 15.0
size_flags_horizontal = 10
text = "Mist level"
[node name="value" type="HSlider" parent="ui_window/v_box_container/mist_box/mist_level"]
[node name="value" type="HSlider" parent="kh_window/v_box_container/mist_box/mist_level"]
margin_left = 67.0
margin_right = 112.0
margin_right = 128.0
margin_bottom = 16.0
size_flags_horizontal = 3
max_value = 1.0
step = 0.1
[node name="fears_label" type="Label" parent="ui_window/v_box_container"]
[node name="fears_label" type="Label" parent="kh_window/v_box_container"]
margin_top = 76.0
margin_right = 112.0
margin_right = 128.0
margin_bottom = 90.0
text = "Fears:"
[node name="fears_box" type="VBoxContainer" parent="ui_window/v_box_container"]
[node name="fears_box" type="VBoxContainer" parent="kh_window/v_box_container"]
margin_top = 94.0
margin_right = 112.0
margin_right = 128.0
margin_bottom = 138.0
[node name="oubli" type="HBoxContainer" parent="ui_window/v_box_container/fears_box"]
margin_right = 112.0
[node name="oubli" type="HBoxContainer" parent="kh_window/v_box_container/fears_box"]
margin_right = 128.0
margin_bottom = 20.0
[node name="label" type="Label" parent="ui_window/v_box_container/fears_box/oubli"]
margin_left = 16.0
[node name="label" type="Label" parent="kh_window/v_box_container/fears_box/oubli"]
margin_left = 32.0
margin_top = 3.0
margin_right = 51.0
margin_right = 67.0
margin_bottom = 17.0
size_flags_horizontal = 10
text = "Oubli"
[node name="minus" type="Button" parent="ui_window/v_box_container/fears_box/oubli"]
margin_left = 55.0
margin_right = 80.0
[node name="minus" type="Button" parent="kh_window/v_box_container/fears_box/oubli"]
margin_left = 71.0
margin_right = 96.0
margin_bottom = 20.0
text = "-1"
[node name="plus" type="Button" parent="ui_window/v_box_container/fears_box/oubli"]
margin_left = 84.0
margin_right = 112.0
[node name="plus" type="Button" parent="kh_window/v_box_container/fears_box/oubli"]
margin_left = 100.0
margin_right = 128.0
margin_bottom = 20.0
text = "+1"
[node name="douleur" type="HBoxContainer" parent="ui_window/v_box_container/fears_box"]
[node name="douleur" type="HBoxContainer" parent="kh_window/v_box_container/fears_box"]
margin_top = 24.0
margin_right = 112.0
margin_right = 128.0
margin_bottom = 44.0
[node name="label" type="Label" parent="ui_window/v_box_container/fears_box/douleur"]
[node name="label" type="Label" parent="kh_window/v_box_container/fears_box/douleur"]
margin_left = 16.0
margin_top = 3.0
margin_right = 51.0
margin_right = 67.0
margin_bottom = 17.0
size_flags_horizontal = 10
text = "Douleur"
[node name="minus" type="Button" parent="ui_window/v_box_container/fears_box/douleur"]
margin_left = 55.0
margin_right = 80.0
[node name="minus" type="Button" parent="kh_window/v_box_container/fears_box/douleur"]
margin_left = 71.0
margin_right = 96.0
margin_bottom = 20.0
text = "-1"
[node name="plus" type="Button" parent="ui_window/v_box_container/fears_box/douleur"]
margin_left = 84.0
margin_right = 112.0
[node name="plus" type="Button" parent="kh_window/v_box_container/fears_box/douleur"]
margin_left = 100.0
margin_right = 128.0
margin_bottom = 20.0
text = "+1"
[connection signal="mouse_exited" from="." to="." method="_on_debug_window_mouse_exited"]
[connection signal="value_changed" from="ui_window/v_box_container/sky_box/time_of_day/value" to="." method="_on_time_of_day_value_changed"]
[connection signal="value_changed" from="ui_window/v_box_container/mist_box/mist_level/value" to="." method="_on_mist_level_value_changed"]
[connection signal="pressed" from="ui_window/v_box_container/fears_box/oubli/minus" to="." method="_on_oubli_minus_pressed"]
[connection signal="pressed" from="ui_window/v_box_container/fears_box/oubli/plus" to="." method="_on_oubli_plus_pressed"]
[connection signal="pressed" from="ui_window/v_box_container/fears_box/douleur/minus" to="." method="_on_douleur_minus_pressed"]
[connection signal="pressed" from="ui_window/v_box_container/fears_box/douleur/plus" to="." method="_on_douleur_plus_pressed"]
[connection signal="value_changed" from="kh_window/v_box_container/sky_box/time_of_day/value" to="." method="_on_time_of_day_value_changed"]
[connection signal="value_changed" from="kh_window/v_box_container/mist_box/mist_level/value" to="." method="_on_mist_level_value_changed"]
[connection signal="pressed" from="kh_window/v_box_container/fears_box/oubli/minus" to="." method="_on_oubli_minus_pressed"]
[connection signal="pressed" from="kh_window/v_box_container/fears_box/oubli/plus" to="." method="_on_oubli_plus_pressed"]
[connection signal="pressed" from="kh_window/v_box_container/fears_box/douleur/minus" to="." method="_on_douleur_minus_pressed"]
[connection signal="pressed" from="kh_window/v_box_container/fears_box/douleur/plus" to="." method="_on_douleur_plus_pressed"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 418 KiB

After

Width:  |  Height:  |  Size: 418 KiB

View file

@ -20,6 +20,11 @@ _global_script_classes=[ {
"path": "res://ressources/scripts/items/equippable.gd"
}, {
"base": "Node",
"class": "Inventory",
"language": "GDScript",
"path": "res://ressources/scripts/items/inventory.gd"
}, {
"base": "Node",
"class": "Item",
"language": "GDScript",
"path": "res://ressources/scripts/items/item.gd"
@ -37,6 +42,7 @@ _global_script_classes=[ {
_global_script_class_icons={
"Creature": "",
"Equippable": "",
"Inventory": "",
"Item": "",
"Mannequiny": "",
"Ra": ""
@ -68,7 +74,7 @@ window/size/height=720
[editor_plugins]
enabled=PoolStringArray( "kh_slider", "ui_window" )
enabled=PoolStringArray( "kh_slider", "kh_window" )
[input]
@ -128,7 +134,7 @@ music_manager={
}
debug_window={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":73,"unicode":0,"echo":false,"script":null)
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":79,"unicode":0,"echo":false,"script":null)
]
}
free_look={
@ -161,6 +167,11 @@ toggle_sprint={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777241,"unicode":0,"echo":false,"script":null)
]
}
inventory_window={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":73,"unicode":0,"echo":false,"script":null)
]
}
[khanat]
@ -173,4 +184,5 @@ name_casing=2
[rendering]
threads/thread_model=2
environment/default_environment="res://default_env.tres"

View file

@ -1,5 +1,6 @@
{
"label": "Pendo Teddy",
"icon": "pendo_teddy/pendo_teddy.png",
"scene": "pendo_teddy/pendo_teddy.tscn",
"attachment": "hand_r_attachment"
}

View file

@ -1,11 +1,12 @@
extends "res://ressources/scripts/creatures/creature.gd"
class_name Ra
var inventory = []
var inventory = null
func from_dict( datas ):
.creature( datas )
self.inventory = datas.get( "inventory", self.inventory )
.from_dict( datas )
var new_inventory = Inventory.new()
new_inventory.from_dict( datas.get( "inventory", [] ) )
self.inventory = new_inventory

View file

@ -6,7 +6,12 @@ var attachment = ""
func from_dict( datas ):
.item( datas )
.from_dict( datas )
var icon_filename = datas.get( "icon", null )
if icon_filename:
print( icon_filename )
self.icon = load( "res://assets/items/equippables/"+icon_filename )
self.scene = datas.get( "scene", self.scene )
self.attachment = datas.get( "attachment", self.attachment )

View file

@ -0,0 +1,18 @@
extends Node
class_name Inventory
var items = []
func from_dict( datas ):
for item in datas:
var extension = item.get_extension()
if extension == "equippable":
var new_item = Equippable.new()
var file = File.new()
if file.open( "res://ressources/files/items/equippables/" + item, File.READ) == OK:
var json = JSON.parse( file.get_as_text() )
if json.result:
new_item.from_dict( json.result )
self.items.push_back( new_item )

View file

@ -2,8 +2,11 @@ extends Node
class_name Item
var label = ""
var icon = null
func from_dict( datas ):
self.label = datas.get( "label", self.label )
# var icon_filename = datas.get( "icon", null )
# if icon_filename:
# self.icon = load( "res://assets/items/"+icon_filename )

View file

@ -16,8 +16,11 @@ var heightmap = null
func _ready():
var player_ra = Ra.new()
var file = File.new()
if file.open("res://ressources/files/creatures/test.creature", File.READ) == OK:
player_ra.from_dict( JSON.parse( file.get_as_text() ).result )
$game_ui/inventory_window.get_content_child( "content_box/inventory_box" ).set_inventory( player_ra.inventory )
@ -62,6 +65,14 @@ func _input( event ):
self.mouse_delta = self.mouse_old_position - event.position
self.mouse_old_position = event.position
if event.is_action_released( "inventory_window" ):
if not $inventory_window.visible:
$inventory_window.show()
else:
$inventory_window.hide()
func _process( delta ):
$creatures/player.rotate_camera_arm( Vector3( 0.0, 1.0, 0.0 ), deg2rad( self.mouse_delta.x ) )

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=23 format=2]
[gd_scene load_steps=22 format=2]
[ext_resource path="res://scenes/player/player.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/decors/terrains/demo/demo.tscn" type="PackedScene" id=2]
@ -8,7 +8,6 @@
[ext_resource path="res://scenes/game/sky.gd" type="Script" id=6]
[ext_resource path="res://assets/mist/mist.shader" type="Shader" id=7]
[ext_resource path="res://assets/interfaces/debug_window/debug_window.tscn" type="PackedScene" id=8]
[ext_resource path="res://assets/interfaces/themes/khanat_theme.theme" type="Theme" id=9]
[ext_resource path="res://assets/decors/terrains/demo/water/water_fx.shader" type="Shader" id=10]
[ext_resource path="res://scenes/interfaces/game_menu/game_ui.tscn" type="PackedScene" id=11]
@ -25,8 +24,8 @@ noise = SubResource( 1 )
[sub_resource type="ShaderMaterial" id=3]
resource_local_to_scene = true
shader = ExtResource( 5 )
shader_param/iTime = 3.93876
shader_param/iFrame = 307
shader_param/iTime = 444.652
shader_param/iFrame = 25808
shader_param/COVERAGE = 0.5
shader_param/THICKNESS = 25.0
shader_param/ABSORPTION = 1.031
@ -77,17 +76,17 @@ shader_param/mist_height = 0.0
shader_param/mist_distance = 25.0
[sub_resource type="ShaderMaterial" id=10]
shader = ExtResource( 4 )
shader_param/mist_level = 0.0
shader_param/blur_amount = null
[sub_resource type="ShaderMaterial" id=11]
shader = ExtResource( 10 )
shader_param/mist_level = 0.0
shader_param/mist_color = Color( 0.0156863, 0.411765, 0.545098, 1 )
shader_param/mist_height = 0.0
shader_param/mist_distance = 5.0
[sub_resource type="ShaderMaterial" id=11]
shader = ExtResource( 4 )
shader_param/mist_level = 0.0
shader_param/blur_amount = null
[node name="game" type="Spatial"]
script = ExtResource( 3 )
@ -129,13 +128,13 @@ extra_cull_margin = 16384.0
mesh = SubResource( 8 )
material/0 = SubResource( 9 )
[node name="water_fx" type="MeshInstance" parent="."]
[node name="trauma_fx" type="MeshInstance" parent="."]
cast_shadow = 0
extra_cull_margin = 16384.0
mesh = SubResource( 8 )
material/0 = SubResource( 10 )
[node name="trauma_fx" type="MeshInstance" parent="."]
[node name="water_fx" type="MeshInstance" parent="."]
cast_shadow = 0
extra_cull_margin = 16384.0
mesh = SubResource( 8 )
@ -144,12 +143,10 @@ material/0 = SubResource( 11 )
[node name="game_ui" parent="." instance=ExtResource( 11 )]
[node name="debug_window" parent="." instance=ExtResource( 8 )]
margin_left = 972.873
margin_top = 52.3552
margin_right = -51.1268
margin_bottom = -411.645
focus_mode = 1
theme = ExtResource( 9 )
margin_left = 908.654
margin_top = 51.8173
margin_right = -115.346
margin_bottom = -412.183
[connection signal="douleur_minus_pressed" from="debug_window" to="." method="_on_debug_window_douleur_minus_pressed"]
[connection signal="douleur_plus_pressed" from="debug_window" to="." method="_on_debug_window_douleur_plus_pressed"]
[connection signal="mist_level_changed" from="debug_window" to="." method="_on_debug_window_mist_level_changed"]

View file

@ -1,9 +1,11 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://addons/ui_window/ui_window.gd" type="Script" id=1]
[ext_resource path="res://addons/kh_window/kh_window.gd" type="Script" id=1]
[ext_resource path="res://scenes/interfaces/game_menu/game_ui.gd" type="Script" id=2]
[ext_resource path="res://assets/interfaces/jauges/peurs_oubli_douleur.png" type="Texture" id=3]
[ext_resource path="res://assets/interfaces/jauges/peurs_trauma.png" type="Texture" id=4]
[ext_resource path="res://scenes/interfaces/inventory_window/inventory_box.tscn" type="PackedScene" id=5]
[ext_resource path="res://scenes/interfaces/inventory_window/inventory_window.tscn" type="PackedScene" id=6]
[node name="game_ui" type="Control"]
anchor_right = 1.0
@ -65,6 +67,13 @@ fill_mode = 8
__meta__ = {
"_edit_use_anchors_": false
}
[node name="inventory_window" parent="." instance=ExtResource( 6 )]
[node name="inventory_box" parent="inventory_window" instance=ExtResource( 5 )]
margin_left = 0.0
margin_right = 128.0
margin_bottom = 128.0
[connection signal="value_changed" from="stats_window/douleur" to="." method="_on_douleur_value_changed"]
[connection signal="value_changed" from="stats_window/oubli" to="." method="_on_oubli_value_changed"]
[connection signal="value_changed" from="stats_window/trauma" to="." method="_on_trauma_value_changed"]

View file

@ -0,0 +1,27 @@
extends VBoxContainer
signal inventory_item_hovered( item )
signal inventory_item_gui_input( item, event, node )
func _on_inventory_item_hovered( item ):
emit_signal( "inventory_item_hovered", item )
func _on_inventory_item_gui_input( item, event, node ):
emit_signal( "inventory_item_gui_input", item, event, node )
func clean_inventory():
for child in $scroll_item_box/items_box.get_children():
$scroll_item_box/items_box.remove_child( child )
child.queue_free()
func set_inventory( p_inventory ):
self.clean_inventory()
if p_inventory:
for item in p_inventory.items:
print( item )
var new_item_box = preload( "res://scenes/interfaces/inventory_window/item_box.tscn").instance()
new_item_box.item = item
new_item_box.update()
$scroll_item_box/items_box.add_child( new_item_box )

View file

@ -0,0 +1,38 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://assets/fonts/IMMORTAL.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://scenes/interfaces/inventory_window/items_box.gd" type="Script" id=2]
[ext_resource path="res://scenes/interfaces/inventory_window/inventory_box.gd" type="Script" id=4]
[sub_resource type="DynamicFont" id=1]
size = 10
outline_size = 2
outline_color = Color( 0, 0, 0, 1 )
font_data = ExtResource( 1 )
[sub_resource type="Theme" id=2]
default_font = SubResource( 1 )
[node name="inventory_box" type="VBoxContainer"]
margin_left = 474.0
margin_right = 506.0
size_flags_horizontal = 11
script = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="scroll_item_box" type="ScrollContainer" parent="."]
margin_right = 32.0
size_flags_horizontal = 3
size_flags_vertical = 11
scroll_horizontal_enabled = false
[node name="items_box" type="GridContainer" parent="scroll_item_box"]
margin_right = 32.0
size_flags_horizontal = 11
theme = SubResource( 2 )
custom_constants/vseparation = 8
custom_constants/hseparation = 8
script = ExtResource( 2 )
[connection signal="resized" from="scroll_item_box/items_box" to="scroll_item_box/items_box" method="_on_items_box_resized"]

View file

@ -0,0 +1,34 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://addons/kh_window/kh_window.gd" type="Script" id=1]
[ext_resource path="res://scenes/interfaces/inventory_window/inventory_box.tscn" type="PackedScene" id=2]
[ext_resource path="res://assets/interfaces/windows/window_frame.png" type="Texture" id=3]
[node name="inventory_window" type="MarginContainer"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -642.158
margin_top = -360.0
margin_right = -514.158
margin_bottom = -232.0
rect_min_size = Vector2( 128, 128 )
size_flags_horizontal = 2
size_flags_vertical = 2
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
title = "inventaire"
background_texture = ExtResource( 3 )
[node name="content_box" type="VBoxContainer" parent="."]
margin_right = 128.0
margin_bottom = 128.0
[node name="inventory_box" parent="content_box" instance=ExtResource( 2 )]
margin_left = 0.0
margin_right = 128.0
margin_bottom = 128.0
size_flags_vertical = 3

View file

@ -0,0 +1,31 @@
extends MarginContainer
signal item_hovered( item )
signal item_gui_input( item, event, node )
var item = null
func _on_icon_mouse_entered():
emit_signal( "item_hovered", self.item )
func _on_icon_gui_input(event):
emit_signal( "item_gui_input", self.item, event, self.name )
func update():
if self.item.icon:
$icon.texture = self.item.icon
elif not $icon.texture:
$icon.texture = preload( "res://assets/interfaces/unknow_icon.png" )
$label.text = self.item.label
# if self.item.number > 1:
# $number.text = str(self.item.number)
# else:
# $number.text = ""
#
# if not self.item.is_stackable and self.item.number_uses > 1:
# $number.text = str(self.item.number_uses)

View file

@ -0,0 +1,37 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://assets/interfaces/unknow_icon.png" type="Texture" id=1]
[ext_resource path="res://scenes/interfaces/inventory_window/item_box.gd" type="Script" id=2]
[node name="item_box" type="MarginContainer"]
margin_right = 32.0
margin_bottom = 32.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="icon" type="TextureRect" parent="."]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 1 )
[node name="label" type="Label" parent="."]
margin_right = 32.0
margin_bottom = 14.0
size_flags_vertical = 0
text = "name"
clip_text = true
[node name="number" type="Label" parent="."]
margin_top = 18.0
margin_right = 32.0
margin_bottom = 32.0
size_flags_horizontal = 9
size_flags_vertical = 8
text = "99"
align = 2
valign = 2
clip_text = true
[connection signal="gui_input" from="icon" to="." method="_on_icon_gui_input"]
[connection signal="mouse_entered" from="icon" to="." method="_on_icon_mouse_entered"]

View file

@ -0,0 +1,7 @@
extends GridContainer
func _on_items_box_resized():
var inventory_window = self.find_parent("inventory_window")
if inventory_window:
var nb_columns = ( inventory_window.get_size().x - 32 ) / 32
self.set_columns( nb_columns )

View file

@ -4,7 +4,6 @@
[ext_resource path="res://assets/interfaces/themes/khanat_theme.theme" type="Theme" id=2]
[ext_resource path="res://scenes/interfaces/main_menu/main_menu.gd" type="Script" id=3]
[node name="main_menu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0

View file

@ -1,5 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/items/equippable/pendo_teddy/pendo_teddy.glb" type="PackedScene" id=1]
[node name="pendo_teddy" instance=ExtResource( 1 )]

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/items/equippables/pendo_teddy/pendo_teddy.glb" type="PackedScene" id=1]
[node name="pendo_teddy" instance=ExtResource( 1 )]