diff --git a/data/itemRegs/packsacks.yaml b/data/itemRegs/packsacks.yaml index 937aea4..8c83de3 100644 --- a/data/itemRegs/packsacks.yaml +++ b/data/itemRegs/packsacks.yaml @@ -1,4 +1,4 @@ - id: packsack scene_path: res://prefab/packsacks/packsack.tscn - icon_path: res://sprites/Player.png - max_stack_value: 1 \ No newline at end of file + icon_path: res://sprites/packsack.png + max_stack_value: 1 diff --git a/data/itemRegs/weapons.yaml b/data/itemRegs/weapons.yaml index 0d8abb7..300a9c7 100644 --- a/data/itemRegs/weapons.yaml +++ b/data/itemRegs/weapons.yaml @@ -1,6 +1,6 @@ - id: staff_of_the_undead scene_path: res://prefab/weapons/staffOfTheUndead.tscn - icon_path: res://sprites/weapon/staffOfTheUndead.png + icon_path: res://sprites/weapon/staffOfTheUndead_icon.png max_stack_value: 1 custom_args: - name: FiringIntervalAsMillisecond diff --git a/locals/UI.csv b/locals/UI.csv index 7f407b4..caa5fee 100644 --- a/locals/UI.csv +++ b/locals/UI.csv @@ -25,3 +25,11 @@ ui_room_injection_processor,房间注入处理器,Room injection processor,部 ui_game_over_title,游戏结束!,Game Over!,ゲームオーバー! ui_death_info_describe,死因,death,死因 ui_restart,重新开始,Restart,ぶり返す +ui_contributor_tips,由{0}位贡献者共同打造,Built by {0} contributors,{0}のコントリビューターが共同で作り上げました +ui_contributor,贡献者,contributor,貢献者です +ui_coder,编程,coder,程序设计 +ui_artist,美术,artist,びじゅつ +ui_musician,音乐,musician,音楽 +ui_character_voice,角色配音,character_voice,キャラクターボイスです +ui_translator,翻译,translator,翻訳 +ui_unordered_list_tip,排名不分先后,Ranking is not in order,順位は関係ありません diff --git a/prefab/packsacks/packsack.tscn b/prefab/packsacks/packsack.tscn index 8160034..2b6750f 100644 --- a/prefab/packsacks/packsack.tscn +++ b/prefab/packsacks/packsack.tscn @@ -1,20 +1,34 @@ -[gd_scene load_steps=4 format=3 uid="uid://cn10fimoem04m"] +[gd_scene load_steps=5 format=3 uid="uid://cn10fimoem04m"] [ext_resource type="Script" path="res://scripts/item/Packsack.cs" id="1_slakl"] -[ext_resource type="Texture2D" uid="uid://b1twcink38sh0" path="res://sprites/Player.png" id="2_e1ale"] +[ext_resource type="Texture2D" uid="uid://dvx10dfjctn7t" path="res://sprites/packsack.png" id="2_40jca"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_brthl"] +size = Vector2(21, 29) [sub_resource type="RectangleShape2D" id="RectangleShape2D_xqyue"] -size = Vector2(41, 57) +size = Vector2(21, 29) [node name="RigidBody2D" type="RigidBody2D"] collision_layer = 8 collision_mask = 38 script = ExtResource("1_slakl") Id = "packsack" +_minContactInjury = null +_maxContactInjury = null -[node name="Player" type="Sprite2D" parent="."] -texture = ExtResource("2_e1ale") +[node name="DamageArea2D" type="Area2D" parent="."] +collision_layer = 8 +collision_mask = 102 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageArea2D"] +position = Vector2(-2.5, 1.5) +shape = SubResource("RectangleShape2D_brthl") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2(-0.5, 3.5) +position = Vector2(-2.5, 1.5) shape = SubResource("RectangleShape2D_xqyue") + +[node name="Packsack" type="Sprite2D" parent="."] +scale = Vector2(0.5, 0.5) +texture = ExtResource("2_40jca") diff --git a/prefab/ui/ItemSlot.tscn b/prefab/ui/ItemSlot.tscn index 4b1437c..bb518a1 100644 --- a/prefab/ui/ItemSlot.tscn +++ b/prefab/ui/ItemSlot.tscn @@ -6,6 +6,7 @@ [node name="ItemSlot" type="MarginContainer"] offset_right = 38.0 offset_bottom = 38.0 +size_flags_vertical = 3 theme_override_constants/margin_left = 3 theme_override_constants/margin_top = 3 theme_override_constants/margin_right = 3 @@ -16,16 +17,18 @@ script = ExtResource("1_fbwot") layout_mode = 2 texture = ExtResource("1_y2wyt") -[node name="CenterContainer" type="CenterContainer" parent="BackgroundTexture"] -layout_mode = 2 -offset_right = 160.0 -offset_bottom = 160.0 +[node name="IconTextureRect" type="TextureRect" parent="BackgroundTexture"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 3.0 +offset_top = 3.0 +offset_right = -3.0 +offset_bottom = -3.0 grow_horizontal = 2 grow_vertical = 2 -scale = Vector2(0.2, 0.2) - -[node name="IconTextureRect" type="TextureRect" parent="BackgroundTexture/CenterContainer"] -layout_mode = 2 +expand_mode = 1 [node name="Control" type="Control" parent="."] layout_mode = 2 diff --git a/prefab/ui/contributorGroup.tscn b/prefab/ui/contributorGroup.tscn new file mode 100644 index 0000000..688b8d3 --- /dev/null +++ b/prefab/ui/contributorGroup.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=2 format=3 uid="uid://6i7rgx3sdu1k"] + +[ext_resource type="Script" path="res://scripts/loader/uiLoader/ContributorGroupLoader.cs" id="1_xwjh1"] + +[node name="ContributorGroup" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_vertical = 3 +script = ExtResource("1_xwjh1") + +[node name="TitleLabel" type="Label" parent="."] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_left = 20.0 +offset_right = -1082.0 +offset_bottom = 39.0 +grow_horizontal = 2 +theme_override_font_sizes/font_size = 25 +text = "组名" + +[node name="HFlowContainer" type="HFlowContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 15.0 +offset_top = 45.0 +offset_right = -14.0 +offset_bottom = -6.0 +grow_horizontal = 2 +grow_vertical = 2 diff --git a/prefab/ui/packsackUI.tscn b/prefab/ui/packsackUI.tscn new file mode 100644 index 0000000..97249e6 --- /dev/null +++ b/prefab/ui/packsackUI.tscn @@ -0,0 +1,32 @@ +[gd_scene load_steps=2 format=3 uid="uid://dsat7xk63bfg2"] + +[ext_resource type="Script" path="res://scripts/inventory/PacksackUi.cs" id="1_jgs18"] + +[node name="PacksackUi" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 33.0 +offset_top = 81.0 +offset_right = -58.0 +offset_bottom = -35.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_jgs18") + +[node name="GridContainer" type="GridContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Label" type="Label" parent="."] +layout_mode = 0 +offset_left = 3.0 +offset_top = -43.0 +offset_right = 43.0 +offset_bottom = -18.0 +text = "背包" diff --git a/prefab/weapons/staffOfTheUndead.tscn b/prefab/weapons/staffOfTheUndead.tscn index ca0c9c0..ffd1bb0 100644 --- a/prefab/weapons/staffOfTheUndead.tscn +++ b/prefab/weapons/staffOfTheUndead.tscn @@ -21,7 +21,7 @@ metadata/Projectiles = PackedStringArray("res://prefab/projectile/curseOfTheUnde [node name="DamageArea2D" type="Area2D" parent="."] collision_layer = 8 -collision_mask = 71 +collision_mask = 70 [node name="CollisionShape2D" type="CollisionShape2D" parent="DamageArea2D"] position = Vector2(25.5, 0.5) diff --git a/project.godot b/project.godot index 933865e..fa06aa6 100644 --- a/project.godot +++ b/project.godot @@ -153,7 +153,7 @@ locale/translations=PackedStringArray("res://locals/DeathInfo.en.translation", " 2d_physics/layer_1="RoomArea" 2d_physics/layer_2="Ground" 2d_physics/layer_3="Player" -2d_physics/layer_4="Weapon" +2d_physics/layer_4="PickAbleItem" 2d_physics/layer_5="Projectile" 2d_physics/layer_6="Platform" 2d_physics/layer_7="Mob" diff --git a/scenes/contributor.tscn b/scenes/contributor.tscn new file mode 100644 index 0000000..da7f898 --- /dev/null +++ b/scenes/contributor.tscn @@ -0,0 +1,68 @@ +[gd_scene load_steps=2 format=3 uid="uid://ljvmhhrk1d6j"] + +[ext_resource type="Script" path="res://scripts/loader/uiLoader/ContributorLoader.cs" id="1_ia4x6"] + +[node name="Contributor" 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_ia4x6") + +[node name="Panel" type="Panel" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="CenterContainer" type="CenterContainer" parent="."] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 45.0 +grow_horizontal = 2 + +[node name="Label" type="Label" parent="CenterContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 30 +text = "ui_contributor" + +[node name="ExitButton" type="Button" parent="."] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -86.0 +offset_top = 6.0 +offset_right = -19.0 +offset_bottom = 39.0 +grow_horizontal = 0 +text = "ui_close" + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 20.0 +offset_top = 59.0 +offset_right = -18.0 +offset_bottom = -20.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Label" type="Label" parent="."] +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_left = 16.0 +offset_top = -36.0 +offset_right = 168.0 +offset_bottom = -11.0 +grow_vertical = 0 +text = "ui_unordered_list_tip" diff --git a/scenes/mainMenu.tscn b/scenes/mainMenu.tscn index 9e32f9d..6fb0a0a 100644 --- a/scenes/mainMenu.tscn +++ b/scenes/mainMenu.tscn @@ -119,6 +119,12 @@ grow_vertical = 0 layout_mode = 2 horizontal_alignment = 2 +[node name="ContributorButton" type="LinkButton" parent="VBoxContainer2"] +layout_direction = 3 +layout_mode = 2 +text = "ui_contributor_tips" +underline = 1 + [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer2"] layout_mode = 2 diff --git a/scripts/Config.cs b/scripts/Config.cs index 119f521..98e4d42 100644 --- a/scripts/Config.cs +++ b/scripts/Config.cs @@ -377,7 +377,7 @@ public static class Config public const int RoomArea = 1; public const int Ground = 2; public const int Player = 3; - public const int Weapon = 4; + public const int PickAbleItem = 4; public const int Projectile = 5; public const int Platform = 6; public const int Mob = 7; diff --git a/scripts/SloganProvider.cs b/scripts/SloganProvider.cs index a92fe2a..384c140 100644 --- a/scripts/SloganProvider.cs +++ b/scripts/SloganProvider.cs @@ -1,4 +1,4 @@ -using ColdMint.scripts.utils; +using ColdMint.scripts.utils; using Godot; diff --git a/scripts/character/CharacterTemplate.cs b/scripts/character/CharacterTemplate.cs index 285cc90..0c7c82f 100644 --- a/scripts/character/CharacterTemplate.cs +++ b/scripts/character/CharacterTemplate.cs @@ -11,6 +11,7 @@ using ColdMint.scripts.item; using ColdMint.scripts.utils; using ColdMint.scripts.item.weapon; using ColdMint.scripts.loot; +using ColdMint.scripts.pickable; using Godot; @@ -300,14 +301,14 @@ public partial class CharacterTemplate : CharacterBody2D //设置捡起物品的常规处理。 //You can supplement picking up state handling for more types of objects here. //您可以在这里补充更多类型对象的捡起状态处理。 - if (pickAbleItem is WeaponTemplate weaponTemplate) + if (pickAbleItem is PickAbleTemplate pickAbleTemplate) { - weaponTemplate.Owner = this; - weaponTemplate.Picked = true; - weaponTemplate.SetCollisionMaskValue(Config.LayerNumber.Platform, false); - weaponTemplate.SetCollisionMaskValue(Config.LayerNumber.Ground, false); - weaponTemplate.EnableContactInjury = false; - weaponTemplate.Sleeping = true; + pickAbleTemplate.Owner = this; + pickAbleTemplate.Picked = true; + pickAbleTemplate.SetCollisionMaskValue(Config.LayerNumber.Platform, false); + pickAbleTemplate.SetCollisionMaskValue(Config.LayerNumber.Ground, false); + pickAbleTemplate.EnableContactInjury = false; + pickAbleTemplate.Sleeping = true; } if (itemSlotNode.GetItem() != null && itemSlotNode.GetItem() == item && _currentItem == null) @@ -652,31 +653,31 @@ public partial class CharacterTemplate : CharacterBody2D CallDeferred(nameof(NodeReparent), node2D); switch (item) { - case WeaponTemplate weaponTemplate: + case PickAbleTemplate pickAbleTemplate: if (GameSceneNodeHolder.WeaponContainer == null) { return; } - weaponTemplate.Picked = false; + pickAbleTemplate.Picked = false; var timer = new Timer(); - weaponTemplate.AddChild(timer); + pickAbleTemplate.AddChild(timer); timer.WaitTime = _itemCollisionRecoveryTime; timer.OneShot = true; timer.Timeout += () => { //We cannot immediately resume the physical collision when the weapon is discharged, which will cause the weapon to collide with the ground and platform earlier, preventing the weapon from flying. //仍出武器时,我们不能立即恢复物理碰撞,立即恢复会导致武器更早的与地面和平台碰撞,阻止武器的飞行。 - weaponTemplate.EnableContactInjury = true; - weaponTemplate.SetCollisionMaskValue(Config.LayerNumber.Ground, true); - weaponTemplate.SetCollisionMaskValue(Config.LayerNumber.Platform, true); + pickAbleTemplate.EnableContactInjury = true; + pickAbleTemplate.SetCollisionMaskValue(Config.LayerNumber.Ground, true); + pickAbleTemplate.SetCollisionMaskValue(Config.LayerNumber.Platform, true); timer.QueueFree(); }; timer.Start(); - weaponTemplate.Sleeping = false; + pickAbleTemplate.Sleeping = false; //Setting an initial speed of 0 for items here prevents the problem of throwing items too fast. //在这里给物品设置一个为0的初始速度,可防止扔出物品时速度过快的问题。 - weaponTemplate.LinearVelocity = Vector2.Zero; + pickAbleTemplate.LinearVelocity = Vector2.Zero; break; } diff --git a/scripts/character/Player.cs b/scripts/character/Player.cs index a965b5c..f60298f 100644 --- a/scripts/character/Player.cs +++ b/scripts/character/Player.cs @@ -4,11 +4,11 @@ using System.Threading.Tasks; using ColdMint.scripts.damage; using ColdMint.scripts.deathInfo; +using ColdMint.scripts.debug; using ColdMint.scripts.item; using ColdMint.scripts.map.events; using ColdMint.scripts.utils; -using ColdMint.scripts.item.weapon; - +using ColdMint.scripts.pickable; using Godot; namespace ColdMint.scripts.character; @@ -24,7 +24,7 @@ public partial class Player : CharacterTemplate //Empty object projectile //空的物品抛射线 - private readonly Vector2[] _emptyVector2Array = new[] { Vector2.Zero }; + private readonly Vector2[] _emptyVector2Array = [Vector2.Zero]; //抛物线 private Line2D? _parabola; @@ -337,9 +337,9 @@ public partial class Player : CharacterTemplate base.Flip(); //If there is a weapon, flip it too //如果有武器的话,也要翻转 - if (CurrentItem is WeaponTemplate weapon) + if (CurrentItem is PickAbleTemplate pickAbleTemplate) { - weapon.Flip(FacingLeft); + pickAbleTemplate.Flip(FacingLeft); } } @@ -408,16 +408,16 @@ public partial class Player : CharacterTemplate : new Vector2(0, -PromptTextDistance); _floatLabel.RotationDegrees = 0 - rotationDegreesNode2D; var label = _floatLabel.GetNode