Fix list object
This commit is contained in:
@@ -12,22 +12,27 @@
|
||||
|
||||
[node name="Control" type="MarginContainer"]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -196.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
size_flags_vertical = 4
|
||||
rect_min_size = Vector2( 196, 900 )
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ListContainer" type="VBoxContainer" parent="."]
|
||||
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
|
||||
|
||||
[node name="TextureButtonFirst" type="TextureButton" parent="ListContainer"]
|
||||
visible = false
|
||||
margin_right = 196.0
|
||||
margin_bottom = 81.0
|
||||
texture_normal = ExtResource( 2 )
|
||||
@@ -46,9 +51,9 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="TextureButtonMiddle" type="TextureButton" parent="ListContainer"]
|
||||
margin_top = 71.0
|
||||
visible = false
|
||||
margin_right = 196.0
|
||||
margin_bottom = 152.0
|
||||
margin_bottom = 81.0
|
||||
texture_normal = ExtResource( 4 )
|
||||
texture_hover = ExtResource( 7 )
|
||||
texture_focused = ExtResource( 7 )
|
||||
@@ -65,9 +70,9 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="TextureButtonLast" type="TextureButton" parent="ListContainer"]
|
||||
margin_top = 142.0
|
||||
visible = false
|
||||
margin_right = 196.0
|
||||
margin_bottom = 223.0
|
||||
margin_bottom = 81.0
|
||||
texture_normal = ExtResource( 3 )
|
||||
texture_hover = ExtResource( 9 )
|
||||
texture_focused = ExtResource( 9 )
|
||||
@@ -85,9 +90,8 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="ListContainer"]
|
||||
margin_top = 213.0
|
||||
margin_right = 196.0
|
||||
margin_bottom = 341.0
|
||||
margin_bottom = 128.0
|
||||
alignment = 1
|
||||
|
||||
[node name="TextureButtonIndice" type="TextureButton" parent="ListContainer/HBoxContainer"]
|
||||
|
||||
@@ -119,10 +119,15 @@ func _load_meshes():
|
||||
|
||||
if scene_detail.key() != null:
|
||||
meshes[scene_detail.key()] = scene_detail
|
||||
# _display_label(scene_detail)
|
||||
|
||||
for key in meshes:
|
||||
meshes[key].search_keys()
|
||||
|
||||
"""
|
||||
func _display_label(scene):
|
||||
print("[meshes#key] : "+scene.label())
|
||||
$ListObjects/ListContainer/TextureButton.set_text(scene.label())
|
||||
"""
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton or event is InputEventScreenTouch:
|
||||
var camera = $"Main Camera"
|
||||
|
||||
@@ -1,6 +1,45 @@
|
||||
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():
|
||||
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
|
||||
baked_meshes = [ SubResource( 4 ) ]
|
||||
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__ = {
|
||||
"_editor_clip_": 0,
|
||||
@@ -743,4 +743,5 @@ shape = SubResource( 18 )
|
||||
|
||||
[connection signal="pressed" from="Quit/TextureButton" to="." method="_on_TextureButton_pressed"]
|
||||
|
||||
[editable path="ListObjects"]
|
||||
[editable path="Quit"]
|
||||
|
||||
Reference in New Issue
Block a user