diff --git a/locals/Misc.csv b/locals/Misc.csv index 1d3370e..295c8a7 100644 --- a/locals/Misc.csv +++ b/locals/Misc.csv @@ -1,4 +1,3 @@ id,zh,en,ja -de,的,"'s",の default_player_name,白纸,blankPaper,しらかみ item_prompt_debug,ID:{0}\n名称:{1}\n数量:{2}\n最大叠加数量:{3}\n数据类型:{4}\n描述:{5},ID: {0}\nName: {1}\nQuantity: {2}\nMaximum stacking quantity: {3}\nData type: {4}\nDescription:{5},id:{0}\n名称:{1}\nの数は最大{2}\nシナジー数:{3}\nデータタイプ:{4}\n述べ表わす:{5} \ No newline at end of file diff --git a/prefab/packsacks/PortableBackpacks.tscn b/prefab/packsacks/PortableBackpacks.tscn index 3079339..0e0dff1 100644 --- a/prefab/packsacks/PortableBackpacks.tscn +++ b/prefab/packsacks/PortableBackpacks.tscn @@ -30,3 +30,8 @@ shape = SubResource("RectangleShape2D_xqyue") [node name="Packsack" type="Sprite2D" parent="."] scale = Vector2(0.5, 0.5) texture = ExtResource("2_l0fbh") + +[node name="TipLabel" type="Label" parent="."] +offset_top = 31.0 +offset_right = 40.0 +offset_bottom = 56.0 diff --git a/prefab/ui/FloatLabel.tscn b/prefab/ui/FloatLabel.tscn deleted file mode 100644 index ce612b5..0000000 --- a/prefab/ui/FloatLabel.tscn +++ /dev/null @@ -1,14 +0,0 @@ -[gd_scene format=3 uid="uid://b7se73tsnlpd6"] - -[node name="FloatLabel" type="Control"] -layout_mode = 3 -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_right = 40.0 -offset_bottom = 23.0 diff --git a/prefab/weapons/StaffNecromancy.tscn b/prefab/weapons/StaffNecromancy.tscn index ce940cc..17df48c 100644 --- a/prefab/weapons/StaffNecromancy.tscn +++ b/prefab/weapons/StaffNecromancy.tscn @@ -45,3 +45,9 @@ position = Vector2(65, 0) [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="Marker2D"] stream = ExtResource("4_ffr2k") bus = &"SoundEffect" + +[node name="TipLabel" type="Label" parent="."] +offset_left = 6.0 +offset_top = 48.0 +offset_right = 46.0 +offset_bottom = 73.0 diff --git a/scripts/character/CharacterTemplate.cs b/scripts/character/CharacterTemplate.cs index 73c1837..ccf871a 100644 --- a/scripts/character/CharacterTemplate.cs +++ b/scripts/character/CharacterTemplate.cs @@ -322,26 +322,15 @@ public partial class CharacterTemplate : CharacterBody2D } - private bool _mouseEntered; - - public override void _InputEvent(Viewport viewport, InputEvent @event, int shapeIdx) - { - if (!_mouseEntered) - { - return; - } - } + public override void _MouseEnter() { - _mouseEntered = true; - var canCauseHarm = false; if (GameSceneNodeHolder.Player != null) { var targetCamp = CampManager.GetCamp(CampId); var playerCamp = CampManager.GetCamp(GameSceneNodeHolder.Player.CampId); - canCauseHarm = CampManager.CanCauseHarm(targetCamp, playerCamp); - if (canCauseHarm) + if (CampManager.CanCauseHarm(targetCamp, playerCamp)) { GameSceneNodeHolder.TemporaryTargetNode = this; } @@ -350,7 +339,7 @@ public partial class CharacterTemplate : CharacterBody2D if (_tipLabel != null) { _tipLabel.Visible = true; - _tipLabel.Text = canCauseHarm + CharacterName; + _tipLabel.Text = CharacterName; //Vertical Centering Tip //垂直居中提示 var oldPosition = _tipLabel.Position; @@ -361,7 +350,6 @@ public partial class CharacterTemplate : CharacterBody2D public override void _MouseExit() { - _mouseEntered = false; if (_tipLabel != null) { _tipLabel.Visible = false; diff --git a/scripts/character/Player.cs b/scripts/character/Player.cs index 3977a58..a0fc58b 100644 --- a/scripts/character/Player.cs +++ b/scripts/character/Player.cs @@ -1,4 +1,3 @@ -using System; using System.Text; using System.Threading.Tasks; using ColdMint.scripts.damage; @@ -17,8 +16,6 @@ namespace ColdMint.scripts.character; /// public partial class Player : CharacterTemplate { - private Control? _floatLabel; - //Empty object projectile //空的物品抛射线 private readonly Vector2[] _emptyVector2Array = [Vector2.Zero]; @@ -29,10 +26,6 @@ public partial class Player : CharacterTemplate //用于检测玩家是否站在平台上的射线 private RayCast2D? _platformDetectionRayCast2D; - - private const float PromptTextDistance = 50; - - //抛出物品的飞行速度 private float _throwingVelocity = Config.CellSize * 13; @@ -50,17 +43,6 @@ public partial class Player : CharacterTemplate CharacterName = TranslationServerUtils.Translate("default_player_name"); LogCat.LogWithFormat("player_spawn_debug", LogCat.LogLabel.Default, LogCat.UploadFormat, ReadOnlyCharacterName, GlobalPosition); - var floatLabelPackedScene = GD.Load("res://prefab/ui/FloatLabel.tscn"); - //Initializes the float label. - //初始化悬浮标签。 - _floatLabel = NodeUtils.InstantiatePackedScene(floatLabelPackedScene); - if (_floatLabel == null) - { - throw new NullReferenceException(TranslationServer.Translate("float_label_instantiate_failed")); - } - - _floatLabel.Hide(); - NodeUtils.CallDeferredAddChild(this, _floatLabel); _parabola = GetNode("Parabola"); _platformDetectionRayCast2D = GetNode("PlatformDetectionRayCast"); UpdateOperationTip(); @@ -109,6 +91,14 @@ public partial class Player : CharacterTemplate } } + public override void _MouseEnter() + { + } + + public override void _MouseExit() + { + } + /// /// Update operation prompt /// 更新操作提示 @@ -243,8 +233,6 @@ public partial class Player : CharacterTemplate { PickingRangeBodiesList?.Remove(pickAbleItem); } - - RecycleFloatLabel(); } } @@ -430,48 +418,11 @@ public partial class Player : CharacterTemplate return; } - if (node is not Node2D node2D) + if (node is not Node2D) { return; } - if (_floatLabel != null) - { - if (node is not PickAbleTemplate pickAbleTemplate) - { - return; - } - - if (pickAbleTemplate.Picked) - { - //If the pickables are picked up, the label is not displayed. - //如果可拾捡物被捡起了,那么不显示标签。 - LogCat.LogWarning("pickable_picked_up"); - return; - } - - NodeUtils.CallDeferredReparent(node, _floatLabel); - var rotationDegreesNode2D = node2D.RotationDegrees; - var rotationDegreesNode2DAbs = Math.Abs(rotationDegreesNode2D); - _floatLabel.GlobalPosition = node2D.GlobalPosition; - _floatLabel.Position = rotationDegreesNode2DAbs > 90 - ? new Vector2(0, PromptTextDistance) - : new Vector2(0, -PromptTextDistance); - _floatLabel.RotationDegrees = 0 - rotationDegreesNode2D; - var label = _floatLabel.GetNode