This commit is contained in:
TsubakiLoL 2024-09-25 23:56:53 +08:00
parent 11b972d7e1
commit 5f39096cb2
17 changed files with 483 additions and 320 deletions

View File

@ -272,7 +272,7 @@ func get_texture(id:String):
func get_script_data(id:String):
if script_data.has(id):
var dictionary:Dictionary=script_data[id]
return dictionary.duplicate()
return dictionary.duplicate(true)
else:
return null
func get_all_script_data():
@ -280,38 +280,38 @@ func get_all_script_data():
func get_event_data(id:String):
if event_data.has(id):
var dictionary:Dictionary=event_data[id]
return dictionary.duplicate()
return dictionary.duplicate(true)
else:
return null
func get_scene_data(id:String):
if scene_data.has(id):
var dictionary:Dictionary=scene_data[id]
return dictionary.duplicate()
return dictionary.duplicate(true)
else:
return null
func get_character_data(id:String):
if character_data.has(id):
var dictionary:Dictionary=character_data[id]
return dictionary.duplicate()
return dictionary.duplicate(true)
else:
return null
func get_map_data(id:String):
if map_data.has(id):
var dictionary:Dictionary=map_data[id]
return dictionary.duplicate()
return dictionary.duplicate(true)
else:
return null
pass
func get_npc_data(id:String):
if npc_data.has(id):
var dictionary:Dictionary=npc_data[id]
return dictionary.duplicate()
return dictionary.duplicate(true)
else:
return null
pass
func get_card_data(id:String):
if card_data.has(id):
var dictionary:Dictionary=card_data[id]
return dictionary.duplicate()
return dictionary.duplicate(true)
else:
return null

View File

@ -0,0 +1,64 @@
class_name CharacterTool
static func get_character_attribute(character_data:Dictionary,attribute_name:String):
var arr=has_attribute(character_data)
if arr[0]:
var attribute_data=arr[1]
if attribute_data.has(attribute_name):
return attribute_data[attribute_name]
else:
return null
else:
return null
pass
static func has_attribute(character_data:Dictionary):
if character_data.has("basic_attribute"):
return [true,character_data["basic_attribute"]]
else:
return [false,null]
func get_head(character_data:Dictionary):
pass
static func cacul_fight_attribute(character_data:Dictionary)->Dictionary:
var res={}
var arr=has_attribute(character_data)
if arr[0]:
var attribute_data=arr[1]
#"CON":100,体质
#"AGI":100,敏捷
#"INT":100,智力
#"WIS":100,感知
#"STR":100,力量
#"MND":100,意志
#"LUC":100,幸运
#"AM":100,魅力
#体质
var CON=attribute_data["CON"]
var AGI=attribute_data["AGI"]
var INT=attribute_data["INT"]
var WIS=attribute_data["WIS"]
var STR=attribute_data["STR"]
var MND=attribute_data["MND"]
var LUC=attribute_data["LUC"]
var AM=attribute_data["AM"]
res["HP"]=CON*5
res["SP"]=INT+MND
res["VIT"]=120
pass
return res
pass
static func get_skin_now_use_data(character_data:Dictionary)->Dictionary:
return character_data["character"]["skin"][character_data["character"]["skin_now_use"]]
static func get_character_name(character_data:Dictionary)->String:
return character_data["character"]["name"]
pass
static func get_initiative_value(character_data:Dictionary)->int:
var AGI=get_character_attribute(character_data,"AGI")
return AGI/2+randi_range(-10,10)

View File

@ -1,12 +1,15 @@
{
"card_01":{
"name":"测试卡01(友方目标)",
"name":"测试卡01(友方目标回血10)",
"icon":"?",
"target_queue":0,
"cost":0
"cost":0,
"triger":{
}
},
"card_02":{
"name":"测试卡02(不需要目标)",
"name":"测试卡02(不需要目标所有人掉20)",
"icon":"?",
"cost":1

View File

@ -1,15 +1,14 @@
{
"test_character_01":{
"character":{
"name":"朱雀院椿(测试1)",
"name":"朱雀院椿(测试1敏捷100)",
"head":"test_character_tsubaki_head",
"star":3,
"skin":[
{
"name":"皮肤1",
"card_face":"test_character_tsubaki",
"character":"角色图片路径"
"character":"test_character_tsubaki"
}
],
"skin_now_use":0
@ -20,45 +19,19 @@
"sex":0,
"race":"种族",
"birthday":"xxxx-xx-xx",
"introduction":"这是一个介绍",
"basic_attribute":[
{
"name":"体质",
"value":100,
},
{
"name":"敏捷",
"value":100,
},
{
"name":"智力",
"value":100,
},
{
"name":"感知",
"value":100,
},
],
"fight_attribute":[
{
"name":"生命",
"value":100,
},
{
"name":"精神",
"value":100,
},
{
"name":"物理攻击",
"value":100,
},
{
"name":"法术强度",
"value":100,
},
]
},
"basic_attribute":{
"CON":100,
"AGI":100,
"INT":100,
"WIS":100,
"STR":100,
"MND":100,
"LUC":100,
"AM":100
},
"special":[
{
"name":"倾国倾城",
@ -82,18 +55,25 @@
"name":"某地区",
"value":100
}
]
],
"card_as_NPC":[]
},
"test_character_02":{
"character":{
"name":"朱雀院椿(测试2)",
"star":3,
"name":"朱雀院椿(测试2,敏捷50)",
"head":"test_character_tsubaki_head",
"star":3,
"skin":[
{
"name":"皮肤1",
"card_face":"test_character_tsubaki",
"character":"角色图片路径"
"character":"test_character_tsubaki"
}
],
"skin_now_use":0
@ -104,45 +84,19 @@
"sex":0,
"race":"种族",
"birthday":"xxxx-xx-xx",
"introduction":"这是一个介绍",
"basic_attribute":[
{
"name":"体质",
"value":100,
},
{
"name":"敏捷",
"value":100,
},
{
"name":"智力",
"value":100,
},
{
"name":"感知",
"value":100,
},
],
"fight_attribute":[
{
"name":"生命",
"value":100,
},
{
"name":"精神",
"value":100,
},
{
"name":"物理攻击",
"value":100,
},
{
"name":"法术强度",
"value":100,
},
]
},
"basic_attribute":{
"CON":100,
"AGI":50,
"INT":100,
"WIS":100,
"STR":100,
"MND":100,
"LUC":100,
"AM":100
},
"special":[
{
"name":"倾国倾城",
@ -166,7 +120,9 @@
"name":"某地区",
"value":100
}
]
],
"card_as_NPC":[]
},
@ -175,13 +131,11 @@
"test_character_03":{
"character":{
"name":"朱雀院椿(NPC)",
"name":"朱雀院椿(测试3)",
"head":"test_character_tsubaki_head",
"star":3,
"skin":[
{
"name":"皮肤1",
@ -197,45 +151,18 @@
"sex":0,
"race":"种族",
"birthday":"xxxx-xx-xx",
"introduction":"这是一个介绍",
"basic_attribute":[
{
"name":"体质",
"value":100,
},
{
"name":"敏捷",
"value":100,
},
{
"name":"智力",
"value":100,
},
{
"name":"感知",
"value":100,
},
],
"fight_attribute":[
{
"name":"生命",
"value":100,
},
{
"name":"精神",
"value":100,
},
{
"name":"物理攻击",
"value":100,
},
{
"name":"法术强度",
"value":100,
},
]
},
"basic_attribute":{
"CON":100,
"AGI":100,
"INT":100,
"WIS":100,
"STR":100,
"MND":100,
"LUC":100,
},
"special":[
{
"name":"倾国倾城",
@ -261,87 +188,4 @@
}
]
},
"test_character_04":{
"character":{
"name":"朱雀院椿(测试)",
"star":3,
"skin":[
{
"name":"皮肤1",
"card_face":"test_character_tsubaki",
"character":"角色图片路径"
}
],
"skin_now_use":0
},
"basic_mes":{
"script_category":"剧本类别",
"place":"地点",
"sex":0,
"race":"种族",
"birthday":"xxxx-xx-xx",
"introduction":"这是一个介绍",
"basic_attribute":[
{
"name":"体质",
"value":100,
},
{
"name":"敏捷",
"value":100,
},
{
"name":"智力",
"value":100,
},
{
"name":"感知",
"value":100,
},
],
"fight_attribute":[
{
"name":"生命",
"value":100,
},
{
"name":"精神",
"value":100,
},
{
"name":"物理攻击",
"value":100,
},
{
"name":"法术强度",
"value":100,
},
]
},
"special":[
{
"name":"倾国倾城",
"introduction":"鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果"
}
],
"ability":[
{
"name":"武学 LV3",
"introduction":"鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果"
}
],
"favor":[{
"name":"姐姐",
"value":100
}
],
"reputation":[
{
"name":"某地区",
"value":100
}
]
}
}

View File

@ -1,5 +1,14 @@
{
"测试npc_1":{
"basic_attribute":{
"CON":100,
"AGI":100,
"INT":100,
"WIS":100,
"STR":100,
"MND":100,
"LUC":100,
},
}
}

View File

@ -51,16 +51,21 @@ func move_finished():
state_machine.send_message("move_finished")
move_finished_sig.emit()
pass
func up():
z_index=1
scale_to(scale_multiple)
func up():
z_index=basic_index+10
scale_to(scale_multiple)
var basic_index:int=0:
set(val):
basic_index=val
down()
pass
func down():
z_index=0
z_index=basic_index
scale_to(1)
func show_big():
z_index=1
z_index=basic_index+10
scale_to(1.5)
var last_scale_tween:Tween
func scale_to(sc:float):

View File

@ -20,6 +20,9 @@ layout_mode = 3
anchors_preset = 0
script = ExtResource("1_wc0x3")
[node name="arrow" parent="." instance=ExtResource("11_gjfgy")]
texture_num = 20
[node name="fight_card" parent="." instance=ExtResource("1_nmkht")]
layout_direction = 1
layout_mode = 0
@ -62,8 +65,5 @@ script = ExtResource("9_40m88")
[node name="discard" type="Node" parent="state_machine"]
script = ExtResource("12_sl7jh")
[node name="arrow" parent="." instance=ExtResource("11_gjfgy")]
texture_num = 20
[connection signal="mouse_entered" from="fight_card" to="." method="_on_fight_card_mouse_entered"]
[connection signal="mouse_exited" from="fight_card" to="." method="_on_fight_card_mouse_exited"]

View File

@ -3,6 +3,7 @@ class_name CardMachine
const CARD = preload("res://scene/card.tscn")
var rand_release:float=20
@export var release_card_pos:Control
@export var queue_card_distance:float=50
var distance:float=100
var card_arr:Array[Card]=[]
var queue_card:Array[Card]=[]
@ -40,6 +41,7 @@ func get_card_index(card:Card):
return 0
func card_queue(card:Card):
queue_card.append(card)
card.basic_index=queue_card.size()
pass
#获取释放位置
func get_queue_pos()->Vector2:
@ -48,8 +50,8 @@ func get_queue_pos()->Vector2:
pos=release_card_pos.global_position -self.global_position
else:
pos=Vector2.ZERO
var rand:Vector2=Vector2(randf_range(-rand_release,rand_release),randf_range(-rand_release,rand_release))
return pos+rand
#var rand:Vector2=Vector2(randf_range(-rand_release,rand_release),randf_range(-rand_release,rand_release))
return pos+Vector2(queue_card_distance*queue_card.size(),0)
@export var exe_card_pos:Control
func get_exe_position():
var pos:Vector2

View File

@ -16,3 +16,10 @@ func exit_state():
func time_out():
pass
func process_message(type:String,n):
match type:
"mouse_enter":
get_player().up()
"mouse_exit":
get_player().down()
pass

View File

@ -6,6 +6,7 @@ func enter_state(n):
player.move_to(player.position,player.get_queue_position())
init_position=n
get_player().open_arrow()
get_player().up()
func update_state(delta):
if Input.is_action_just_released("mouse_left"):
var target=get_player().get_select_result()
@ -28,6 +29,7 @@ func update_state_phy(delta):
pass
func exit_state():
get_player().close_arrow()
get_player().down()
pass
func time_out():

View File

@ -30,7 +30,7 @@ func update_state(delta):
func update_state_phy(delta):
pass
func exit_state():
get_player().down()
pass
func time_out():

View File

@ -1,18 +1,26 @@
extends Control
class_name FightScene
var user:FightCharacterCard
##角色节点的引用队列
var character_arr:Array[FightCharacterCard]=[]
var enermy_arr:Array[FightEnermyCard]=[]
var extract_card_arr:Array=[]
var hand_card_arr:Array=[]
var left_card_arr:Array=[]
var extract_num:int=5
const FIGHT_CHARACTER_CARD = preload("res://scene/fight_character_card.tscn")
const FIGHT_ENERMY_CARD = preload("res://scene/fight_enermy_card.tscn")
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
Global.now_fight_scene=self
extract_card_arr=Global.get_all_card()
extract_card(extract_num)
add_user(Global.get_character_data("test_character_01"))
add_character(Global.get_character_data("test_character_01"))
add_enermy(Global.get_character_data("test_character_01"))
add_enermy(Global.get_character_data("test_character_02"))
pass # Replace with function body.
##抽牌
func extract_card(num:int):
if extract_card_arr.size()<num:
refresh_card()
@ -25,21 +33,51 @@ func extract_card(num:int):
hand_card_arr.append(id)
%card_machine.add_card(id,1)
pass
##洗牌
func refresh_card():
extract_card_arr.append_array(left_card_arr.duplicate())
left_card_arr.clear()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
##释放队列决定后开始回合
func start_turn():
left_card_arr.append_array(hand_card_arr.duplicate())
hand_card_arr.clear()
await %card_machine.exe_queue()
var sort_unit=get_sort_all_unit()
for i in sort_unit:
if i[0]!=user:
await i[0].atk()
else:
await %card_machine.exe_queue()
extract_card(extract_num)
%end_select.show()
pass
##添加友方角色(非玩家)
func add_character(character_data:Dictionary):
var new_character=FIGHT_CHARACTER_CARD.instantiate()
%character_card_add_pos.add_child(new_character)
new_character.set_data(character_data)
character_arr.append(new_character)
pass
##添加敌方角色
func add_enermy(character_data:Dictionary):
var new_character=FIGHT_ENERMY_CARD.instantiate()
%enermy_card_add_pos.add_child(new_character)
new_character.set_data(character_data)
enermy_arr.append(new_character)
pass
##设置玩家
func add_user(character_data:Dictionary):
if user!=null:
if is_instance_valid(user):
user.queue_free()
user=null
var new_character=FIGHT_CHARACTER_CARD.instantiate()
%character_card_add_pos.add_child(new_character)
new_character.set_data(character_data)
user=new_character
func _on_tool_button_pressed() -> void:
pass # Replace with function body.
@ -49,3 +87,32 @@ func _on_end_select_pressed() -> void:
%end_select.hide()
start_turn()
pass # Replace with function body.
func get_all_character():
return character_arr.duplicate()
func get_all_enermy():
return enermy_arr.duplicate()
func get_all_unit():
var unit_arr:Array=[]
unit_arr.append_array(get_all_character())
unit_arr.append_array(get_all_enermy())
unit_arr.append(user)
return unit_arr
func sort(a,b)->bool:
if a[1]<b[1]:
return false
else:
return true
pass
func get_sort_all_unit():
var all_unit=get_all_unit()
var sort_arr:Array=[]
for i in all_unit:
var new_arr=[i,i.cacul_initiative_value()]
sort_arr.append(new_arr)
sort_arr.sort_custom(sort)
return sort_arr
pass

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://sn3v7t7xjr1o"]
[gd_scene load_steps=8 format=3 uid="uid://sn3v7t7xjr1o"]
[ext_resource type="Script" path="res://scene/fight.gd" id="1_1e3ie"]
[ext_resource type="Texture2D" uid="uid://b1wfklbrwhh3y" path="res://res/ui/ui_025_adventure_mode/tuceng349.png" id="1_08haj"]
@ -6,45 +6,6 @@
[ext_resource type="Texture2D" uid="uid://se3j07m0mm5p" path="res://res/ui/ui_026_fight/kaishizhandou.png" id="4_3x8hl"]
[ext_resource type="PackedScene" uid="uid://b6t1mn3dd73ox" path="res://scene/card_state_machine/card_machine.tscn" id="4_i7vc5"]
[ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="5_cxbtq"]
[ext_resource type="PackedScene" uid="uid://braadtw2q0x6u" path="res://scene/fight_character_card.tscn" id="6_5ixhk"]
[ext_resource type="Shader" path="res://res/shader/stroke.gdshader" id="6_no4k5"]
[ext_resource type="PackedScene" uid="uid://dd4387syao6lj" path="res://scene/fight_enermy_card.tscn" id="7_fjnhq"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hr0jf"]
resource_local_to_scene = true
shader = ExtResource("6_no4k5")
shader_parameter/color = Color(0, 0, 0, 0.996078)
shader_parameter/width = 0.0
shader_parameter/pattern = 0
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
shader_parameter/open_flashing = false
shader_parameter/flashing_color = Color(0.851769, 0.851769, 0.851769, 1)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ey3i6"]
resource_local_to_scene = true
shader = ExtResource("6_no4k5")
shader_parameter/color = Color(0, 0, 0, 0.996078)
shader_parameter/width = 0.0
shader_parameter/pattern = 0
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
shader_parameter/open_flashing = false
shader_parameter/flashing_color = Color(0.851769, 0.851769, 0.851769, 1)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_n2ued"]
resource_local_to_scene = true
shader = ExtResource("6_no4k5")
shader_parameter/color = Color(0, 0, 0, 1)
shader_parameter/width = 0.0
shader_parameter/pattern = 0
shader_parameter/inside = false
shader_parameter/add_margins = true
shader_parameter/number_of_images = Vector2(1, 1)
shader_parameter/open_flashing = null
shader_parameter/flashing_color = Color(1, 1, 1, 1)
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_246ik"]
texture = ExtResource("1_yh6pq")
@ -73,22 +34,24 @@ texture = ExtResource("1_08haj")
expand_mode = 1
stretch_mode = 6
[node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 0
anchor_left = 0.409896
anchor_top = 0.237963
anchor_right = 0.613542
anchor_bottom = 0.337037
offset_right = -351.0
offset_bottom = -67.0
[node name="end_select" type="TextureRect" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.847917
anchor_top = 0.785185
anchor_right = 0.957812
anchor_bottom = 0.844444
texture = ExtResource("4_3x8hl")
expand_mode = 2
stretch_mode = 4
metadata/_edit_use_anchors_ = true
[node name="end_select" parent="TextureRect" instance=ExtResource("5_cxbtq")]
unique_name_in_owner = true
[node name="end_select" parent="end_select" instance=ExtResource("5_cxbtq")]
layout_mode = 1
[node name="character_card_add_pos" type="HBoxContainer" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.0260417
@ -98,15 +61,8 @@ anchor_bottom = 0.686111
theme_override_constants/separation = 20
metadata/_edit_use_anchors_ = true
[node name="fight_character_card" parent="character_card_add_pos" instance=ExtResource("6_5ixhk")]
material = SubResource("ShaderMaterial_hr0jf")
layout_mode = 2
[node name="fight_character_card2" parent="character_card_add_pos" instance=ExtResource("6_5ixhk")]
material = SubResource("ShaderMaterial_ey3i6")
layout_mode = 2
[node name="enermy_card_add_pos" type="HBoxContainer" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.0260417
@ -116,10 +72,6 @@ theme_override_constants/separation = 20
alignment = 2
metadata/_edit_use_anchors_ = true
[node name="fight_enermy_card" parent="enermy_card_add_pos" instance=ExtResource("7_fjnhq")]
material = SubResource("ShaderMaterial_n2ued")
layout_mode = 2
[node name="Panel" type="Panel" parent="."]
layout_mode = 1
anchors_preset = -1
@ -149,21 +101,21 @@ layout_mode = 1
[node name="release_mark" type="Control" parent="."]
layout_mode = 1
anchor_left = 0.059375
anchor_left = 0.04375
anchor_top = 0.337037
anchor_right = 0.0802083
anchor_right = 0.0645833
anchor_bottom = 0.374074
grow_vertical = 2
metadata/_edit_use_anchors_ = true
[node name="exe_mark" type="Control" parent="."]
layout_mode = 1
anchor_left = 0.755208
anchor_top = 0.39537
anchor_right = 0.776042
anchor_bottom = 0.432407
anchor_left = 0.471875
anchor_top = 0.337037
anchor_right = 0.492709
anchor_bottom = 0.374074
grow_vertical = 2
metadata/_edit_use_anchors_ = true
[connection signal="pressed" from="TextureRect/end_select" to="." method="_on_end_select_pressed"]
[connection signal="pressed" from="end_select/end_select" to="." method="_on_end_select_pressed"]
[connection signal="pressed" from="Label/ToolButton" to="." method="_on_tool_button_pressed"]

View File

@ -2,7 +2,53 @@ extends TextureRect
class_name FightCharacterCard
@onready var n: Label = $TextureRect/n
@onready var icon: TextureRect = $TextureRect/TextureRect2/icon
var data:Dictionary
var fight_data:Dictionary
var HP_max:int=100:
set(val):
HP_max=val
%HP_bar.max_value=val
%HP_label.text=str(HP)+"/"+str(val)
var HP:int=100:
set(val):
HP=val
%HP_bar.value=val
%HP_label.text=str(val)+"/"+str(HP_max)
var SP_max:int=100:
set(val):
SP_max=val
%SP_bar.max_value=val
%SP_label.text=str(SP)+"/"+str(val)
var SP:int=100:
set(val):
SP=val
%SP_bar.value=val
%SP_label.text=str(val)+"/"+str(SP_max)
var VIT_max:int=100:
set(val):
VIT_max=val
%VIT_bar.max_value=val
%VIT_label.text=str(VIT)+"/"+str(val)
var VIT:int=100:
set(val):
VIT=val
%VIT_bar.value=val
%VIT_label.text=str(val)+"/"+str(VIT_max)
func _ready() -> void:
set_data(Global.get_character_data("test_character_01"))
func set_data(_data:Dictionary):
data=_data
icon.texture=Global.get_texture(CharacterTool.get_skin_now_use_data(data)["card_face"])
n.text=CharacterTool.get_character_name(data)
fight_data=CharacterTool.cacul_fight_attribute(data)
HP_max=fight_data["HP"]
HP=HP_max
SP_max=fight_data["SP"]
SP=SP_max
VIT_max=fight_data["VIT"]
VIT=VIT_max
pass
func _on_area_2d_area_entered(area: Area2D) -> void:
material.set_shader_parameter("width",10)
@ -12,3 +58,10 @@ func _on_area_2d_area_entered(area: Area2D) -> void:
func _on_area_2d_area_exited(area: Area2D) -> void:
material.set_shader_parameter("width",0)
pass # Replace with function body.
func cacul_initiative_value()->int:
return CharacterTool.get_initiative_value(data)
func atk():
%turn_flag.show()
await get_tree().create_timer(1).timeout
%turn_flag.hide()

View File

@ -98,7 +98,8 @@ horizontal_alignment = 1
vertical_alignment = 1
justification_flags = 162
[node name="TextureProgressBar" type="TextureProgressBar" parent="VBoxContainer/HBoxContainer"]
[node name="HP_bar" type="TextureProgressBar" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(176, 32)
layout_mode = 2
size_flags_horizontal = 0
@ -107,7 +108,8 @@ value = 100.0
nine_patch_stretch = true
texture_progress = ExtResource("5_mey8u")
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer/TextureProgressBar"]
[node name="HP_label" type="Label" parent="VBoxContainer/HBoxContainer/HP_bar"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -118,6 +120,17 @@ text = "999/999"
horizontal_alignment = 1
vertical_alignment = 1
[node name="back" type="TextureRect" parent="VBoxContainer/HBoxContainer/HP_bar"]
modulate = Color(0, 0, 0, 1)
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("7_wx32q")
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
@ -131,7 +144,8 @@ horizontal_alignment = 1
vertical_alignment = 1
justification_flags = 162
[node name="TextureProgressBar" type="TextureProgressBar" parent="VBoxContainer/HBoxContainer2"]
[node name="SP_bar" type="TextureProgressBar" parent="VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
custom_minimum_size = Vector2(176, 32)
layout_mode = 2
size_flags_horizontal = 0
@ -140,7 +154,19 @@ value = 100.0
nine_patch_stretch = true
texture_progress = ExtResource("6_j0vci")
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2/TextureProgressBar"]
[node name="back" type="TextureRect" parent="VBoxContainer/HBoxContainer2/SP_bar"]
modulate = Color(0, 0, 0, 1)
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("7_wx32q")
[node name="SP_label" type="Label" parent="VBoxContainer/HBoxContainer2/SP_bar"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -164,7 +190,8 @@ horizontal_alignment = 1
vertical_alignment = 1
justification_flags = 162
[node name="TextureProgressBar" type="TextureProgressBar" parent="VBoxContainer/HBoxContainer3"]
[node name="VIT_bar" type="TextureProgressBar" parent="VBoxContainer/HBoxContainer3"]
unique_name_in_owner = true
custom_minimum_size = Vector2(176, 32)
layout_mode = 2
size_flags_horizontal = 0
@ -173,7 +200,19 @@ value = 100.0
nine_patch_stretch = true
texture_progress = ExtResource("7_wx32q")
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer3/TextureProgressBar"]
[node name="back" type="TextureRect" parent="VBoxContainer/HBoxContainer3/VIT_bar"]
modulate = Color(0, 0, 0, 1)
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("7_wx32q")
[node name="VIT_label" type="Label" parent="VBoxContainer/HBoxContainer3/VIT_bar"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -190,5 +229,20 @@ vertical_alignment = 1
position = Vector2(224.5, 124)
shape = SubResource("RectangleShape2D_oitb8")
[node name="turn_flag" type="Label" parent="."]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 100
text = "回合中"
horizontal_alignment = 1
vertical_alignment = 1
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
[connection signal="area_exited" from="Area2D" to="." method="_on_area_2d_area_exited"]

View File

@ -1,13 +1,54 @@
extends TextureRect
class_name FightEnermyCard
# Called when the node enters the scene tree for the first time.
@onready var icon: TextureRect = $TextureRect/TextureRect2/icon
@onready var n: Label = $TextureRect/n
var data:Dictionary
var fight_data:Dictionary
var HP_max:int=100:
set(val):
HP_max=val
%HP_bar.max_value=val
%HP_label.text=str(HP)+"/"+str(val)
var HP:int=100:
set(val):
HP=val
%HP_bar.value=val
%HP_label.text=str(val)+"/"+str(HP_max)
var SP_max:int=100:
set(val):
SP_max=val
%SP_bar.max_value=val
%SP_label.text=str(SP)+"/"+str(val)
var SP:int=100:
set(val):
SP=val
%SP_bar.value=val
%SP_label.text=str(val)+"/"+str(SP_max)
var VIT_max:int=100:
set(val):
VIT_max=val
%VIT_bar.max_value=val
%VIT_label.text=str(VIT)+"/"+str(val)
var VIT:int=100:
set(val):
VIT=val
%VIT_bar.value=val
%VIT_label.text=str(val)+"/"+str(VIT_max)
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
set_data(Global.get_character_data("test_character_01"))
func set_data(_data:Dictionary):
data=_data
icon.texture=Global.get_texture(CharacterTool.get_skin_now_use_data(data)["card_face"])
n.text=CharacterTool.get_character_name(data)
fight_data=CharacterTool.cacul_fight_attribute(data)
HP_max=fight_data["HP"]
HP=HP_max
SP_max=fight_data["SP"]
SP=SP_max
VIT_max=fight_data["VIT"]
VIT=VIT_max
pass
func _on_area_2d_area_entered(area: Area2D) -> void:
@ -18,3 +59,9 @@ func _on_area_2d_area_entered(area: Area2D) -> void:
func _on_area_2d_area_exited(area: Area2D) -> void:
material.set_shader_parameter("width",0)
pass # Replace with function body.
func cacul_initiative_value()->int:
return CharacterTool.get_initiative_value(data)
func atk():
%turn_flag.show()
await get_tree().create_timer(1).timeout
%turn_flag.hide()

View File

@ -58,7 +58,7 @@ grow_vertical = 2
texture = ExtResource("3_s8rrj")
flip_h = true
[node name="TextureRect" type="TextureRect" parent="TextureRect/TextureRect2"]
[node name="icon" type="TextureRect" parent="TextureRect/TextureRect2"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -69,7 +69,7 @@ texture = ExtResource("4_u7od8")
expand_mode = 1
stretch_mode = 6
[node name="Label" type="Label" parent="TextureRect"]
[node name="n" type="Label" parent="TextureRect"]
layout_mode = 0
anchor_top = 0.884
anchor_right = 1.0
@ -100,7 +100,8 @@ horizontal_alignment = 1
vertical_alignment = 1
justification_flags = 162
[node name="TextureProgressBar" type="TextureProgressBar" parent="VBoxContainer/HBoxContainer"]
[node name="HP_bar" type="TextureProgressBar" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(176, 32)
layout_mode = 2
size_flags_horizontal = 0
@ -109,7 +110,8 @@ value = 100.0
nine_patch_stretch = true
texture_progress = ExtResource("5_0j5x7")
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer/TextureProgressBar"]
[node name="HP_label" type="Label" parent="VBoxContainer/HBoxContainer/HP_bar"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -120,6 +122,17 @@ text = "999/999"
horizontal_alignment = 1
vertical_alignment = 1
[node name="back" type="TextureRect" parent="VBoxContainer/HBoxContainer/HP_bar"]
modulate = Color(0, 0, 0, 1)
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("7_4wsqq")
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
@ -133,7 +146,8 @@ horizontal_alignment = 1
vertical_alignment = 1
justification_flags = 162
[node name="TextureProgressBar" type="TextureProgressBar" parent="VBoxContainer/HBoxContainer2"]
[node name="SP_bar" type="TextureProgressBar" parent="VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
custom_minimum_size = Vector2(176, 32)
layout_mode = 2
size_flags_horizontal = 0
@ -142,7 +156,8 @@ value = 100.0
nine_patch_stretch = true
texture_progress = ExtResource("6_x31v6")
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2/TextureProgressBar"]
[node name="SP_label" type="Label" parent="VBoxContainer/HBoxContainer2/SP_bar"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -153,6 +168,17 @@ text = "999/999"
horizontal_alignment = 1
vertical_alignment = 1
[node name="back" type="TextureRect" parent="VBoxContainer/HBoxContainer2/SP_bar"]
modulate = Color(0, 0, 0, 1)
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("7_4wsqq")
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
@ -166,7 +192,8 @@ horizontal_alignment = 1
vertical_alignment = 1
justification_flags = 162
[node name="TextureProgressBar" type="TextureProgressBar" parent="VBoxContainer/HBoxContainer3"]
[node name="VIT_bar" type="TextureProgressBar" parent="VBoxContainer/HBoxContainer3"]
unique_name_in_owner = true
custom_minimum_size = Vector2(176, 32)
layout_mode = 2
size_flags_horizontal = 0
@ -175,7 +202,8 @@ value = 100.0
nine_patch_stretch = true
texture_progress = ExtResource("7_4wsqq")
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer3/TextureProgressBar"]
[node name="VIT_label" type="Label" parent="VBoxContainer/HBoxContainer3/VIT_bar"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -186,6 +214,17 @@ text = "999/999"
horizontal_alignment = 1
vertical_alignment = 1
[node name="back" type="TextureRect" parent="VBoxContainer/HBoxContainer3/VIT_bar"]
modulate = Color(0, 0, 0, 1)
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("7_4wsqq")
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 2
collision_mask = 2
@ -194,5 +233,20 @@ collision_mask = 2
position = Vector2(226.5, 125.5)
shape = SubResource("RectangleShape2D_ut4q5")
[node name="turn_flag" type="Label" parent="."]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 100
text = "回合中"
horizontal_alignment = 1
vertical_alignment = 1
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
[connection signal="area_exited" from="Area2D" to="." method="_on_area_2d_area_exited"]