From cb4f2e02da2ce1eb23cf732ba4a197a1d42d98f2 Mon Sep 17 00:00:00 2001 From: TsubakiLoL <2789646812@qq.com> Date: Thu, 10 Oct 2024 18:09:32 +0800 Subject: [PATCH] 10.10 --- autoload/database/script/database.gd | 25 +++- autoload/global/script/global.gd | 17 ++- class/character_tool/character_tool.gd | 23 +++- class/item_tool/item_tool.gd | 7 ++ json/event.json | 54 +++++++++ json/item.json | 33 ++++-- json/npc.json | 2 +- json/scene.json | 8 ++ json/script.json | 10 +- json/type.json | 10 ++ scene/ability_to_cards.gd | 75 ++++++++++++ scene/ability_to_cards.tscn | 47 +++++--- scene/ability_to_cards_side_card.gd | 18 +++ scene/ability_to_cards_side_card.tscn | 11 +- scene/auction.gd | 12 ++ scene/auction.tscn | 13 ++- scene/bag_side_card_introduction.tscn | 8 +- scene/basic_message.gd | 15 +-- scene/game_flow.gd | 11 ++ scene/game_flow.tscn | 18 ++- scene/item_level_up.gd | 5 + scene/save_and_load.gd | 2 + scene/save_and_load_mono.gd | 2 +- scene/select.gd | 7 ++ scene/select.tscn | 10 +- scene/warehouse.gd | 77 +++++++++++++ scene/warehouse.tscn | 154 +++++++++++++++++++++---- scene/warehouse_card.gd | 21 ++++ scene/warehouse_card.tscn | 14 ++- scene/warehouse_item_panel.gd | 5 + scene/warehouse_tab.gd | 20 ++++ scene/warehouse_tab.tscn | 55 +++++++++ 32 files changed, 700 insertions(+), 89 deletions(-) create mode 100644 json/type.json create mode 100644 scene/ability_to_cards.gd create mode 100644 scene/ability_to_cards_side_card.gd create mode 100644 scene/warehouse.gd create mode 100644 scene/warehouse_card.gd create mode 100644 scene/warehouse_item_panel.gd create mode 100644 scene/warehouse_tab.gd create mode 100644 scene/warehouse_tab.tscn diff --git a/autoload/database/script/database.gd b/autoload/database/script/database.gd index 67b253b..2b4fb0b 100644 --- a/autoload/database/script/database.gd +++ b/autoload/database/script/database.gd @@ -15,6 +15,7 @@ var character_data:Dictionary var map_json_path:String="res://json/map.json" var map_data:Dictionary + var item_json_path:String="res://json/item.json" var item_data @@ -28,6 +29,8 @@ var word_data:Dictionary var identifation_json_path:String="res://json/indetification.json" var identifation_data:Dictionary +var type_json_path:String="res://json/type.json" +var type_data:Dictionary #角色修饰数据的存储路径 var character_embellish_data_path:String="user://emblish.data" var character_embellish_data:Dictionary={ @@ -74,6 +77,7 @@ func _ready() -> void: load_item_data() load_word_data() load_identifation_data() + load_type_data() #加载当前图片数据 func load_texture_data(): var file=FileAccess.open(texture_json_path,FileAccess.READ) @@ -165,7 +169,7 @@ func load_word_data(): for i in dictionary.keys(): dictionary[i]["id"]=i word_data=dictionary -#加载鉴定时间数据 +#加载鉴定数据 func load_identifation_data(): var file=FileAccess.open(identifation_json_path,FileAccess.READ) var str=file.get_as_text() @@ -174,7 +178,13 @@ func load_identifation_data(): dictionary[i]["id"]=i identifation_data=dictionary pass - +#加载物品类型数据 +func load_type_data(): + var file=FileAccess.open(type_json_path,FileAccess.READ) + var str=file.get_as_text() + var dictionary:Dictionary=JSON.parse_string(str) + type_data=dictionary + pass #获取图标 func get_texture(id:String): if texture_data.has(id): @@ -298,3 +308,14 @@ func get_identifation_data(id:String): else: return null pass +#获取类型对应的名字 +func get_type_name(type:int)->String: + var type_str=str(type) + if type_data.has(type_str): + return type_data[type_str] + else: + return "未知类型" + pass +#获取全部主要类型字典 +func get_all_main_type(): + return type_data["main"].duplicate() diff --git a/autoload/global/script/global.gd b/autoload/global/script/global.gd index c4f06fa..1264ae6 100644 --- a/autoload/global/script/global.gd +++ b/autoload/global/script/global.gd @@ -317,7 +317,7 @@ var now_game_data:Dictionary={ #存储的NPC数据(仅包含遇到的NPC,用于存储NPC的背包,在申请NPCdata时进行写入 "NPC_data":{}, - + #当前场景ID "now_scene":"", "difficulty":0, "gold":1000, @@ -326,12 +326,19 @@ var now_game_data:Dictionary={ "map":"map_01", "move_ability":1, "time_unix":0, + #背包卡牌(废弃) "card_in_bag":["card_03","card_03","card_02","card_02","card_01","card_01","card_01","card_01"], + #互动点触摸随机结果记忆字典 "condition_triger_randi_dic":{ - } + }, + #当前可以制作的物品ID(配方) + "item_could_make":["item_06"] } +#返回当前可以制作的物品ID +func get_now_game_item_could_make(): + return now_game_data["item_could_make"].duplicate() #获取当前局内NPC数据 func get_now_game_npc_data(NPC_id:String): var now_npc_data:Dictionary=now_game_data["NPC_data"] @@ -477,7 +484,9 @@ var triger:Dictionary={ #拍卖触发器 "show_auction":func(data):show_auction(data), #装备升级界面展示触发器 - "show_level_up":func (data):now_game_flow.show_item_level_up() + "show_level_up":func (data):now_game_flow.show_item_level_up(), + "show_warehouse":func(data):now_game_flow.show_warehouse(), + "make_card":func(data):now_game_flow.show_make_card() } #使用事件触发器 func call_triger(triger_type:String,data): @@ -569,8 +578,10 @@ func fish_round(character_data:Dictionary,round_dic:Dictionary,choice:String)->b if res: round_dic["left_cost"]-=1 round_dic["right_total"]+=1 + round_dic["introduction"]="你钓到了一条鱼" else: round_dic["left_total"]+=1 + round_dic["introduction"]="你钓到了一条鱼,但是跑了" round_dic["right_cost"]-=1 return res diff --git a/class/character_tool/character_tool.gd b/class/character_tool/character_tool.gd index 9cb545b..ad57257 100644 --- a/class/character_tool/character_tool.gd +++ b/class/character_tool/character_tool.gd @@ -38,6 +38,12 @@ static func cacul_fight_attribute(character_data:Dictionary)->Dictionary: #"LUC":100,幸运 #"AM":100,魅力 #体质 + #"AD":"物理伤害", + #"AP":"法术强度", + #"CRT":"暴击率", + #"CSD":"暴击伤害", + #"LPD":"物理减伤", + #"LSD":"法术减伤", var CON=attribute_data["CON"] var AGI=attribute_data["AGI"] var INT=attribute_data["INT"] @@ -49,7 +55,12 @@ static func cacul_fight_attribute(character_data:Dictionary)->Dictionary: res["HP"]=CON*5 res["SP"]=INT+MND res["VIT"]=120 - + res["AD"]=int(STR/10) + res["AP"]=int(MND/10) + res["CRT"]=5+LUC/2 + res["CSD"]=100+WIS + res["LPD"]=0 + res["LSD"]=0 return res pass @@ -92,6 +103,7 @@ static func character_embellish(character_data:Dictionary,embellish_data:Diction res_data["unlocked_start"].append(float(i)) return res_data +#获取先手值 static func get_initiative_value(character_data:Dictionary)->int: var AGI=get_character_attribute(character_data,"AGI") return AGI/2+randi_range(-10,10) @@ -108,7 +120,13 @@ static var attribute_key_to_name_dic:Dictionary={ "AM":"魅力", "HP":"生命", "SP":"精神", - "VIT":"体力" + "VIT":"体力", + "AD":"物理伤害", + "AP":"法术强度", + "CRT":"暴击率", + "CSD":"暴击伤害", + "LPD":"物理减伤", + "LSD":"法术减伤", } ##通过属性的键名获取显示名字 static func get_name_by_attribute_key(key:String)->String: @@ -214,6 +232,7 @@ static func get_character_with_equip_value(character_data:Dictionary)->Dictionar if basic_attribute.has(j): #计算白值 basic_attribute[j]+=add_attribute[j] + return res pass diff --git a/class/item_tool/item_tool.gd b/class/item_tool/item_tool.gd index 248f9ac..6379864 100644 --- a/class/item_tool/item_tool.gd +++ b/class/item_tool/item_tool.gd @@ -134,3 +134,10 @@ static func could_item_level_up(item_data:Dictionary): #获取当前item升级所需材料 static func get_item_level_up_need(item_data:Dictionary): return item_data["level_up_need_material"][str(item_data["quality"])].duplicate(true) + +#当前item是否可以被制作 +static func could_item_be_made(item_data:Dictionary)->bool: + return item_data.has("make_need") +#获取制作材料 +static func get_item_make_material(item_data:Dictionary): + return item_data["make_need"] diff --git a/json/event.json b/json/event.json index d918106..ffdad2c 100644 --- a/json/event.json +++ b/json/event.json @@ -259,5 +259,59 @@ },] } ] + }, + "warehouse_test":{ + "name":"升级测试事件", + "texture":"test_scene", + "text":"这是一个测试装备升级系统的事件", + "choice":[ + { + "name":"打开仓库", + "triger":[ + { + "type":"show_warehouse", + "data":"" + }, + { + "type":"end_event", + "data":"" + }, + ] + }, + { + "name":"结束", + "triger":[{ + "type":"end_event", + "data":"" + },] + } + ] + }, + "make_card_test":{ + "name":"卡牌制作测试事件", + "texture":"test_scene", + "text":"这是一个测试卡牌制作系统的事件", + "choice":[ + { + "name":"制作", + "triger":[ + { + "type":"make_card", + "data":"" + }, + { + "type":"end_event", + "data":"" + }, + ] + }, + { + "name":"结束", + "triger":[{ + "type":"end_event", + "data":"" + },] + } + ] } } diff --git a/json/item.json b/json/item.json index 5a9facd..f89802f 100644 --- a/json/item.json +++ b/json/item.json @@ -66,9 +66,7 @@ "texture":"bag", "name":"测试手部装备背包", "introduction":"用于测试的手部装备,并没有什么用", - "material":{ - - } + }, "item_03":{ @@ -91,9 +89,7 @@ "texture":"clothes", "name":"测试身体", "introduction":"用于测试的身体装备,并没有什么用", - "material":{ - - } + }, "item_04":{ @@ -141,9 +137,7 @@ "texture":"knife", "name":"小刀", "introduction":"用于测试的武器,并没有什么用", - "material":{ - - } + }, "item_06":{ @@ -163,8 +157,8 @@ "name":"绷带", "introduction":"用于测试的道具,并没有什么用", "texture":"bandage", - "material":{ - + "make_need":{ + "item_08":5 } }, "item_07":{ @@ -186,6 +180,23 @@ "introduction":"用于测试的技能,并没有什么用", "material":{ + } + }, + "item_08":{ + "type":7, + "allow_merge":true, + "price":10, + "quality_lib":[ + { + "value":0, + "weight":10 + } + ], + "name":"纱布(测试材料)", + "texture":"bandage", + "introduction":"用于测试的材料,制作绷带", + "material":{ + } } diff --git a/json/npc.json b/json/npc.json index 9c6824c..5463afd 100644 --- a/json/npc.json +++ b/json/npc.json @@ -1,7 +1,7 @@ { "npc_01":{ "name":"测试NPC1", - "sold_item":["item_01","item_01","item_01","item_02"], + "sold_item":["item_01","item_01","item_01","item_02","item_08","item_08","item_08","item_08","item_08","item_08","item_08"], "init_favor":50, "gold":9999 }, diff --git a/json/scene.json b/json/scene.json index 42185ec..9ff8b09 100644 --- a/json/scene.json +++ b/json/scene.json @@ -35,6 +35,14 @@ { "name":"升级测试", "event":"item_level_up_test" + }, + { + "name":"仓库测试", + "event":"warehouse_test" + }, + { + "name":"卡牌制作测试", + "event":"make_card_test" } ], "linked_scene":[{ diff --git a/json/script.json b/json/script.json index d51c93f..3922d09 100644 --- a/json/script.json +++ b/json/script.json @@ -16,11 +16,11 @@ "month":2, "day":1, }, - "init_scene":"scene_02", + "init_scene":"scene_01", }, "script_002":{ - "name":"测试剧本001", + "name":"测试剧本002", "texture":"test_scene", "side_texture":"texture_test", "introduction":"这是一个测试剧本", @@ -39,7 +39,7 @@ }, "script_003":{ - "name":"测试剧本001", + "name":"测试剧本003", "texture":"test_scene", "side_texture":"texture_test", "introduction":"这是一个测试剧本", @@ -58,7 +58,7 @@ }, "script_004":{ - "name":"测试剧本001", + "name":"测试剧本004", "texture":"test_scene", "side_texture":"texture_test", "introduction":"这是一个测试剧本", @@ -77,7 +77,7 @@ }, "script_008":{ - "name":"测试剧本001", + "name":"测试剧本005", "texture":"test_scene", "side_texture":"texture_test", "introduction":"这是一个测试剧本", diff --git a/json/type.json b/json/type.json new file mode 100644 index 0000000..24b0216 --- /dev/null +++ b/json/type.json @@ -0,0 +1,10 @@ +{ + "main":[0,1,2,4,5,6,], + "0":"饰品", + "1":"手部", + "2":"身体", + "3":"头部", + "4":"武器", + "5":"道具", + "6":"技能" +} diff --git a/scene/ability_to_cards.gd b/scene/ability_to_cards.gd new file mode 100644 index 0000000..5f6f136 --- /dev/null +++ b/scene/ability_to_cards.gd @@ -0,0 +1,75 @@ +extends Control +const ABILITY_TO_CARDS_SIDE_CARD = preload("res://scene/ability_to_cards_side_card.tscn") +const ABILITY_TO_CARD_NEED = preload("res://scene/ability_to_card_need.tscn") +signal close +var all_could_make_item:Array +func fresh(): + before_click_card=null + for i in %card_add_pos.get_children(): + i.queue_free() + for i in %need_add_pos.get_children(): + i.queue_free() + all_could_make_item=Global.get_now_game_item_could_make() + for i in all_could_make_item.size(): + + var new_size_card=ABILITY_TO_CARDS_SIDE_CARD.instantiate() + %card_add_pos.add_child(new_size_card) + new_size_card.selected=false + if i==0: + side_click(new_size_card,0) + new_size_card.click.connect(side_click.bindv([new_size_card,i])) + new_size_card.set_text(Database.get_item_name(all_could_make_item[i])) + pass + +var before_click_card +var now_selected_item_ind:int=0 +func side_click(side_card,ind:int): + now_selected_item_ind=ind + if before_click_card!=null: + before_click_card.selected=false + side_card.selected=true + var item_id=all_could_make_item[ind] + var item_data=Database.get_item_data(item_id) + var need_material=ItemTool.get_item_make_material(item_data) + %introduction.text=item_data["introduction"] + for i in %need_add_pos.get_children(): + i.queue_free() + %make.disable(false) + for i in need_material.keys(): + var new_need=ABILITY_TO_CARD_NEED.instantiate() + %need_add_pos.add_child(new_need) + var now_item_num=Global.get_item_by_id(i) + var need_num:int=need_material[i] + if now_item_num void: + var could_make:bool=true + var item_id=all_could_make_item[now_selected_item_ind] + var item_data=Database.get_item_data(item_id) + var need_material=ItemTool.get_item_make_material(item_data) + for i in need_material.keys(): + var now_item_num=Global.get_item_by_id(i) + var need_num:int=need_material[i] + if now_item_num void: + self.hide() + close.emit() + pass # Replace with function body. diff --git a/scene/ability_to_cards.tscn b/scene/ability_to_cards.tscn index 04c4c44..e736a54 100644 --- a/scene/ability_to_cards.tscn +++ b/scene/ability_to_cards.tscn @@ -1,5 +1,6 @@ -[gd_scene load_steps=10 format=3 uid="uid://dou3d6026w2ke"] +[gd_scene load_steps=12 format=3 uid="uid://dou3d6026w2ke"] +[ext_resource type="Script" path="res://scene/ability_to_cards.gd" id="1_0t6ea"] [ext_resource type="Texture2D" uid="uid://30i1np6r4irr" path="res://res/ui/ui_022_ability_to_cards/tuceng456.png" id="1_ggp8l"] [ext_resource type="Texture2D" uid="uid://d1ynk80ss0e3w" path="res://res/ui/ui_022_ability_to_cards/juxing631.png" id="2_knnlo"] [ext_resource type="Texture2D" uid="uid://dyr5wjyuofe6f" path="res://res/ui/ui_022_ability_to_cards/juxing632.png" id="3_3xw8r"] @@ -8,6 +9,7 @@ [ext_resource type="PackedScene" uid="uid://dbb1aw7idwsqu" path="res://scene/ability_to_card_need.tscn" id="4_w21b3"] [ext_resource type="PackedScene" uid="uid://cbyrnlb63voun" path="res://scene/ability_to_cards_side_card.tscn" id="4_xu1q7"] [ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="5_8bwb8"] +[ext_resource type="Texture2D" uid="uid://ckxvlfayu5pli" path="res://res/ui/ui_016_warehouse/back.png" id="10_ucexl"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_b55g6"] texture = ExtResource("2_knnlo") @@ -19,6 +21,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_0t6ea") [node name="back" type="TextureRect" parent="."] layout_mode = 1 @@ -78,25 +81,26 @@ layout_mode = 2 layout_mode = 2 size_flags_vertical = 3 -[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer/ScrollContainer"] +[node name="card_add_pos" type="VBoxContainer" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer/ScrollContainer"] +unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 0 theme_override_constants/separation = 13 -[node name="ability_to_cards_side_card" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer/ScrollContainer/VBoxContainer" instance=ExtResource("4_xu1q7")] +[node name="ability_to_cards_side_card" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_xu1q7")] layout_mode = 2 -[node name="ability_to_cards_side_card2" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer/ScrollContainer/VBoxContainer" instance=ExtResource("4_xu1q7")] +[node name="ability_to_cards_side_card2" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_xu1q7")] layout_mode = 2 -[node name="ability_to_cards_side_card3" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer/ScrollContainer/VBoxContainer" instance=ExtResource("4_xu1q7")] +[node name="ability_to_cards_side_card3" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_xu1q7")] layout_mode = 2 -[node name="ability_to_cards_side_card4" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer/ScrollContainer/VBoxContainer" instance=ExtResource("4_xu1q7")] +[node name="ability_to_cards_side_card4" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_xu1q7")] layout_mode = 2 -[node name="ability_to_cards_side_card5" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer/ScrollContainer/VBoxContainer" instance=ExtResource("4_xu1q7")] +[node name="ability_to_cards_side_card5" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer/ScrollContainer/card_add_pos" instance=ExtResource("4_xu1q7")] layout_mode = 2 [node name="VBoxContainer2" type="VBoxContainer" parent="Panel/MarginContainer/HBoxContainer"] @@ -112,31 +116,33 @@ theme_override_constants/margin_top = 34 theme_override_constants/margin_right = 35 theme_override_constants/margin_bottom = 53 -[node name="Label" type="Label" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/MarginContainer"] +[node name="introduction" type="Label" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/MarginContainer"] +unique_name_in_owner = true layout_mode = 2 size_flags_vertical = 0 theme_override_font_sizes/font_size = 26 text = "卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍卡牌介绍" autowrap_mode = 3 -[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2"] +[node name="need_add_pos" type="VBoxContainer" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2"] +unique_name_in_owner = true layout_mode = 2 size_flags_vertical = 0 theme_override_constants/separation = 15 -[node name="ability_to_card_need" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer" instance=ExtResource("4_w21b3")] +[node name="ability_to_card_need" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/need_add_pos" instance=ExtResource("4_w21b3")] layout_mode = 2 -[node name="ability_to_card_need2" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer" instance=ExtResource("4_w21b3")] +[node name="ability_to_card_need2" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/need_add_pos" instance=ExtResource("4_w21b3")] layout_mode = 2 -[node name="ability_to_card_need3" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer" instance=ExtResource("4_w21b3")] +[node name="ability_to_card_need3" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/need_add_pos" instance=ExtResource("4_w21b3")] layout_mode = 2 -[node name="ability_to_card_need4" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer" instance=ExtResource("4_w21b3")] +[node name="ability_to_card_need4" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/need_add_pos" instance=ExtResource("4_w21b3")] layout_mode = 2 -[node name="ability_to_card_need5" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer" instance=ExtResource("4_w21b3")] +[node name="ability_to_card_need5" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/need_add_pos" instance=ExtResource("4_w21b3")] layout_mode = 2 [node name="TextureRect" type="TextureRect" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2"] @@ -157,7 +163,8 @@ text = "制作" horizontal_alignment = 1 vertical_alignment = 1 -[node name="ToolButton" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/TextureRect" instance=ExtResource("5_8bwb8")] +[node name="make" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2/TextureRect" instance=ExtResource("5_8bwb8")] +unique_name_in_owner = true layout_mode = 1 [node name="tab" type="Control" parent="Panel/MarginContainer/HBoxContainer/VBoxContainer2"] @@ -187,3 +194,13 @@ text = "能力生成卡牌" horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_use_anchors_ = true + +[node name="TextureRect" type="TextureRect" parent="."] +size_flags_horizontal = 0 +texture = ExtResource("10_ucexl") + +[node name="back" parent="TextureRect" instance=ExtResource("5_8bwb8")] +layout_mode = 1 + +[connection signal="pressed" from="Panel/MarginContainer/HBoxContainer/VBoxContainer2/TextureRect/make" to="." method="_on_make_pressed"] +[connection signal="pressed" from="TextureRect/back" to="." method="_on_back_pressed"] diff --git a/scene/ability_to_cards_side_card.gd b/scene/ability_to_cards_side_card.gd new file mode 100644 index 0000000..a9b24ff --- /dev/null +++ b/scene/ability_to_cards_side_card.gd @@ -0,0 +1,18 @@ +extends TextureRect + +signal click + +var selected:bool=false: + set(val): + selected=val + if selected: + %selected.show() + else: + %selected.hide() +func set_text(text:String): + $Label.text=text + + +func _on_click_pressed() -> void: + click.emit() + pass # Replace with function body. diff --git a/scene/ability_to_cards_side_card.tscn b/scene/ability_to_cards_side_card.tscn index a4ce762..ea3f635 100644 --- a/scene/ability_to_cards_side_card.tscn +++ b/scene/ability_to_cards_side_card.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=4 format=3 uid="uid://cbyrnlb63voun"] +[gd_scene load_steps=5 format=3 uid="uid://cbyrnlb63voun"] [ext_resource type="Texture2D" uid="uid://xn13ffpmvk2k" path="res://res/ui/ui_022_ability_to_cards/tuceng321.png" id="1_gx4gn"] +[ext_resource type="Script" path="res://scene/ability_to_cards_side_card.gd" id="2_rdhvi"] [ext_resource type="Texture2D" uid="uid://ca28omw2a01lq" path="res://res/ui/ui_022_ability_to_cards/juxing688.png" id="2_s5wdp"] [ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="3_k75v4"] @@ -8,8 +9,10 @@ offset_right = 40.0 offset_bottom = 40.0 texture = ExtResource("1_gx4gn") +script = ExtResource("2_rdhvi") -[node name="TextureRect" type="TextureRect" parent="."] +[node name="selected" type="TextureRect" parent="."] +unique_name_in_owner = true layout_mode = 0 anchor_left = 0.0355872 anchor_top = 0.197674 @@ -31,5 +34,7 @@ text = "卡牌名称" vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="ToolButton" parent="." instance=ExtResource("3_k75v4")] +[node name="click" parent="." instance=ExtResource("3_k75v4")] layout_mode = 1 + +[connection signal="pressed" from="click" to="." method="_on_click_pressed"] diff --git a/scene/auction.gd b/scene/auction.gd index 113e0c7..fbd694d 100644 --- a/scene/auction.gd +++ b/scene/auction.gd @@ -279,3 +279,15 @@ func _on_close_pressed() -> void: close.emit() timer.stop() pass # Replace with function body. + + +func _on_bag_pressed() -> void: + %warehouse.show() + %warehouse.fresh() + timer.paused=true + pass # Replace with function body. + + +func _on_warehouse_close() -> void: + timer.paused=false + pass # Replace with function body. diff --git a/scene/auction.tscn b/scene/auction.tscn index 8c1ab89..f944831 100644 --- a/scene/auction.tscn +++ b/scene/auction.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=35 format=3 uid="uid://cykq0nd4y57xe"] +[gd_scene load_steps=36 format=3 uid="uid://cykq0nd4y57xe"] [ext_resource type="Texture2D" uid="uid://uqdkgws2e3dt" path="res://res/ui/ui_029_multi_indetification/tuceng384.png" id="1_6ffgs"] [ext_resource type="Script" path="res://scene/auction.gd" id="1_butyf"] @@ -20,6 +20,7 @@ [ext_resource type="Texture2D" uid="uid://butvsyebc5fep" path="res://res/ui/ui_031_auction/juxing5_1.png" id="13_ubgv7"] [ext_resource type="Script" path="res://scene/auction_center_mask.gd" id="14_8d3i1"] [ext_resource type="Texture2D" uid="uid://c3nm3avrqj4pf" path="res://res/ui/ui_031_auction/tuceng385.png" id="14_bdkb3"] +[ext_resource type="PackedScene" uid="uid://g38jdt16mvek" path="res://scene/warehouse.tscn" id="21_olr8u"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_ycg8o"] texture = ExtResource("2_5wobl") @@ -352,7 +353,7 @@ horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_use_anchors_ = true -[node name="ToolButton" parent="MarginContainer/Panel/HBoxContainer2/TextureRect2" instance=ExtResource("11_yjciw")] +[node name="bag" parent="MarginContainer/Panel/HBoxContainer2/TextureRect2" instance=ExtResource("11_yjciw")] layout_mode = 1 [node name="TextureRect2" type="TextureRect" parent="MarginContainer/Panel"] @@ -445,10 +446,18 @@ horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_use_anchors_ = true +[node name="warehouse" parent="." instance=ExtResource("21_olr8u")] +unique_name_in_owner = true +visible = false +z_index = 1 +layout_mode = 1 + [connection signal="pressed" from="MarginContainer/Panel/HBoxContainer/TextureRect/left" to="." method="left"] [connection signal="pressed" from="MarginContainer/Panel/HBoxContainer/TextureRect3/right" to="." method="right"] [connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/TextureRect3/out_price_btn" to="." method="_on_out_price_btn_pressed"] [connection signal="pressed" from="MarginContainer/Panel/HBoxContainer2/TextureRect/jump" to="." method="_on_jump_pressed"] +[connection signal="pressed" from="MarginContainer/Panel/HBoxContainer2/TextureRect2/bag" to="." method="_on_bag_pressed"] [connection signal="pressed" from="MarginContainer/Panel/TextureRect2/close" to="." method="_on_close_pressed"] [connection signal="pressed" from="test" to="." method="_on_test_pressed"] [connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] +[connection signal="close" from="warehouse" to="." method="_on_warehouse_close"] diff --git a/scene/bag_side_card_introduction.tscn b/scene/bag_side_card_introduction.tscn index 6221bf2..c6d8c31 100644 --- a/scene/bag_side_card_introduction.tscn +++ b/scene/bag_side_card_introduction.tscn @@ -35,14 +35,16 @@ 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 +anchors_preset = -1 +anchor_right = 1.00086 +anchor_bottom = 0.67281 +offset_right = 3.05176e-05 grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("3_ptbh5") expand_mode = 1 stretch_mode = 5 +metadata/_edit_use_anchors_ = true [node name="Panel" type="Panel" parent="."] layout_mode = 1 diff --git a/scene/basic_message.gd b/scene/basic_message.gd index 641f2c9..c580b94 100644 --- a/scene/basic_message.gd +++ b/scene/basic_message.gd @@ -47,8 +47,8 @@ func init_from_data(): var basic_attribute:Dictionary=data["basic_attribute"] var fight_attribute:Dictionary={} - if data.has("fight_attribute"): - fight_attribute=data["fight_attribute"] + if is_in_game: + fight_attribute=CharacterTool.cacul_fight_attribute(data) for i in %basic_attribute.get_children(): i.queue_free() for i in %fight_attribute.get_children(): @@ -64,7 +64,7 @@ func init_from_data(): var new_attribute=ATTRIBUTE.instantiate() new_attribute.data={ "name":CharacterTool.get_name_by_attribute_key(i), - "value":basic_attribute[i] + "value":fight_attribute[i] } %fight_attribute.add_child(new_attribute) pass @@ -184,7 +184,7 @@ func init_from_data(): new_card.click.connect(card_down_click.bind(bag_index[i])) new_card.set_data(bag_skill_data[i]) pass - + pass #角色装备技能被点击触发 func card_up_click(ind:int): @@ -269,12 +269,7 @@ 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(Database.get_item_data("item_07")) - Global.add_item_to_bag(Database.get_item_data("item_07")) - Global.add_item_to_bag(Database.get_item_data("item_07")) - Global.add_item_to_bag(Database.get_item_data("item_07")) - Global.add_item_to_bag(Database.get_item_data("item_07")) - Global.add_item_to_bag(Database.get_item_data("item_07")) + if is_in_game: $VBoxContainer/TextureRect/HBoxContainer/Button6.hide() diff --git a/scene/game_flow.gd b/scene/game_flow.gd index 465236e..e870e85 100644 --- a/scene/game_flow.gd +++ b/scene/game_flow.gd @@ -152,3 +152,14 @@ func show_item_level_up(): %item_level_up.show() %item_level_up.fresh() pass + +func show_warehouse(): + %warehouse.show() + %warehouse.fresh() + +func show_make_card(): + %ability_to_cards.show() + %ability_to_cards.fresh() + + + pass diff --git a/scene/game_flow.tscn b/scene/game_flow.tscn index 3f33724..e72ac4a 100644 --- a/scene/game_flow.tscn +++ b/scene/game_flow.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=31 format=3 uid="uid://bht5sd88340s5"] +[gd_scene load_steps=34 format=3 uid="uid://bht5sd88340s5"] [ext_resource type="Texture2D" uid="uid://5vyvaedcfv38" path="res://res/ui/ui_019_game_flow/tuceng1.png" id="1_gjw3y"] [ext_resource type="Script" path="res://scene/game_flow.gd" id="1_w6afk"] [ext_resource type="Texture2D" uid="uid://bfxq2lfnecjue" path="res://res/ui/ui_019_game_flow/juxing505.png" id="2_w5ej7"] [ext_resource type="PackedScene" uid="uid://bsegldhx3w3ws" path="res://scene/game_flow_event.tscn" id="3_h6xm4"] +[ext_resource type="PackedScene" uid="uid://clhtya30fwcwp" path="res://scene/game_flow_card.tscn" id="4_yorfj"] [ext_resource type="Texture2D" uid="uid://78rjb4sv4jrp" path="res://res/ui/ui_019_game_flow/juxing507.png" id="5_htscv"] [ext_resource type="Texture2D" uid="uid://bslh6vgaom0ds" path="res://res/ui/ui_019_game_flow/tuceng303.png" id="6_5kjvb"] [ext_resource type="Texture2D" uid="uid://y2mohttec2d0" path="res://res/ui/ui_019_game_flow/mask.tres" id="6_jmymv"] @@ -24,6 +25,8 @@ [ext_resource type="PackedScene" uid="uid://mcf2riinvukc" path="res://scene/single_identification.tscn" id="22_0wbgg"] [ext_resource type="PackedScene" uid="uid://cykq0nd4y57xe" path="res://scene/auction.tscn" id="23_mavou"] [ext_resource type="PackedScene" uid="uid://b0xgo1tguum73" path="res://scene/item_level_up.tscn" id="24_7ni35"] +[ext_resource type="PackedScene" uid="uid://g38jdt16mvek" path="res://scene/warehouse.tscn" id="25_ep25b"] +[ext_resource type="PackedScene" uid="uid://dou3d6026w2ke" path="res://scene/ability_to_cards.tscn" id="27_r2101"] [sub_resource type="Gradient" id="Gradient_4wq1v"] @@ -126,6 +129,9 @@ size_flags_horizontal = 0 size_flags_vertical = 8 theme_override_constants/separation = 29 +[node name="game_flow_card" parent="bottom_container/card" instance=ExtResource("4_yorfj")] +layout_mode = 2 + [node name="event" type="HBoxContainer" parent="bottom_container"] layout_mode = 2 size_flags_horizontal = 10 @@ -478,6 +484,16 @@ unique_name_in_owner = true visible = false layout_mode = 1 +[node name="warehouse" parent="." instance=ExtResource("25_ep25b")] +unique_name_in_owner = true +visible = false +layout_mode = 1 + +[node name="ability_to_cards" parent="." instance=ExtResource("27_r2101")] +unique_name_in_owner = true +visible = false +layout_mode = 1 + [connection signal="pressed" from="hbox/TextureRect/head_btn" to="." method="_on_head_btn_pressed"] [connection signal="pressed" from="HBoxContainer/TextureRect/save" to="." method="_on_save_pressed"] [connection signal="pressed" from="HBoxContainer/TextureRect2/load" to="." method="_on_load_pressed"] diff --git a/scene/item_level_up.gd b/scene/item_level_up.gd index 83ff7f8..ff75c6a 100644 --- a/scene/item_level_up.gd +++ b/scene/item_level_up.gd @@ -18,6 +18,10 @@ func fresh(): if now_select_item_index>=0: %level_up.disable(false) var selected_item_data=Global.get_all_item_game_data()[now_select_item_index] + if selected_item_data.has("level") and selected_item_data["level"]>0: + %level.text="+"+str(selected_item_data["level"]) + else: + %level.text="" %selected_face.texture=Database.get_texture(selected_item_data["texture"]) var level_up_need_material=ItemTool.get_item_level_up_need(selected_item_data) for i in level_up_need_material.keys(): @@ -28,6 +32,7 @@ func fresh(): if now_item_num void: diff --git a/scene/save_and_load.gd b/scene/save_and_load.gd index 072c130..c8c776d 100644 --- a/scene/save_and_load.gd +++ b/scene/save_and_load.gd @@ -17,10 +17,12 @@ func fresh(): var all_save=Global.get_all_save() for i in all_save.size(): var new_mono=SAVE_AND_LOAD_MONO.instantiate() + new_mono.need_save=need_save %mono_add_pos.add_child(new_mono) new_mono.cover.connect(cover.bind(i)) new_mono.load.connect(load_save.bind(i)) new_mono.delete.connect(delete_save.bind(i)) + new_mono.set_data(all_save[i]) pass pass diff --git a/scene/save_and_load_mono.gd b/scene/save_and_load_mono.gd index d37cbe1..9a3af2a 100644 --- a/scene/save_and_load_mono.gd +++ b/scene/save_and_load_mono.gd @@ -3,7 +3,7 @@ extends NinePatchRect var need_save:bool=true func set_data(data:Dictionary): %name.text=data["name"] - %date.text=Time.get_datetime_string_from_unix_time(data["time_unix"]) + %date.text=Time.get_datetime_string_from_unix_time(data["time_unix"],true) %place.text=Database.get_scene_name(data["now_scene"]) pass diff --git a/scene/select.gd b/scene/select.gd index 76c2cd1..ef1e684 100644 --- a/scene/select.gd +++ b/scene/select.gd @@ -152,6 +152,8 @@ func _on_enter_button_pressed() -> void: func _on_continue_button_pressed() -> void: continue_script.emit() + %save_and_load.fresh() + %save_and_load.show() pass # Replace with function body. @@ -178,3 +180,8 @@ func _on_difficulty_selection_select(ind: int) -> void: func _on_character_select_start_game(character_data: Dictionary) -> void: pass # Replace with function body. + + +func _on_save_and_load_close() -> void: + %save_and_load.hide() + pass # Replace with function body. diff --git a/scene/select.tscn b/scene/select.tscn index e6c774e..661a1d0 100644 --- a/scene/select.tscn +++ b/scene/select.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=27 format=3 uid="uid://33lcg23hy4mi"] +[gd_scene load_steps=28 format=3 uid="uid://33lcg23hy4mi"] [ext_resource type="Script" path="res://scene/select.gd" id="1_cgnul"] [ext_resource type="Texture2D" uid="uid://li8e5ntlgcpg" path="res://res/ui/ui_003_select/test.png" id="3_jw1jl"] @@ -20,6 +20,7 @@ [ext_resource type="Texture2D" uid="uid://bt5qrcsynsp6j" path="res://res/ui/ui_004_character_bag/tuceng231.png" id="18_qwfod"] [ext_resource type="Texture2D" uid="uid://bdnuk1oe6bhjv" path="res://res/ui/ui_003_select/tuceng29.png" id="19_ubknp"] [ext_resource type="PackedScene" uid="uid://c6ucq32jlpjd6" path="res://scene/difficulty_selection.tscn" id="20_168x8"] +[ext_resource type="PackedScene" uid="uid://ln0ri824gh2c" path="res://scene/save_and_load.tscn" id="21_p88u2"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_ly4bd"] resource_local_to_scene = true @@ -576,9 +577,16 @@ rag = 1.0 unique_name_in_owner = true layout_mode = 2 +[node name="save_and_load" parent="." instance=ExtResource("21_p88u2")] +unique_name_in_owner = true +visible = false +z_index = 2 +layout_mode = 1 + [connection signal="pressed" from="HBoxContainer/continue_texture/continue_button" to="." method="_on_continue_button_pressed"] [connection signal="pressed" from="back_button/ToolButton" to="." method="_on_back_button_pressed"] [connection signal="pressed" from="enter_texture/enter_button" to="." method="_on_enter_button_pressed"] [connection signal="back" from="DrawerContainer2/difficulty_selection" to="." method="_on_difficulty_selection_back"] [connection signal="select" from="DrawerContainer2/difficulty_selection" to="." method="_on_difficulty_selection_select"] [connection signal="back" from="DrawerContainer/character_select" to="." method="_on_character_select_back"] +[connection signal="close" from="save_and_load" to="." method="_on_save_and_load_close"] diff --git a/scene/warehouse.gd b/scene/warehouse.gd new file mode 100644 index 0000000..30aa566 --- /dev/null +++ b/scene/warehouse.gd @@ -0,0 +1,77 @@ +extends Control +signal close +const WAREHOUSE_CARD = preload("res://scene/warehouse_card.tscn") +const WAREHOUSE_TAB = preload("res://scene/warehouse_tab.tscn") + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. +var now_selected_type:int=-1 + + +func fresh(): + %item_panel.hide() + for i in %tab_add_pos.get_children(): + i.queue_free() + for i in %card_add_pos.get_children(): + i.queue_free() + + var all_main_type=Database.get_all_main_type() + var type_all=WAREHOUSE_TAB.instantiate() + %tab_add_pos.add_child(type_all) + type_all.set_text("全部") + type_all.click.connect(type_click.bind(-1)) + if now_selected_type<0: + type_all.selected=true + else: + type_all.selected=false + for i in all_main_type: + var new_tab=WAREHOUSE_TAB.instantiate() + %tab_add_pos.add_child(new_tab) + if i==now_selected_type: + new_tab.selected=true + else: + new_tab.selected=false + new_tab.set_text(Database.get_type_name(int(i))) + new_tab.click.connect(type_click.bind(int(i))) + var item=Global.get_all_item_game_data() + if now_selected_type<0: + for i in item.size(): + var new_card=WAREHOUSE_CARD.instantiate() + %card_add_pos.add_child(new_card) + new_card.set_data(item[i]) + + new_card.item_index_in_all=i + new_card.click.connect(item_card_click.bind(i)) + else: + for i in item.size(): + if int(item[i]["type"])==now_selected_type: + var new_card=WAREHOUSE_CARD.instantiate() + %card_add_pos.add_child(new_card) + new_card.set_data(item[i]) + new_card.item_index_in_all=i + new_card.click.connect(item_card_click.bind(i)) + pass + + pass +func type_click(type:int): + now_selected_type=type + fresh() + pass + + +func item_card_click(ind:int): + var item_data=Global.get_all_item_game_data()[ind] + %item_panel.show() + %name.text=ItemTool.get_name_from_item_data(item_data) + %introduction.text=ItemTool.get_introduction_from_item_data(item_data) + pass +func _on_back_pressed() -> void: + close.emit() + self.hide() + pass # Replace with function body. + + +func _on_empty_pressed() -> void: + %item_panel.hide() + pass # Replace with function body. diff --git a/scene/warehouse.tscn b/scene/warehouse.tscn index 86458ba..0f6797b 100644 --- a/scene/warehouse.tscn +++ b/scene/warehouse.tscn @@ -1,10 +1,26 @@ -[gd_scene load_steps=6 format=3 uid="uid://g38jdt16mvek"] +[gd_scene load_steps=16 format=3 uid="uid://g38jdt16mvek"] [ext_resource type="Texture2D" uid="uid://cmqat5e0htv3c" path="res://res/ui/ui_016_warehouse/tuceng246.png" id="1_dili2"] +[ext_resource type="Script" path="res://scene/warehouse.gd" id="1_pc0qc"] [ext_resource type="Texture2D" uid="uid://ckxvlfayu5pli" path="res://res/ui/ui_016_warehouse/back.png" id="2_o2wt7"] [ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="3_a2pau"] [ext_resource type="Texture2D" uid="uid://btij1np3xl1y3" path="res://res/ui/ui_016_warehouse/tuceng241.png" id="4_i3i26"] [ext_resource type="PackedScene" uid="uid://badmgihnaaxwk" path="res://scene/warehouse_card.tscn" id="5_cg0ke"] +[ext_resource type="Texture2D" uid="uid://cmbg8esuviq25" path="res://res/ui/ui_016_warehouse/tuceng240.png" id="5_cy5jy"] +[ext_resource type="PackedScene" uid="uid://crrqs1woslql2" path="res://scene/warehouse_tab.tscn" id="6_arwik"] +[ext_resource type="Texture2D" uid="uid://faghontv8mf0" path="res://res/ui/ui_016_warehouse/tuceng244.png" id="9_0q7pg"] +[ext_resource type="Script" path="res://scene/warehouse_item_panel.gd" id="10_45lxp"] +[ext_resource type="Texture2D" uid="uid://dqfjfxett0kl7" path="res://res/ui/ui_016_warehouse/tuceng245.png" id="10_wpye3"] +[ext_resource type="Texture2D" uid="uid://en8cdckjc6lk" path="res://res/ui/ui_016_warehouse/juxing21.png" id="11_r6xnx"] + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_ams42"] +texture = ExtResource("9_0q7pg") + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_fixed"] +texture = ExtResource("10_wpye3") + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_dhdip"] +texture = ExtResource("11_r6xnx") [node name="warehouse" type="Control"] layout_mode = 3 @@ -13,6 +29,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_pc0qc") [node name="backfround" type="TextureRect" parent="."] layout_mode = 1 @@ -47,15 +64,41 @@ layout_mode = 2 size_flags_horizontal = 0 texture = ExtResource("2_o2wt7") -[node name="ToolButton" parent="VBoxContainer/HBoxContainer/TextureRect" instance=ExtResource("3_a2pau")] +[node name="back" parent="VBoxContainer/HBoxContainer/TextureRect" instance=ExtResource("3_a2pau")] layout_mode = 1 [node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 10 +theme_override_constants/margin_top = 17 -[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/HBoxContainer/MarginContainer"] +[node name="TextureRect" type="TextureRect" parent="VBoxContainer/HBoxContainer/MarginContainer"] layout_mode = 2 +texture = ExtResource("5_cy5jy") +expand_mode = 1 + +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/HBoxContainer/MarginContainer"] +layout_mode = 2 +theme_override_constants/margin_left = 5 +theme_override_constants/margin_top = 5 +theme_override_constants/margin_right = 5 +theme_override_constants/margin_bottom = 5 + +[node name="tab_add_pos" type="HBoxContainer" parent="VBoxContainer/HBoxContainer/MarginContainer/MarginContainer"] +unique_name_in_owner = true +layout_mode = 2 + +[node name="warehouse_tab" parent="VBoxContainer/HBoxContainer/MarginContainer/MarginContainer/tab_add_pos" instance=ExtResource("6_arwik")] +layout_mode = 2 +size_flags_vertical = 4 + +[node name="warehouse_tab2" parent="VBoxContainer/HBoxContainer/MarginContainer/MarginContainer/tab_add_pos" instance=ExtResource("6_arwik")] +layout_mode = 2 +size_flags_vertical = 4 + +[node name="warehouse_tab3" parent="VBoxContainer/HBoxContainer/MarginContainer/MarginContainer/tab_add_pos" instance=ExtResource("6_arwik")] +layout_mode = 2 +size_flags_vertical = 4 [node name="tab" type="Control" parent="VBoxContainer"] custom_minimum_size = Vector2(0, 29) @@ -76,71 +119,132 @@ theme_override_constants/margin_right = 131 [node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer/MarginContainer"] layout_mode = 2 -[node name="hflow" type="HFlowContainer" parent="VBoxContainer/MarginContainer/ScrollContainer"] +[node name="card_add_pos" type="HFlowContainer" parent="VBoxContainer/MarginContainer/ScrollContainer"] +unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 theme_override_constants/h_separation = 60 theme_override_constants/v_separation = 60 -[node name="warehouse_card" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card2" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card2" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card3" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card3" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card4" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card4" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card5" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card5" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card6" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card6" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card7" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card7" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card8" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card8" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card9" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card9" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card10" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card10" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card11" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card11" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card12" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card12" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card13" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card13" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card14" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card14" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card15" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card15" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card16" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card16" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card17" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card17" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card18" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card18" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card19" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card19" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card20" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card20" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 -[node name="warehouse_card21" parent="VBoxContainer/MarginContainer/ScrollContainer/hflow" instance=ExtResource("5_cg0ke")] +[node name="warehouse_card21" parent="VBoxContainer/MarginContainer/ScrollContainer/card_add_pos" instance=ExtResource("5_cg0ke")] layout_mode = 2 + +[node name="item_panel" type="PanelContainer" parent="."] +unique_name_in_owner = true +visible = false +custom_minimum_size = Vector2(1069, 510) +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -534.5 +offset_top = -255.0 +offset_right = 534.5 +offset_bottom = 255.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxTexture_ams42") +script = ExtResource("10_45lxp") + +[node name="MarginContainer" type="MarginContainer" parent="item_panel"] +layout_mode = 2 +theme_override_constants/margin_left = 23 +theme_override_constants/margin_top = 20 +theme_override_constants/margin_right = 23 +theme_override_constants/margin_bottom = 20 + +[node name="VBoxContainer" type="VBoxContainer" parent="item_panel/MarginContainer"] +layout_mode = 2 +theme_override_constants/separation = 25 + +[node name="PanelContainer" type="PanelContainer" parent="item_panel/MarginContainer/VBoxContainer"] +custom_minimum_size = Vector2(194, 46) +layout_mode = 2 +size_flags_horizontal = 0 +theme_override_styles/panel = SubResource("StyleBoxTexture_fixed") + +[node name="name" type="Label" parent="item_panel/MarginContainer/VBoxContainer/PanelContainer"] +unique_name_in_owner = true +layout_mode = 2 +theme_override_font_sizes/font_size = 40 +text = "物品名称" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="PanelContainer2" type="PanelContainer" parent="item_panel/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_styles/panel = SubResource("StyleBoxTexture_dhdip") + +[node name="introduction" type="Label" parent="item_panel/MarginContainer/VBoxContainer/PanelContainer2"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_vertical = 1 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 40 +text = "物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介物品简介" +autowrap_mode = 3 + +[connection signal="pressed" from="VBoxContainer/HBoxContainer/TextureRect/back" to="." method="_on_back_pressed"] diff --git a/scene/warehouse_card.gd b/scene/warehouse_card.gd new file mode 100644 index 0000000..21c4d3a --- /dev/null +++ b/scene/warehouse_card.gd @@ -0,0 +1,21 @@ +extends NinePatchRect +var item_index_in_all:int=0 +signal click +func set_data(item_data:Dictionary): + %face.texture=Database.get_texture(item_data["texture"]) + if item_data.has("num") and item_data["num"]>1: + %num.show() + %num.text=str(item_data["num"]) + + else: + %num.hide() + + + + pass + + + +func _on_tool_button_pressed() -> void: + click.emit() + pass # Replace with function body. diff --git a/scene/warehouse_card.tscn b/scene/warehouse_card.tscn index 15a9d1d..fa3aeec 100644 --- a/scene/warehouse_card.tscn +++ b/scene/warehouse_card.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=6 format=3 uid="uid://badmgihnaaxwk"] +[gd_scene load_steps=7 format=3 uid="uid://badmgihnaaxwk"] [ext_resource type="Texture2D" uid="uid://c88u2eqpm17qc" path="res://res/ui/ui_016_warehouse/juxing17.png" id="1_p4sr5"] [ext_resource type="Texture2D" uid="uid://d27oognf3dnln" path="res://res/ui/ui_016_warehouse/tuceng250.png" id="2_2js7r"] [ext_resource type="Texture2D" uid="uid://w3jjf58pk5kk" path="res://res/ui/ui_016_warehouse/tuceng242.png" id="2_3sntv"] +[ext_resource type="Script" path="res://scene/warehouse_card.gd" id="2_e0yk3"] [ext_resource type="Texture2D" uid="uid://li8e5ntlgcpg" path="res://res/ui/ui_003_select/test.png" id="3_wxx86"] [ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="5_nbnqm"] @@ -15,6 +16,7 @@ patch_margin_left = 52 patch_margin_top = 39 patch_margin_right = 21 patch_margin_bottom = 36 +script = ExtResource("2_e0yk3") [node name="TextureRect" type="TextureRect" parent="."] show_behind_parent = true @@ -26,7 +28,8 @@ grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("2_3sntv") -[node name="TextureRect2" type="TextureRect" parent="."] +[node name="face" type="TextureRect" parent="."] +unique_name_in_owner = true show_behind_parent = true layout_mode = 1 anchors_preset = -1 @@ -49,14 +52,15 @@ anchor_bottom = 0.912664 offset_bottom = 7.0 metadata/_edit_use_anchors_ = true -[node name="Label" type="Label" parent="hbox"] +[node name="num" type="Label" parent="hbox"] +unique_name_in_owner = true layout_mode = 2 size_flags_vertical = 1 theme_override_font_sizes/font_size = 31 text = "999" vertical_alignment = 1 -[node name="TextureRect" type="TextureRect" parent="hbox/Label"] +[node name="TextureRect" type="TextureRect" parent="hbox/num"] show_behind_parent = true layout_mode = 1 anchors_preset = 15 @@ -69,3 +73,5 @@ expand_mode = 1 [node name="ToolButton" parent="." instance=ExtResource("5_nbnqm")] layout_mode = 1 + +[connection signal="pressed" from="ToolButton" to="." method="_on_tool_button_pressed"] diff --git a/scene/warehouse_item_panel.gd b/scene/warehouse_item_panel.gd new file mode 100644 index 0000000..924329f --- /dev/null +++ b/scene/warehouse_item_panel.gd @@ -0,0 +1,5 @@ +extends PanelContainer + +func _input(event: InputEvent) -> void: + if event.is_action_pressed("mouse_left"): + self.hide() diff --git a/scene/warehouse_tab.gd b/scene/warehouse_tab.gd new file mode 100644 index 0000000..c4217ca --- /dev/null +++ b/scene/warehouse_tab.gd @@ -0,0 +1,20 @@ +extends PanelContainer + +signal click + +var selected:bool=false: + set(val): + selected=val + if selected: + %selected_texture.show() + else: + %selected_texture.hide() + +func set_text(text:String): + %text.text=text + + + +func _on_tool_button_pressed() -> void: + click.emit() + pass # Replace with function body. diff --git a/scene/warehouse_tab.tscn b/scene/warehouse_tab.tscn new file mode 100644 index 0000000..1f031a7 --- /dev/null +++ b/scene/warehouse_tab.tscn @@ -0,0 +1,55 @@ +[gd_scene load_steps=6 format=3 uid="uid://crrqs1woslql2"] + +[ext_resource type="Texture2D" uid="uid://en8cdckjc6lk" path="res://res/ui/ui_016_warehouse/juxing21.png" id="1_vlsrg"] +[ext_resource type="Texture2D" uid="uid://cb6fxlk3a38b6" path="res://res/ui/ui_016_warehouse/juxing22.png" id="2_dmltj"] +[ext_resource type="Script" path="res://scene/warehouse_tab.gd" id="2_ew5ng"] +[ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="2_kw7l8"] + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_i80v0"] +texture = ExtResource("1_vlsrg") + +[node name="warehouse_tab" type="PanelContainer"] +custom_minimum_size = Vector2(237, 67) +offset_right = 237.0 +offset_bottom = 69.0 +theme_override_styles/panel = SubResource("StyleBoxTexture_i80v0") +script = ExtResource("2_ew5ng") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 2 +theme_override_constants/separation = 0 + +[node name="text" type="Label" parent="HBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 1 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 50 +text = "类别" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="selected_texture" type="TextureRect" parent="HBoxContainer/text"] +unique_name_in_owner = true +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.0215517 +anchor_top = 0.0434783 +anchor_right = 0.982759 +anchor_bottom = 0.942029 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("2_dmltj") +expand_mode = 1 +metadata/_edit_use_anchors_ = true + +[node name="ColorRect" type="ColorRect" parent="HBoxContainer"] +custom_minimum_size = Vector2(5, 0) +layout_mode = 2 +color = Color(0, 0, 0, 1) + +[node name="ToolButton" parent="." instance=ExtResource("2_kw7l8")] +layout_mode = 2 + +[connection signal="pressed" from="ToolButton" to="." method="_on_tool_button_pressed"]