summaryrefslogtreecommitdiff
path: root/ui/login
diff options
context:
space:
mode:
Diffstat (limited to 'ui/login')
-rw-r--r--ui/login/character_selection_item.gd54
-rw-r--r--ui/login/character_selection_item.tscn19
-rw-r--r--ui/login/character_selection_status.gd18
-rw-r--r--ui/login/character_selection_status.tscn36
-rw-r--r--ui/login/login_character_selection_list.gd111
-rw-r--r--ui/login/login_character_selection_list.tscn61
6 files changed, 256 insertions, 43 deletions
diff --git a/ui/login/character_selection_item.gd b/ui/login/character_selection_item.gd
index 7ad77b6..fa0fad8 100644
--- a/ui/login/character_selection_item.gd
+++ b/ui/login/character_selection_item.gd
@@ -4,14 +4,22 @@ extends PanelContainer
signal selected
-static var selected_item: CharacterSelectionItem:
+var is_hovered := false:
set(value):
- var previous_item = selected_item
- selected_item = value
- if previous_item:
- previous_item.draw_highlight(false)
+ is_hovered = value
+ draw_highlight(value)
+
+var is_selected := false:
+ set(value):
+ is_selected = value
+ draw_highlight(false)
+ if value:
+ selected.emit()
-var is_hovered := false
+
+func _ready() -> void:
+ clear()
+ %SelectionBorder.visible = false
func initialize_with_info(info: CharacterInformation):
@@ -21,6 +29,7 @@ func initialize_with_info(info: CharacterInformation):
Constants.FilePaths.get_player_head(info.gender, info.head),
]
)
+ %Head.visible = true
%Body.texture = load(
"%s/%s/000.png" % [
@@ -28,30 +37,43 @@ func initialize_with_info(info: CharacterInformation):
Constants.FilePaths.get_player_body(info.gender, info.job),
]
)
-
- %Name.text = info.name
+ %Body.visible = true
+
+
+func clear():
+ %Head.visible = false
+ %Body.visible = false
func draw_highlight(is_highlighted: bool):
- if selected_item == self:
- is_highlighted = true
-
var style_box: StyleBoxFlat = get_theme_stylebox("panel").duplicate()
style_box.draw_center = is_highlighted
add_theme_stylebox_override("panel", style_box)
+
+ if is_selected:
+ %SelectionBorder.visible = true
+ var style_box2: StyleBoxFlat = get_theme_stylebox("panel").duplicate()
+ style_box2.border_color.a = 0.0
+ add_theme_stylebox_override("panel", style_box2)
+
+ # spacing "fix"
+ #%SelectionBorder.top_level = true
+ #await get_tree().process_frame
+ #%SelectionBorder.global_position = global_position
+ else:
+ %SelectionBorder.visible = false
+ var style_box2: StyleBoxFlat = get_theme_stylebox("panel").duplicate()
+ style_box2.border_color.a = 1.0
+ add_theme_stylebox_override("panel", style_box2)
func _on_gui_input(event: InputEvent) -> void:
if event.is_pressed():
- selected_item = self
- draw_highlight(true)
- selected.emit()
+ is_selected = true
func _on_mouse_entered() -> void:
is_hovered = true
- draw_highlight(is_hovered)
func _on_mouse_exited() -> void:
is_hovered = false
- draw_highlight(is_hovered)
diff --git a/ui/login/character_selection_item.tscn b/ui/login/character_selection_item.tscn
index adc37bb..4b8a249 100644
--- a/ui/login/character_selection_item.tscn
+++ b/ui/login/character_selection_item.tscn
@@ -1,9 +1,10 @@
-[gd_scene load_steps=6 format=3 uid="uid://rrd131rq74n5"]
+[gd_scene load_steps=7 format=3 uid="uid://rrd131rq74n5"]
[ext_resource type="Script" uid="uid://bsglhorusc7ug" path="res://ui/login/character_selection_item.gd" id="1_25yur"]
[ext_resource type="Texture2D" uid="uid://danymuvfjf4o1" path="res://client_data/data/sprite/Àΰ£Á·/¸Ó¸®Åë/³²/16_³²/000.png" id="2_aqbfs"]
[ext_resource type="Texture2D" uid="uid://cwqgdd00sf7pu" path="res://client_data/data/sprite/Àΰ£Á·/¸öÅë/³²/Ãʺ¸ÀÚ_³²/000.png" id="3_xv3pn"]
-[ext_resource type="Theme" uid="uid://c6y6r8kcnbb10" path="res://ui/theme_clear.tres" id="4_u21ok"]
+[ext_resource type="PackedScene" uid="uid://knmmuhon34rh" path="res://ui/bmp_texture_rect.tscn" id="4_vhrt2"]
+[ext_resource type="Texture2D" uid="uid://g2cx2uuvffe" path="res://client_data/data/texture/À¯ÀúÀÎÅÍÆäÀ̽º/login_interface/box_select.bmp" id="5_vhrt2"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_u21ok"]
bg_color = Color(0, 0, 0, 0.0980392)
@@ -15,9 +16,9 @@ border_width_bottom = 1
border_color = Color(0.760784, 0.760784, 0.760784, 1)
[node name="CharacterSelectionItem" type="PanelContainer"]
-custom_minimum_size = Vector2(150, 150)
-offset_right = 150.0
-offset_bottom = 163.0
+custom_minimum_size = Vector2(141, 146)
+offset_right = 141.0
+offset_bottom = 146.0
mouse_default_cursor_shape = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_u21ok")
script = ExtResource("1_25yur")
@@ -52,12 +53,12 @@ layout_mode = 2
texture = ExtResource("3_xv3pn")
stretch_mode = 3
-[node name="Name" type="Label" parent="MarginContainer/VBoxContainer"]
+[node name="SelectionBorder" parent="." instance=ExtResource("4_vhrt2")]
unique_name_in_owner = true
+show_behind_parent = true
layout_mode = 2
-theme = ExtResource("4_u21ok")
-text = "Name"
-horizontal_alignment = 1
+texture = ExtResource("5_vhrt2")
+stretch_mode = 4
[connection signal="gui_input" from="." to="." method="_on_gui_input"]
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
diff --git a/ui/login/character_selection_status.gd b/ui/login/character_selection_status.gd
index 2c0e450..5bbd200 100644
--- a/ui/login/character_selection_status.gd
+++ b/ui/login/character_selection_status.gd
@@ -17,3 +17,21 @@ func set_info(info: CharacterInformation):
%Luk.text = str(info.luck)
%Map.text = info.map_name.substr(0, info.map_name.length() - 4)
+
+
+func clear():
+ %Name.text = ""
+ %Job.text = ""
+ %Level.text = ""
+ %Exp.text = ""
+ %Hp.text = ""
+ %Sp.text = ""
+
+ %Str.text = ""
+ %Agi.text = ""
+ %Vit.text = ""
+ %Int.text = ""
+ %Dex.text = ""
+ %Luk.text = ""
+
+ %Map.text = ""
diff --git a/ui/login/character_selection_status.tscn b/ui/login/character_selection_status.tscn
index 0de1865..31c5ab0 100644
--- a/ui/login/character_selection_status.tscn
+++ b/ui/login/character_selection_status.tscn
@@ -6,15 +6,15 @@
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_qjr2b"]
[node name="CharacterSelectionStatus" type="PanelContainer"]
-offset_right = 360.0
-offset_bottom = 158.0
+offset_right = 352.0
+offset_bottom = 152.0
theme = ExtResource("1_o7mxo")
theme_override_styles/panel = SubResource("StyleBoxEmpty_qjr2b")
script = ExtResource("2_nhn0f")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
-theme_override_constants/separation = 8
+theme_override_constants/separation = 2
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2
@@ -32,11 +32,11 @@ custom_minimum_size = Vector2(45, 0)
layout_mode = 2
theme = ExtResource("1_o7mxo")
theme_type_variation = &"CharacterSelectionStatusLabel"
-text = "NAME"
+text = "Name"
[node name="Name" type="Label" parent="VBoxContainer/VBoxContainer/HBoxContainer/HBoxContainer"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(130, 0)
+custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_o7mxo")
@@ -55,7 +55,7 @@ text = "STR"
[node name="Str" type="Label" parent="VBoxContainer/VBoxContainer/HBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(130, 0)
+custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_o7mxo")
@@ -74,11 +74,11 @@ custom_minimum_size = Vector2(45, 0)
layout_mode = 2
theme = ExtResource("1_o7mxo")
theme_type_variation = &"CharacterSelectionStatusLabel"
-text = "JOB"
+text = "Job"
[node name="Job" type="Label" parent="VBoxContainer/VBoxContainer/HBoxContainer2/HBoxContainer"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(130, 0)
+custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_o7mxo")
@@ -97,7 +97,7 @@ text = "AGI"
[node name="Agi" type="Label" parent="VBoxContainer/VBoxContainer/HBoxContainer2/HBoxContainer2"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(130, 0)
+custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_o7mxo")
@@ -120,7 +120,7 @@ text = "Lv."
[node name="Level" type="Label" parent="VBoxContainer/VBoxContainer/HBoxContainer3/HBoxContainer"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(130, 0)
+custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_o7mxo")
@@ -139,7 +139,7 @@ text = "VIT"
[node name="Vit" type="Label" parent="VBoxContainer/VBoxContainer/HBoxContainer3/HBoxContainer2"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(130, 0)
+custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_o7mxo")
@@ -162,7 +162,7 @@ text = "EXP"
[node name="Exp" type="Label" parent="VBoxContainer/VBoxContainer/HBoxContainer4/HBoxContainer"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(130, 0)
+custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_o7mxo")
@@ -181,7 +181,7 @@ text = "INT"
[node name="Int" type="Label" parent="VBoxContainer/VBoxContainer/HBoxContainer4/HBoxContainer2"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(130, 0)
+custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_o7mxo")
@@ -204,7 +204,7 @@ text = "HP"
[node name="Hp" type="Label" parent="VBoxContainer/VBoxContainer/HBoxContainer5/HBoxContainer"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(130, 0)
+custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_o7mxo")
@@ -223,7 +223,7 @@ text = "DEX"
[node name="Dex" type="Label" parent="VBoxContainer/VBoxContainer/HBoxContainer5/HBoxContainer2"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(130, 0)
+custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_o7mxo")
@@ -246,7 +246,7 @@ text = "SP"
[node name="Sp" type="Label" parent="VBoxContainer/VBoxContainer/HBoxContainer6/HBoxContainer"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(130, 0)
+custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_o7mxo")
@@ -265,7 +265,7 @@ text = "LUK"
[node name="Luk" type="Label" parent="VBoxContainer/VBoxContainer/HBoxContainer6/HBoxContainer2"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(130, 0)
+custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_o7mxo")
@@ -284,7 +284,7 @@ text = "MAP"
[node name="Map" type="Label" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
-custom_minimum_size = Vector2(307, 0)
+custom_minimum_size = Vector2(287, 0)
layout_mode = 2
theme = ExtResource("1_o7mxo")
theme_type_variation = &"CharacterSelectionStatusLabel2"
diff --git a/ui/login/login_character_selection_list.gd b/ui/login/login_character_selection_list.gd
new file mode 100644
index 0000000..221c47f
--- /dev/null
+++ b/ui/login/login_character_selection_list.gd
@@ -0,0 +1,111 @@
+class_name CharacterSelectionList
+extends Control
+
+
+signal selected(slot_idx: int)
+
+var item_scene := preload("res://ui/login/character_selection_item.tscn")
+
+var slot_offset := 0
+
+@export var displayed_slots_count: int = 3:
+ set = set_displayed_slots_count
+
+@export var selected_slot_index: int = -1:
+ set = set_selected_slot_index
+
+@export var login_character_list: LoginCharacterList:
+ set = set_login_character_list
+
+
+func _ready() -> void:
+ if %CharacterList.get_child_count() != displayed_slots_count:
+ set_displayed_slots_count(displayed_slots_count)
+
+
+func set_displayed_slots_count(value: int) -> void:
+ displayed_slots_count = value
+
+ for node in %CharacterList.get_children():
+ node.queue_free()
+
+ for _idx in displayed_slots_count:
+ var item = preload("res://ui/login/character_selection_item.tscn").instantiate()
+ %CharacterList.add_child(item)
+
+ draw()
+
+
+func set_selected_slot_index(value: int) -> void:
+ if selected_slot_index == value:
+ return
+
+ var character_list := login_character_list.character_information
+ var maximum_slot_count := login_character_list.slot_count
+
+ %CharacterList.get_child(selected_slot_index - slot_offset).is_selected = false
+
+ if value >= maximum_slot_count:
+ selected_slot_index = 0
+ elif value < 0:
+ selected_slot_index = maximum_slot_count - 1
+ else:
+ selected_slot_index = value
+
+ if selected_slot_index > slot_offset + (displayed_slots_count - 1):
+ #slot_offset = selected_slot_index - (displayed_slots_count - 1)
+ slot_offset = min(selected_slot_index, maximum_slot_count - displayed_slots_count)
+ elif selected_slot_index < slot_offset:
+ #slot_offset = selected_slot_index
+ slot_offset = max(0, selected_slot_index - displayed_slots_count)
+
+ draw()
+ %CharacterList.get_child(selected_slot_index - slot_offset).is_selected = true
+
+ if selected_slot_index < character_list.size():
+ %CharacterSelectionStatus.set_info(character_list[selected_slot_index])
+ else:
+ $CharacterSelectionStatus.clear()
+
+ selected.emit(selected_slot_index)
+
+
+func set_login_character_list(value: LoginCharacterList) -> void:
+ login_character_list = value
+ draw()
+
+
+func draw():
+ if not login_character_list:
+ return
+
+ var character_information: Array[CharacterInformation] = login_character_list.character_information
+
+ for display_slot_idx in displayed_slots_count:
+ var item: CharacterSelectionItem = %CharacterList.get_child(display_slot_idx)
+ var slot_idx = slot_offset + display_slot_idx
+
+ if slot_idx < character_information.size():
+ var info: CharacterInformation = character_information[slot_idx]
+ item.initialize_with_info(info)
+ else:
+ item.clear()
+
+ if item.selected.is_connected(_on_item_selected):
+ item.selected.disconnect(_on_item_selected)
+ item.selected.connect(_on_item_selected.bind(slot_idx))
+
+
+func select(slot_idx: int):
+ selected_slot_index = slot_idx
+
+
+func _on_item_selected(slot_idx: int):
+ selected_slot_index = slot_idx
+
+
+func _on_button_left_pressed() -> void:
+ selected_slot_index -= 1
+
+func _on_button_right_pressed() -> void:
+ selected_slot_index += 1
diff --git a/ui/login/login_character_selection_list.tscn b/ui/login/login_character_selection_list.tscn
new file mode 100644
index 0000000..1a5aba7
--- /dev/null
+++ b/ui/login/login_character_selection_list.tscn
@@ -0,0 +1,61 @@
+[gd_scene load_steps=11 format=3 uid="uid://bxbprntny8duj"]
+
+[ext_resource type="PackedScene" uid="uid://uo7qgv3ydh0q" path="res://ui/login/character_selection_status.tscn" id="1_5anyi"]
+[ext_resource type="Script" uid="uid://dmch4gi1khn2r" path="res://ui/login/login_character_selection_list.gd" id="1_togb6"]
+[ext_resource type="PackedScene" uid="uid://rrd131rq74n5" path="res://ui/login/character_selection_item.tscn" id="2_k142l"]
+[ext_resource type="PackedScene" uid="uid://cjcm2mai50thr" path="res://ui/bmp_texture_button.tscn" id="2_s7n6r"]
+[ext_resource type="Texture2D" uid="uid://s5uc6sa6y88f" path="res://client_data/data/texture/À¯ÀúÀÎÅÍÆäÀ̽º/select_character/chr_arrow_l_out.bmp" id="3_c5a25"]
+[ext_resource type="Texture2D" uid="uid://b8n4w8a4yumax" path="res://client_data/data/texture/À¯ÀúÀÎÅÍÆäÀ̽º/select_character/chr_arrow_l_press.bmp" id="4_ntkas"]
+[ext_resource type="Texture2D" uid="uid://e3k5tdqv2jft" path="res://client_data/data/texture/À¯ÀúÀÎÅÍÆäÀ̽º/select_character/chr_arrow_l_over.bmp" id="5_606nc"]
+[ext_resource type="Texture2D" uid="uid://bhap22qcv1mga" path="res://client_data/data/texture/À¯ÀúÀÎÅÍÆäÀ̽º/select_character/chr_arrow_r_out.bmp" id="7_c8nb3"]
+[ext_resource type="Texture2D" uid="uid://dvf7yx7b3dj4m" path="res://client_data/data/texture/À¯ÀúÀÎÅÍÆäÀ̽º/select_character/chr_arrow_r_press.bmp" id="8_p8h60"]
+[ext_resource type="Texture2D" uid="uid://4ngcs00s5cnn" path="res://client_data/data/texture/À¯ÀúÀÎÅÍÆäÀ̽º/select_character/chr_arrow_r_over.bmp" id="9_7p86f"]
+
+[node name="LoginCharacterSelectionList" type="VBoxContainer"]
+theme_override_constants/separation = 32
+script = ExtResource("1_togb6")
+
+[node name="MarginContainer" type="MarginContainer" parent="."]
+layout_mode = 2
+theme_override_constants/margin_left = -30
+theme_override_constants/margin_top = 0
+theme_override_constants/margin_right = 0
+
+[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
+layout_mode = 2
+theme_override_constants/separation = 16
+alignment = 1
+
+[node name="ButtonLeft" parent="MarginContainer/HBoxContainer" instance=ExtResource("2_s7n6r")]
+texture_filter = 0
+layout_mode = 2
+texture_normal = ExtResource("3_c5a25")
+texture_pressed = ExtResource("4_ntkas")
+texture_hover = ExtResource("5_606nc")
+stretch_mode = 5
+
+[node name="CharacterList" type="HBoxContainer" parent="MarginContainer/HBoxContainer"]
+unique_name_in_owner = true
+layout_mode = 2
+theme_override_constants/separation = 32
+
+[node name="CharacterSelectionItem" parent="MarginContainer/HBoxContainer/CharacterList" instance=ExtResource("2_k142l")]
+layout_mode = 2
+
+[node name="CharacterSelectionItem2" parent="MarginContainer/HBoxContainer/CharacterList" instance=ExtResource("2_k142l")]
+layout_mode = 2
+
+[node name="ButtonRight" parent="MarginContainer/HBoxContainer" instance=ExtResource("2_s7n6r")]
+texture_filter = 0
+layout_mode = 2
+texture_normal = ExtResource("7_c8nb3")
+texture_pressed = ExtResource("8_p8h60")
+texture_hover = ExtResource("9_7p86f")
+stretch_mode = 5
+
+[node name="CharacterSelectionStatus" parent="." instance=ExtResource("1_5anyi")]
+unique_name_in_owner = true
+layout_mode = 2
+
+[connection signal="pressed" from="MarginContainer/HBoxContainer/ButtonLeft" to="." method="_on_button_left_pressed"]
+[connection signal="pressed" from="MarginContainer/HBoxContainer/ButtonRight" to="." method="_on_button_right_pressed"]