diff --git a/locals/DeathInfo.en.translation b/locals/DeathInfo.en.translation index 13de0d7..6727962 100644 Binary files a/locals/DeathInfo.en.translation and b/locals/DeathInfo.en.translation differ diff --git a/locals/DeathInfo.ja.translation b/locals/DeathInfo.ja.translation index e859ccc..7c98516 100644 Binary files a/locals/DeathInfo.ja.translation and b/locals/DeathInfo.ja.translation differ diff --git a/locals/DeathInfo.zh.translation b/locals/DeathInfo.zh.translation index 4ff332e..553a247 100644 Binary files a/locals/DeathInfo.zh.translation and b/locals/DeathInfo.zh.translation differ diff --git a/locals/InputMapping.en.translation b/locals/InputMapping.en.translation index c89383c..55f97d1 100644 Binary files a/locals/InputMapping.en.translation and b/locals/InputMapping.en.translation differ diff --git a/locals/InputMapping.ja.translation b/locals/InputMapping.ja.translation index 3446dc7..fd91bde 100644 Binary files a/locals/InputMapping.ja.translation and b/locals/InputMapping.ja.translation differ diff --git a/locals/InputMapping.zh.translation b/locals/InputMapping.zh.translation index 9a4fd44..8f0cf50 100644 Binary files a/locals/InputMapping.zh.translation and b/locals/InputMapping.zh.translation differ diff --git a/locals/Log.en.translation b/locals/Log.en.translation index bc8e628..3b5c688 100644 Binary files a/locals/Log.en.translation and b/locals/Log.en.translation differ diff --git a/locals/Log.ja.translation b/locals/Log.ja.translation index 5b680be..f907936 100644 Binary files a/locals/Log.ja.translation and b/locals/Log.ja.translation differ diff --git a/locals/Log.zh.translation b/locals/Log.zh.translation index 5b2d9d0..b13c1f9 100644 Binary files a/locals/Log.zh.translation and b/locals/Log.zh.translation differ diff --git a/locals/Slogan.ja.translation b/locals/Slogan.ja.translation index 584a42b..16ad9fc 100644 Binary files a/locals/Slogan.ja.translation and b/locals/Slogan.ja.translation differ diff --git a/locals/UI.en.translation b/locals/UI.en.translation index b842904..0ad0d60 100644 Binary files a/locals/UI.en.translation and b/locals/UI.en.translation differ diff --git a/locals/UI.ja.translation b/locals/UI.ja.translation index 15d7e31..e8364fa 100644 Binary files a/locals/UI.ja.translation and b/locals/UI.ja.translation differ diff --git a/locals/UI.zh.translation b/locals/UI.zh.translation index 82bff56..9bb5b4c 100644 Binary files a/locals/UI.zh.translation and b/locals/UI.zh.translation differ diff --git a/locals/Weapon.en.translation b/locals/Weapon.en.translation index 40ce8d5..46fb4a6 100644 Binary files a/locals/Weapon.en.translation and b/locals/Weapon.en.translation differ diff --git a/locals/Weapon.ja.translation b/locals/Weapon.ja.translation index 4b0e72a..054a56e 100644 Binary files a/locals/Weapon.ja.translation and b/locals/Weapon.ja.translation differ diff --git a/locals/Weapon.zh.translation b/locals/Weapon.zh.translation index 770caa6..cff4f66 100644 Binary files a/locals/Weapon.zh.translation and b/locals/Weapon.zh.translation differ diff --git a/locals/slogan.csv b/locals/slogan.csv index 0d163c5..0a74c59 100644 --- a/locals/slogan.csv +++ b/locals/slogan.csv @@ -3,4 +3,6 @@ slogan_0,游戏属于每一个人。,The game belongs to everyone.,ゲームは slogan_1,如果你想要得到爱,你就播种爱。,"If you want love, you sow love.",愛を手に入れたければ、愛の種をまきます。 slogan_2,快乐?伤心?痛苦?,Happy? Sad? Pain?,楽しいですか?悲しいですか?苦しいですか? slogan_3,Kawaii!,Kawaii!,Kawaii! -slogan_4,魔法是想象的世界。,Magic is an imaginary world.,魔法は想像の世界です。 \ No newline at end of file +slogan_4,魔法是想象的世界。,Magic is an imaginary world.,魔法は想像の世界です。 +slogan_5,也试试Minecraft!,Also try Minecraft!,Minecraftもやってみて! +slogan_6,也试试Terraria!,Also try Terraria!,Terrariaもやってみて! \ No newline at end of file diff --git a/locals/slogan.csv.import b/locals/slogan.csv.import index bfacd67..b9d7c86 100644 --- a/locals/slogan.csv.import +++ b/locals/slogan.csv.import @@ -2,7 +2,7 @@ importer="csv_translation" type="Translation" -uid="uid://dbgkevd34vb0d" +uid="uid://bgfmprv2sm645" [deps] diff --git a/locals/slogan.en.translation b/locals/slogan.en.translation index 01bea34..b55a276 100644 Binary files a/locals/slogan.en.translation and b/locals/slogan.en.translation differ diff --git a/locals/slogan.zh.translation b/locals/slogan.zh.translation index 6ed2eed..008eea7 100644 Binary files a/locals/slogan.zh.translation and b/locals/slogan.zh.translation differ diff --git a/prefab/roomTemplates/dungeon/initialRoom.tscn b/prefab/roomTemplates/dungeon/initialRoom.tscn index 73bfc19..06fa45b 100644 --- a/prefab/roomTemplates/dungeon/initialRoom.tscn +++ b/prefab/roomTemplates/dungeon/initialRoom.tscn @@ -45,3 +45,18 @@ script = ExtResource("2_6p8mv") [node name="StaffOfTheUndead" parent="." instance=ExtResource("3_ud0w8")] position = Vector2(231, 116) + +[node name="StaffOfTheUndead2" parent="." instance=ExtResource("3_ud0w8")] +position = Vector2(113, 149) + +[node name="StaffOfTheUndead5" parent="." instance=ExtResource("3_ud0w8")] +position = Vector2(213, 177) + +[node name="StaffOfTheUndead6" parent="." instance=ExtResource("3_ud0w8")] +position = Vector2(290, 167) + +[node name="StaffOfTheUndead3" parent="." instance=ExtResource("3_ud0w8")] +position = Vector2(70, 88) + +[node name="StaffOfTheUndead4" parent="." instance=ExtResource("3_ud0w8")] +position = Vector2(367, 85) diff --git a/project.godot b/project.godot index e991cd5..f453d76 100644 --- a/project.godot +++ b/project.godot @@ -147,6 +147,7 @@ hotbar_previous={ [internationalization] locale/translations=PackedStringArray("res://locals/DeathInfo.en.translation", "res://locals/DeathInfo.ja.translation", "res://locals/DeathInfo.zh.translation", "res://locals/InputMapping.en.translation", "res://locals/InputMapping.ja.translation", "res://locals/InputMapping.zh.translation", "res://locals/Log.en.translation", "res://locals/Log.ja.translation", "res://locals/Log.zh.translation", "res://locals/Slogan.en.translation", "res://locals/Slogan.ja.translation", "res://locals/Slogan.zh.translation", "res://locals/UI.en.translation", "res://locals/UI.ja.translation", "res://locals/UI.zh.translation", "res://locals/Weapon.en.translation", "res://locals/Weapon.ja.translation", "res://locals/Weapon.zh.translation") +locale/test="ja" [layer_names] diff --git a/scenes/mainMenu.tscn b/scenes/mainMenu.tscn index 6986741..8b1cf45 100644 --- a/scenes/mainMenu.tscn +++ b/scenes/mainMenu.tscn @@ -124,7 +124,7 @@ layout_mode = 2 [node name="GodotLabel" type="Label" parent="VBoxContainer2/HBoxContainer"] layout_mode = 2 -text = "Power by" +text = "Powered by" horizontal_alignment = 2 [node name="LinkButton" type="LinkButton" parent="VBoxContainer2/HBoxContainer"] diff --git a/scripts/SloganProvider.cs b/scripts/SloganProvider.cs index 7968455..a92fe2a 100644 --- a/scripts/SloganProvider.cs +++ b/scripts/SloganProvider.cs @@ -13,6 +13,7 @@ public static class SloganProvider static SloganProvider() { // Calculate SloganCount From translation file + // 从翻译文件中计算口号计数 var sloganTrans = ResourceLoader.Load("res://locals/Slogan.en.translation")!; SloganCount = sloganTrans.GetTranslatedMessageList().Length; } diff --git a/scripts/character/CharacterTemplate.cs b/scripts/character/CharacterTemplate.cs index f7d2830..b5547d7 100644 --- a/scripts/character/CharacterTemplate.cs +++ b/scripts/character/CharacterTemplate.cs @@ -151,7 +151,7 @@ public partial class CharacterTemplate : CharacterBody2D //Check whether the new Hp is greater than the maximum Hp. If yes, set the current Hp to the maximum Hp. If no, set the current Hp to the new HP //判断新的Hp是否大于最大Hp,若大于那么将当前Hp设置为最大Hp,否则设置为新的Hp CurrentHp = newHp > MaxHp ? MaxHp : newHp; - Visible = true; + Show(); } /// @@ -318,7 +318,7 @@ public partial class CharacterTemplate : CharacterBody2D } else { - pickAbleItem.Visible = false; + pickAbleItem.Hide(); pickAbleItem.ProcessMode = ProcessModeEnum.Disabled; } @@ -358,7 +358,7 @@ public partial class CharacterTemplate : CharacterBody2D var timeSpan = DateTime.Now - _lastDamageTime; if (timeSpan > Config.HealthBarDisplaysTime) { - _healthBar.Visible = false; + _healthBar.Hide(); } } } @@ -410,7 +410,7 @@ public partial class CharacterTemplate : CharacterBody2D } } - _healthBar.Visible = true; + _healthBar.Show(); _healthBar.Value = CurrentHp; } @@ -437,6 +437,7 @@ public partial class CharacterTemplate : CharacterBody2D //Character death //角色死亡 OnDie(damageTemplate); + ThrowAllItemOnDie(); return true; } @@ -528,6 +529,44 @@ public partial class CharacterTemplate : CharacterBody2D _animatedSprite2D.FlipH = FacingLeft; } + /// + /// Throw all items when the creature dies + /// 当生物死亡后抛出所有物品 + /// + private void ThrowAllItemOnDie() + { + //If the item container is null, then return + //如果物品容器为null,那么返回 + if (_itemContainer == null) + { + return; + } + + var len = _itemContainer.GetItemSlotCount(); + if (len == 0) + { + return; + } + + CurrentItem = null; + const float height = -Config.CellSize * 7; + const float horizontalDirection = Config.CellSize * 15; + for (var i = 0; i < len; i++) + { + //Generates a random number that controls the horizontal velocity of thrown items (range: 0.01 to 1) + //生成一个随机数,用于控制抛出物品的水平方向速度(范围为:0.01到1) + var percent = GD.Randf() + 0.01f; + if (GD.Randf() > 0.5) + { + ThrowItem(i, -1, new Vector2(horizontalDirection * percent, height)); + } + else + { + ThrowItem(i, -1, new Vector2(-horizontalDirection * percent, height)); + } + } + } + /// /// Throw item /// 抛出物品 @@ -539,6 +578,8 @@ public partial class CharacterTemplate : CharacterBody2D /// /// How many to throw /// 要扔几个 + /// The amount passed into a negative number will throw all the items in the slot at once. + /// 数量传入一个负数,将一次扔出槽内的所有物品。 /// /// ///The speed to be applied to the item @@ -562,7 +603,12 @@ public partial class CharacterTemplate : CharacterBody2D { return; } - + + if (item is not Node2D node2D) + { + return; + } + switch (item) { case WeaponTemplate weaponTemplate: @@ -571,7 +617,7 @@ public partial class CharacterTemplate : CharacterBody2D return; } - weaponTemplate.Reparent(GameSceneNodeHolder.WeaponContainer); + CallDeferred("WeaponTemplateReparent", weaponTemplate); var timer = new Timer(); weaponTemplate.AddChild(timer); timer.WaitTime = _itemCollisionRecoveryTime; @@ -587,13 +633,17 @@ public partial class CharacterTemplate : CharacterBody2D }; timer.Start(); weaponTemplate.Sleeping = false; - // weaponTemplate.LinearVelocity = Vector2.Zero; + //Setting an initial speed of 0 for items here prevents the problem of throwing items too fast. + //在这里给物品设置一个为0的初始速度,可防止扔出物品时速度过快的问题。 + weaponTemplate.LinearVelocity = Vector2.Zero; break; } + node2D.ProcessMode = ProcessModeEnum.Inherit; + node2D.Show(); //We apply force to objects. //我们给物品施加力。 - switch (CurrentItem) + switch (node2D) { case CharacterBody2D characterBody2D: characterBody2D.Velocity = velocity; @@ -605,9 +655,25 @@ public partial class CharacterTemplate : CharacterBody2D //Remove items from the item container //在物品容器内移除物品 - itemSlotNode.RemoveItem(number); + if (number < 0) + { + itemSlotNode.RemoveItem(item.Quantity); + } + else + { + itemSlotNode.RemoveItem(number); + } } + /// + /// Replace the parent node of the weapon + /// 替换武器的父节点 + /// + /// + private void WeaponTemplateReparent(WeaponTemplate weaponTemplate) + { + weaponTemplate.Reparent(GameSceneNodeHolder.WeaponContainer); + } public sealed override void _PhysicsProcess(double delta) { diff --git a/scripts/character/Player.cs b/scripts/character/Player.cs index 7070d94..c91571d 100644 --- a/scripts/character/Player.cs +++ b/scripts/character/Player.cs @@ -353,9 +353,15 @@ public partial class Player : CharacterTemplate } } + /// + /// When the player dies + /// 当玩家死亡的时候 + /// + /// protected override async Task OnDie(DamageTemplate damageTemplate) { - Visible = false; + Hide(); + ProcessMode = ProcessModeEnum.Disabled; if (EventManager.GameOverEvent == null) { return; diff --git a/scripts/inventory/ItemSlotNode.cs b/scripts/inventory/ItemSlotNode.cs index dc98da9..a5d30be 100644 --- a/scripts/inventory/ItemSlotNode.cs +++ b/scripts/inventory/ItemSlotNode.cs @@ -97,7 +97,7 @@ public partial class ItemSlotNode : MarginContainer if (_quantityLabel != null) { - _quantityLabel.Visible = false; + _quantityLabel.Hide(); } } @@ -213,16 +213,16 @@ public partial class ItemSlotNode : MarginContainer switch (quantity) { case null: - _quantityLabel.Visible = false; + _quantityLabel.Hide(); return; case > 1: //When the quantity is greater than 1, we display the quantity. //当数量大于1时,我们显示数量 _quantityLabel.Text = quantity.ToString(); - _quantityLabel.Visible = true; + _quantityLabel.Show(); break; default: - _quantityLabel.Visible = false; + _quantityLabel.Hide(); break; } } @@ -236,6 +236,6 @@ public partial class ItemSlotNode : MarginContainer _iconTextureRect = GetNode("BackgroundTexture/CenterContainer/IconTextureRect"); _quantityLabel = GetNode