Merge pull request 'feature/link-hud-to-code' (#49) from feature/link-hud-to-code into dev
Reviewed-on: Athena/game-source#49
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,7 @@ extends "res://db/MBase.gd"
|
|||||||
var m_value = { "id": null, "value": null }
|
var m_value = { "id": null, "value": null }
|
||||||
var m_lock = { "id": null, "value": null }
|
var m_lock = { "id": null, "value": null }
|
||||||
var m_label = null
|
var m_label = null
|
||||||
|
var m_label_id = null
|
||||||
var m_tick_reference = { "id": null, "value": null }
|
var m_tick_reference = { "id": null, "value": null }
|
||||||
var m_key = null
|
var m_key = null
|
||||||
var m_level = null
|
var m_level = null
|
||||||
@@ -17,6 +18,7 @@ func _init(row_index):
|
|||||||
m_value["value"] = _get_value(datas)
|
m_value["value"] = _get_value(datas)
|
||||||
m_lock["value"] = _get_lock(datas)
|
m_lock["value"] = _get_lock(datas)
|
||||||
m_label = _get_label(datas)
|
m_label = _get_label(datas)
|
||||||
|
m_label_id = _get_label_id(datas)
|
||||||
m_tick_reference["value"] = _get_tick_reference(datas)
|
m_tick_reference["value"] = _get_tick_reference(datas)
|
||||||
m_mesh = _get_mesh(datas)
|
m_mesh = _get_mesh(datas)
|
||||||
|
|
||||||
@@ -35,6 +37,12 @@ func search_keys():
|
|||||||
func key():
|
func key():
|
||||||
return m_key
|
return m_key
|
||||||
|
|
||||||
|
func label():
|
||||||
|
return m_label
|
||||||
|
|
||||||
|
func label_id():
|
||||||
|
return m_label_id
|
||||||
|
|
||||||
func lock():
|
func lock():
|
||||||
return m_lock["value"]
|
return m_lock["value"]
|
||||||
|
|
||||||
@@ -75,6 +83,9 @@ func _get_lock_id(index):
|
|||||||
func _get_label(datas):
|
func _get_label(datas):
|
||||||
return _get_data(datas, 2) as String
|
return _get_data(datas, 2) as String
|
||||||
|
|
||||||
|
func _get_label_id(datas):
|
||||||
|
return _get_data(datas, 7) as String
|
||||||
|
|
||||||
func _get_tick_reference(datas):
|
func _get_tick_reference(datas):
|
||||||
return _get_data(datas, 3) as int
|
return _get_data(datas, 3) as int
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ __meta__ = {
|
|||||||
[node name="TextureButton" type="TextureButton" parent="."]
|
[node name="TextureButton" type="TextureButton" parent="."]
|
||||||
margin_right = 40.0
|
margin_right = 40.0
|
||||||
margin_bottom = 40.0
|
margin_bottom = 40.0
|
||||||
|
mouse_default_cursor_shape = 2
|
||||||
texture_normal = ExtResource( 1 )
|
texture_normal = ExtResource( 1 )
|
||||||
texture_hover = ExtResource( 2 )
|
texture_hover = ExtResource( 2 )
|
||||||
texture_focused = ExtResource( 2 )
|
texture_focused = ExtResource( 2 )
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-first-hover.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-first.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://assets/fonts/kirsty/kirsty.tres" type="DynamicFont" id=3]
|
||||||
|
|
||||||
|
[node name="TextureButton" type="TextureButton"]
|
||||||
|
margin_right = 196.0
|
||||||
|
margin_bottom = 81.0
|
||||||
|
texture_normal = ExtResource( 2 )
|
||||||
|
texture_hover = ExtResource( 1 )
|
||||||
|
texture_focused = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false,
|
||||||
|
"_editor_description_": ""
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
custom_fonts/font = ExtResource( 3 )
|
||||||
|
text = "First Entry"
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://assets/ui/themes/leather.theme" type="Theme" id=1]
|
||||||
|
[ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-last.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-last-hover.png" type="Texture" id=3]
|
||||||
|
[ext_resource path="res://assets/fonts/kirsty/kirsty.tres" type="DynamicFont" id=4]
|
||||||
|
|
||||||
|
[node name="TextureButton" type="TextureButton"]
|
||||||
|
margin_right = 196.0
|
||||||
|
margin_bottom = 81.0
|
||||||
|
texture_normal = ExtResource( 2 )
|
||||||
|
texture_hover = ExtResource( 3 )
|
||||||
|
texture_focused = ExtResource( 3 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false,
|
||||||
|
"_editor_description_": ""
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
theme = ExtResource( 1 )
|
||||||
|
custom_fonts/font = ExtResource( 4 )
|
||||||
|
text = "Last"
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-hover.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://assets/fonts/kirsty/kirsty.tres" type="DynamicFont" id=2]
|
||||||
|
[ext_resource path="res://assets/ui/themes/UI-Button-ItemsList.png" type="Texture" id=3]
|
||||||
|
|
||||||
|
[node name="TextureButton" type="TextureButton"]
|
||||||
|
margin_right = 196.0
|
||||||
|
margin_bottom = 81.0
|
||||||
|
texture_normal = ExtResource( 3 )
|
||||||
|
texture_hover = ExtResource( 1 )
|
||||||
|
texture_focused = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false,
|
||||||
|
"_editor_description_": ""
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
custom_fonts/font = ExtResource( 2 )
|
||||||
|
text = "Middle"
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
@@ -12,22 +12,27 @@
|
|||||||
|
|
||||||
[node name="Control" type="MarginContainer"]
|
[node name="Control" type="MarginContainer"]
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 1.0
|
||||||
|
margin_left = -196.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
size_flags_vertical = 4
|
rect_min_size = Vector2( 196, 900 )
|
||||||
|
size_flags_vertical = 3
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="ListContainer" type="VBoxContainer" parent="."]
|
[node name="ListContainer" type="VBoxContainer" parent="."]
|
||||||
margin_right = 196.0
|
margin_right = 196.0
|
||||||
margin_bottom = 341.0
|
margin_bottom = 900.0
|
||||||
|
rect_min_size = Vector2( 196, 900 )
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
custom_constants/separation = -10
|
custom_constants/separation = -10
|
||||||
|
|
||||||
[node name="TextureButtonFirst" type="TextureButton" parent="ListContainer"]
|
[node name="TextureButtonFirst" type="TextureButton" parent="ListContainer"]
|
||||||
|
visible = false
|
||||||
margin_right = 196.0
|
margin_right = 196.0
|
||||||
margin_bottom = 81.0
|
margin_bottom = 81.0
|
||||||
texture_normal = ExtResource( 2 )
|
texture_normal = ExtResource( 2 )
|
||||||
@@ -46,9 +51,9 @@ __meta__ = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[node name="TextureButtonMiddle" type="TextureButton" parent="ListContainer"]
|
[node name="TextureButtonMiddle" type="TextureButton" parent="ListContainer"]
|
||||||
margin_top = 71.0
|
visible = false
|
||||||
margin_right = 196.0
|
margin_right = 196.0
|
||||||
margin_bottom = 152.0
|
margin_bottom = 81.0
|
||||||
texture_normal = ExtResource( 4 )
|
texture_normal = ExtResource( 4 )
|
||||||
texture_hover = ExtResource( 7 )
|
texture_hover = ExtResource( 7 )
|
||||||
texture_focused = ExtResource( 7 )
|
texture_focused = ExtResource( 7 )
|
||||||
@@ -65,9 +70,9 @@ __meta__ = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[node name="TextureButtonLast" type="TextureButton" parent="ListContainer"]
|
[node name="TextureButtonLast" type="TextureButton" parent="ListContainer"]
|
||||||
margin_top = 142.0
|
visible = false
|
||||||
margin_right = 196.0
|
margin_right = 196.0
|
||||||
margin_bottom = 223.0
|
margin_bottom = 81.0
|
||||||
texture_normal = ExtResource( 3 )
|
texture_normal = ExtResource( 3 )
|
||||||
texture_hover = ExtResource( 9 )
|
texture_hover = ExtResource( 9 )
|
||||||
texture_focused = ExtResource( 9 )
|
texture_focused = ExtResource( 9 )
|
||||||
@@ -85,9 +90,8 @@ __meta__ = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="ListContainer"]
|
[node name="HBoxContainer" type="HBoxContainer" parent="ListContainer"]
|
||||||
margin_top = 213.0
|
|
||||||
margin_right = 196.0
|
margin_right = 196.0
|
||||||
margin_bottom = 341.0
|
margin_bottom = 128.0
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
|
||||||
[node name="TextureButtonIndice" type="TextureButton" parent="ListContainer/HBoxContainer"]
|
[node name="TextureButtonIndice" type="TextureButton" parent="ListContainer/HBoxContainer"]
|
||||||
|
|||||||
+7
-24
@@ -18,15 +18,9 @@ func _ready():
|
|||||||
_load_meshes()
|
_load_meshes()
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
_check_quit_scene()
|
|
||||||
_check_dissolve_mesh()
|
_check_dissolve_mesh()
|
||||||
_check_change_angle_camera()
|
_check_change_angle_camera()
|
||||||
|
|
||||||
func _check_quit_scene():
|
|
||||||
# Event key "escape" and "godot event" ui_end
|
|
||||||
if Input.is_action_just_pressed("ui_end"):
|
|
||||||
_confirm_before_quit()
|
|
||||||
|
|
||||||
func _check_dissolve_mesh():
|
func _check_dissolve_mesh():
|
||||||
# Event dissolve in object searched by gamer
|
# Event dissolve in object searched by gamer
|
||||||
for key in meshes:
|
for key in meshes:
|
||||||
@@ -109,29 +103,13 @@ func _gyroscope_changed_up(gyroscope):
|
|||||||
(gyroscope.abs().x - gyroscope_value_old.abs().x) > GYROSCOPE_MAX_DIFF and \
|
(gyroscope.abs().x - gyroscope_value_old.abs().x) > GYROSCOPE_MAX_DIFF and \
|
||||||
gyroscope.x < gyroscope_value_old.x
|
gyroscope.x < gyroscope_value_old.x
|
||||||
|
|
||||||
func _notification(what):
|
|
||||||
# Notification for android back action
|
|
||||||
if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
|
|
||||||
_confirm_before_quit()
|
|
||||||
|
|
||||||
func _confirm_before_quit():
|
|
||||||
$Dialog/ConfirmEscape.popup()
|
|
||||||
|
|
||||||
# Back to main scene
|
|
||||||
func _quit_to_menu():
|
|
||||||
Global.goto_scene("res://scenes/main.tscn")
|
|
||||||
|
|
||||||
func _start_dissolve(key):
|
func _start_dissolve(key):
|
||||||
if meshes[key].lock() == false:
|
if meshes[key].lock() == false:
|
||||||
meshes[key].set_lock(true)
|
meshes[key].set_lock(true)
|
||||||
|
|
||||||
func _on_ConfirmEscape_confirmed():
|
|
||||||
_quit_to_menu()
|
|
||||||
|
|
||||||
## PRIVATE
|
## PRIVATE
|
||||||
func _load_translations():
|
func _load_translations():
|
||||||
$Dialog/ConfirmEscape.set_title(tr("SCENE_WARCRAFT_DIALOG_QUIT_TITLE"))
|
pass
|
||||||
$Dialog/ConfirmEscape.set_text(tr("SCENE_WARCRAFT_DIALOG_QUIT_QUESTION"))
|
|
||||||
|
|
||||||
func _load_meshes():
|
func _load_meshes():
|
||||||
var scene_detail = null
|
var scene_detail = null
|
||||||
@@ -141,10 +119,15 @@ func _load_meshes():
|
|||||||
|
|
||||||
if scene_detail.key() != null:
|
if scene_detail.key() != null:
|
||||||
meshes[scene_detail.key()] = scene_detail
|
meshes[scene_detail.key()] = scene_detail
|
||||||
|
# _display_label(scene_detail)
|
||||||
|
|
||||||
for key in meshes:
|
for key in meshes:
|
||||||
meshes[key].search_keys()
|
meshes[key].search_keys()
|
||||||
|
"""
|
||||||
|
func _display_label(scene):
|
||||||
|
print("[meshes#key] : "+scene.label())
|
||||||
|
$ListObjects/ListContainer/TextureButton.set_text(scene.label())
|
||||||
|
"""
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event is InputEventMouseButton or event is InputEventScreenTouch:
|
if event is InputEventMouseButton or event is InputEventScreenTouch:
|
||||||
var camera = $"Main Camera"
|
var camera = $"Main Camera"
|
||||||
|
|||||||
@@ -1,4 +1,45 @@
|
|||||||
extends "res://scenes/levels/levels.gd"
|
extends "res://scenes/levels/levels.gd"
|
||||||
|
|
||||||
|
export (PackedScene) var object_first = load("res://scenes/UI/list_ho/ObjectListFirst.tscn")
|
||||||
|
export (PackedScene) var object_std = load("res://scenes/UI/list_ho/ObjectListStd.tscn")
|
||||||
|
export (PackedScene) var object_last = load("res://scenes/UI/list_ho/ObjectListLast.tscn")
|
||||||
|
|
||||||
|
onready var label_id = null
|
||||||
|
onready var last_btn = null
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
pass
|
print(meshes)
|
||||||
|
var counter = 0
|
||||||
|
var scene = null
|
||||||
|
for key in meshes:
|
||||||
|
scene = meshes[key]
|
||||||
|
_create_button_info(scene, counter)
|
||||||
|
label_id = scene.label_id()
|
||||||
|
counter = +1
|
||||||
|
|
||||||
|
# Back to main scene
|
||||||
|
func _on_TextureButton_pressed():
|
||||||
|
print("[levels#_on_TextureButton_pressed] quit to menu")
|
||||||
|
Global.goto_scene("res://scenes/main.tscn")
|
||||||
|
|
||||||
|
func _create_button_info(scene, counter):
|
||||||
|
var btn = null
|
||||||
|
|
||||||
|
if counter == 0:
|
||||||
|
print("[warCraft#_create_button_info] ["+String(counter)+"] use first")
|
||||||
|
btn = object_first.instance()
|
||||||
|
elif counter == meshes.size() - 1:
|
||||||
|
btn = object_last.instance()
|
||||||
|
print("[warCraft#_create_button_info] ["+String(counter)+"] use last")
|
||||||
|
else:
|
||||||
|
btn = object_std.instance()
|
||||||
|
print("[warCraft#_create_button_info] ["+String(counter)+"] use standar")
|
||||||
|
|
||||||
|
if label_id != null and label_id == scene.label_id():
|
||||||
|
# $ListObjects/ListContainer.add_child(btn)
|
||||||
|
last_btn.get_node("Label").set_text(last_btn.get_node("Label").text + " X")
|
||||||
|
else:
|
||||||
|
$ListObjects/ListContainer.add_child(btn)
|
||||||
|
btn.get_node("Label").set_text(scene.label())
|
||||||
|
|
||||||
|
last_btn = btn
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ cell_center_y = false
|
|||||||
cell_center_z = false
|
cell_center_z = false
|
||||||
baked_meshes = [ SubResource( 4 ) ]
|
baked_meshes = [ SubResource( 4 ) ]
|
||||||
data = {
|
data = {
|
||||||
"cells": PoolIntArray( 0, 0, 3, 65531, 0, 3, 65532, 0, 3, 65533, 0, 3, 65534, 0, 3, 65535, 0, 3, 0, 1, 3, 65531, 1, 3, 65532, 1, 3, 65533, 1, 3, 65534, 1, 3, 65535, 1, 3, 0, 2, 3, 65531, 2, 3, 65532, 2, 3, 65533, 2, 3, 65534, 2, 3, 65535, 2, 3, 0, 65533, 3, 65532, 65533, 3, 65533, 65533, 3, 65534, 65533, 3, 65535, 65533, 3, 0, 65534, 3, 65531, 65534, 3, 65532, 65534, 3, 65533, 65534, 3, 65534, 65534, 3, 65535, 65534, 3, 0, 65535, 3, 65531, 65535, 3, 65532, 65535, 3, 65533, 65535, 3, 65534, 65535, 3, 65535, 65535, 3 )
|
"cells": PoolIntArray( 0, 0, 3, 65531, 0, 3, 65532, 0, 3, 65533, 0, 536870915, 65534, 0, 3, 65535, 0, 3, 0, 1, 3, 65531, 1, 3, 65532, 1, 3, 65533, 1, 3, 65534, 1, 3, 65535, 1, 3, 0, 2, 3, 65531, 2, 3, 65532, 2, 3, 65533, 2, 3, 65534, 2, 3, 65535, 2, 3, 0, 65533, 3, 65532, 65533, 3, 65533, 65533, 3, 65534, 65533, 3, 65535, 65533, 3, 0, 65534, 3, 65531, 65534, 3, 65532, 65534, 3, 65533, 65534, 3, 65534, 65534, 3, 65535, 65534, 3, 0, 65535, 3, 65531, 65535, 3, 65532, 65535, -1610612733, 65533, 65535, -1610612733, 65534, 65535, 536870915, 65535, 65535, 3 )
|
||||||
}
|
}
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_editor_clip_": 0,
|
"_editor_clip_": 0,
|
||||||
@@ -544,23 +544,6 @@ use_in_baked_light = true
|
|||||||
mesh = ExtResource( 9 )
|
mesh = ExtResource( 9 )
|
||||||
material/0 = null
|
material/0 = null
|
||||||
|
|
||||||
[node name="Dialog" type="Control" parent="."]
|
|
||||||
margin_right = 40.0
|
|
||||||
margin_bottom = 40.0
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="ConfirmEscape" type="ConfirmationDialog" parent="Dialog"]
|
|
||||||
visible = true
|
|
||||||
margin_right = 200.0
|
|
||||||
margin_bottom = 70.0
|
|
||||||
rect_min_size = Vector2( 400, 140 )
|
|
||||||
window_title = "Veuillez confirmer…"
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="sm_gabarit_male" type="MeshInstance" parent="."]
|
[node name="sm_gabarit_male" type="MeshInstance" parent="."]
|
||||||
transform = Transform( 0.534795, 0, 0.844982, 0, 1, 0, -0.844982, 0, 0.534795, -4.02751, 0.0561329, -0.889434 )
|
transform = Transform( 0.534795, 0, 0.844982, 0, 1, 0, -0.844982, 0, 0.534795, -4.02751, 0.0561329, -0.889434 )
|
||||||
mesh = ExtResource( 20 )
|
mesh = ExtResource( 20 )
|
||||||
@@ -754,8 +737,11 @@ collision_mask = 2
|
|||||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0358186, 0, 0.0109152 )
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0358186, 0, 0.0109152 )
|
||||||
shape = SubResource( 18 )
|
shape = SubResource( 18 )
|
||||||
|
|
||||||
[node name="Control" parent="." instance=ExtResource( 44 )]
|
[node name="ListObjects" parent="." instance=ExtResource( 44 )]
|
||||||
|
|
||||||
[node name="Control2" parent="." instance=ExtResource( 45 )]
|
[node name="Quit" parent="." instance=ExtResource( 45 )]
|
||||||
|
|
||||||
[connection signal="confirmed" from="Dialog/ConfirmEscape" to="." method="_on_ConfirmEscape_confirmed"]
|
[connection signal="pressed" from="Quit/TextureButton" to="." method="_on_TextureButton_pressed"]
|
||||||
|
|
||||||
|
[editable path="ListObjects"]
|
||||||
|
[editable path="Quit"]
|
||||||
|
|||||||
Reference in New Issue
Block a user