探索事件
This commit is contained in:
parent
2e11493610
commit
09de53f523
@ -877,6 +877,7 @@ func show_auction(data:Dictionary):
|
||||
var identfication_round_triger_dic:Dictionary={
|
||||
"fish_round": fish_round,
|
||||
|
||||
"explore_round":explore_round,
|
||||
}
|
||||
func call_round_triger(triger_type:String,character_data:Dictionary,round_dic:Dictionary,choice:String):
|
||||
if identfication_round_triger_dic.has(triger_type):
|
||||
@ -913,6 +914,7 @@ func fish_get_difficulty(character_data:Dictionary,round_dic:Dictionary):
|
||||
#用来判断鉴定是否结束的函数
|
||||
var identification_is_finish_triger:Dictionary={
|
||||
"normal":normal_is_finish,
|
||||
"explore_is_finish":explore_is_finish,
|
||||
}
|
||||
func call_is_finish_triger(triger_type:String,character_data:Dictionary,round_dic:Dictionary):
|
||||
if identification_is_finish_triger.has(triger_type):
|
||||
@ -928,6 +930,7 @@ func normal_is_finish(character_data:Dictionary,round_dic:Dictionary)->bool:
|
||||
#鉴定结束触发的函数(用于获得奖励一类的)
|
||||
var identification_finish_triger:Dictionary={
|
||||
"fish":fish_finish,
|
||||
"explore_finish":explore_finish,
|
||||
}
|
||||
func call_finish_triger(triger_type:String,character_data:Dictionary,round_dic:Dictionary):
|
||||
if identification_finish_triger.has(triger_type):
|
||||
@ -976,3 +979,55 @@ func _ready() -> void:
|
||||
load_config()
|
||||
load_system_game_data()
|
||||
load_save_data()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#探索鉴定
|
||||
|
||||
|
||||
|
||||
func explore_round(character_data:Dictionary,round_dic:Dictionary,choice:String)->bool:
|
||||
if choice=="退出探索":
|
||||
round_dic["is_finish"]=true
|
||||
return false
|
||||
flow_time({
|
||||
"minute":5
|
||||
})
|
||||
Toast.popup(choice)
|
||||
#Toast.popup("角色鉴定属性名:"+single_judge_name)
|
||||
#获取感知属性
|
||||
var attribute_value=CharacterTool.get_character_attribute(character_data,"WIS")
|
||||
#Toast.popup("角色值:"+str(attribute_value))
|
||||
if attribute_value is float:
|
||||
|
||||
var percent=(attribute_value-50)/50
|
||||
var rand=randf()
|
||||
#Toast.popup("鉴定概率:"+str(percent*100)+"%")
|
||||
if rand<percent:
|
||||
round_dic["right_total"]+=1
|
||||
Toast.popup("鉴定成功!")
|
||||
return true
|
||||
else:
|
||||
round_dic["right_cost"]-=1
|
||||
Toast.popup("鉴定失败!")
|
||||
return false
|
||||
else:
|
||||
#Toast.popup("不存在对应的属性!")
|
||||
Toast.popup("角色不存在属性,鉴定失败!")
|
||||
round_dic["right_cost"]-=1
|
||||
return false
|
||||
#探索鉴定中判定是否结束的函数
|
||||
func explore_is_finish(character_data:Dictionary,round_dic:Dictionary):
|
||||
if round_dic["right_cost"]==0 ||round_dic.has("is_finish") && round_dic["is_finish"]:
|
||||
return true
|
||||
else:
|
||||
return false
|
||||
#探索鉴定结束后的结算
|
||||
func explore_finish(character_data:Dictionary,round_data:Dictionary):
|
||||
var now_scene=get_now_scene()
|
||||
Toast.popup(Database.get_scene_name(now_scene)+"探索度增加"+str(round_data["right_total"])+"!")
|
||||
change_scene_explore(now_scene,round_data["right_total"])
|
||||
pass
|
||||
|
@ -356,7 +356,27 @@
|
||||
"name":"探索-伦敦西区",
|
||||
"texture":"london_tansuo",
|
||||
"text":"你整顿装备,准备对这座城市进行探索",
|
||||
"choice":[]
|
||||
"choice":[{
|
||||
"name":"开始探索",
|
||||
"triger":[{
|
||||
"type":"show_identifaction",
|
||||
"data":{
|
||||
"id":"explore"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type":"end_event",
|
||||
"data":""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"退出",
|
||||
"triger":[{
|
||||
"type":"end_event",
|
||||
"data":""
|
||||
}]
|
||||
}]
|
||||
},
|
||||
"find_cat_start":{
|
||||
"name":"寻找丢失的猫咪",
|
||||
@ -618,5 +638,5 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -45,5 +45,26 @@
|
||||
"type":0,
|
||||
"attribute_name":"WIS",
|
||||
"attribute_value":0,
|
||||
}
|
||||
},
|
||||
"explore":{
|
||||
"type":1,
|
||||
"preview":"fish_preview",
|
||||
"init_round":{
|
||||
|
||||
"right_total":0,
|
||||
"right_cost":6,
|
||||
"right_total_max":6,
|
||||
"right_cost_max":6,
|
||||
"right_total_name":"探索度",
|
||||
"right_cost_name":"耐心",
|
||||
"identification_name":"感知",
|
||||
"identification_value":50,
|
||||
"right_texture":"london_tansuo",
|
||||
"center_texture":"london_tansuo",
|
||||
"introduction":"你在城市中穿行",
|
||||
"choice":["探索(感知鉴定)","退出探索"],
|
||||
"triger":["explore_round","fish","explore_is_finish","explore_finish"]
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ class_name GameFlow
|
||||
@onready var event_panel: Control = $event_panel
|
||||
@onready var character_name: Label = $hbox/TextureRect2/vbox/HBoxContainer/character_name
|
||||
@onready var map: Control = $map
|
||||
@onready var date: Label = $hbox/TextureRect2/vbox/date
|
||||
@onready var touch_add_pos: Control = $touch_add_pos
|
||||
|
||||
const GAME_FLOW_TOUCH = preload("res://scene/game_flow_touch.tscn")
|
||||
@ -80,7 +79,10 @@ func touch_click(data:Dictionary):
|
||||
func update_date():
|
||||
Global.judge_clock_event()
|
||||
var time_dic=Global.get_time_dictionary()
|
||||
date.text=str(time_dic["year"])+"/"+str(time_dic["month"])+"/"+str(time_dic["day"])
|
||||
%date.text=str(time_dic["year"])+"/"+str(time_dic["month"])+"/"+str(time_dic["day"])
|
||||
|
||||
%time.text="%02d:%02d"%[time_dic["hour"],time_dic["minute"]]
|
||||
|
||||
judge_touch()
|
||||
if Global.is_script_finish():
|
||||
%points_settlement.show()
|
||||
|
@ -203,7 +203,21 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="date" type="Label" parent="hbox/TextureRect2/vbox"]
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="hbox/TextureRect2/vbox"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 30
|
||||
|
||||
[node name="date" type="Label" parent="hbox/TextureRect2/vbox/HBoxContainer3"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 34
|
||||
text = "1999/12/12"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="time" type="Label" parent="hbox/TextureRect2/vbox/HBoxContainer3"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
|
@ -11,7 +11,8 @@ var round_data:Dictionary
|
||||
var character_data:Dictionary={}
|
||||
func set_data(_data:Dictionary):
|
||||
data=_data
|
||||
round_data=_data["init_round"].duplicate()
|
||||
is_finish=false
|
||||
round_data=_data["init_round"].duplicate(true)
|
||||
round_data_update()
|
||||
%AnimationPlayer.play("show_text")
|
||||
pass
|
||||
@ -115,6 +116,7 @@ func choice_click(choice:String):
|
||||
if finish:
|
||||
is_finish=finish
|
||||
round_data["choice"]=["退出"]
|
||||
|
||||
round_data_update()
|
||||
if is_success:
|
||||
%result_label.add_theme_color_override("font_color",Color.GREEN)
|
||||
@ -125,4 +127,5 @@ func choice_click(choice:String):
|
||||
|
||||
else:
|
||||
self.hide()
|
||||
Global.call_finish_triger(round_data["triger"][3],character_data,round_data)
|
||||
finish.emit()
|
||||
|
Loading…
Reference in New Issue
Block a user