From 1429b879e81c2ed96b9f5f74a827a1e4f065fb6f Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Sun, 1 Sep 2024 23:24:35 +0800 Subject: [PATCH] =?UTF-8?q?Can=20generate=20a=20preview=20and=20place=20it?= =?UTF-8?q?=20in=20the=20mini-map.=20=E8=83=BD=E5=A4=9F=E7=94=9F=E6=88=90?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E5=9B=BE=E5=B9=B6=E5=B0=86=E5=85=B6=E6=94=BE?= =?UTF-8?q?=E7=BD=AE=E5=88=B0=E8=BF=B7=E4=BD=A0=E5=9C=B0=E5=9B=BE=E5=86=85?= =?UTF-8?q?=E4=BA=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/game.tscn | 6 ++- scenes/mapContainer.tscn | 43 ++++++++++++++++++ ...eSceneNodeHolder.cs => GameSceneDepend.cs} | 18 ++++++-- scripts/character/CharacterTemplate.cs | 20 ++++---- scripts/character/Player.cs | 12 ++--- scripts/database/gameDbTables/ErrorRecord.cs | 2 + scripts/inventory/Packsack.cs | 2 +- scripts/loader/sceneLoader/GameSceneLoader.cs | 28 ++++++++---- scripts/loader/uiLoader/PacksackUi.cs | 2 +- scripts/map/AiCharacterSpawn.cs | 4 +- scripts/map/MapGenerator.cs | 41 +++++++++++------ scripts/map/PlayerSpawn.cs | 20 ++++---- scripts/map/preview/RoomPreview.cs | 2 +- scripts/utils/NodeUtils.cs | 20 ++++---- scripts/weapon/ProjectileWeapon.cs | 6 +-- sprites/ui/MiniMapBg.png | Bin 0 -> 277 bytes sprites/ui/MiniMapBg.png.import | 34 ++++++++++++++ 17 files changed, 190 insertions(+), 70 deletions(-) create mode 100644 scenes/mapContainer.tscn rename scripts/{GameSceneNodeHolder.cs => GameSceneDepend.cs} (88%) create mode 100644 sprites/ui/MiniMapBg.png create mode 100644 sprites/ui/MiniMapBg.png.import diff --git a/scenes/game.tscn b/scenes/game.tscn index 5bd4dbd..bba6d90 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=7 format=3 uid="uid://bnftvkj2cido7"] +[gd_scene load_steps=8 format=3 uid="uid://bnftvkj2cido7"] [ext_resource type="Script" path="res://scripts/loader/sceneLoader/GameSceneLoader.cs" id="1_mqdgt"] [ext_resource type="Texture2D" uid="uid://cs6e0af876ss5" path="res://sprites/ui/HeartEmpty.png" id="2_n1yht"] [ext_resource type="Script" path="res://scripts/inventory/HotBar.cs" id="2_owrhq"] [ext_resource type="Script" path="res://scripts/HealthBarUi.cs" id="2_xrm3v"] [ext_resource type="Script" path="res://scripts/FpsLabel.cs" id="5_dis4v"] +[ext_resource type="PackedScene" uid="uid://c74180dtf7j7a" path="res://scenes/mapContainer.tscn" id="6_ljdj4"] [ext_resource type="PackedScene" uid="uid://bb188382q7btp" path="res://scenes/gameOverMenu.tscn" id="6_yjmrv"] [node name="Game" type="Node2D"] @@ -90,6 +91,9 @@ offset_right = 20.0 offset_bottom = 25.0 grow_horizontal = 2 +[node name="MapContainer" parent="CanvasLayer/Control" instance=ExtResource("6_ljdj4")] +layout_mode = 1 + [node name="BackpackUIContainer" type="Control" parent="CanvasLayer"] visible = false layout_mode = 3 diff --git a/scenes/mapContainer.tscn b/scenes/mapContainer.tscn new file mode 100644 index 0000000..89618e6 --- /dev/null +++ b/scenes/mapContainer.tscn @@ -0,0 +1,43 @@ +[gd_scene load_steps=2 format=3 uid="uid://c74180dtf7j7a"] + +[ext_resource type="Texture2D" uid="uid://c35bsle7thcnh" path="res://sprites/ui/MiniMapBg.png" id="1_h88bi"] + +[node name="MapContainer" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 + +[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 +mouse_filter = 2 + +[node name="MiniMap" type="NinePatchRect" parent="."] +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -174.0 +offset_top = -177.0 +offset_right = -24.0 +offset_bottom = -27.0 +grow_horizontal = 0 +grow_vertical = 0 +texture = ExtResource("1_h88bi") +patch_margin_left = 7 +patch_margin_top = 7 +patch_margin_right = 7 +patch_margin_bottom = 7 + +[node name="RoomPreviewContainer" type="Node2D" parent="MiniMap"] diff --git a/scripts/GameSceneNodeHolder.cs b/scripts/GameSceneDepend.cs similarity index 88% rename from scripts/GameSceneNodeHolder.cs rename to scripts/GameSceneDepend.cs index d98ef29..134fced 100644 --- a/scripts/GameSceneNodeHolder.cs +++ b/scripts/GameSceneDepend.cs @@ -8,11 +8,17 @@ using Godot; namespace ColdMint.scripts; /// -/// The node holder within the game scene -/// 游戏场景内的节点持有者 +/// Dependencies on the runtime of the game scene +/// 游戏场景运行时的依赖 /// -public static class GameSceneNodeHolder +public static class GameSceneDepend { + /// + /// The midpoint of the minimap + /// 迷你地图的中点 + /// + public static Vector2 MiniMapMidpointCoordinate; + private static Player? _player; /// @@ -40,6 +46,12 @@ public static class GameSceneNodeHolder /// 鼠标进入到某个角色的范围内时,会将其视作目标 /// public static Node2D? TemporaryTargetNode { get; set; } + + /// + /// MiniMapContainerNode + /// 迷你地图容器节点 + /// + public static Node2D? MiniMapContainerNode { get; set; } /// /// ProjectileContainer diff --git a/scripts/character/CharacterTemplate.cs b/scripts/character/CharacterTemplate.cs index ccf871a..8e720e1 100644 --- a/scripts/character/CharacterTemplate.cs +++ b/scripts/character/CharacterTemplate.cs @@ -315,9 +315,9 @@ public partial class CharacterTemplate : CharacterBody2D public override void _ExitTree() { base._ExitTree(); - if (GameSceneNodeHolder.TemporaryTargetNode == this) + if (GameSceneDepend.TemporaryTargetNode == this) { - GameSceneNodeHolder.TemporaryTargetNode = null; + GameSceneDepend.TemporaryTargetNode = null; } } @@ -326,13 +326,13 @@ public partial class CharacterTemplate : CharacterBody2D public override void _MouseEnter() { - if (GameSceneNodeHolder.Player != null) + if (GameSceneDepend.Player != null) { var targetCamp = CampManager.GetCamp(CampId); - var playerCamp = CampManager.GetCamp(GameSceneNodeHolder.Player.CampId); + var playerCamp = CampManager.GetCamp(GameSceneDepend.Player.CampId); if (CampManager.CanCauseHarm(targetCamp, playerCamp)) { - GameSceneNodeHolder.TemporaryTargetNode = this; + GameSceneDepend.TemporaryTargetNode = this; } } @@ -511,7 +511,7 @@ public partial class CharacterTemplate : CharacterBody2D return; } - if (GameSceneNodeHolder.Player == null) + if (GameSceneDepend.Player == null) { //We didn't know who the player was, so we showed it as a hostile color //我们不知道玩家是谁,所以我们将其显示为敌对颜色 @@ -522,7 +522,7 @@ public partial class CharacterTemplate : CharacterBody2D //If we set up a player node, then compare the injured party ID to the player's party ID //如果我们设置了玩家节点,那么将受伤者的阵营ID与玩家的阵营ID进行比较 var targetCamp = CampManager.GetCamp(CampId); - var playerCamp = CampManager.GetCamp(GameSceneNodeHolder.Player.CampId); + var playerCamp = CampManager.GetCamp(GameSceneDepend.Player.CampId); if (CampManager.CanCauseHarm(targetCamp, playerCamp)) { if (targetCamp != null && playerCamp != null) @@ -618,6 +618,10 @@ public partial class CharacterTemplate : CharacterBody2D /// public void AddForce(Vector2 force) { + if (_additionalForce != Vector2.Zero) + { + throw new InvalidOperationException("AddForce called more than once"); + } _additionalForce = force; } @@ -792,7 +796,7 @@ public partial class CharacterTemplate : CharacterBody2D switch (item) { case PickAbleTemplate pickAbleTemplate: - if (GameSceneNodeHolder.WeaponContainer == null) + if (GameSceneDepend.WeaponContainer == null) { return; } diff --git a/scripts/character/Player.cs b/scripts/character/Player.cs index 400c845..64c5c90 100644 --- a/scripts/character/Player.cs +++ b/scripts/character/Player.cs @@ -46,7 +46,7 @@ public partial class Player : CharacterTemplate _parabola = GetNode("Parabola"); _platformDetectionRayCast2D = GetNode("PlatformDetectionRayCast"); UpdateOperationTip(); - var healthBarUi = GameSceneNodeHolder.HealthBarUi; + var healthBarUi = GameSceneDepend.HealthBarUi; if (healthBarUi != null) { healthBarUi.MaxHp = MaxHp; @@ -89,7 +89,7 @@ public partial class Player : CharacterTemplate private void SelectedItemSlotChangeEvent(SelectedItemSlotChangeEvent selectedItemSlotChangeEvent) { var item = selectedItemSlotChangeEvent.NewItemSlotNode?.GetItem(); - GameSceneNodeHolder.HideBackpackUiContainerIfVisible(); + GameSceneDepend.HideBackpackUiContainerIfVisible(); if (item is Node2D node2D) { CurrentItem = node2D; @@ -114,7 +114,7 @@ public partial class Player : CharacterTemplate /// private void UpdateOperationTip() { - var operationTipLabel = GameSceneNodeHolder.OperationTipLabel; + var operationTipLabel = GameSceneDepend.OperationTipLabel; if (operationTipLabel == null) { return; @@ -303,7 +303,7 @@ public partial class Player : CharacterTemplate } ThrowItem(ItemContainer.GetSelectIndex(), 1, GetThrowVelocity()); - GameSceneNodeHolder.HideBackpackUiContainerIfVisible(); + GameSceneDepend.HideBackpackUiContainerIfVisible(); CurrentItem = null; } } @@ -385,7 +385,7 @@ public partial class Player : CharacterTemplate public override void Revive(int newHp) { base.Revive(newHp); - var healthBarUi = GameSceneNodeHolder.HealthBarUi; + var healthBarUi = GameSceneDepend.HealthBarUi; if (healthBarUi != null) { //The purpose of setting Hp to the current Hp is to cause the life bar to refresh. @@ -451,7 +451,7 @@ public partial class Player : CharacterTemplate protected override void OnHit(DamageTemplate damageTemplate) { base.OnHit(damageTemplate); - var healthBarUi = GameSceneNodeHolder.HealthBarUi; + var healthBarUi = GameSceneDepend.HealthBarUi; if (healthBarUi != null) { healthBarUi.CurrentHp = CurrentHp; diff --git a/scripts/database/gameDbTables/ErrorRecord.cs b/scripts/database/gameDbTables/ErrorRecord.cs index c38bef4..a59761c 100644 --- a/scripts/database/gameDbTables/ErrorRecord.cs +++ b/scripts/database/gameDbTables/ErrorRecord.cs @@ -15,7 +15,9 @@ public class ErrorRecord /// [Key] [MaxLength(255)] + // ReSharper disable UnusedAutoPropertyAccessor.Global public string? Message { get; set; } + // ReSharper restore UnusedAutoPropertyAccessor.Global /// /// Count diff --git a/scripts/inventory/Packsack.cs b/scripts/inventory/Packsack.cs index 1b2b3bc..1a36e31 100644 --- a/scripts/inventory/Packsack.cs +++ b/scripts/inventory/Packsack.cs @@ -46,7 +46,7 @@ public partial class Packsack : PickAbleTemplate } } - GameSceneNodeHolder.BackpackUiContainer?.Show(); + GameSceneDepend.BackpackUiContainer?.Show(); _packsackUi?.Show(); } diff --git a/scripts/loader/sceneLoader/GameSceneLoader.cs b/scripts/loader/sceneLoader/GameSceneLoader.cs index 5193ba2..69c827d 100644 --- a/scripts/loader/sceneLoader/GameSceneLoader.cs +++ b/scripts/loader/sceneLoader/GameSceneLoader.cs @@ -23,39 +23,46 @@ public partial class GameSceneLoader : SceneLoaderTemplate //Loading the blood bar scene //加载血条场景 var healthBarUi = GetNode("CanvasLayer/Control/VBoxContainer/HealthBarUi"); - GameSceneNodeHolder.HealthBarUi = healthBarUi; + GameSceneDepend.HealthBarUi = healthBarUi; //Load HotBar //加载HotBar var hotBar = GetNode("CanvasLayer/Control/VBoxContainer/HotBar"); - GameSceneNodeHolder.HotBar = hotBar; + GameSceneDepend.HotBar = hotBar; //Backpack Ui container //背包Ui容器 var backpackUiContainer = GetNode("CanvasLayer/BackpackUIContainer"); - GameSceneNodeHolder.BackpackUiContainer = backpackUiContainer; + GameSceneDepend.BackpackUiContainer = backpackUiContainer; //Load operation prompt //加载操作提示 var operationTip = GetNode("CanvasLayer/Control/VBoxContainer/OperationTip"); - GameSceneNodeHolder.OperationTipLabel = operationTip; + GameSceneDepend.OperationTipLabel = operationTip; //Loaded weapon container //加载武器容器 var weaponContainer = GetNode("WeaponContainer"); - GameSceneNodeHolder.WeaponContainer = weaponContainer; + GameSceneDepend.WeaponContainer = weaponContainer; //Load projectile container //加载抛射体容器 var projectileContainer = GetNode("ProjectileContainer"); - GameSceneNodeHolder.ProjectileContainer = projectileContainer; + GameSceneDepend.ProjectileContainer = projectileContainer; //Load Packsack container //加载背包容器 var packsackContainer = GetNode("PacksackContainer"); - GameSceneNodeHolder.PacksackContainer = packsackContainer; + GameSceneDepend.PacksackContainer = packsackContainer; //Load AICharacter container //加载AICharacter容器 var aiCharacterContainer = GetNode("AICharacterContainer"); - GameSceneNodeHolder.AiCharacterContainer = aiCharacterContainer; + GameSceneDepend.AiCharacterContainer = aiCharacterContainer; //Load player container //加载玩家容器 var playerContainer = GetNode("PlayerContainer"); - GameSceneNodeHolder.PlayerContainer = playerContainer; + GameSceneDepend.PlayerContainer = playerContainer; + //Load the room container node + //加载房间容器节点 + var miniMapContainerNode = GetNode("CanvasLayer/Control/MapContainer/MiniMap/RoomPreviewContainer"); + GameSceneDepend.MiniMapContainerNode = miniMapContainerNode; + //计算迷你地图的中点 + var mapContainer = GetNode("CanvasLayer/Control/MapContainer/MiniMap"); + GameSceneDepend.MiniMapMidpointCoordinate = mapContainer.Size / 2; return Task.CompletedTask; } @@ -96,6 +103,7 @@ public partial class GameSceneLoader : SceneLoaderTemplate var seedInfo = TranslationServerUtils.TranslateWithFormat("ui_seed_info", MapGenerator.Seed); _seedLabel.Text = seedInfo ?? $"Seed: {MapGenerator.Seed}"; } + await MapGenerator.GenerateMap(); } -} +} \ No newline at end of file diff --git a/scripts/loader/uiLoader/PacksackUi.cs b/scripts/loader/uiLoader/PacksackUi.cs index e96feb9..ab1b998 100644 --- a/scripts/loader/uiLoader/PacksackUi.cs +++ b/scripts/loader/uiLoader/PacksackUi.cs @@ -107,7 +107,7 @@ public partial class PacksackUi : UiLoaderTemplate { _exitButton.Pressed += () => { - GameSceneNodeHolder.BackpackUiContainer?.Hide(); + GameSceneDepend.BackpackUiContainer?.Hide(); Hide(); }; } diff --git a/scripts/map/AiCharacterSpawn.cs b/scripts/map/AiCharacterSpawn.cs index 5032544..14924a7 100644 --- a/scripts/map/AiCharacterSpawn.cs +++ b/scripts/map/AiCharacterSpawn.cs @@ -33,7 +33,7 @@ public partial class AiCharacterSpawn : Marker2D /// public void OnAiCharacterGenerateEvent(AiCharacterGenerateEvent aiCharacterGenerateEvent) { - if (GameSceneNodeHolder.AiCharacterContainer == null) + if (GameSceneDepend.AiCharacterContainer == null) { return; } @@ -49,7 +49,7 @@ public partial class AiCharacterSpawn : Marker2D return; } - NodeUtils.CallDeferredAddChild(GameSceneNodeHolder.AiCharacterContainer, aiCharacter); + NodeUtils.CallDeferredAddChild(GameSceneDepend.AiCharacterContainer, aiCharacter); aiCharacter.GlobalPosition = GlobalPosition; } diff --git a/scripts/map/MapGenerator.cs b/scripts/map/MapGenerator.cs index c20750f..8c91c46 100644 --- a/scripts/map/MapGenerator.cs +++ b/scripts/map/MapGenerator.cs @@ -149,9 +149,14 @@ public static class MapGenerator return; } - if (GameSceneNodeHolder.AiCharacterContainer != null) + if (GameSceneDepend.MiniMapContainerNode != null) { - NodeUtils.DeleteAllChild(GameSceneNodeHolder.AiCharacterContainer); + NodeUtils.DeleteAllChild(GameSceneDepend.MiniMapContainerNode); + } + + if (GameSceneDepend.AiCharacterContainer != null) + { + NodeUtils.DeleteAllChild(GameSceneDepend.AiCharacterContainer); } NodeUtils.DeleteAllChild(_mapRoot); @@ -336,21 +341,29 @@ public static class MapGenerator return false; } + //Create a room preview image. + //创建房间预览图。 + var image = RoomPreview.CreateImage(roomPlacementData.NewRoom.GetTileMapLayer(Config.TileMapLayerName.Ground)); + if (GameSceneDepend.MiniMapContainerNode == null || roomPlacementData.Position == null || + image == null) + { + return false; + } + + var sprite = new Sprite2D(); + sprite.Scale = new Vector2(5, 5); + sprite.Texture = image; + //TODO:Calculate the coordinates of the room preview view. + //TODO:计算房间预览图的坐标。 + sprite.Position = GameSceneDepend.MiniMapMidpointCoordinate + + roomPlacementData.Position.Value / Config.CellSize; + NodeUtils.CallDeferredAddChild(GameSceneDepend.MiniMapContainerNode, sprite); + + //Rooms are added to the dictionary only after the preview is created. + //创建预览图后才将房间添加到字典。 dictionary.Add(roomNodeDataId, roomPlacementData.NewRoom); LogCat.LogWithFormat("room_placement_information", LogCat.LogLabel.Default, LogCat.UploadFormat, roomNodeDataId, roomPlacementData.Position.ToString()); - //Create a room preview image. - //创建房间预览图。 - var rootNode = roomPlacementData.NewRoom.RootNode; - var image = RoomPreview.CreateImage(roomPlacementData.NewRoom.GetTileMapLayer(Config.TileMapLayerName.Ground)); - if (rootNode != null && image != null) - { - var sprite = new Sprite2D(); - sprite.Scale = new Vector2(10, 10); - sprite.Texture = image; - NodeUtils.CallDeferredAddChild(rootNode, sprite); - } - return true; } } \ No newline at end of file diff --git a/scripts/map/PlayerSpawn.cs b/scripts/map/PlayerSpawn.cs index 6b82b34..e7cc47d 100644 --- a/scripts/map/PlayerSpawn.cs +++ b/scripts/map/PlayerSpawn.cs @@ -25,10 +25,10 @@ public partial class PlayerSpawn : Marker2D private void GameReplayEvent(GameReplayEvent gameReplayEvent) { - if (GameSceneNodeHolder.Player != null) + if (GameSceneDepend.Player != null) { - GameSceneNodeHolder.Player.Revive(GameSceneNodeHolder.Player.MaxHp); - GameSceneNodeHolder.Player.GlobalPosition = GlobalPosition; + GameSceneDepend.Player.Revive(GameSceneDepend.Player.MaxHp); + GameSceneDepend.Player.GlobalPosition = GlobalPosition; return; } @@ -41,7 +41,7 @@ public partial class PlayerSpawn : Marker2D /// private void SpawnPlayer() { - if (GameSceneNodeHolder.PlayerContainer == null) + if (GameSceneDepend.PlayerContainer == null) { return; } @@ -59,10 +59,10 @@ public partial class PlayerSpawn : Marker2D return; } - //The player's parent node must be GameSceneNodeHolder PlayerContainer. - //玩家的父节点必须是GameSceneNodeHolder.PlayerContainer。 - NodeUtils.CallDeferredAddChild(GameSceneNodeHolder.PlayerContainer, playerNode); - var itemContainer = GameSceneNodeHolder.HotBar?.GetItemContainer(); + //The player's parent node must be GameSceneDepend PlayerContainer. + //玩家的父节点必须是GameSceneDepend.PlayerContainer。 + NodeUtils.CallDeferredAddChild(GameSceneDepend.PlayerContainer, playerNode); + var itemContainer = GameSceneDepend.HotBar?.GetItemContainer(); if (itemContainer == null) { //Throws an exception when the item container is empty. @@ -71,7 +71,7 @@ public partial class PlayerSpawn : Marker2D } playerNode.ItemContainer = itemContainer; - GameSceneNodeHolder.Player = playerNode; + GameSceneDepend.Player = playerNode; playerNode.GlobalPosition = GlobalPosition; } @@ -79,7 +79,7 @@ public partial class PlayerSpawn : Marker2D { //After the map is generated, create the player instance. //当地图生成完成后,创建玩家实例。 - if (GameSceneNodeHolder.Player != null) + if (GameSceneDepend.Player != null) { //An existing player instance will not be created. //已经存在玩家实例,不再创建。 diff --git a/scripts/map/preview/RoomPreview.cs b/scripts/map/preview/RoomPreview.cs index 70fbcdc..8164f45 100644 --- a/scripts/map/preview/RoomPreview.cs +++ b/scripts/map/preview/RoomPreview.cs @@ -60,7 +60,7 @@ public static class RoomPreview //填充像素点 foreach (var vector2I in cellsArray) { - image.SetPixel(vector2I.X + offsetVector2.X, vector2I.Y + offsetVector2.Y, new Color(100, 221, 23)); + image.SetPixel(vector2I.X + offsetVector2.X, vector2I.Y + offsetVector2.Y, Colors.Blue); } //Create texture. diff --git a/scripts/utils/NodeUtils.cs b/scripts/utils/NodeUtils.cs index 1b1c39b..edd1bc2 100644 --- a/scripts/utils/NodeUtils.cs +++ b/scripts/utils/NodeUtils.cs @@ -225,29 +225,29 @@ public static class NodeUtils /// public static Node FindContainerNode(Node childNode, Node defaultParentNode) { - if (GameSceneNodeHolder.AiCharacterContainer!= null && childNode is AiCharacter) + if (GameSceneDepend.AiCharacterContainer!= null && childNode is AiCharacter) { - return GameSceneNodeHolder.AiCharacterContainer; + return GameSceneDepend.AiCharacterContainer; } - if (GameSceneNodeHolder.ProjectileContainer != null && childNode is Projectile) + if (GameSceneDepend.ProjectileContainer != null && childNode is Projectile) { - return GameSceneNodeHolder.ProjectileContainer; + return GameSceneDepend.ProjectileContainer; } - if (GameSceneNodeHolder.WeaponContainer != null && childNode is WeaponTemplate) + if (GameSceneDepend.WeaponContainer != null && childNode is WeaponTemplate) { - return GameSceneNodeHolder.WeaponContainer; + return GameSceneDepend.WeaponContainer; } - if (GameSceneNodeHolder.PacksackContainer != null && childNode is Packsack) + if (GameSceneDepend.PacksackContainer != null && childNode is Packsack) { - return GameSceneNodeHolder.PacksackContainer; + return GameSceneDepend.PacksackContainer; } - if (GameSceneNodeHolder.BackpackUiContainer != null && childNode is PacksackUi) + if (GameSceneDepend.BackpackUiContainer != null && childNode is PacksackUi) { - return GameSceneNodeHolder.BackpackUiContainer; + return GameSceneDepend.BackpackUiContainer; } return defaultParentNode; diff --git a/scripts/weapon/ProjectileWeapon.cs b/scripts/weapon/ProjectileWeapon.cs index 0a9c9d1..cd82379 100644 --- a/scripts/weapon/ProjectileWeapon.cs +++ b/scripts/weapon/ProjectileWeapon.cs @@ -136,7 +136,7 @@ public partial class ProjectileWeapon : WeaponTemplate return; } - if (GameSceneNodeHolder.ProjectileContainer == null) + if (GameSceneDepend.ProjectileContainer == null) { LogCat.LogError("projectile_container_is_null"); return; @@ -167,9 +167,9 @@ public partial class ProjectileWeapon : WeaponTemplate projectile.AddProjectileDecorator(nodeSpawnOnKillCharacterDecorator); } - NodeUtils.CallDeferredAddChild(GameSceneNodeHolder.ProjectileContainer, projectile); + NodeUtils.CallDeferredAddChild(GameSceneDepend.ProjectileContainer, projectile); projectile.Owner = owner; - projectile.TargetNode = GameSceneNodeHolder.TemporaryTargetNode; + projectile.TargetNode = GameSceneDepend.TemporaryTargetNode; projectile.Velocity = (_marker2D.GlobalPosition.DirectionTo(enemyGlobalPosition) * projectile.Speed) .Rotated(GetRandomAngle()); diff --git a/sprites/ui/MiniMapBg.png b/sprites/ui/MiniMapBg.png new file mode 100644 index 0000000000000000000000000000000000000000..2b92325067464028ea13e126ef3a77f09e094ed1 GIT binary patch literal 277 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|&U?BzhE&XX zds~t3P=EkKV3%X^1rL?>gN1f7?T$(pB~1FbO-jEwS}B*GP5Cr=eOZL>haL0cgMZg2 z)$htV{_OQm*ScP&3`SqZEe&ZO8QWH_fA{asoo7>isOtYYhmoY>+1T*L^(4*muJOfXyQ_%`u}cq_f?0D6tV)78&qol`;+ E00QA*JOBUy literal 0 HcmV?d00001 diff --git a/sprites/ui/MiniMapBg.png.import b/sprites/ui/MiniMapBg.png.import new file mode 100644 index 0000000..5c01393 --- /dev/null +++ b/sprites/ui/MiniMapBg.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c35bsle7thcnh" +path="res://.godot/imported/MiniMapBg.png-d798deffd210ae6fbca7a397a2bc688e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/ui/MiniMapBg.png" +dest_files=["res://.godot/imported/MiniMapBg.png-d798deffd210ae6fbca7a397a2bc688e.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1