From be558aac4a795a284572aa76090dfe4f4776aacc Mon Sep 17 00:00:00 2001 From: TsubakiLoL <2789646812@qq.com> Date: Wed, 16 Oct 2024 11:54:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=83=A8=E5=88=86=E5=88=86?= =?UTF-8?q?=E8=BE=A8=E7=8E=87=E7=BC=A9=E6=94=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- json/event.json | 20 +++++++++ json/indetification.json | 7 +++ json/scene.json | 4 ++ project.godot | 2 + scene/basic_mes_skin_card.tscn | 7 ++- scene/basic_message.tscn | 10 ++--- scene/config.tscn | 1 + scene/difficulty_selection.tscn | 1 + scene/event.tscn | 23 +++++++--- scene/game_flow.gd | 1 + scene/map.gd | 20 +++++++-- scene/map.tscn | 1 + scene/map_2d.gd | 1 + scene/map_2d.tscn | 75 ++++++++++++++++++++++++++++++++ scene/single_identification.gd | 2 + scene/single_identification.tscn | 5 ++- scene/start_the_game.gd | 1 + test/scene/map_example0.tscn | 15 +++++++ test/scene/map_example1.tscn | 15 +++++++ test/scene/map_example_0.gd | 3 ++ test/scene/map_example_1.gd | 5 ++- test/scene/map_example_2.gd | 2 + 22 files changed, 203 insertions(+), 18 deletions(-) create mode 100644 scene/map_2d.gd create mode 100644 scene/map_2d.tscn diff --git a/json/event.json b/json/event.json index ffdad2c..f2163b9 100644 --- a/json/event.json +++ b/json/event.json @@ -313,5 +313,25 @@ },] } ] + }, + "event_socialize":{ + "name":"社交", + "texture":"test_scene", + "text":"你需要社交", + "choice":[ + { + "name":"魅力鉴定", + "triger":[ + { + "type":"show_identifaction", + "data":"AM_judge" + }, + { + "type":"end_event", + "data":"" + } + ] + } + ] } } diff --git a/json/indetification.json b/json/indetification.json index 67a0019..5988cb7 100644 --- a/json/indetification.json +++ b/json/indetification.json @@ -30,5 +30,12 @@ "fish_single":{ "type":0, "preview":"fish_preview", + }, + "AM_judge":{ + "name":"魅力鉴定", + "type":0, + "attribute_name":"AM", + "attribute_value":100, + } } diff --git a/json/scene.json b/json/scene.json index 9ff8b09..fe3b991 100644 --- a/json/scene.json +++ b/json/scene.json @@ -43,6 +43,10 @@ { "name":"卡牌制作测试", "event":"make_card_test" + }, + { + "name":"社交", + "event":"event_socialize" } ], "linked_scene":[{ diff --git a/project.godot b/project.godot index dc497e2..a6832b2 100644 --- a/project.godot +++ b/project.godot @@ -28,6 +28,8 @@ Database="*res://autoload/database/tscn/database.tscn" window/size/viewport_width=1920 window/size/viewport_height=1080 window/size/mode=3 +window/size/initial_position_type=0 +window/size/initial_position=Vector2i(200, 200) [editor_plugins] diff --git a/scene/basic_mes_skin_card.tscn b/scene/basic_mes_skin_card.tscn index a5c4796..9f92751 100644 --- a/scene/basic_mes_skin_card.tscn +++ b/scene/basic_mes_skin_card.tscn @@ -52,9 +52,12 @@ stretch_mode = 4 [node name="mask" type="TextureRect" parent="."] show_behind_parent = true layout_mode = 0 -offset_right = 40.0 -offset_bottom = 40.0 +anchor_right = 0.987654 +anchor_bottom = 0.990476 +offset_right = -120.0 +offset_bottom = -168.0 texture = ExtResource("4_yka8x") +metadata/_edit_use_anchors_ = true [node name="lock" type="TextureRect" parent="."] unique_name_in_owner = true diff --git a/scene/basic_message.tscn b/scene/basic_message.tscn index d3812dc..fd1dc12 100644 --- a/scene/basic_message.tscn +++ b/scene/basic_message.tscn @@ -165,14 +165,14 @@ layout_mode = 2 unique_name_in_owner = true layout_mode = 1 anchors_preset = -1 -anchor_left = 0.290417 +anchor_left = 0.148 anchor_top = 1.0 -anchor_right = 0.33 +anchor_right = 0.469 anchor_bottom = 1.0 -offset_left = -266.6 +offset_left = 6.84058 offset_top = -977.0 -offset_right = 266.4 -expand_mode = 1 +offset_right = -0.480042 +expand_mode = 5 stretch_mode = 6 metadata/_edit_use_anchors_ = true diff --git a/scene/config.tscn b/scene/config.tscn index 730d29e..2006e21 100644 --- a/scene/config.tscn +++ b/scene/config.tscn @@ -60,6 +60,7 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("1_nt8m8") +expand_mode = 1 [node name="MarginContainer" type="MarginContainer" parent="."] layout_mode = 1 diff --git a/scene/difficulty_selection.tscn b/scene/difficulty_selection.tscn index d1a236f..0a845e1 100644 --- a/scene/difficulty_selection.tscn +++ b/scene/difficulty_selection.tscn @@ -27,6 +27,7 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("1_dy7pb") +expand_mode = 1 [node name="CenterContainer" type="CenterContainer" parent="."] layout_mode = 1 diff --git a/scene/event.tscn b/scene/event.tscn index 33d6c54..5023b16 100644 --- a/scene/event.tscn +++ b/scene/event.tscn @@ -67,16 +67,29 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_cpmb4") -[node name="TextureRect" type="TextureRect" parent="."] +[node name="ColorRect" type="ColorRect" parent="."] +visible = false layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +color = Color(0, 0, 0, 0.384314) + +[node name="TextureRect" type="TextureRect" parent="."] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.0520833 +anchor_top = 0.0925926 +anchor_right = 0.947917 +anchor_bottom = 0.907407 +grow_horizontal = 2 +grow_vertical = 2 texture = ExtResource("1_u31m8") expand_mode = 1 stretch_mode = 6 +metadata/_edit_use_anchors_ = true [node name="MarginContainer" type="MarginContainer" parent="."] modulate = Color(0.454524, 0.454524, 0.454524, 1) @@ -86,10 +99,10 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -theme_override_constants/margin_left = 44 -theme_override_constants/margin_top = 40 -theme_override_constants/margin_right = 44 -theme_override_constants/margin_bottom = 39 +theme_override_constants/margin_left = 100 +theme_override_constants/margin_top = 100 +theme_override_constants/margin_right = 100 +theme_override_constants/margin_bottom = 100 [node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"] show_behind_parent = true diff --git a/scene/game_flow.gd b/scene/game_flow.gd index 01ecbbc..7b89232 100644 --- a/scene/game_flow.gd +++ b/scene/game_flow.gd @@ -18,6 +18,7 @@ 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: + #get_window().size=Vector2i(2560,1440) if Global.is_script_finish(): %points_settlement.show() %points_settlement.show_mes({}) diff --git a/scene/map.gd b/scene/map.gd index 93c2356..ca40b40 100644 --- a/scene/map.gd +++ b/scene/map.gd @@ -88,14 +88,15 @@ func set_map(id:String): scale_limit_max=scale_limit[1] scale_index_1=scale_index[0] scale_index_2=scale_index[1] - var _init_size=map_data["init_size"] - init_size=Vector2(_init_size[0],_init_size[1]) + #var _init_size=map_data["init_size"] + #init_size=Vector2(_init_size[0],_init_size[1]) pass func update_time(): var time_dic:Dictionary=Global.get_time_dictionary() date.text=str(time_dic["year"])+"/"+str(time_dic["month"])+"/"+str(time_dic["day"]) time.text=str(time_dic["hour"])+":"+"%02d"%[time_dic["minute"]] func resize_map(before_rag:float,rag:float,mouse_pos:Vector2,init:Vector2): + var l=rag/before_rag var now_pos=Vector2(scroll_container.scroll_horizontal,scroll_container.scroll_vertical)+mouse_pos now_pos*=l @@ -118,11 +119,13 @@ func click(scene_id:String): self.hide() self.set_process(false) -var init_size:Vector2=Vector2(1920,1080) +@onready var init_size:Vector2=get_viewport().size # Called when the node enters the scene tree for the first time. func _ready() -> void: set_map("map_01") update_time() + + get_window().size_changed.connect(resize_map.bindv([scale_rag,scale_rag,get_global_mouse_position(),init_size])) Global.time_changed.connect(update_time) h_box_container.custom_minimum_size=init_size pass # Replace with function body. @@ -130,6 +133,7 @@ func _ready() -> void: # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: + init_size=get_viewport().size update_pointer() pass @@ -162,3 +166,13 @@ func _on_back_pressed() -> void: set_process(false) self.hide() pass # Replace with function body. + + +func _on_visibility_changed() -> void: + #当地图开始显示的时候 + if visible: + var tween=create_tween() + tween.tween_property(self,"scale_rag",2,0.1) + + + pass diff --git a/scene/map.tscn b/scene/map.tscn index 1a56eb5..548b49e 100644 --- a/scene/map.tscn +++ b/scene/map.tscn @@ -194,5 +194,6 @@ texture = ExtResource("9_u7qpf") [node name="back" parent="back" instance=ExtResource("10_vgkwd")] layout_mode = 1 +[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"] [connection signal="gui_input" from="ScrollContainer" to="." method="_on_scroll_container_gui_input"] [connection signal="pressed" from="back/back" to="." method="_on_back_pressed"] diff --git a/scene/map_2d.gd b/scene/map_2d.gd new file mode 100644 index 0000000..e07a0bf --- /dev/null +++ b/scene/map_2d.gd @@ -0,0 +1 @@ +extends Control diff --git a/scene/map_2d.tscn b/scene/map_2d.tscn new file mode 100644 index 0000000..b382a9f --- /dev/null +++ b/scene/map_2d.tscn @@ -0,0 +1,75 @@ +[gd_scene load_steps=6 format=3 uid="uid://7agx3qjkgnwl"] + +[ext_resource type="Script" path="res://scene/map_2d.gd" id="1_j8foi"] +[ext_resource type="PackedScene" uid="uid://dtbfpnr54ifod" path="res://test/scene/map_example0.tscn" id="2_7c5c8"] +[ext_resource type="Texture2D" uid="uid://bx2layh7wm6ft" path="res://res/ui/ui_021_map/tuceng309.png" id="3_pyawj"] +[ext_resource type="Texture2D" uid="uid://bc4vkd7u4s4sb" path="res://res/ui/ui_021_map/tuceng308.png" id="4_0ppjt"] + +[sub_resource type="ViewportTexture" id="ViewportTexture_32us8"] +viewport_path = NodePath("SubViewport") + +[node name="Map2d" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_j8foi") + +[node name="ColorRect" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0.505882, 0.552941, 0.262745, 1) + +[node name="SubViewport" type="SubViewport" parent="."] +transparent_bg = true + +[node name="Node2D" type="Node2D" parent="SubViewport"] + +[node name="Camera2D" type="Camera2D" parent="SubViewport/Node2D"] + +[node name="map_example" parent="SubViewport/Node2D" instance=ExtResource("2_7c5c8")] + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/separation = 0 + +[node name="TextureRect2" type="TextureRect" parent="HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 0 +texture = ExtResource("3_pyawj") +expand_mode = 3 + +[node name="TextureRect3" type="TextureRect" parent="HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 0 +texture = ExtResource("4_0ppjt") +expand_mode = 3 + +[node name="TextureRect" type="TextureRect" parent="HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +texture = SubResource("ViewportTexture_32us8") + +[node name="TextureRect4" type="TextureRect" parent="HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 8 +texture = ExtResource("4_0ppjt") +expand_mode = 3 +flip_h = true + +[node name="TextureRect5" type="TextureRect" parent="HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 4 +texture = ExtResource("3_pyawj") +expand_mode = 3 diff --git a/scene/single_identification.gd b/scene/single_identification.gd index b6f61d9..9dcef1b 100644 --- a/scene/single_identification.gd +++ b/scene/single_identification.gd @@ -17,6 +17,8 @@ func set_data(_data:Dictionary): else: %multi_pre.hide() %single.show() + %single_name.text=data["name"] + %indetification_value.text=CharacterTool.get_name_by_attribute_key(data["attribute_name"])+":"+str(data["attribute_value"]) var apped_item_data:Array=[] #从背包中寻找可用item func search_bag(): diff --git a/scene/single_identification.tscn b/scene/single_identification.tscn index 7ddc99c..0b2ca3b 100644 --- a/scene/single_identification.tscn +++ b/scene/single_identification.tscn @@ -111,7 +111,6 @@ stretch_mode = 6 [node name="single" type="Panel" parent="."] unique_name_in_owner = true -visible = false layout_mode = 1 anchors_preset = -1 anchor_left = 0.257813 @@ -121,7 +120,8 @@ anchor_bottom = 0.597222 theme_override_styles/panel = SubResource("StyleBoxTexture_meexh") metadata/_edit_use_anchors_ = true -[node name="Label" type="Label" parent="single"] +[node name="single_name" type="Label" parent="single"] +unique_name_in_owner = true layout_mode = 1 anchors_preset = 5 anchor_left = 0.5 @@ -244,6 +244,7 @@ vertical_alignment = 1 [node name="multi_pre" type="Panel" parent="."] unique_name_in_owner = true +visible = false layout_mode = 1 anchors_preset = -1 anchor_left = 0.257813 diff --git a/scene/start_the_game.gd b/scene/start_the_game.gd index d82143a..5e14848 100644 --- a/scene/start_the_game.gd +++ b/scene/start_the_game.gd @@ -12,6 +12,7 @@ var target = null: #$TextureRect3.global_position = target.global_position + Vector2(target.size.x, target.size.y/2) # Called when the node enters the scene tree for the first time. func _ready() -> void: + #get_window().size=Vector2i(2560,1440) #var tween = get_tree().create_tween() #tween.set_loops() #tween.tween_property($TextureRect2, "scale", Vector2(1,0), 0.4) diff --git a/test/scene/map_example0.tscn b/test/scene/map_example0.tscn index d0fb943..3571b55 100644 --- a/test/scene/map_example0.tscn +++ b/test/scene/map_example0.tscn @@ -31,3 +31,18 @@ metadata/_edit_use_anchors_ = true [node name="ToolButton" parent="TextureRect" instance=ExtResource("4_d7xih")] layout_mode = 1 + +[node name="TextureRect2" type="TextureRect" parent="."] +visible = false +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.614583 +anchor_top = 0.456481 +anchor_right = 0.64375 +anchor_bottom = 0.508333 +texture = ExtResource("3_4ivo3") +expand_mode = 1 +metadata/_edit_use_anchors_ = true + +[node name="ToolButton" parent="TextureRect2" instance=ExtResource("4_d7xih")] +layout_mode = 1 diff --git a/test/scene/map_example1.tscn b/test/scene/map_example1.tscn index 8162e35..56d6465 100644 --- a/test/scene/map_example1.tscn +++ b/test/scene/map_example1.tscn @@ -31,3 +31,18 @@ metadata/_edit_use_anchors_ = true [node name="ToolButton" parent="TextureRect" instance=ExtResource("4_wygvp")] layout_mode = 1 + +[node name="TextureRect2" type="TextureRect" parent="."] +visible = false +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.614583 +anchor_top = 0.456481 +anchor_right = 0.64375 +anchor_bottom = 0.508333 +texture = ExtResource("3_rdri5") +expand_mode = 1 +metadata/_edit_use_anchors_ = true + +[node name="ToolButton" parent="TextureRect2" instance=ExtResource("4_wygvp")] +layout_mode = 1 diff --git a/test/scene/map_example_0.gd b/test/scene/map_example_0.gd index d51dec6..2d5d751 100644 --- a/test/scene/map_example_0.gd +++ b/test/scene/map_example_0.gd @@ -6,10 +6,13 @@ extends MapIndex func _on_tool_button_pressed() -> void: click_scene("scene_tower") pass # Replace with function body. + func get_scene_global_pos(scene_id:String): match scene_id: "scene_tower": return $TextureRect/ToolButton.global_position + "scene_01": + return $TextureRect2.global_position+Vector2($TextureRect2.size.x/2,0) _:return Vector2(0,0) pass diff --git a/test/scene/map_example_1.gd b/test/scene/map_example_1.gd index d51dec6..c224c09 100644 --- a/test/scene/map_example_1.gd +++ b/test/scene/map_example_1.gd @@ -10,6 +10,9 @@ func get_scene_global_pos(scene_id:String): match scene_id: "scene_tower": return $TextureRect/ToolButton.global_position + "scene_01": + return $TextureRect2.global_position+Vector2($TextureRect2.size.x/2,0) + _:return Vector2(0,0) - + pass diff --git a/test/scene/map_example_2.gd b/test/scene/map_example_2.gd index 6233f50..da65e3f 100644 --- a/test/scene/map_example_2.gd +++ b/test/scene/map_example_2.gd @@ -9,6 +9,8 @@ func get_scene_global_pos(scene_id:String): match scene_id: "scene_tower": return $TextureRect/ToolButton.global_position+Vector2($TextureRect/ToolButton.size.x/2,0) + "scene_01": + return $TextureRect2.global_position+Vector2($TextureRect2.size.x/2,0) _:return Vector2(0,0) pass