This commit is contained in:
TsubakiLoL 2024-10-04 18:08:33 +08:00
parent c35377e0c2
commit 0982f4e650
41 changed files with 766 additions and 339 deletions

View File

@ -0,0 +1,268 @@
extends Node
var texture_json_path:String="res://json/texture.json"
var texture_data:Dictionary
var card_json_path:String="res://json/card.json"
var card_data:Dictionary
var script_json_path:String="res://json/script.json"
var script_data:Dictionary
var script_type_divide_data:Array=[]
var event_json_path:String="res://json/event.json"
var event_data:Dictionary
var scene_json_path:String="res://json/scene.json"
var scene_data:Dictionary
var character_json_path:String="res://json/character.json"
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
var npc_json_path:String="res://json/npc.json"
var npc_data:Dictionary
var word_json_path:String="res://json/word.json"
var word_data:Dictionary
#角色修饰数据的存储路径
var character_embellish_data_path:String="user://emblish.data"
var character_embellish_data:Dictionary={
}
#加载角色修饰数据(没有则自动创建文件
func load_character_emblish_data():
var f=FileAccess.open(character_embellish_data_path,FileAccess.READ)
if f!=null:
var data=f.get_var()
if data is Dictionary:
character_embellish_data=data.duplicate()
f.close()
else:
f=FileAccess.open(character_embellish_data_path,FileAccess.WRITE)
f.store_var(character_embellish_data)
f.close()
#存储角色修饰数据
func save_character_embellish_data():
var f=FileAccess.open(character_embellish_data_path,FileAccess.WRITE)
f.store_var(character_embellish_data)
f.close()
#添加角色修饰数据
func add_character_embellich_data(character_id:String,embellish_name:String,data):
if character_embellish_data.has(character_id):
character_embellish_data[character_id][embellish_name]=data
else:
character_embellish_data[character_id]={
embellish_name:data
}
save_character_embellish_data()
func _ready() -> void:
load_texture_data()
load_script_data()
load_event_data()
load_scene_data()
load_card_data()
load_character_data()
load_map_data()
load_npc_data()
load_character_emblish_data()
load_item_data()
load_word_data()
#加载当前图片数据
func load_texture_data():
var file=FileAccess.open(texture_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
var texture=load(dictionary[i])
if texture is Texture2D:
dictionary[i]=texture
texture_data=dictionary
#加载当前剧本数据
func load_script_data():
var file=FileAccess.open(script_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
script_type_divide_data=[{},{},{},{}]
for i in dictionary.keys():
dictionary[i]["id"]=i
var data=dictionary[i]
if data.has("type"):
var type:int=int(data["type"])
script_type_divide_data[type][i]=data
script_data=dictionary
#加载当前事件数据
func load_event_data():
var file=FileAccess.open(event_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
event_data=dictionary
#加载当前场景数据
func load_scene_data():
var file=FileAccess.open(scene_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
scene_data=dictionary
pass
#加载当前角色数据(未被修饰)
func load_character_data():
var file=FileAccess.open(character_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
#预处理
dictionary[i]=CharacterTool.pre_process_character_data(dictionary[i])
character_data=dictionary
#加载当前地图字典
func load_map_data():
var file=FileAccess.open(map_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
map_data=dictionary
#加载当前NPC数据可能废弃
func load_npc_data():
var file=FileAccess.open(npc_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
npc_data=dictionary
#加载当前卡牌数据
func load_card_data():
var file=FileAccess.open(card_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
card_data=dictionary
pass
func load_item_data():
var file=FileAccess.open(item_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
item_data=dictionary
#加载词条数据
func load_word_data():
var file=FileAccess.open(word_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
word_data=dictionary
#获取图标
func get_texture(id:String):
if texture_data.has(id):
return texture_data[id]
else:
return null
#获取剧本数据
func get_script_data(id:String):
if script_data.has(id):
var dictionary:Dictionary=script_data[id]
return dictionary.duplicate(true)
else:
return null
#获取全部剧本数据,数组
func get_all_script_data():
return script_type_divide_data.duplicate()
#获取对应ID的事件数据
func get_event_data(id:String):
if event_data.has(id):
var dictionary:Dictionary=event_data[id]
return dictionary.duplicate(true)
else:
return null
#获取对应ID的场景数据
func get_scene_data(id:String):
if scene_data.has(id):
var dictionary:Dictionary=scene_data[id]
return dictionary.duplicate(true)
else:
return null
#获取对应ID的场景字符串
func get_scene_name(id:String)->String:
if scene_data.has(id):
var dictionary:Dictionary=scene_data[id]
return dictionary["name"]
else:
return "未定义场景"
pass
#获取对应ID的角色数据
func get_character_data(id:String):
if character_data.has(id):
var dictionary:Dictionary=character_data[id].duplicate(true)
#如果有修饰数据,则返回修饰后的数据
if character_embellish_data.has(id):
dictionary=CharacterTool.character_embellish(dictionary,character_embellish_data[id])
return dictionary.duplicate(true)
else:
return null
#获取全部角色数据
func get_all_character()->Dictionary:
var all_character:Dictionary=character_data.duplicate(true)
#修饰数据
for i in all_character.keys():
if character_embellish_data.has(i):
all_character[i]=CharacterTool.character_embellish(all_character[i],character_embellish_data[i])
return all_character
#获取对应ID的地图数据
func get_map_data(id:String):
if map_data.has(id):
var dictionary:Dictionary=map_data[id]
return dictionary.duplicate(true)
else:
return null
pass
#获取NPC数据
func get_npc_data(id:String):
if npc_data.has(id):
var dictionary:Dictionary=npc_data[id]
return dictionary.duplicate(true)
else:
return null
pass
#获取NPC名字
func get_npc_name(id:String):
if npc_data.has(id):
var dictionary:Dictionary=npc_data[id]
if dictionary.has("name"):
return dictionary["name"]
else:
return "未命名"
else:
return "未知"
pass
#获取对应ID的卡牌数据
func get_card_data(id:String):
if card_data.has(id):
var dictionary:Dictionary=card_data[id]
return dictionary.duplicate(true)
else:
return null
#获取物品数据
func get_item_data(id:String):
if item_data.has(id):
var dictionary:Dictionary=item_data[id]
return ItemTool.re_process_item_data(dictionary)
else:
return null
#获取词条数据
func get_word_data(id:String):
if word_data.has(id):
var dictionary:Dictionary=word_data[id]
return dictionary.duplicate(true)
else:
return null

View File

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bou2nkackqopj"]
[ext_resource type="Script" path="res://autoload/database/script/database.gd" id="1_e20p4"]
[node name="Database" type="Node"]
script = ExtResource("1_e20p4")

View File

@ -1,59 +1,45 @@
extends Node
#全局数据json的加载
var texture_json_path:String="res://json/texture.json"
var texture_data:Dictionary
var card_json_path:String="res://json/card.json"
var card_data:Dictionary
var script_json_path:String="res://json/script.json"
var script_data:Dictionary
var script_type_divide_data:Array=[]
var event_json_path:String="res://json/event.json"
var event_data:Dictionary
var scene_json_path:String="res://json/scene.json"
var scene_data:Dictionary
var character_json_path:String="res://json/character.json"
var character_data:Dictionary
var map_json_path:String="res://json/map.json"
var map_data:Dictionary
#存档路径
var save_file_path:String="user://save.data"
#加载的存档数据
var save_data:Array=[]
var item_json_path:String="res://json/item.json"
var item_data
var npc_json_path:String="res://json/npc.json"
var npc_data:Dictionary
#角色修饰数据的存储路径
var character_embellish_data_path:String="user://emblish.data"
var character_embellish_data:Dictionary={
}
#加载角色修饰数据(没有则自动创建文件
func load_character_emblish_data():
var f=FileAccess.open(character_embellish_data_path,FileAccess.READ)
func load_save_data():
var f= FileAccess.open(save_file_path,FileAccess.READ)
if f!=null:
var data=f.get_var()
if data is Dictionary:
character_embellish_data=data.duplicate()
f.close()
save_data=f.get_var()
else:
f=FileAccess.open(character_embellish_data_path,FileAccess.WRITE)
f.store_var(character_embellish_data)
f.close()
#存储角色修饰数据
func save_character_embellish_data():
var f=FileAccess.open(character_embellish_data_path,FileAccess.WRITE)
f.store_var(character_embellish_data)
f.close()
#添加角色修饰数据
func add_character_embellich_data(character_id:String,embellish_name:String,data):
if character_embellish_data.has(character_id):
character_embellish_data[character_id][embellish_name]=data
else:
character_embellish_data[character_id]={
embellish_name:data
}
save_character_embellish_data()
f=FileAccess.open(save_file_path,FileAccess.WRITE)
f.store_var(save_data)
#将所有存档数据保存到硬盘
func save_save_data():
var f=FileAccess.open(save_file_path,FileAccess.WRITE)
f.store_var(save_data)
#将当前的游戏数据以存档名n的名字添加到存储队列
func add_now_game_to_save(n:String):
var new_save=now_game_data.duplicate(true)
new_save["name"]=n
save_data.append(new_save)
save_save_data()
#将当前的游戏数据以存档原名覆盖到第ind个存档上
func cover_now_game_to_save(ind:int):
var n:String=save_data[ind]["name"]
var new_save=now_game_data.duplicate(true)
new_save["name"]=n
save_data[ind]=new_save
save_save_data()
#获取当前存档队列
func get_all_save():
return save_data.duplicate(true)
#加载第ind个存档
func load_save(ind:int):
now_game_data=save_data[ind].duplicate()
SceneManager.change_scene_to("res://scene/game_flow.tscn")
pass
#删除第ind个存档
func delete_save(ind:int):
save_data.pop_at(ind)
save_save_data()
var system_config_data_path:String="user://config.data"
#加载配置文件
func load_config():
@ -333,7 +319,11 @@ 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"]
"card_in_bag":["card_03","card_03","card_02","card_02","card_01","card_01","card_01","card_01"],
"condition_triger_randi_dic":{
}
}
#获取当前局内NPC数据
func get_now_game_npc_data(NPC_id:String):
@ -343,9 +333,9 @@ func get_now_game_npc_data(NPC_id:String):
return now_npc_data[NPC_id]
else:
#填入npc数据并实例出售卖的道具可以通过在get item data上施加影响来实现随机
var n_data=get_npc_data(NPC_id)
var n_data=Database.get_npc_data(NPC_id)
for i in n_data["sold_item"].size():
n_data["sold_item"][i]=get_item_data(n_data["sold_item"][i])
n_data["sold_item"][i]=Database.get_item_data(n_data["sold_item"][i])
now_game_data["NPC_data"][NPC_id]=n_data
return now_npc_data[NPC_id]
#获取当前角色与NPC的好感度
@ -494,20 +484,10 @@ func call_condition_triger(triger_type:String,data):
else:
return false
#记录随机的场景上一次结果,如果时间不变则直接取上一次结果
var condition_triger_randi_dic:Dictionary={
"scene_id":{
"touch_name":{
"index":{
"last_time_triger":0000,
"last_rand_result":false,
}
}
}
}
#同上
#记录在游戏存档内,保证加载数据不改变
func get_rand(scene_id:String,touch_name:String,index:String,condition:float)->bool:
if condition_triger_randi_dic.has(scene_id):
var scene_data=condition_triger_randi_dic[scene_id]
if now_game_data["condition_triger_randi_dic"].has(scene_id):
var scene_data=now_game_data["condition_triger_randi_dic"][scene_id]
if scene_data.has(touch_name):
var touch_data=scene_data[touch_name]
if touch_data.has(index):
@ -517,23 +497,23 @@ func get_rand(scene_id:String,touch_name:String,index:String,condition:float)->b
return triger_data["last_rand_result"]
else:
var dic=recreate_rand_dic(condition)
condition_triger_randi_dic[scene_id][touch_name][index]=dic
now_game_data["condition_triger_randi_dic"][scene_id][touch_name][index]=dic
return dic["last_rand_result"]
pass
else:
var dic=recreate_rand_dic(condition)
condition_triger_randi_dic[scene_id][touch_name][index]=dic
now_game_data["condition_triger_randi_dic"][scene_id][touch_name][index]=dic
return dic["last_rand_result"]
else:
var dic=recreate_rand_dic(condition)
condition_triger_randi_dic[scene_id][touch_name]={
now_game_data["condition_triger_randi_dic"][scene_id][touch_name]={
index:dic
}
return dic["last_rand_result"]
pass
else:
var dic=recreate_rand_dic(condition)
condition_triger_randi_dic[scene_id]={
now_game_data["condition_triger_randi_dic"][scene_id]={
touch_name:{
index:dic
}
@ -572,180 +552,10 @@ func get_now_character_data():
return now_game_data["character_data"].duplicate()
#设置当前角色(游戏内)
func set_now_character(id:String):
now_game_data["character_data"]=get_character_data(id)
now_game_data["character_data"]=Database.get_character_data(id)
func _ready() -> void:
load_texture_data()
load_script_data()
load_event_data()
load_scene_data()
load_card_data()
load_character_data()
load_map_data()
load_npc_data()
load_character_emblish_data()
load_item_data()
load_config()
load_system_game_data()
#加载当前图片数据
func load_texture_data():
var file=FileAccess.open(texture_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
var texture=load(dictionary[i])
if texture is Texture2D:
dictionary[i]=texture
texture_data=dictionary
#加载当前剧本数据
func load_script_data():
var file=FileAccess.open(script_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
script_type_divide_data=[{},{},{},{}]
for i in dictionary.keys():
dictionary[i]["id"]=i
var data=dictionary[i]
if data.has("type"):
var type:int=int(data["type"])
script_type_divide_data[type][i]=data
script_data=dictionary
#加载当前事件数据
func load_event_data():
var file=FileAccess.open(event_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
event_data=dictionary
#加载当前场景数据
func load_scene_data():
var file=FileAccess.open(scene_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
scene_data=dictionary
pass
#加载当前角色数据(未被修饰)
func load_character_data():
var file=FileAccess.open(character_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
#预处理
dictionary[i]=CharacterTool.pre_process_character_data(dictionary[i])
character_data=dictionary
#加载当前地图字典
func load_map_data():
var file=FileAccess.open(map_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
map_data=dictionary
#加载当前NPC数据可能废弃
func load_npc_data():
var file=FileAccess.open(npc_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
npc_data=dictionary
#加载当前卡牌数据
func load_card_data():
var file=FileAccess.open(card_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
card_data=dictionary
pass
func load_item_data():
var file=FileAccess.open(item_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
item_data=dictionary
#获取图标
func get_texture(id:String):
if texture_data.has(id):
return texture_data[id]
else:
return null
#获取剧本数据
func get_script_data(id:String):
if script_data.has(id):
var dictionary:Dictionary=script_data[id]
return dictionary.duplicate(true)
else:
return null
#获取全部剧本数据,数组
func get_all_script_data():
return script_type_divide_data.duplicate()
#获取对应ID的事件数据
func get_event_data(id:String):
if event_data.has(id):
var dictionary:Dictionary=event_data[id]
return dictionary.duplicate(true)
else:
return null
#获取对应ID的场景数据
func get_scene_data(id:String):
if scene_data.has(id):
var dictionary:Dictionary=scene_data[id]
return dictionary.duplicate(true)
else:
return null
#获取对应ID的角色数据
func get_character_data(id:String):
if character_data.has(id):
var dictionary:Dictionary=character_data[id].duplicate(true)
#如果有修饰数据,则返回修饰后的数据
if character_embellish_data.has(id):
dictionary=CharacterTool.character_embellish(dictionary,character_embellish_data[id])
return dictionary.duplicate(true)
else:
return null
#获取全部角色数据
func get_all_character()->Dictionary:
var all_character:Dictionary=character_data.duplicate(true)
#修饰数据
for i in all_character.keys():
if character_embellish_data.has(i):
all_character[i]=CharacterTool.character_embellish(all_character[i],character_embellish_data[i])
return all_character
#获取对应ID的地图数据
func get_map_data(id:String):
if map_data.has(id):
var dictionary:Dictionary=map_data[id]
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(true)
else:
return null
pass
#获取对应ID的卡牌数据
func get_card_data(id:String):
if card_data.has(id):
var dictionary:Dictionary=card_data[id]
return dictionary.duplicate(true)
else:
return null
func get_item_data(id:String):
if item_data.has(id):
var dictionary:Dictionary=item_data[id]
return dictionary.duplicate(true)
else:
return null
load_save_data()

View File

@ -199,6 +199,6 @@ static func get_character_with_npc_favor(character_data:Dictionary,npc_id:String
if favor_data.has(npc_id):
return favor_data[npc_id]
else:
character_data["favor"][npc_id]=Global.get_npc_data(npc_id)["init_favor"]
character_data["favor"][npc_id]=Database.get_npc_data(npc_id)["init_favor"]
return favor_data[npc_id]
pass

View File

@ -0,0 +1,92 @@
class_name ItemTool
#用来进行对物品数据进行处理的工具类
#对物品数据进行预处理(如随机品质,随机词条等项)
static func re_process_item_data(item_data:Dictionary):
var new_item_data=item_data.duplicate(true)
#随机品质
if new_item_data.has("quality_lib"):
var quality:Array=new_item_data["quality_lib"]
new_item_data["quality"]=get_rand_value_weight(quality)
#根据品质及词条库添加词条
if item_data.has("word_lib"):
var word_num:int=0
match int(new_item_data["quality"]):
2:
if randf()>0.5:
word_num=1
3:
if randf()>0.5:
word_num=2
else:
word_num=1
4:
if randf()>0.5:
word_num=3
else:
word_num=2
5:
word_num=3
6:
word_num=3
var word_lib=item_data["word_lib"]
var word_arr:Array=[]
for i in word_num:
word_arr.append(get_rand_value_weight(word_lib))
new_item_data["word"]=word_arr
return new_item_data
static func get_weight(qalib:Dictionary):
return qalib["weight"]
static func sum_weight(acc:float,new:Dictionary):
return acc+get_weight(new)
static func get_rand_value_weight(weight_arr:Array):
var sum_wight=weight_arr.reduce(sum_weight,0)
#迭代器
var weight_ind:float=0
var final_res:Dictionary
var rand=randf_range(0,sum_wight)
for i in weight_arr:
weight_ind+=get_weight(i)
if weight_ind>=rand:
final_res=i
break
return final_res["value"]
static func get_name_from_item_data(item_data:Dictionary)->String:
var n:String=item_data["name"]
if item_data.has("quality"):
var quility:int=item_data["quality"]
#劣质 普通 优秀 稀有 史诗 传说 无双
match quility:
0:
return n+"(劣质)"
1:
return n+"(普通)"
2:
return n+"(优秀)"
3:
return n+"(稀有)"
4:
return n+"(史诗)"
5:
return n+"(传说)"
6:
return n+"(无双)"
_:
return n
else:
return n
pass
static func get_introduction_from_item_data(item_data:Dictionary)->String:
var res:String=""
if item_data.has("word"):
var word_arr:Array=item_data["word"]
for i in word_arr:
var word_data=Database.get_word_data(i)
res+=word_data["name"]+":"+word_data["introduction"]+"\n"
res+=item_data["introduction"]
return res
pass

View File

@ -3,10 +3,30 @@
"type":0,
"allow_merge":false,
"price":100,
"quality":0,
"quality_lib":[
{
"value":4,
"weight":10
},
{
"value":5,
"weight":1
}
],
"word_lib":[
{
"value":"test_word1",
"weight":10
},
{
"value":"test_word2",
"weight":2
},
],
"texture":"issuing",
"name":"发卡(测试饰品)",
"introduction":"用于测试的饰品装备,并没有什么用",
"material":{
}
@ -16,7 +36,16 @@
"type":1,
"allow_merge":false,
"price":100,
"quality":0,
"quality_lib":[
{
"value":0,
"weight":10
},
{
"value":1,
"weight":1
}
],
"texture":"bag",
"name":"测试手部装备背包",
"introduction":"用于测试的手部装备,并没有什么用",
@ -29,7 +58,16 @@
"type":2,
"allow_merge":false,
"price":100,
"quality":0,
"quality_lib":[
{
"value":0,
"weight":10
},
{
"value":1,
"weight":1
}
],
"texture":"clothes",
"name":"测试身体",
"introduction":"用于测试的身体装备,并没有什么用",
@ -43,7 +81,16 @@
"allow_merge":false,
"price":100,
"quality":0,
"quality_lib":[
{
"value":0,
"weight":10
},
{
"value":1,
"weight":1
}
],
"texture":"hat",
"name":"测试头部",
"introduction":"用于测试的头部装备,并没有什么用",
@ -56,7 +103,16 @@
"type":4,
"allow_merge":false,
"price":100,
"quality":0,
"quality_lib":[
{
"value":0,
"weight":10
},
{
"value":1,
"weight":1
}
],
"texture":"knife",
"name":"小刀",
"introduction":"用于测试的武器,并没有什么用",
@ -69,7 +125,16 @@
"type":5,
"allow_merge":true,
"price":100,
"quality":0,
"quality_lib":[
{
"value":0,
"weight":10
},
{
"value":1,
"weight":1
}
],
"name":"绷带",
"introduction":"用于测试的道具,并没有什么用",
"material":{
@ -80,7 +145,16 @@
"type":6,
"allow_merge":false,
"price":100,
"quality":0,
"quality_lib":[
{
"value":0,
"weight":10
},
{
"value":1,
"weight":1
}
],
"name":"测试技能",
"texture":"knife",
"introduction":"用于测试的技能,并没有什么用",

View File

@ -33,7 +33,7 @@
]
},
"scene_02":{
"name":"测试场景1",
"name":"测试场景2",
"map":"map_01",
"texture":"test_character",
"quick_event":[
@ -78,7 +78,7 @@
],
"touch":{
"测试互动点1":{
"测试互动点118点后出现":{
"condition":[
{
"type":"time_limit",
@ -89,10 +89,12 @@
}
}
],
"triger":[],
"position":[100,100],
"event":"event_01"
},
"测试互动点2":{
"测试互动点2197012后出现":{
"condition":[
{
"type":"date_limit",
@ -108,7 +110,7 @@
"position":[200,200],
"event":"event_02"
},
"测试互动点3":{
"测试互动点3时间变化有50%概率出现)":{
"condition":[
{
"type":"rand",

View File

@ -16,7 +16,7 @@
"month":2,
"day":1,
},
"init_scene":"scene_01",
"init_scene":"scene_02",
},
"script_002":{

16
json/word.json Normal file
View File

@ -0,0 +1,16 @@
{
"test_word1":{
"name":"百分比加成测试词条",
"introduction":"体质+5%",
"percent":{
"CON":0.05
}
},
"test_word2":{
"name":"百分比加成测试词条",
"introduction":"敏捷+5%",
"percent":{
"AGI":0.05
}
}
}

View File

@ -21,6 +21,7 @@ PopUpWindow="*res://addons/popupwindow/PopUpWindow.tscn"
Global="*res://autoload/global/tscn/global.tscn"
SceneManager="*res://autoload/scene_manager/tscn/scene_manager.tscn"
Bgm="*res://autoload/BGM/tscn/bgm.tscn"
Database="*res://autoload/database/tscn/database.tscn"
[display]

View File

@ -11,7 +11,7 @@ var data:Dictionary={
}
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
set_data(Global.get_item_data("item_01"))
set_data(Database.get_item_data("item_01"))
pass # Replace with function body.
@ -23,7 +23,7 @@ func _input(event: InputEvent) -> void:
click.emit(data)
func _get_drag_data(at_position: Vector2) -> Variant:
var texture_rect=TextureRect.new()
texture_rect.texture=Global.get_texture(data["texture"])
texture_rect.texture=Database.get_texture(data["texture"])
texture_rect.expand_mode=TextureRect.EXPAND_IGNORE_SIZE
texture_rect.stretch_mode=TextureRect.STRETCH_KEEP_ASPECT_CENTERED
texture_rect.size=self.size
@ -33,7 +33,7 @@ func _get_drag_data(at_position: Vector2) -> Variant:
return new_data
func set_data(_data:Dictionary):
data=_data
%face.texture=Global.get_texture(data["texture"])
%face.texture=Database.get_texture(data["texture"])
pass
func _on_mouse_entered() -> void:
is_mouse_enter=true

View File

@ -4,7 +4,8 @@ var data
func _ready() -> void:
if data!=null:
%bag_card_face_big.texture=Global.get_texture(data["texture"])
%bag_card_name.text=data["name"]
%bag_card_introduction.text=data["introduction"]
%bag_card_face_big.texture=Database.get_texture(data["texture"])
%bag_card_name.text=ItemTool.get_name_from_item_data(data)
%bag_card_introduction.text=ItemTool.get_introduction_from_item_data(data)
get_parent().add_theme_stylebox_override("panel",StyleBoxEmpty.new())

View File

@ -26,7 +26,7 @@ func set_data(_data):
item_data=null
return
item_data=_data
texture.texture=Global.get_texture(_data["texture"])
texture.texture=Database.get_texture(_data["texture"])
func _on_mouse_entered():
is_mouse_enter=true
@ -39,6 +39,6 @@ func _ready() -> void:
func _input(event: InputEvent) -> void:
if event.is_action_pressed("mouse_left") and is_mouse_enter:
print("xxx")
#print("xxx")
Global.replace_equip_with_data(page,index,null)
fresh.emit()

View File

@ -23,7 +23,7 @@ var state:int=-2:
pass
func set_data(_data:Dictionary):
data=_data
%skin_head.texture=Global.get_texture(data["skin_card_face"])
%skin_head.texture=Database.get_texture(data["skin_card_face"])
func _on_btn_pressed() -> void:

View File

@ -28,7 +28,7 @@ func init_from_data():
i.queue_free()
for i in %ability_container.get_children():
i.queue_free()
%character.texture=Global.get_texture(CharacterTool.get_skin_now_use_data(data)["character"])
%character.texture=Database.get_texture(CharacterTool.get_skin_now_use_data(data)["character"])
var basic_data=data["basic_mes"]
match int(basic_data["type"]):
0:
@ -82,7 +82,7 @@ func init_from_data():
new_button.show_mes=i["introduction"]
new_button.text=i["name"]
%ability_container.add_child(new_button)
%character_name.text=data["name"]
%character_name.text=data["name"]
var star_arr=%star_container.get_children()
var star_num:int=data["star"]
for i in star_arr.size():
@ -96,7 +96,7 @@ func init_from_data():
i.queue_free()
for i in data["favor"].keys():
var new_label=Label.new()
new_label.text=i+":"+str(data["favor"][i])
new_label.text=Database.get_npc_name(i)+":"+str(data["favor"][i])
%favor.add_child(new_label)
new_label.add_theme_font_size_override("font_size",26)
#声望
@ -205,8 +205,8 @@ func start_config_mes_click(mes:StartConfigMes,ind:int):
mes.state=1
now_selected_mes=mes
#添加开局选择修饰
Global.add_character_embellich_data(data["id"],"start",ind)
data=Global.get_character_data(data["id"])
Database.add_character_embellich_data(data["id"],"start",ind)
data=Database.get_character_data(data["id"])
init_from_data()
pass
var now_selected_skin_card:BasicMesSkinCard
@ -218,7 +218,7 @@ func connect_button():
func skin_card_click(skin:BasicMesSkinCard,skin_index:int):
#添加皮肤修饰器
Global.add_character_embellich_data(data["id"],"skin",skin_index)
%character.texture=Global.get_texture(data["skin"][skin_index]["character"])
%character.texture=Database.get_texture(data["skin"][skin_index]["character"])
now_selected_skin_card.state=0
skin.state=1
now_selected_skin_card=skin
@ -269,12 +269,12 @@ func _ready() -> void:
#Global.add_item_to_bag(Global.get_item_data("item_03"))
#Global.add_item_to_bag(Global.get_item_data("item_04"))
#Global.add_item_to_bag(Global.get_item_data("item_05"))
Global.add_item_to_bag(Global.get_item_data("item_07"))
Global.add_item_to_bag(Global.get_item_data("item_07"))
Global.add_item_to_bag(Global.get_item_data("item_07"))
Global.add_item_to_bag(Global.get_item_data("item_07"))
Global.add_item_to_bag(Global.get_item_data("item_07"))
Global.add_item_to_bag(Global.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"))
Global.add_item_to_bag(Database.get_item_data("item_07"))
if is_in_game:
$VBoxContainer/TextureRect/HBoxContainer/Button6.hide()

View File

@ -22,7 +22,7 @@ func _on_fight_card_mouse_exited() -> void:
var data:Dictionary
##设置卡牌信息
func set_data(id:String):
var d=Global.get_card_data(id)
var d=Database.get_card_data(id)
if d!=null:
data=d
fight_card.set_data(d)

View File

@ -36,7 +36,7 @@ func _on_back_btn_pressed() -> void:
get_parent().change_open(false)
pass # Replace with function body.
func refresh():
data=Global.get_all_character()
data=Database.get_all_character()
select(-1,-1)
pass

View File

@ -22,7 +22,7 @@ func set_character_name(n:String):
pass
func _ready() -> void:
set_star_num(CharacterTool.get_character_star_num(data))
set_face(Global.get_texture(CharacterTool.get_skin_now_use_data(data)["card_face"]))
set_face(Database.get_texture(CharacterTool.get_skin_now_use_data(data)["card_face"]))
set_character_name(CharacterTool.get_character_name(data))

View File

@ -25,7 +25,7 @@ func fresh():
for i in Global.system_game_data["unlock_character"]:
var new_character=CHARACTER_SELECT_CARD.instantiate()
character_add_pos.add_child(new_character)
new_character.set_data(Global.get_character_data(i))
new_character.set_data(Database.get_character_data(i))
new_character.pressed.connect(pressed)
func _ready() -> void:
fresh()

View File

@ -30,14 +30,14 @@ func _on_tool_button_pressed() -> void:
func _ready() -> void:
#set_data(Global.get_character_data("test_character_01"))
#set_data(Database.get_character_data("test_character_01"))
pass
func set_data(_data:Dictionary):
data=_data
var skin_data=CharacterTool.get_skin_now_use_data(data)
texture_face.texture=Global.get_texture(skin_data["card_face"])
texture_face.texture=Database.get_texture(skin_data["card_face"])
set_star_num(data["star"])
n.text=data["name"]
pass

View File

@ -20,10 +20,10 @@ func _process(delta: float) -> void:
pass
#通过事件ID初始化界面
func set_event_data(id:String):
data=Global.get_event_data(id)
data=Database.get_event_data(id)
for i in choice_add_pos.get_children():
i.queue_free()
event_texture.texture=Global.get_texture(data["texture"])
event_texture.texture=Database.get_texture(data["texture"])
event_intro.text=data["text"]
event_name.text=data["name"]
var choice_data=data["choice"]
@ -35,7 +35,7 @@ func set_event_data(id:String):
for j in condition_data:
enable=enable and Global.call_condition_triger(j["type"],j["data"])
pass
print(enable)
#print(enable)
var new_btn=EVENT_CHOICE_BUTTON.instantiate()
choice_add_pos.add_child(new_btn)
new_btn.set_data(i)
@ -54,7 +54,7 @@ func choice_click(event_data:Dictionary):
change_choice(self.choice_data)
pass
func change_texture(texture_id:String):
event_texture.texture=Global.get_texture(texture_id)
event_texture.texture=Database.get_texture(texture_id)
func change_text(text:String):
event_intro.text=text
@ -68,7 +68,7 @@ func change_choice(choice_data:Array):
var condition_data:Array=i["condition"]
for j in condition_data:
enable=enable and Global.call_condition_triger(j["type"],j["data"])
print(enable)
#print(enable)
var new_btn=EVENT_CHOICE_BUTTON.instantiate()
choice_add_pos.add_child(new_btn)
new_btn.set_data(i)

View File

@ -15,10 +15,10 @@ 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"))
add_user(Database.get_character_data("test_character_01"))
add_character(Database.get_character_data("test_character_01"))
add_enermy(Database.get_character_data("test_character_01"))
add_enermy(Database.get_character_data("test_character_02"))
pass # Replace with function body.
##抽牌
func extract_card(num:int):

View File

@ -6,6 +6,6 @@ extends TextureRect
var data:Dictionary
func set_data(_data:Dictionary):
data=_data
icon.texture=Global.get_texture(_data["icon"])
icon.texture=Database.get_texture(_data["icon"])
n.text=data["name"]
pass

View File

@ -35,11 +35,11 @@ var VIT:int=100:
%VIT_bar.value=val
%VIT_label.text=str(val)+"/"+str(VIT_max)
func _ready() -> void:
set_data(Global.get_character_data("test_character_01"))
set_data(Database.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"])
icon.texture=Database.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"]

View File

@ -36,11 +36,11 @@ var VIT:int=100:
%VIT_bar.value=val
%VIT_label.text=str(val)+"/"+str(VIT_max)
func _ready() -> void:
set_data(Global.get_character_data("test_character_01"))
set_data(Database.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"])
icon.texture=Database.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"]

View File

@ -18,18 +18,18 @@ const GAME_FLOW_EVENT = preload("res://scene/game_flow_event.tscn")
const GAME_FLOW_PLACE = preload("res://scene/game_flow_place.tscn")
var scene_data:Dictionary
func _ready() -> void:
set_scene("scene_01")
set_scene(Global.get_now_scene())
update_date()
Global.time_changed.connect(update_date)
Global.now_game_flow=self
var character_data=Global.get_now_character_data()
character_texture.texture=Global.get_texture(CharacterTool.get_head(character_data))
character_texture.texture=Database.get_texture(CharacterTool.get_head(character_data))
character_name.text=CharacterTool.get_character_name(character_data)
update_game_currency()
Global.game_currency_changed.connect(update_game_currency)
func set_scene(id:String):
scene_data=Global.get_scene_data(id)
back.texture=Global.get_texture(scene_data["texture"])
scene_data=Database.get_scene_data(id)
back.texture=Database.get_texture(scene_data["texture"])
for i in event.get_children():
i.queue_free()
for i in place_add.get_children():
@ -116,3 +116,13 @@ func update_game_currency():
func show_trade(NPC_id:String):
%trade.set_data(NPC_id)
%trade.show()
func _on_save_pressed() -> void:
%save_and_load.show()
%save_and_load.fresh()
pass # Replace with function body.
func _on_load_pressed() -> void:
pass # Replace with function body.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=27 format=3 uid="uid://bht5sd88340s5"]
[gd_scene load_steps=28 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"]
@ -20,6 +20,7 @@
[ext_resource type="PackedScene" uid="uid://ccsaeb8hm5lsu" path="res://scene/map.tscn" id="19_fok85"]
[ext_resource type="PackedScene" uid="uid://chh7gr3qbkr8u" path="res://scene/basic_message.tscn" id="19_xvka5"]
[ext_resource type="PackedScene" uid="uid://cewsjbnll1iol" path="res://scene/trade.tscn" id="20_ql26d"]
[ext_resource type="PackedScene" uid="uid://ln0ri824gh2c" path="res://scene/save_and_load.tscn" id="21_2j45w"]
[sub_resource type="Gradient" id="Gradient_4wq1v"]
@ -372,7 +373,7 @@ layout_mode = 2
size_flags_horizontal = 10
texture = ExtResource("12_ddt74")
[node name="ToolButton" parent="HBoxContainer/TextureRect" instance=ExtResource("8_q6ple")]
[node name="save" parent="HBoxContainer/TextureRect" instance=ExtResource("8_q6ple")]
layout_mode = 1
[node name="TextureRect2" type="TextureRect" parent="HBoxContainer"]
@ -380,7 +381,7 @@ layout_mode = 2
size_flags_horizontal = 8
texture = ExtResource("13_ll8xc")
[node name="ToolButton" parent="HBoxContainer/TextureRect2" instance=ExtResource("8_q6ple")]
[node name="load" parent="HBoxContainer/TextureRect2" instance=ExtResource("8_q6ple")]
layout_mode = 1
[node name="TextureRect3" type="TextureRect" parent="HBoxContainer"]
@ -453,5 +454,14 @@ unique_name_in_owner = true
visible = false
layout_mode = 1
[node name="save_and_load" parent="." instance=ExtResource("21_2j45w")]
unique_name_in_owner = true
visible = false
layout_mode = 1
need_save = true
[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"]
[connection signal="pressed" from="HBoxContainer/TextureRect3/map" to="." method="_on_map_pressed"]
[connection signal="close" from="save_and_load" to="save_and_load" method="hide"]

View File

@ -7,7 +7,7 @@ var scene_id:String
var ind:String
func set_data(_data:Dictionary):
data=_data
name_debug.text==data["name"]
name_debug.text=data["name"]
position=Vector2(data["position"][0],data["position"][1])
pass
@ -33,4 +33,10 @@ func judge():
self.hide()
func _on_tool_button_pressed() -> void:
if data.has("triger"):
for i in data["triger"]:
var type=data["triger"]["type"]
var data=data["triger"]["data"]
Global.call_triger(type,data)
pass
pass # Replace with function body.

View File

@ -65,6 +65,11 @@ texture = ExtResource("5_oqc0n")
[node name="name_debug" type="Label" parent="."]
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 38
text = "名字"
horizontal_alignment = 1
vertical_alignment = 1
[node name="ToolButton" parent="." instance=ExtResource("7_xebjv")]
layout_mode = 2

View File

@ -65,7 +65,7 @@ var map_data:Dictionary
func set_map(id:String):
set_process(true)
scale_rag=1
map_data=Global.get_map_data(id)
map_data=Database.get_map_data(id)
var map_index:Array=map_data["index"]
for i in map_add_pos.get_children():
if i is MapIndex:

View File

@ -1,11 +1,48 @@
extends Control
signal close
const SAVE_AND_LOAD_MONO = preload("res://scene/save_and_load_mono.tscn")
@export var need_save:bool=false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
if need_save:
%back.show()
%debug_add.show()
else:
%back.hide()
%debug_add.hide()
#刷新
func fresh():
for i in %mono_add_pos.get_children():
i.queue_free()
var all_save=Global.get_all_save()
for i in all_save.size():
var new_mono=SAVE_AND_LOAD_MONO.instantiate()
%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
func _on_tool_button_pressed() -> void:
close.emit()
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
func cover(ind:int):
Global.cover_now_game_to_save(ind)
fresh()
pass
func load_save(ind:int):
Global.load_save(ind)
pass
func delete_save(ind:int):
Global.delete_save(ind)
fresh()
func _on_button_pressed() -> void:
Global.add_now_game_to_save("测试存档")
fresh()
pass # Replace with function body.

View File

@ -24,6 +24,7 @@ grow_vertical = 2
script = ExtResource("1_db4b7")
[node name="back" type="TextureRect" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -55,15 +56,16 @@ grow_horizontal = 2
grow_vertical = 2
horizontal_scroll_mode = 0
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/ScrollContainer"]
[node name="mono_add_pos" type="VBoxContainer" parent="Panel/ScrollContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
[node name="save_and_load_mono" parent="Panel/ScrollContainer/VBoxContainer" instance=ExtResource("3_exjxy")]
[node name="save_and_load_mono" parent="Panel/ScrollContainer/mono_add_pos" instance=ExtResource("3_exjxy")]
layout_mode = 2
[node name="save_and_load_mono2" parent="Panel/ScrollContainer/VBoxContainer" instance=ExtResource("3_exjxy")]
[node name="save_and_load_mono2" parent="Panel/ScrollContainer/mono_add_pos" instance=ExtResource("3_exjxy")]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="."]
@ -83,3 +85,13 @@ stretch_mode = 3
[node name="ToolButton" parent="TextureRect" instance=ExtResource("4_ohaxm")]
layout_mode = 1
[node name="debug_add" type="Button" parent="."]
unique_name_in_owner = true
layout_mode = 0
offset_right = 343.0
offset_bottom = 115.0
text = "添加存档debug"
[connection signal="pressed" from="TextureRect/ToolButton" to="." method="_on_tool_button_pressed"]
[connection signal="pressed" from="debug_add" to="." method="_on_button_pressed"]

View File

@ -1,6 +1,12 @@
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"])
%place.text=Database.get_scene_name(data["now_scene"])
pass
func _ready() -> void:
if need_save:
@ -8,10 +14,21 @@ func _ready() -> void:
else:
$TextureRect3.hide()
signal cover
func _on_save_pressed() -> void:
pass # Replace with function body.
signal load
signal delete
func _on_load_pressed() -> void:
load.emit()
pass # Replace with function body.
func _on_cover_pressed() -> void:
cover.emit()
pass # Replace with function body.
func _on_delete_pressed() -> void:
delete.emit()
pass # Replace with function body.

View File

@ -36,7 +36,8 @@ offset_top = 26.0
offset_right = 425.0
offset_bottom = 174.0
[node name="Label" type="Label" parent="VBoxContainer"]
[node name="name" type="Label" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
theme_override_font_sizes/font_size = 24
@ -53,7 +54,8 @@ size_flags_vertical = 1
theme_override_font_sizes/font_size = 24
text = "存档时间:"
[node name="Label2" type="Label" parent="VBoxContainer/HBoxContainer"]
[node name="date" type="Label" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
@ -71,7 +73,8 @@ size_flags_vertical = 1
theme_override_font_sizes/font_size = 24
text = "存档地点:"
[node name="Label2" type="Label" parent="VBoxContainer/HBoxContainer2"]
[node name="place" type="Label" parent="VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
@ -108,7 +111,7 @@ expand_mode = 1
stretch_mode = 5
metadata/_edit_use_anchors_ = true
[node name="ToolButton" parent="TextureRect2" instance=ExtResource("4_i5nwn")]
[node name="delete" parent="TextureRect2" instance=ExtResource("4_i5nwn")]
layout_mode = 1
[node name="TextureRect3" type="TextureRect" parent="."]
@ -136,7 +139,7 @@ horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true
[node name="save" parent="TextureRect3" instance=ExtResource("4_i5nwn")]
[node name="cover" parent="TextureRect3" instance=ExtResource("4_i5nwn")]
layout_mode = 1
[node name="TextureRect4" type="TextureRect" parent="."]
@ -167,5 +170,6 @@ metadata/_edit_use_anchors_ = true
[node name="load" parent="TextureRect4" instance=ExtResource("4_i5nwn")]
layout_mode = 1
[connection signal="pressed" from="TextureRect3/save" to="." method="_on_save_pressed"]
[connection signal="pressed" from="TextureRect2/delete" to="." method="_on_delete_pressed"]
[connection signal="pressed" from="TextureRect3/cover" to="." method="_on_cover_pressed"]
[connection signal="pressed" from="TextureRect4/load" to="." method="_on_load_pressed"]

View File

@ -37,7 +37,7 @@ func load_now_script():
var new_btn=SELECT_BUTTON.instantiate()
new_btn.id=now_select_array[i]["id"]
%btn_add_pos.add_child(new_btn)
new_btn.set_texture(Global.get_texture(now_select_array[i]["side_texture"]))
new_btn.set_texture(Database.get_texture(now_select_array[i]["side_texture"]))
new_btn.pressed.connect(side_btn_clicked.bind(i))
btn_group.append(new_btn)
side_btn_clicked(0)
@ -57,14 +57,14 @@ func side_btn_clicked(ind:int):
btn.is_selected=true
selected_button=btn
var now_select_array:Array=data[now_selected_script]
set_script_texture(Global.get_texture(now_select_array[ind]["texture"]))
set_script_texture(Database.get_texture(now_select_array[ind]["texture"]))
%script_name.text=now_select_array[ind]["name"]
%script_introduction.text=now_select_array[ind]["introduction"]
now_selected_script_id=btn.id
pass
func get_global_script_data():
var glbdt=Global.get_all_script_data()
var glbdt=Database.get_all_script_data()
data["history"]=glbdt[0].values()
data["fantasy"]=glbdt[1].values()
data["reality"]=glbdt[2].values()
@ -142,7 +142,7 @@ func init_button_connection():
func _on_enter_button_pressed() -> void:
enter_script.emit(now_selected_script_id)
var script_data=Global.get_script_data(now_selected_script_id)
var script_data=Database.get_script_data(now_selected_script_id)
if script_data!=null:
Global.now_game_data["script_data"]=script_data
Global.set_now_scene(script_data["init_scene"])

View File

@ -7,7 +7,7 @@ var data:Dictionary
func set_data(_data:Dictionary):
data=_data
%face.texture=Global.get_texture(data["texture"])
%face.texture=Database.get_texture(data["texture"])
%name.text=data["name"]
%introduction.text=data["introduction"]

View File

@ -7,7 +7,7 @@ var data:Dictionary
func set_data(_data:Dictionary):
data=_data
%face.texture=Global.get_texture(data["texture"])
%face.texture=Database.get_texture(data["texture"])
func _on_tool_button_pressed() -> void:

View File

@ -59,3 +59,19 @@ func _on_button_4_pressed() -> void:
func _on_button_pressed() -> void:
SceneManager.change_scene_to("res://scene/main.tscn")
pass # Replace with function body.
func _on_save_and_load_close() -> void:
%save_load_container.change_open(false)
pass # Replace with function body.
func _on_button_2_pressed() -> void:
%save_and_load.fresh()
%save_load_container.change_open(true)
pass # Replace with function body.
func _on_button_3_pressed() -> void:
%config_container.change_open(true)
pass # Replace with function body.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://vd8ovfqb4bkq"]
[gd_scene load_steps=11 format=3 uid="uid://vd8ovfqb4bkq"]
[ext_resource type="Script" path="res://scene/start_the_game.gd" id="1_ivvmj"]
[ext_resource type="Texture2D" uid="uid://bxpr6jpaoc851" path="res://res/ui/ui_001_start/bg.png" id="1_nr2kd"]
@ -6,6 +6,8 @@
[ext_resource type="Texture2D" uid="uid://bbamxd1q6qwkd" path="res://res/ui/ui_001_start/button_0.png" id="3_ljvo4"]
[ext_resource type="Texture2D" uid="uid://syusk0q7y0jv" path="res://res/ui/ui_001_start/choice.png" id="5_yiext"]
[ext_resource type="PackedScene" uid="uid://ln0ri824gh2c" path="res://scene/save_and_load.tscn" id="6_8wpd4"]
[ext_resource type="Script" path="res://class/tool/DrawerContainer.gd" id="6_ljpln"]
[ext_resource type="PackedScene" uid="uid://bp04hbeued2uo" path="res://scene/config.tscn" id="8_xtg6p"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_m4deq"]
content_margin_left = 102.0
@ -155,13 +157,49 @@ pivot_offset = Vector2(38, 42)
mouse_filter = 2
texture = ExtResource("5_yiext")
[node name="save_and_load" parent="." instance=ExtResource("6_8wpd4")]
visible = false
[node name="save_load_container" type="Container" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
script = ExtResource("6_ljpln")
disable_button = true
is_open = false
rag = 1.0
[node name="save_and_load" parent="save_load_container" instance=ExtResource("6_8wpd4")]
unique_name_in_owner = true
layout_mode = 2
[node name="config_container" type="Container" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
script = ExtResource("6_ljpln")
button_model = 3
disable_button = true
is_open = false
rag = 1.0
[node name="Config" parent="config_container" instance=ExtResource("8_xtg6p")]
unique_name_in_owner = true
layout_mode = 2
[connection signal="mouse_entered" from="MarginContainer/VBoxContainer2/VBoxContainer/Button" to="." method="_on_button_mouse_entered"]
[connection signal="pressed" from="MarginContainer/VBoxContainer2/VBoxContainer/Button" to="." method="_on_button_pressed"]
[connection signal="mouse_entered" from="MarginContainer/VBoxContainer2/VBoxContainer/Button2" to="." method="_on_button_2_mouse_entered"]
[connection signal="pressed" from="MarginContainer/VBoxContainer2/VBoxContainer/Button2" to="." method="_on_button_2_pressed"]
[connection signal="mouse_entered" from="MarginContainer/VBoxContainer2/VBoxContainer/Button3" to="." method="_on_button_3_mouse_entered"]
[connection signal="pressed" from="MarginContainer/VBoxContainer2/VBoxContainer/Button3" to="." method="_on_button_3_pressed"]
[connection signal="mouse_entered" from="MarginContainer/VBoxContainer2/VBoxContainer/Button4" to="." method="_on_button_4_mouse_entered"]
[connection signal="pressed" from="MarginContainer/VBoxContainer2/VBoxContainer/Button4" to="." method="_on_button_4_pressed"]
[connection signal="close" from="save_load_container/save_and_load" to="." method="_on_save_and_load_close"]

View File

@ -55,7 +55,7 @@ func other_bag_card_click(arr:Array):
var item_data=npc_data["sold_item"][ind]
%other_item_panel.show()
%self_item_panel.hide()
%other_item_icon.texture=Global.get_texture(item_data["texture"])
%other_item_icon.texture=Database.get_texture(item_data["texture"])
%other_item_introduction.text=item_data["introduction"]
if int(item_data["price"]*clamp((2-float(favor)/100),0.5,2))>Global.get_currency_game(1):
%other_item_accept_btn.disable(true)
@ -69,13 +69,13 @@ func self_bag_card_click(arr:Array):
var item_data=data
%self_item_panel.show()
%other_item_panel.hide()
%self_item_icon.texture=Global.get_texture(item_data["texture"])
%self_item_icon.texture=Database.get_texture(item_data["texture"])
%self_item_introduction.text=item_data["introduction"]
if int(item_data["price"]*clamp(0.5+float(favor)/100,0.5,1.5))>npc_data["gold"]:
%self_item_accept_btn.disable(true)
else:
%self_item_accept_btn.disable(false)
func _on_other_item_accept_btn_pressed() -> void:
@ -149,5 +149,7 @@ func _on_self_item_accept_btn_pressed() -> void:
func _on_back_pressed() -> void:
%self_item_panel.hide()
%other_item_panel.hide()
self.hide()
pass # Replace with function body.

View File

@ -6,9 +6,9 @@ var discount:float=0
var data:Dictionary
func set_item(item_data:Dictionary):
data=item_data
%face.texture=Global.get_texture(data["texture"])
%face.texture=Database.get_texture(data["texture"])
%price.text="价格:"+str(int(data["price"]*discount))
func _on_trade_card_btn_spec_pressed() -> void:
click.emit()