This commit is contained in:
TsubakiLoL 2024-11-08 00:44:27 +08:00
parent be558aac4a
commit 1afda410a0
20 changed files with 321 additions and 44 deletions

View File

@ -13,5 +13,6 @@ func pop_up_text(text:String,pos:Vector2,H_limit:float,label_settings:LabelSetti
new_text.custom_minimum_size.x=H_limit new_text.custom_minimum_size.x=H_limit
pop_up_control(new_text,pos) pop_up_control(new_text,pos)
new_text.set_label(label_settings) new_text.set_label(label_settings)
new_text.set_mes(text)
%Container.show() %Container.show()
pass pass

View File

@ -31,6 +31,11 @@ var identifation_data:Dictionary
var type_json_path:String="res://json/type.json" var type_json_path:String="res://json/type.json"
var type_data:Dictionary var type_data:Dictionary
#特质数据
var special_json_path:String="res://json/special.json"
var special_data:Dictionary
#角色修饰数据的存储路径 #角色修饰数据的存储路径
var character_embellish_data_path:String="user://emblish.data" var character_embellish_data_path:String="user://emblish.data"
var character_embellish_data:Dictionary={ var character_embellish_data:Dictionary={
@ -78,6 +83,7 @@ func _ready() -> void:
load_word_data() load_word_data()
load_identifation_data() load_identifation_data()
load_type_data() load_type_data()
load_special_data()
#加载当前图片数据 #加载当前图片数据
func load_texture_data(): func load_texture_data():
var file=FileAccess.open(texture_json_path,FileAccess.READ) var file=FileAccess.open(texture_json_path,FileAccess.READ)
@ -185,6 +191,16 @@ func load_type_data():
var dictionary:Dictionary=JSON.parse_string(str) var dictionary:Dictionary=JSON.parse_string(str)
type_data=dictionary type_data=dictionary
pass pass
func load_special_data():
var file=FileAccess.open(special_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
#排除注释
if i !="#":
dictionary[i]["id"]=i
special_data=dictionary
#获取图标 #获取图标
func get_texture(id:String): func get_texture(id:String):
if texture_data.has(id): if texture_data.has(id):
@ -319,3 +335,17 @@ func get_type_name(type:int)->String:
#获取全部主要类型字典 #获取全部主要类型字典
func get_all_main_type(): func get_all_main_type():
return type_data["main"].duplicate() return type_data["main"].duplicate()
#获取特质数据
func get_special_data(id:String):
if special_data.has(id):
return special_data[id].duplicate(true)
else:
return null
#获取特质类型
func get_special_type(id:String):
if special_data.has(id):
return special_data[id]["type"]
else:
return ""

View File

@ -83,7 +83,7 @@ var system_config_data:Dictionary={
var system_game_data_path:String="user://system_game.data" var system_game_data_path:String="user://system_game.data"
#局外游戏数据 #局外游戏数据
var system_game_data:Dictionary={ var system_game_data:Dictionary={
"unlock_character":["test_character_01","test_character_02"], "unlock_character":["test_character_01","test_character_02","Rolland"],
#全局物品 #全局物品
"item":[], "item":[],
"jifen":100, "jifen":100,
@ -337,6 +337,24 @@ var now_game_data:Dictionary={
"item_could_make":["item_06"] "item_could_make":["item_06"]
} }
#当前是否应该展示开始事件
func should_show_init_event()->bool:
var now_script_data=now_game_data["script_data"]
if not now_script_data.has("init_event"):
return false
if not now_script_data.has("init_finished"):
return true
return false
#获取初始事件
func get_init_event():
var now_script_data=now_game_data["script_data"]
return now_script_data["init_event"]
#执行完初始事件后使用
func shown_init_event():
var now_script_data=now_game_data["script_data"]
now_script_data["init_finished"]=true
#返回当前可以制作的物品ID #返回当前可以制作的物品ID
func get_now_game_item_could_make(): func get_now_game_item_could_make():
return now_game_data["item_could_make"].duplicate() return now_game_data["item_could_make"].duplicate()
@ -491,14 +509,26 @@ var triger:Dictionary={
#装备升级界面展示触发器 #装备升级界面展示触发器
"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(), "show_warehouse":func(data):now_game_flow.show_warehouse(),
"make_card":func(data):now_game_flow.show_make_card() "make_card":func(data):now_game_flow.show_make_card(),
#人类特质触发器,触发为当前游戏人物属性随机加一
"human":func(data):human_triger()
} }
#使用事件触发器 #使用事件触发器
func call_triger(triger_type:String,data): func call_triger(triger_type:String,data):
if triger.has(triger_type): if triger.has(triger_type):
return triger[triger_type].call(data) return triger[triger_type].call(data)
else: else:
return null return null
#人类特质触发器
func human_triger():
var character_data:Dictionary=now_game_data["character_data"]
var basic_attribute_dic:Dictionary=character_data["basic_attribute"]
var size=basic_attribute_dic.size()
var rand:int=randi_range(0,size-1)
var key:String=basic_attribute_dic.keys()[rand]
basic_attribute_dic[key]+=1
pass
#条件触发器(用于返回是否的条件判定结果) #条件触发器(用于返回是否的条件判定结果)
var condition_triger:Dictionary={ var condition_triger:Dictionary={
"date_limit":func (data:Dictionary):return TimeTool.is_in_date(data,get_time_dictionary()), "date_limit":func (data:Dictionary):return TimeTool.is_in_date(data,get_time_dictionary()),

View File

@ -118,8 +118,12 @@ static var attribute_key_to_name_dic:Dictionary={
"MND":"意志", "MND":"意志",
"LUC":"幸运", "LUC":"幸运",
"AM":"魅力", "AM":"魅力",
"MOR":"道德",
"LAF":"守序",
"HP":"生命", "HP":"生命",
"SP":"精神", "SP":"精神",
"VIT":"体力", "VIT":"体力",
"AD":"物理伤害", "AD":"物理伤害",
"AP":"法术强度", "AP":"法术强度",
@ -248,3 +252,31 @@ static func get_character_use_identification_card(character_data:Dictionary,item
#计算白值 #计算白值
basic_attribute[j]+=add_attribute[j] basic_attribute[j]+=add_attribute[j]
return res return res
#获取一个角色身上对应类型的特质
static func get_all_special_type(character_data:Dictionary,target_type:String)->Array[CharacterSpecial]:
var special_all=character_data["special"]
var res:Array[CharacterSpecial]=[]
for i in special_all:
if Database.get_special_type(i)==target_type:
var target_data=Database.get_special_data(i)
var new_special:CharacterSpecial=CharacterSpecial.new()
new_special.data=target_data
res.append(new_special)
return res
pass
#特质工具类
class CharacterSpecial:
var data:Dictionary
#触发特质
func call_triger():
if data.has("triger") and data["triger"] is Array:
var triget_arr:Array=data["triger"]
for i in triget_arr:
Global.call_triger(i["type"],i["data"])

View File

@ -45,10 +45,7 @@
}, },
"special":[ "special":[
{
"name":"倾国倾城",
"introduction":"鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果"
}
], ],
"ability":[ "ability":[
{ {
@ -138,10 +135,7 @@
}, },
"special":[ "special":[
{
"name":"倾国倾城",
"introduction":"鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果"
}
], ],
"ability":[ "ability":[
{ {
@ -233,10 +227,7 @@
}, },
"special":[ "special":[
{
"name":"倾国倾城",
"introduction":"鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果"
}
], ],
"ability":[ "ability":[
{ {
@ -275,4 +266,68 @@
"card_as_NPC":[] "card_as_NPC":[]
}, },
"Rolland":{
"name":"罗兰",
"head":"?",
"star":3,
"skin":[
{
"name":"皮肤1",
"skin_card_face":"?",
"card_face":"?",
"character":"?"
},
{
"name":"皮肤2",
"skin_card_face":"?",
"card_face":"?",
"character":"?"
},
{
"name":"皮肤3",
"skin_card_face":"?",
"card_face":"?",
"character":"?"
}
],
"skin_now_use":0,
"unlocked_skin":[0,1,2],
"basic_mes":{
"type":0,
"place":"地点",
"sex":0,
"race":"种族",
"birthday":"1982-02-06",
"introduction":"这是一个介绍",
},
"basic_attribute":{
"CON":70,
"AGI":72,
"INT":68,
"WIS":77,
"STR":69,
"MND":51,
"LUC":46,
"AM":40,
"MOR":50,
"LAF":50
},
"start":[
{
"name":"穷困潦倒的侦探",
"introduction":"罗兰是一位不知名的侦探,尽管他有着一定出色的能力却不懂得如何经营从而住在一个破旧的出租屋浑浑噩噩的过着日子,如何他才能走出这恶性循环,他需要静静思考。",
"add_buff":[],
"del_buff":[]
},
{
"name":"一场噩梦?!",
"introduction":"罗兰在自己的出租屋中惊醒,刚刚做了一个奇怪的噩梦,一直怪异的触手吞噬了整个房间,诡异的低吟传遍整个房间,这是怎么回事?罗兰抽着烟静静地思考着,他可以把这一切视作一次偶然,还是说没那么简单?",
"add_buff":[],
"del_buff":[]
},
],
"special":["human"],
"unclocked_start":[0,1],
"start_now_use":0,
}
} }

View File

@ -333,5 +333,19 @@
] ]
} }
] ]
},
"paoxiao1920start":{
"name":"《贡比涅森林停战协定》",
"texture":"paoxiao1920gongbinietingzhan",
"text":"11月11日法国时间凌晨5时福煦代表协约国与德国代表在法国东北部贡比涅森林雷道车站的福煦车厢里签订了停战协定一译《康边停战协定》亦称《协约国对德停战协定》。协定签订当日即生效。",
"choice":[
{
"name":"战争终于结束了...",
"triger":[{
"type":"end_event",
"data":""
}]
}
]
} }
} }

View File

@ -47,6 +47,10 @@
{ {
"name":"社交", "name":"社交",
"event":"event_socialize" "event":"event_socialize"
},
{
"name":"咆哮开局",
"event":"paoxiao1920start"
} }
], ],
"linked_scene":[{ "linked_scene":[{

View File

@ -1,22 +1,24 @@
{ {
"script_001":{ "script_001":{
"name":"测试剧本001", "name":"咆哮的1920年代",
"texture":"test_scene", "texture":"paoxiao1920title",
"side_texture":"texture_test", "side_texture":"paoxiao1920title",
"introduction":"这是一个测试剧本", "introduction":"1920 年代是经济增长与繁荣的年代,一个经济和文化的新时代在向人们招手。世界大战的恐怖被拋诸脑后。爵士乐兴起,大众的艺术追求得到满足,人们对更好生活的向往也能够实现。从北美洲的纽约、芝加哥、新奥尔良,到欧洲的伦敦、巴黎、柏林这样的大都市,在这个时代告别过去的传统成为了现实。从世界大战中诞生的现代化正在召唤着人们。汽车、电影和收音机就是生动的例子,这些新技术开始影响人们的日常生活。同时禁酒令和反英雄的崛起、大量的罢工、暴力骚乱甚至谋杀、女性获得新的权力、战后经济短暂的繁荣背后隐藏着许多危机。",
"type":0, "type":0,
"init_date":{ "init_date":{
"year":1860, "year":1918,
"month":11,
"day":11,
"hour":9
},
"finish_date":{
"year":1930,
"month":1, "month":1,
"day":1, "day":1,
}, },
"finish_date":{
"year":1860,
"month":2,
"day":1,
},
"init_scene":"scene_01", "init_scene":"scene_01",
"init_event":"paoxiao1920start",
}, },
"script_002":{ "script_002":{

15
json/special.json Normal file
View File

@ -0,0 +1,15 @@
{
"#":"特质json字典",
"human":{
"name":"人类",
"introduction":"开局:随机能力等级+1",
"type":"start_game",
"triger":[{
"type":"human",
"data":""
}],
}
}

View File

@ -16,5 +16,7 @@
"fish_preview":"res://test/texture/fish_preview.jpg", "fish_preview":"res://test/texture/fish_preview.jpg",
"fish_success":"res://test/texture/fish_success.jpg", "fish_success":"res://test/texture/fish_success.jpg",
"fish_fail":"res://test/texture/fish_fail.jpg", "fish_fail":"res://test/texture/fish_fail.jpg",
"rod":"res://test/texture/rod.jpg" "rod":"res://test/texture/rod.jpg",
"paoxiao1920title":"res://test/texture/paoxiao1920_demo_title.jpg",
"paoxiao1920gongbinietingzhan":"res://test/texture/paoxiao1920gongbinietingzhan.png"
} }

View File

@ -71,9 +71,13 @@ func init_from_data():
if data.has("special"): if data.has("special"):
var special_data=data["special"] var special_data=data["special"]
for i in special_data: for i in special_data:
var charactr_special_data=Database.get_special_data(i)
if charactr_special_data==null:
continue
var new_button=ABILITY_BUTTON.instantiate() var new_button=ABILITY_BUTTON.instantiate()
new_button.show_mes=i["introduction"] new_button.show_mes=charactr_special_data["introduction"]
new_button.text=i["name"] new_button.text=charactr_special_data["name"]
%special_container.add_child(new_button) %special_container.add_child(new_button)
if data.has("ability"): if data.has("ability"):
var ability_data=data["ability"] var ability_data=data["ability"]
@ -283,9 +287,10 @@ func _ready() -> void:
for i in equipment_group: for i in equipment_group:
i.fresh.connect(fresh) i.fresh.connect(fresh)
Global.set_now_character("test_character_01") #Global.set_now_character("test_character_01")
data=Global.get_now_character_data() if is_in_game:
init_from_data() data=Global.get_now_character_data()
init_from_data()
connect_button() connect_button()

View File

@ -346,11 +346,12 @@ layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
size_flags_stretch_ratio = 939.0 size_flags_stretch_ratio = 939.0
theme_override_styles/panel = SubResource("StyleBoxEmpty_81i7t") theme_override_styles/panel = SubResource("StyleBoxEmpty_81i7t")
current_tab = 0 current_tab = 1
clip_tabs = false clip_tabs = false
tabs_visible = false tabs_visible = false
[node name="basic_mes" type="MarginContainer" parent="VBoxContainer/TabContainer"] [node name="basic_mes" type="MarginContainer" parent="VBoxContainer/TabContainer"]
visible = false
layout_mode = 2 layout_mode = 2
theme_override_constants/margin_right = 19 theme_override_constants/margin_right = 19
theme_override_constants/margin_bottom = 43 theme_override_constants/margin_bottom = 43
@ -1166,7 +1167,6 @@ vertical_alignment = 1
metadata/_edit_use_anchors_ = true metadata/_edit_use_anchors_ = true
[node name="special_ability" type="MarginContainer" parent="VBoxContainer/TabContainer"] [node name="special_ability" type="MarginContainer" parent="VBoxContainer/TabContainer"]
visible = false
layout_mode = 2 layout_mode = 2
theme_override_constants/margin_left = 54 theme_override_constants/margin_left = 54
theme_override_constants/margin_top = 8 theme_override_constants/margin_top = 8

View File

@ -23,6 +23,7 @@ func fresh():
for i in character_add_pos.get_children(): for i in character_add_pos.get_children():
i.queue_free() i.queue_free()
for i in Global.system_game_data["unlock_character"]: for i in Global.system_game_data["unlock_character"]:
print(i)
var new_character=CHARACTER_SELECT_CARD.instantiate() var new_character=CHARACTER_SELECT_CARD.instantiate()
character_add_pos.add_child(new_character) character_add_pos.add_child(new_character)
new_character.set_data(Database.get_character_data(i)) new_character.set_data(Database.get_character_data(i))
@ -33,6 +34,7 @@ func _ready() -> void:
func pressed(data,node,is_select): func pressed(data,node,is_select):
if is_select: if is_select:
print(data)
now_select_data=data now_select_data=data
now_select_node=node now_select_node=node
else: else:
@ -44,6 +46,12 @@ func pressed(data,node,is_select):
func _on_start_pressed() -> void: func _on_start_pressed() -> void:
print(now_select_data)
Global.now_game_data.character_data=now_select_data Global.now_game_data.character_data=now_select_data
SceneManager.change_scene_to("res://scene/game_flow.tscn") SceneManager.change_scene_to("res://scene/game_flow.tscn")
var all_special:Array[CharacterTool.CharacterSpecial]=CharacterTool.get_all_special_type(Global.now_game_data.character_data,"start_game")
for i in all_special:
i.call_triger()
pass # Replace with function body. pass # Replace with function body.

View File

@ -156,9 +156,9 @@ texture = ExtResource("4_tkp1l")
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/NinePatchRect"] [node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/NinePatchRect"]
layout_mode = 1 layout_mode = 1
anchors_preset = -1 anchors_preset = -1
anchor_left = 0.0322052 anchor_left = 0.0319767
anchor_top = 0.127872 anchor_top = 0.152273
anchor_right = 0.465065 anchor_right = 0.465116
anchor_bottom = 1.0 anchor_bottom = 1.0
metadata/_edit_use_anchors_ = true metadata/_edit_use_anchors_ = true

View File

@ -60,7 +60,7 @@ func set_scene(id:String):
touch_data[i]["name"]=i touch_data[i]["name"]=i
new_touch.set_data(touch_data[i]) new_touch.set_data(touch_data[i])
new_touch.judge() new_touch.judge()
try_init_event()
func judge_touch(): func judge_touch():
for i in touch_add_pos.get_children(): for i in touch_add_pos.get_children():
@ -171,3 +171,9 @@ func show_make_card():
pass pass
#检测当前是否应该展示初始事件,如果是,则展示事件并记录
func try_init_event():
if Global.should_show_init_event():
var init_event=Global.get_init_event()
show_event(init_event)
Global.shown_init_event()

View File

@ -430,16 +430,21 @@ patch_margin_right = 90
patch_margin_bottom = 56 patch_margin_bottom = 56
metadata/_edit_use_anchors_ = true metadata/_edit_use_anchors_ = true
[node name="script_introduction" type="Label" parent="NinePatchRect"] [node name="ScrollContainer" type="ScrollContainer" parent="NinePatchRect"]
unique_name_in_owner = true layout_mode = 0
layout_mode = 1 anchor_left = 0.116279
anchors_preset = -1
anchor_left = 0.0976744
anchor_top = 0.137931 anchor_top = 0.137931
anchor_right = 0.809302 anchor_right = 0.797672
anchor_bottom = 0.901996 anchor_bottom = 0.907441
horizontal_scroll_mode = 0
metadata/_edit_use_anchors_ = true
[node name="script_introduction" type="Label" parent="NinePatchRect/ScrollContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_colors/font_color = Color(0, 0, 0, 1) theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 34 theme_override_font_sizes/font_size = 30
text = "剧本介绍剧本介绍 text = "剧本介绍剧本介绍
剧本介绍剧本介绍 剧本介绍剧本介绍
剧本介绍剧本介绍 剧本介绍剧本介绍

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cfwhr6xjfpseu"
path="res://.godot/imported/paoxiao1920_demo_title.jpg-01950cc867d4ad6eb3e46d8591be20ba.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://test/texture/paoxiao1920_demo_title.jpg"
dest_files=["res://.godot/imported/paoxiao1920_demo_title.jpg-01950cc867d4ad6eb3e46d8591be20ba.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://jyorl3y2jemo"
path="res://.godot/imported/paoxiao1920gongbinietingzhan.png-b1f561041c6d3c68ca9bee61aab8362e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://test/texture/paoxiao1920gongbinietingzhan.png"
dest_files=["res://.godot/imported/paoxiao1920gongbinietingzhan.png-b1f561041c6d3c68ca9bee61aab8362e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1