9.29上午

This commit is contained in:
TsubakiLoL 2024-09-29 11:46:15 +08:00
parent d00c26b78f
commit 5e9b8bcf40
9 changed files with 204 additions and 125 deletions

View File

@ -90,7 +90,7 @@ func get_now_character_equip_page(page:int):
func get_now_character_equip_use():
return CharacterTool.get_character_equip_now(get_now_character_data())
func replace_equip_with_data(page:int,pos:int,item_data:Dictionary):
func replace_equip_with_data(page:int,pos:int,item_data):
var left=CharacterTool.replace_character_equip(now_game_data["character_data"],page,pos,item_data)
if left!=null:

View File

@ -131,9 +131,12 @@ static func pre_process_character_data(character_data:Dictionary)->Dictionary:
return res
#替换装备数据,返回之前装备
static func replace_character_equip(character_data:Dictionary,page:int,pos:int,item_data:Dictionary):
static func replace_character_equip(character_data:Dictionary,page:int,pos:int,item_data):
var data=character_data["equip"][page][pos]
character_data["equip"][page][pos]=item_data.duplicate(true)
if item_data is Dictionary:
character_data["equip"][page][pos]=item_data.duplicate(true)
else:
character_data["equip"][page][pos]=null
return data
#当前使用的装备方案对应页
static func get_character_equip_page(character_data:Dictionary,page:int)->Array:

View File

@ -1,5 +1,8 @@
extends TextureRect
class_name BagSideCard
const BAG_SIDE_CARD_INTRODUCTION = preload("res://scene/bag_side_card_introduction.tscn")
var is_mouse_enter:bool=false
var equip_index:int=0
signal click(data:Dictionary)
@ -41,3 +44,14 @@ func _on_mouse_entered() -> void:
func _on_mouse_exited() -> void:
is_mouse_enter=false
pass # Replace with function body.
func _get_tooltip(at_position: Vector2) -> String:
return JSON.stringify(data)
pass
func _make_custom_tooltip(for_text: String) -> Object:
var new_card=BAG_SIDE_CARD_INTRODUCTION.instantiate()
new_card.data=JSON.parse_string(for_text)
return new_card
pass

View File

@ -6,16 +6,12 @@
[ext_resource type="Texture2D" uid="uid://buq2xt621xilr" path="res://res/ui/ui_008_bag/tuceng160.png" id="3_if27l"]
[node name="bag_side_card" type="TextureRect"]
anchors_preset = -1
anchor_right = 0.059375
anchor_bottom = 0.175926
offset_right = -74.0
offset_bottom = -150.0
offset_right = 114.0
offset_bottom = 190.0
size_flags_horizontal = 2
size_flags_vertical = 0
texture = ExtResource("1_ep34g")
script = ExtResource("2_frdwk")
metadata/_edit_use_anchors_ = true
[node name="face" type="TextureRect" parent="."]
unique_name_in_owner = true

View File

@ -0,0 +1,10 @@
extends TextureRect
var data
func _ready() -> void:
if data!=null:
%bag_card_face_big.texture=Global.get_texture(data["texture"])
%bag_card_name.text=data["name"]
%bag_card_introduction.text=data["introduction"]
get_parent().add_theme_stylebox_override("panel",StyleBoxEmpty.new())

View File

@ -0,0 +1,115 @@
[gd_scene load_steps=7 format=3 uid="uid://b6hfkn7yaj25i"]
[ext_resource type="Texture2D" uid="uid://cb8yq6241lysk" path="res://res/ui/ui_008_bag/tuceng161.png" id="1_n0qka"]
[ext_resource type="Script" path="res://scene/bag_side_card_introduction.gd" id="2_7bq06"]
[ext_resource type="Texture2D" uid="uid://bi8xct6xiw6ot" path="res://res/ui/ui_008_bag/tuceng163.png" id="2_fcw61"]
[ext_resource type="Texture2D" uid="uid://li8e5ntlgcpg" path="res://res/ui/ui_003_select/test.png" id="3_ptbh5"]
[ext_resource type="Texture2D" uid="uid://bv5p851qbn02v" path="res://res/ui/ui_008_bag/tuceng162.png" id="4_nwob5"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_c6gxk"]
texture = ExtResource("4_nwob5")
texture_margin_top = 53.0
texture_margin_right = 133.0
texture_margin_bottom = 23.0
[node name="card" type="TextureRect"]
texture = ExtResource("1_n0qka")
stretch_mode = 5
script = ExtResource("2_7bq06")
[node name="bag_card" type="TextureRect" parent="."]
show_behind_parent = true
clip_children = 2
clip_contents = true
layout_mode = 1
anchors_preset = -1
anchor_top = 0.0124224
anchor_right = 0.999145
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("2_fcw61")
expand_mode = 1
stretch_mode = 5
[node name="bag_card_face_big" type="TextureRect" parent="bag_card"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_ptbh5")
expand_mode = 1
stretch_mode = 5
[node name="Panel" type="Panel" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.0360516
anchor_top = 0.593168
anchor_right = 1.01975
anchor_bottom = 0.981366
theme_override_styles/panel = SubResource("StyleBoxTexture_c6gxk")
[node name="bag_card_name" type="Label" parent="Panel"]
unique_name_in_owner = true
layout_mode = 0
anchor_left = 0.180628
anchor_right = 0.913613
anchor_bottom = 0.212
theme_override_font_sizes/font_size = 27
text = "物品名"
vertical_alignment = 1
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
layout_mode = 1
anchors_preset = -1
anchor_top = 0.212
anchor_right = 0.939791
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 0
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/VBoxContainer"]
custom_minimum_size = Vector2(0, 29)
layout_mode = 2
theme_override_constants/separation = 0
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 6
[node name="bag_card_main_type" type="Label" parent="Panel/VBoxContainer/HBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 0
theme_override_colors/font_color = Color(0.8, 0.8, 0.8, 1)
theme_override_font_sizes/font_size = 20
text = "主类别"
[node name="Label2" type="Label" parent="Panel/VBoxContainer/HBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 0
theme_override_colors/font_color = Color(0.8, 0.8, 0.8, 1)
theme_override_font_sizes/font_size = 20
text = "——"
[node name="bag_card_next_type" type="Label" parent="Panel/VBoxContainer/HBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 2
theme_override_colors/font_color = Color(0.8, 0.8, 0.8, 1)
theme_override_font_sizes/font_size = 20
text = "次类别"
[node name="bag_card_introduction" type="Label" parent="Panel/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/line_spacing = 11
theme_override_font_sizes/font_size = 24
text = "物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品"
autowrap_mode = 3

View File

@ -4,6 +4,7 @@ extends Label
signal fresh
@export var type:int=0
@export var texture:TextureRect
var is_mouse_enter:bool=false
var item_data
#当前使用的页面
var page:int=0
@ -26,3 +27,18 @@ func set_data(_data):
return
item_data=_data
texture.texture=Global.get_texture(_data["texture"])
func _on_mouse_entered():
is_mouse_enter=true
pass
func _on_mouse_exit():
is_mouse_enter=false
func _ready() -> void:
mouse_entered.connect(_on_mouse_entered)
mouse_exited.connect(_on_mouse_exit)
func _input(event: InputEvent) -> void:
if event.is_action_pressed("mouse_left") and is_mouse_enter:
print("xxx")
Global.replace_equip_with_data(page,index,null)
fresh.emit()

View File

@ -152,7 +152,6 @@ func init_from_data():
new_card.equip_index=ind_arr[i]
%bag_side_card_add_pos.add_child(new_card)
new_card.set_data(data_arr[i])
new_card.click.connect(equip_mes_show)
pass
now_character_use_equip_page=Global.get_character_page_now_use()
var now_use_equip_data_arr=Global.get_now_character_equip_use()
@ -161,12 +160,7 @@ func init_from_data():
equipment_group[i].set_data(now_use_equip_data_arr[i])
pass
#要求显示背包卡片的具体信息
func equip_mes_show(data:Dictionary):
%bag_card_face_big.texture=Global.get_texture(data["texture"])
%bag_card_name.text=data["name"]
%bag_card_introduction.text=data["introduction"]
pass
func start_config_mes_click(mes:StartConfigMes,ind:int):
now_selected_mes.state=0
mes.state=1
@ -217,6 +211,26 @@ func _ready() -> void:
Global.add_item_to_bag(Global.get_item_data("item_03"))
Global.add_item_to_bag(Global.get_item_data("item_04"))
Global.add_item_to_bag(Global.get_item_data("item_05"))
Global.add_item_to_bag(Global.get_item_data("item_01"))
Global.add_item_to_bag(Global.get_item_data("item_02"))
Global.add_item_to_bag(Global.get_item_data("item_03"))
Global.add_item_to_bag(Global.get_item_data("item_04"))
Global.add_item_to_bag(Global.get_item_data("item_05"))
Global.add_item_to_bag(Global.get_item_data("item_01"))
Global.add_item_to_bag(Global.get_item_data("item_02"))
Global.add_item_to_bag(Global.get_item_data("item_03"))
Global.add_item_to_bag(Global.get_item_data("item_04"))
Global.add_item_to_bag(Global.get_item_data("item_05"))
Global.add_item_to_bag(Global.get_item_data("item_01"))
Global.add_item_to_bag(Global.get_item_data("item_02"))
Global.add_item_to_bag(Global.get_item_data("item_03"))
Global.add_item_to_bag(Global.get_item_data("item_04"))
Global.add_item_to_bag(Global.get_item_data("item_05"))
Global.add_item_to_bag(Global.get_item_data("item_01"))
Global.add_item_to_bag(Global.get_item_data("item_02"))
Global.add_item_to_bag(Global.get_item_data("item_03"))
Global.add_item_to_bag(Global.get_item_data("item_04"))
Global.add_item_to_bag(Global.get_item_data("item_05"))
if is_in_game:
$VBoxContainer/TextureRect/HBoxContainer/Button6.hide()
$VBoxContainer/TextureRect/HBoxContainer/Button4.show()

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=61 format=3 uid="uid://chh7gr3qbkr8u"]
[gd_scene load_steps=56 format=3 uid="uid://chh7gr3qbkr8u"]
[ext_resource type="Script" path="res://scene/basic_message.gd" id="1_0470d"]
[ext_resource type="Texture2D" uid="uid://dygka5vk5qdhs" path="res://res/ui/ui_005_basic_message/tuceng2.png" id="1_vhe21"]
@ -25,11 +25,7 @@
[ext_resource type="Texture2D" uid="uid://b0j7ab741cigo" path="res://res/ui/ui_008_bag/tuceng157.png" id="21_271ai"]
[ext_resource type="Texture2D" uid="uid://4vh7r32sndeq" path="res://res/ui/ui_005_basic_message/tuceng230.png" id="21_boe0q"]
[ext_resource type="PackedScene" uid="uid://3g5ba73apov5" path="res://scene/bag_tab_button.tscn" id="22_rvfxp"]
[ext_resource type="Texture2D" uid="uid://bi8xct6xiw6ot" path="res://res/ui/ui_008_bag/tuceng163.png" id="23_3tqr0"]
[ext_resource type="PackedScene" uid="uid://dfhx4088ydrme" path="res://scene/bag_side_card.tscn" id="23_o216g"]
[ext_resource type="Texture2D" uid="uid://cb8yq6241lysk" path="res://res/ui/ui_008_bag/tuceng161.png" id="24_eo4hu"]
[ext_resource type="Texture2D" uid="uid://li8e5ntlgcpg" path="res://res/ui/ui_003_select/test.png" id="25_m68h1"]
[ext_resource type="Texture2D" uid="uid://bv5p851qbn02v" path="res://res/ui/ui_008_bag/tuceng162.png" id="26_a0qj1"]
[ext_resource type="Texture2D" uid="uid://by5wwqutmq8ga" path="res://res/ui/ui_002_main/dinglan1.png" id="28_6wej8"]
[ext_resource type="Texture2D" uid="uid://drot7aaqilnqi" path="res://res/ui/ui_002_main/jifen.png" id="29_7c243"]
[ext_resource type="Texture2D" uid="uid://ceiuf8ik4bayc" path="res://res/ui/ui_002_main/dinglan2.png" id="30_pvmw2"]
@ -79,12 +75,6 @@ texture_margin_bottom = 246.247
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_8w1g7"]
texture = ExtResource("20_fxlve")
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_d723k"]
texture = ExtResource("26_a0qj1")
texture_margin_top = 53.0
texture_margin_right = 133.0
texture_margin_bottom = 23.0
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_21cg7"]
texture = ExtResource("32_adg3f")
@ -1462,11 +1452,13 @@ size_flags_horizontal = 0
horizontal_scroll_mode = 0
vertical_scroll_mode = 3
[node name="bag_side_card_add_pos" type="VBoxContainer" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer"]
[node name="bag_side_card_add_pos" type="GridContainer" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 29
theme_override_constants/h_separation = 30
theme_override_constants/v_separation = 30
columns = 6
[node name="bag_side_card" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer/bag_side_card_add_pos" instance=ExtResource("23_o216g")]
layout_mode = 2
@ -1474,116 +1466,35 @@ layout_mode = 2
[node name="bag_side_card2" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer/bag_side_card_add_pos" instance=ExtResource("23_o216g")]
layout_mode = 2
[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer"]
[node name="bag_side_card3" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer/bag_side_card_add_pos" instance=ExtResource("23_o216g")]
layout_mode = 2
size_flags_horizontal = 3
ratio = 0.603
[node name="card" type="TextureRect" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/AspectRatioContainer"]
[node name="bag_side_card4" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer/bag_side_card_add_pos" instance=ExtResource("23_o216g")]
layout_mode = 2
texture = ExtResource("24_eo4hu")
expand_mode = 1
stretch_mode = 5
[node name="bag_card" type="TextureRect" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/AspectRatioContainer/card"]
show_behind_parent = true
clip_children = 2
clip_contents = true
layout_mode = 1
anchors_preset = -1
anchor_top = 0.0124224
anchor_right = 0.999145
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("23_3tqr0")
expand_mode = 1
stretch_mode = 5
metadata/_edit_use_anchors_ = true
[node name="bag_card_face_big" type="TextureRect" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/AspectRatioContainer/card/bag_card"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("25_m68h1")
expand_mode = 1
stretch_mode = 5
[node name="Panel" type="Panel" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/AspectRatioContainer/card"]
layout_mode = 0
anchor_left = 0.0360516
anchor_top = 0.593168
anchor_right = 1.01975
anchor_bottom = 0.981366
theme_override_styles/panel = SubResource("StyleBoxTexture_d723k")
metadata/_edit_use_anchors_ = true
[node name="bag_card_name" type="Label" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/AspectRatioContainer/card/Panel"]
unique_name_in_owner = true
layout_mode = 0
anchor_left = 0.180628
anchor_right = 0.913613
anchor_bottom = 0.212
theme_override_font_sizes/font_size = 27
text = "物品名"
vertical_alignment = 1
metadata/_edit_use_anchors_ = true
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/AspectRatioContainer/card/Panel"]
layout_mode = 1
anchors_preset = -1
anchor_top = 0.212
anchor_right = 0.939791
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 0
metadata/_edit_use_anchors_ = true
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/AspectRatioContainer/card/Panel/VBoxContainer"]
custom_minimum_size = Vector2(0, 29)
[node name="bag_side_card5" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer/bag_side_card_add_pos" instance=ExtResource("23_o216g")]
layout_mode = 2
theme_override_constants/separation = 0
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/AspectRatioContainer/card/Panel/VBoxContainer/HBoxContainer"]
[node name="bag_side_card6" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer/bag_side_card_add_pos" instance=ExtResource("23_o216g")]
layout_mode = 2
size_flags_horizontal = 6
[node name="bag_card_main_type" type="Label" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/AspectRatioContainer/card/Panel/VBoxContainer/HBoxContainer/HBoxContainer"]
unique_name_in_owner = true
[node name="bag_side_card7" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer/bag_side_card_add_pos" instance=ExtResource("23_o216g")]
layout_mode = 2
size_flags_horizontal = 0
theme_override_colors/font_color = Color(0.8, 0.8, 0.8, 1)
theme_override_font_sizes/font_size = 20
text = "主类别"
[node name="Label2" type="Label" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/AspectRatioContainer/card/Panel/VBoxContainer/HBoxContainer/HBoxContainer"]
[node name="bag_side_card8" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer/bag_side_card_add_pos" instance=ExtResource("23_o216g")]
layout_mode = 2
size_flags_horizontal = 0
theme_override_colors/font_color = Color(0.8, 0.8, 0.8, 1)
theme_override_font_sizes/font_size = 20
text = "——"
[node name="bag_card_next_type" type="Label" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/AspectRatioContainer/card/Panel/VBoxContainer/HBoxContainer/HBoxContainer"]
unique_name_in_owner = true
[node name="bag_side_card9" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer/bag_side_card_add_pos" instance=ExtResource("23_o216g")]
layout_mode = 2
size_flags_horizontal = 2
theme_override_colors/font_color = Color(0.8, 0.8, 0.8, 1)
theme_override_font_sizes/font_size = 20
text = "次类别"
[node name="bag_card_introduction" type="Label" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/AspectRatioContainer/card/Panel/VBoxContainer"]
unique_name_in_owner = true
[node name="bag_side_card10" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer/bag_side_card_add_pos" instance=ExtResource("23_o216g")]
layout_mode = 2
[node name="bag_side_card11" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer/bag_side_card_add_pos" instance=ExtResource("23_o216g")]
layout_mode = 2
[node name="bag_side_card12" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer/margin/HBoxContainer/ScrollContainer/bag_side_card_add_pos" instance=ExtResource("23_o216g")]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/line_spacing = 11
theme_override_font_sizes/font_size = 24
text = "物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品介绍物品"
autowrap_mode = 3
[node name="tab" type="Control" parent="VBoxContainer/TabContainer/bag/Panel/VBoxContainer"]
custom_minimum_size = Vector2(0, 62)
@ -1702,7 +1613,7 @@ anchor_right = 1.0
anchor_bottom = 0.913386
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 1
mouse_filter = 0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 4