10.5晚上

This commit is contained in:
TsubakiLoL 2024-10-05 20:51:00 +08:00
parent 390ac82f57
commit f65fe41412
14 changed files with 334 additions and 66 deletions

View File

@ -546,7 +546,14 @@ func call_round_triger(triger_type:String,character_data:Dictionary,round_dic:Di
return null
func fish_round(character_data:Dictionary,round_dic:Dictionary,choice:String)->bool:
print(choice)
return true
var res:bool=randf()>0.5
if res:
round_dic["left_cost"]-=1
round_dic["right_total"]+=1
else:
round_dic["left_total"]+=1
round_dic["right_cost"]-=1
return res
pass
#用来获取鉴定每轮显示的难易度

View File

@ -205,7 +205,27 @@ static func get_character_with_npc_favor(character_data:Dictionary,npc_id:String
#计算装备加成后的角色
static func get_character_with_equip_value(character_data:Dictionary)->Dictionary:
var res:Dictionary=character_data.duplicate(true)
var now_equip=get_character_equip_now(character_data)
for i in now_equip:
if i!=null:
var add_attribute=ItemTool.get_item_attribute_basic(i)
var basic_attribute=res["basic_attribute"]
for j in add_attribute.keys():
if basic_attribute.has(j):
#计算白值
basic_attribute[j]+=add_attribute[j]
return res
pass
#计算角色使用鉴定加成卡后的数值
static func get_character_use_identification_card(character_data:Dictionary,item_arr:Array)->Dictionary:
var res=character_data.duplicate(true)
for i in item_arr:
var add_attribute=ItemTool.get_item_attribute_for_indetification(i)
var basic_attribute=res["basic_attribute"]
if add_attribute!=null:
for j in add_attribute.keys():
if basic_attribute.has(j):
#计算白值
basic_attribute[j]+=add_attribute[j]
return res

View File

@ -90,3 +90,15 @@ static func get_introduction_from_item_data(item_data:Dictionary)->String:
res+=item_data["introduction"]
return res
pass
#从item获取可以用于鉴定的属性
static func get_item_attribute_for_indetification(item_data:Dictionary):
if item_data.has("identification"):
return item_data["identification"]
else:
return null
#获取装备的基础属性(白值)
static func get_item_attribute_basic(item_data:Dictionary):
if item_data.has("attribute"):
return item_data["attribute"].duplicate()
else:
return {}

View File

@ -1,9 +1,10 @@
{
"fish":{
"type":1,
"preview":"fish_preview",
"init_round":{
"left_total":6,
"left_cost":0,
"left_total":0,
"left_cost":6,
"right_total":0,
"right_cost":6,
"left_total_max":6,
@ -14,8 +15,8 @@
"left_cost_name":"鱼群数量",
"right_total_name":"成功累计",
"right_cost_name":"回合数",
"indetification_name":"敏捷",
"indetification_value":50,
"identification_name":"敏捷",
"identification_value":50,
"left_texture":"fish_fail",
"right_texture":"rod",
@ -25,5 +26,9 @@
"triger":["fish_round","fish","normal","fish"]
},
},
"fish_single":{
"type":0,
"preview":"fish_preview",
}
}

View File

@ -3,6 +3,9 @@
"type":0,
"allow_merge":false,
"price":100,
"attribute":{
"AGI":100
},
"quality_lib":[
{
"value":4,
@ -25,8 +28,10 @@
],
"texture":"issuing",
"name":"发卡(测试饰品)",
"introduction":"用于测试的饰品装备,并没有什么用",
"introduction":"用于测试的饰品装备,并没有什么用(现测试用于钓鱼)",
"identification":{
"AGI":100
},
"material":{
}
@ -36,6 +41,9 @@
"type":1,
"allow_merge":false,
"price":100,
"attribute":{
"AGI":100
},
"quality_lib":[
{
"value":0,
@ -58,6 +66,9 @@
"type":2,
"allow_merge":false,
"price":100,
"attribute":{
"AGI":100
},
"quality_lib":[
{
"value":0,
@ -80,7 +91,9 @@
"type":3,
"allow_merge":false,
"price":100,
"attribute":{
"AGI":100
},
"quality_lib":[
{
"value":0,
@ -103,6 +116,9 @@
"type":4,
"allow_merge":false,
"price":100,
"attribute":{
"AGI":100
},
"quality_lib":[
{
"value":0,

View File

@ -1,7 +1,7 @@
{
"npc_01":{
"name":"测试NPC1",
"sold_item":["item_01","item_02"],
"sold_item":["item_01","item_01","item_01","item_02"],
"init_favor":50,
"gold":9999
},

View File

@ -217,7 +217,7 @@ func connect_button():
#当第几个皮肤卡片被点击时
func skin_card_click(skin:BasicMesSkinCard,skin_index:int):
#添加皮肤修饰器
Global.add_character_embellich_data(data["id"],"skin",skin_index)
Database.add_character_embellich_data(data["id"],"skin",skin_index)
%character.texture=Database.get_texture(data["skin"][skin_index]["character"])
now_selected_skin_card.state=0
skin.state=1

View File

@ -2,7 +2,7 @@ extends Control
const BUXIANSHI = preload("res://res/ui/ui_029_multi_indetification/buxianshi.png")
const XIANSHI = preload("res://res/ui/ui_029_multi_indetification/xianshi.png")
const MULTI_INDETIFICATION_CHOICE = preload("res://scene/multi_indetification_choice.tscn")
@onready var result_hide_group:Array=[%result_label, $MarginContainer/HBoxContainer/VBoxContainer/result_panel/Label3, %indetification_attribute_name, %identification_difficulty, %indetification_value]
@onready var result_hide_group:Array=[%result_label, $MarginContainer/HBoxContainer/VBoxContainer/result_panel/Label3, %identification_attribute_name, %identification_difficulty, %identification_value]
#鉴定数据
var data:Dictionary
#回合的数据
@ -13,6 +13,7 @@ func set_data(_data:Dictionary):
data=_data
round_data=_data["init_round"].duplicate()
round_data_update()
%AnimationPlayer.play("show_text")
pass
#根据round data更新显示
func round_data_update():
@ -52,7 +53,6 @@ func round_data_update():
if round_data.has("right_texture"):
%right_texture_panel.modulate.a=1
%right_texture.texture=Database.get_texture(round_data["right_texture"])
else:
%right_texture_panel.modulate.a=0
@ -66,6 +66,8 @@ func round_data_update():
new_choice.set_text(i)
new_choice.click.connect(choice_click.bind(i))
pass
%identification_attribute_name.text=round_data["identification_name"]
%identification_value.text=str(round_data["identification_value"])
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
@ -107,12 +109,20 @@ var is_finish:bool=false
signal finish
func choice_click(choice:String):
if not is_finish:
Global.call_round_triger(round_data["triger"][0],character_data,round_data,choice)
var is_success:bool=Global.call_round_triger(round_data["triger"][0],character_data,round_data,choice)
%AnimationPlayer.play("show_text")
round_data_update()
var finish=Global.call_is_finish_triger(round_data["triger"][2],character_data,round_data)
if is_finish:
if finish:
is_finish=finish
round_data["choice"]=["退出"]
round_data_update()
if is_success:
%result_label.add_theme_color_override("font_color",Color.GREEN)
%result_label.text="成功"
else:
%result_label.add_theme_color_override("font_color",Color.RED)
%result_label.text="失败"
else:
self.hide()
finish.emit()

View File

@ -43,6 +43,21 @@ texture_margin_top = 71.7409
texture_margin_right = 55.6358
texture_margin_bottom = 61.4922
[sub_resource type="Animation" id="Animation_ir5bc"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("MarginContainer/HBoxContainer/VBoxContainer2/TextureRect/introduction_panel/introduction_label:visible_ratio")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="Animation" id="Animation_pblpl"]
resource_name = "show_text"
length = 0.5
@ -59,21 +74,6 @@ tracks/0/keys = {
"values": [0.0, 1.0]
}
[sub_resource type="Animation" id="Animation_ir5bc"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("MarginContainer/HBoxContainer/VBoxContainer2/TextureRect/introduction_panel/introduction_label:visible_ratio")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_aavuy"]
_data = {
"RESET": SubResource("Animation_ir5bc"),
@ -332,7 +332,7 @@ horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true
[node name="indetification_attribute_name" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer/result_panel"]
[node name="identification_attribute_name" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer/result_panel"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
@ -361,7 +361,7 @@ horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true
[node name="indetification_value" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer/result_panel"]
[node name="identification_value" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer/result_panel"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1

View File

@ -1,9 +1,79 @@
extends Control
var data:Dictionary
const SINGLE_IDENTIFICATION_CARD = preload("res://scene/single_identification_card.tscn")
var character_data:Dictionary
func _ready() -> void:
#获取装备加成后的角色数据
character_data=CharacterTool.get_character_with_equip_value(Global.get_now_character_data())
func set_data(_data:Dictionary):
apped_item_data.clear()
data=_data
search_bag()
fresh_card()
if data["type"]==1:
%multi_indetification.set_data(data)
%multi_indetification.show()
%multi_pre.show()
%single.hide()
else:
pass
%multi_pre.hide()
%single.show()
var apped_item_data:Array=[]
#从背包中寻找可用item
func search_bag():
item_data_arr.clear()
#获取游戏中的所有物品数据
var all_item:Array=Global.get_all_item_game_data()
for i in all_item.size():
var atrribute=ItemTool.get_item_attribute_for_indetification(all_item[i])
if atrribute!=null:
item_data_arr.append(all_item[i])
var item_data_arr:Array=[]
func fresh_card():
for i in %card_add_pos.get_children():
i.queue_free()
for i in item_data_arr.size():
var new_card=SINGLE_IDENTIFICATION_CARD.instantiate()
%card_add_pos.add_child(new_card)
new_card.set_data(item_data_arr[i])
new_card.click.connect(card_click.bind(i))
pass
func card_click(ind:int):
var data=item_data_arr[ind]
%card_show.set_data(data)
%AnimationPlayer.play("show_card")
%card_show.show()
now_select_ind=ind
pass
var now_select_ind:int=0
func _on_accept_pressed() -> void:
%card_show.hide()
apped_item_data.append(item_data_arr[now_select_ind])
item_data_arr.pop_at(now_select_ind)
fresh_card()
pass # Replace with function body.
func _on_refuse_pressed() -> void:
%card_show.hide()
pass # Replace with function body.
func _on_single_start_pressed() -> void:
pass # Replace with function body.
func _on_multi_start_pressed() -> void:
%multi_indetification.character_data=CharacterTool.get_character_use_identification_card(character_data,apped_item_data)
%multi_indetification.set_data(data)
%multi_indetification.show()
pass # Replace with function body.
func _on_multi_indetification_finish() -> void:
hide()
pass # Replace with function body.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=3 uid="uid://mcf2riinvukc"]
[gd_scene load_steps=25 format=3 uid="uid://mcf2riinvukc"]
[ext_resource type="Script" path="res://scene/single_identification.gd" id="1_kaw2b"]
[ext_resource type="Texture2D" uid="uid://bchvegwghynrm" path="res://res/ui/ui_002_main/tuceng1.png" id="1_lrfk0"]
@ -15,6 +15,7 @@
[ext_resource type="Texture2D" uid="uid://dayrdgr2hgamx" path="res://res/ui/ui_028_multi_indetification_pre/yuanjiaojuxing901.png" id="11_dj8rc"]
[ext_resource type="PackedScene" uid="uid://2n4wq8llgbib" path="res://scene/single_identification_card.tscn" id="11_qtaae"]
[ext_resource type="PackedScene" uid="uid://cya850fofki0o" path="res://scene/multi_indetification.tscn" id="14_yjjpp"]
[ext_resource type="Texture2D" uid="uid://bbamxd1q6qwkd" path="res://res/ui/ui_001_start/button_0.png" id="16_nbuwj"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_meexh"]
texture = ExtResource("2_is720")
@ -44,6 +45,50 @@ texture_margin_bottom = 3.8147e-06
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_vplyr"]
texture = ExtResource("10_5pymr")
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_6ydwt"]
content_margin_left = 82.0
content_margin_top = 26.0
content_margin_right = 97.0
content_margin_bottom = 7.0
texture = ExtResource("16_nbuwj")
[sub_resource type="Animation" id="Animation_7g1t6"]
resource_name = "show_card"
length = 0.25
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("card_show:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.25),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_d6bed"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("card_show:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_bx88s"]
_data = {
"RESET": SubResource("Animation_d6bed"),
"show_card": SubResource("Animation_7g1t6")
}
[node name="single_identification" type="Control"]
layout_mode = 3
anchors_preset = 15
@ -65,6 +110,7 @@ expand_mode = 1
stretch_mode = 6
[node name="single" type="Panel" parent="."]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = -1
@ -125,7 +171,8 @@ offset_bottom = 53.0
grow_vertical = 0
texture = ExtResource("6_i15ig")
[node name="Label" type="Label" parent="single/TextureRect2"]
[node name="indetification_value" type="Label" parent="single/TextureRect2"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -164,7 +211,7 @@ text = "确定"
horizontal_alignment = 1
vertical_alignment = 1
[node name="ToolButton" parent="single/TextureRect3" instance=ExtResource("8_46oym")]
[node name="single_start" parent="single/TextureRect3" instance=ExtResource("8_46oym")]
layout_mode = 1
[node name="TextureRect4" type="TextureRect" parent="single"]
@ -182,7 +229,8 @@ grow_horizontal = 0
grow_vertical = 0
texture = ExtResource("9_s8bl5")
[node name="Label" type="Label" parent="single/TextureRect4"]
[node name="difficulti_value" type="Label" parent="single/TextureRect4"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -195,6 +243,7 @@ horizontal_alignment = 1
vertical_alignment = 1
[node name="multi_pre" type="Panel" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.257813
@ -269,7 +318,7 @@ text = "确定"
horizontal_alignment = 1
vertical_alignment = 1
[node name="ToolButton" parent="multi_pre/TextureRect3" instance=ExtResource("8_46oym")]
[node name="multi_start" parent="multi_pre/TextureRect3" instance=ExtResource("8_46oym")]
layout_mode = 1
[node name="HBoxContainer" type="HBoxContainer" parent="multi_pre"]
@ -306,7 +355,8 @@ anchor_bottom = 0.969444
theme_override_styles/panel = SubResource("StyleBoxTexture_vplyr")
metadata/_edit_use_anchors_ = true
[node name="HBoxContainer" type="HBoxContainer" parent="Panel2"]
[node name="card_add_pos" type="HBoxContainer" parent="Panel2"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.00107759
@ -319,28 +369,79 @@ grow_vertical = 2
theme_override_constants/separation = 18
metadata/_edit_use_anchors_ = true
[node name="single_identification_card" parent="Panel2/HBoxContainer" instance=ExtResource("11_qtaae")]
layout_mode = 2
[node name="single_identification_card2" parent="Panel2/HBoxContainer" instance=ExtResource("11_qtaae")]
layout_mode = 2
[node name="single_identification_card3" parent="Panel2/HBoxContainer" instance=ExtResource("11_qtaae")]
layout_mode = 2
[node name="single_identification_card4" parent="Panel2/HBoxContainer" instance=ExtResource("11_qtaae")]
layout_mode = 2
[node name="single_identification_card5" parent="Panel2/HBoxContainer" instance=ExtResource("11_qtaae")]
layout_mode = 2
[node name="single_identification_card6" parent="Panel2/HBoxContainer" instance=ExtResource("11_qtaae")]
layout_mode = 2
[node name="single_identification_card7" parent="Panel2/HBoxContainer" instance=ExtResource("11_qtaae")]
[node name="single_identification_card" parent="Panel2/card_add_pos" instance=ExtResource("11_qtaae")]
layout_mode = 2
[node name="multi_indetification" parent="." instance=ExtResource("14_yjjpp")]
unique_name_in_owner = true
visible = false
layout_mode = 1
[node name="card_show" parent="." instance=ExtResource("11_qtaae")]
unique_name_in_owner = true
visible = false
modulate = Color(1, 1, 1, 0)
layout_mode = 1
anchors_preset = -1
anchor_left = 0.392188
anchor_top = 0.182407
anchor_right = 0.564062
anchor_bottom = 0.686817
offset_right = 0.0
offset_bottom = 0.0
metadata/_edit_use_anchors_ = true
[node name="ToolButton" parent="card_show" index="3"]
disabled = true
[node name="accept" type="Button" parent="card_show"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = -0.406061
anchor_top = 1.00044
anchor_right = 0.439394
anchor_bottom = 1.18767
size_flags_horizontal = 4
size_flags_vertical = 4
focus_mode = 0
theme_override_font_sizes/font_size = 50
theme_override_styles/hover = SubResource("StyleBoxTexture_6ydwt")
theme_override_styles/pressed = SubResource("StyleBoxTexture_6ydwt")
theme_override_styles/normal = SubResource("StyleBoxTexture_6ydwt")
text = "投入"
icon_alignment = 1
metadata/_edit_use_anchors_ = true
[node name="refuse" type="Button" parent="card_show"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.642424
anchor_top = 1.00044
anchor_right = 1.48788
anchor_bottom = 1.18767
size_flags_horizontal = 4
size_flags_vertical = 4
focus_mode = 0
theme_override_font_sizes/font_size = 50
theme_override_styles/hover = SubResource("StyleBoxTexture_6ydwt")
theme_override_styles/pressed = SubResource("StyleBoxTexture_6ydwt")
theme_override_styles/normal = SubResource("StyleBoxTexture_6ydwt")
text = "取消"
icon_alignment = 1
metadata/_edit_use_anchors_ = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
"": SubResource("AnimationLibrary_bx88s")
}
[connection signal="pressed" from="single/TextureRect3/single_start" to="." method="_on_single_start_pressed"]
[connection signal="pressed" from="multi_pre/TextureRect3/multi_start" to="." method="_on_multi_start_pressed"]
[connection signal="finish" from="multi_indetification" to="." method="_on_multi_indetification_finish"]
[connection signal="pressed" from="card_show/accept" to="." method="_on_accept_pressed"]
[connection signal="pressed" from="card_show/refuse" to="." method="_on_refuse_pressed"]
[editable path="card_show"]

View File

@ -0,0 +1,13 @@
extends TextureRect
var data:Dictionary
signal click
func set_data(_data:Dictionary):
data=_data
%face.texture=Database.get_texture(data["texture"])
%name.text=data["name"]
pass
func _on_tool_button_pressed() -> void:
click.emit()
pass # Replace with function body.

View File

@ -1,5 +1,6 @@
[gd_scene load_steps=5 format=3 uid="uid://2n4wq8llgbib"]
[gd_scene load_steps=6 format=3 uid="uid://2n4wq8llgbib"]
[ext_resource type="Script" path="res://scene/single_identification_card.gd" id="2_3m1f0"]
[ext_resource type="Texture2D" uid="uid://cyjyr3dhwamnb" path="res://res/ui/ui_019_game_flow/tuceng290.png" id="2_w8rjq"]
[ext_resource type="Texture2D" uid="uid://cq76812dkr2tr" path="res://res/ui/ui_019_game_flow/tuceng289.png" id="3_t4jhx"]
[ext_resource type="Texture2D" uid="uid://li8e5ntlgcpg" path="res://res/ui/ui_003_select/test.png" id="4_itkp3"]
@ -13,6 +14,18 @@ size_flags_horizontal = 0
size_flags_vertical = 8
texture = ExtResource("2_w8rjq")
expand_mode = 5
script = ExtResource("2_3m1f0")
[node name="TextureRect" type="TextureRect" parent="."]
show_behind_parent = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_t4jhx")
expand_mode = 1
[node name="TextureRect2" type="TextureRect" parent="."]
show_behind_parent = true
@ -27,7 +40,8 @@ grow_vertical = 2
texture = ExtResource("3_t4jhx")
expand_mode = 1
[node name="TextureRect" type="TextureRect" parent="TextureRect2"]
[node name="face" type="TextureRect" parent="TextureRect2"]
unique_name_in_owner = true
show_behind_parent = true
layout_mode = 1
anchors_preset = 15
@ -37,9 +51,10 @@ grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("4_itkp3")
expand_mode = 1
stretch_mode = 6
stretch_mode = 5
[node name="Label" type="Label" parent="."]
[node name="name" type="Label" parent="."]
unique_name_in_owner = true
layout_mode = 0
anchor_left = 0.031746
anchor_top = 0.897436

View File

@ -19,4 +19,3 @@ func disable(is_disable:bool):
get_parent().modulate=Color(0.5,0.5,0.5,1)
else:
get_parent().modulate=Color(1,1,1,1)