diff --git a/DungeonShooting_Godot/prefab/ui/RoomMap.tscn b/DungeonShooting_Godot/prefab/ui/RoomMap.tscn new file mode 100644 index 0000000..64719f8 --- /dev/null +++ b/DungeonShooting_Godot/prefab/ui/RoomMap.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=2 format=3 uid="uid://dqajn31a4b0f8"] + +[ext_resource type="Script" path="res://src/game/ui/roomMap/RoomMapPanel.cs" id="1_ng7b3"] + +[node name="RoomMap" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource("1_ng7b3") + +[node name="Bg" 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, 0, 0, 0.196078) diff --git a/DungeonShooting_Godot/prefab/ui/RoomUI.tscn b/DungeonShooting_Godot/prefab/ui/RoomUI.tscn index c4fdc0a..029dad3 100644 --- a/DungeonShooting_Godot/prefab/ui/RoomUI.tscn +++ b/DungeonShooting_Godot/prefab/ui/RoomUI.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=20 format=3 uid="uid://bvpmtfupny8iu"] +[gd_scene load_steps=21 format=3 uid="uid://bvpmtfupny8iu"] [ext_resource type="Script" path="res://src/game/ui/roomUI/RoomUIPanel.cs" id="1_tfcrp"] [ext_resource type="Texture2D" uid="uid://b67i86mtqrn32" path="res://resource/sprite/ui/roomUI/icon_bullet.png" id="2_ruc0p"] @@ -15,6 +15,7 @@ [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="12_fgyob"] [ext_resource type="Texture2D" uid="uid://dwysndc5ffski" path="res://resource/sprite/ui/roomUI/ChargeProgressBar.png" id="13_6w7qi"] [ext_resource type="Texture2D" uid="uid://ck0w7at3oat5" path="res://resource/sprite/ui/roomUI/ChargeProgress.png" id="13_vuglj"] +[ext_resource type="PackedScene" uid="uid://dqajn31a4b0f8" path="res://prefab/ui/RoomMap.tscn" id="16_rp3sg"] [sub_resource type="Gradient" id="1"] colors = PackedColorArray(0.4, 0.498039, 1, 1, 0.4, 0.498039, 1, 0.313726) @@ -33,6 +34,8 @@ shader_parameter/show_outline = true shader_parameter/outline_color = Color(0.941176, 0.941176, 0.941176, 1) shader_parameter/outline_rainbow = false +shader_parameter/outline_use_blend = true +shader_parameter/grey = 0.0 [sub_resource type="ShaderMaterial" id="ShaderMaterial_7pkeh"] resource_local_to_scene = true @@ -43,6 +46,8 @@ shader_parameter/show_outline = true shader_parameter/outline_color = Color(0.941176, 0.941176, 0.941176, 1) shader_parameter/outline_rainbow = false +shader_parameter/outline_use_blend = true +shader_parameter/grey = 0.0 [node name="RoomUI" type="Control"] layout_mode = 3 @@ -332,3 +337,8 @@ text = "30/90" horizontal_alignment = 2 vertical_alignment = 1 + +[node name="RoomMap" parent="." instance=ExtResource("16_rp3sg")] +layout_mode = 1 +grow_horizontal = 2 +grow_vertical = 2 diff --git a/DungeonShooting_Godot/project.godot b/DungeonShooting_Godot/project.godot index 5da264c..c6253cf 100644 --- a/DungeonShooting_Godot/project.godot +++ b/DungeonShooting_Godot/project.godot @@ -187,6 +187,11 @@ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":122,"echo":false,"script":null) ] } +map={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194326,"key_label":0,"unicode":0,"echo":false,"script":null) +] +} [layer_names] diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index d9c70b4..45be278 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -1345,7 +1345,11 @@ public void CalcShadowTransform() { //偏移 - ShadowSprite.Offset = AnimatedSprite.Offset; + if (!IsCustomShadowSprite) + { + ShadowSprite.Offset = AnimatedSprite.Offset; + } + //缩放 ShadowSprite.Scale = AnimatedSprite.Scale; //阴影角度 diff --git a/DungeonShooting_Godot/src/game/manager/InputManager.cs b/DungeonShooting_Godot/src/game/manager/InputManager.cs index f143b97..f492a66 100644 --- a/DungeonShooting_Godot/src/game/manager/InputManager.cs +++ b/DungeonShooting_Godot/src/game/manager/InputManager.cs @@ -98,5 +98,6 @@ UseActiveProp = Input.IsActionJustPressed("useActiveProp"); RemoveProp = Input.IsActionJustPressed("removeProp"); ExchangeProp = Input.IsActionJustPressed("exchangeProp"); + Map = Input.IsActionJustPressed("map"); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index 786c7e5..167ca03 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -77,6 +77,7 @@ public const string prefab_ui_MapEditorSelectObject_tscn = "res://prefab/ui/MapEditorSelectObject.tscn"; public const string prefab_ui_MapEditorTools_tscn = "res://prefab/ui/MapEditorTools.tscn"; public const string prefab_ui_PauseMenu_tscn = "res://prefab/ui/PauseMenu.tscn"; + public const string prefab_ui_RoomMap_tscn = "res://prefab/ui/RoomMap.tscn"; public const string prefab_ui_RoomUI_tscn = "res://prefab/ui/RoomUI.tscn"; public const string prefab_ui_Setting_tscn = "res://prefab/ui/Setting.tscn"; public const string prefab_ui_Settlement_tscn = "res://prefab/ui/Settlement.tscn"; diff --git a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs index f6a415b..f08c798 100644 --- a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs +++ b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs @@ -24,6 +24,7 @@ public const string MapEditorSelectObject = "MapEditorSelectObject"; public const string MapEditorTools = "MapEditorTools"; public const string PauseMenu = "PauseMenu"; + public const string RoomMap = "RoomMap"; public const string RoomUI = "RoomUI"; public const string Setting = "Setting"; public const string Settlement = "Settlement"; @@ -894,6 +895,54 @@ } /// + /// 创建 RoomMap, 并返回UI实例, 该函数不会打开 Ui + /// + public static UI.RoomMap.RoomMapPanel Create_RoomMap() + { + return CreateUi(UiName.RoomMap); + } + + /// + /// 打开 RoomMap, 并返回UI实例 + /// + public static UI.RoomMap.RoomMapPanel Open_RoomMap() + { + return OpenUi(UiName.RoomMap); + } + + /// + /// 隐藏 RoomMap 的所有实例 + /// + public static void Hide_RoomMap() + { + var uiInstance = Get_RoomMap_Instance(); + foreach (var uiPanel in uiInstance) + { + uiPanel.HideUi(); + } + } + + /// + /// 销毁 RoomMap 的所有实例 + /// + public static void Destroy_RoomMap() + { + var uiInstance = Get_RoomMap_Instance(); + foreach (var uiPanel in uiInstance) + { + uiPanel.Destroy(); + } + } + + /// + /// 获取所有 RoomMap 的实例, 如果没有实例, 则返回一个空数组 + /// + public static UI.RoomMap.RoomMapPanel[] Get_RoomMap_Instance() + { + return GetUiInstance(nameof(UI.RoomMap.RoomMap)); + } + + /// /// 创建 RoomUI, 并返回UI实例, 该函数不会打开 Ui /// public static UI.RoomUI.RoomUIPanel Create_RoomUI() diff --git a/DungeonShooting_Godot/src/game/ui/roomMap/RoomMap.cs b/DungeonShooting_Godot/src/game/ui/roomMap/RoomMap.cs new file mode 100644 index 0000000..a48ca30 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/roomMap/RoomMap.cs @@ -0,0 +1,46 @@ +namespace UI.RoomMap; + +/// +/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失 +/// +public abstract partial class RoomMap : UiBase +{ + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomMap.Bg + /// + public Bg L_Bg + { + get + { + if (_L_Bg == null) _L_Bg = new Bg((RoomMapPanel)this, GetNode("Bg")); + return _L_Bg; + } + } + private Bg _L_Bg; + + + public RoomMap() : base(nameof(RoomMap)) + { + } + + public sealed override void OnInitNestedUi() + { + + } + + /// + /// 类型: , 路径: RoomMap.Bg + /// + public class Bg : UiNode + { + public Bg(RoomMapPanel uiPanel, Godot.ColorRect node) : base(uiPanel, node) { } + public override Bg Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate()); + } + + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomMap.Bg + /// + public Bg S_Bg => L_Bg; + +} diff --git a/DungeonShooting_Godot/src/game/ui/roomMap/RoomMapPanel.cs b/DungeonShooting_Godot/src/game/ui/roomMap/RoomMapPanel.cs new file mode 100644 index 0000000..5e06dad --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/roomMap/RoomMapPanel.cs @@ -0,0 +1,18 @@ +using Godot; + +namespace UI.RoomMap; + +public partial class RoomMapPanel : RoomMap +{ + + public override void OnCreateUi() + { + + } + + public override void OnDestroyUi() + { + + } + +} diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/ActivePropBar.cs b/DungeonShooting_Godot/src/game/ui/roomUI/ActivePropBar.cs deleted file mode 100644 index e56f99c..0000000 --- a/DungeonShooting_Godot/src/game/ui/roomUI/ActivePropBar.cs +++ /dev/null @@ -1,204 +0,0 @@ -using Godot; - -namespace UI.RoomUI; - -public class ActivePropBar -{ - private RoomUI.RoomUI_ActivePropBar _activePropBar; - private ShaderMaterial _shaderMaterial; - private Vector2 _startCooldownPos; - private Vector2 _startCooldownSize; - private Vector2 _startChargePos; - private Rect2 _startChargeRect; - - private bool _initCooldown = false; - - public ActivePropBar(RoomUI.RoomUI_ActivePropBar activePropBar) - { - _activePropBar = activePropBar; - _shaderMaterial = (ShaderMaterial)_activePropBar.L_ActivePropSprite.Instance.Material; - _startCooldownPos = _activePropBar.L_CooldownProgress.Instance.Position; - _startCooldownSize = _activePropBar.L_CooldownProgress.Instance.Scale; - _startChargePos = _activePropBar.L_ChargeProgress.Instance.Position; - _startChargeRect = _activePropBar.L_ChargeProgress.Instance.RegionRect; - - SetActivePropTexture(null); - SetChargeProgress(1); - } - - public void OnShow() - { - - } - - public void OnHide() - { - - } - - public void Process(float delta) - { - var prop = Player.Current?.ActivePropsPack.ActiveItem; - if (prop != null) - { - SetActivePropCount(prop.Count); - SetActivePropTexture(prop.GetCurrentTexture()); - - //是否可以使用该道具 - if (prop.CheckUse()) - { - _shaderMaterial.SetShaderParameter("schedule", 0); - } - else - { - _shaderMaterial.SetShaderParameter("schedule", 0.6f); - } - - //冷却 - SetCooldownProgress(prop.GetCooldownProgress()); - - //充能进度 - SetChargeProgress(prop.ChargeProgress); - } - else - { - SetActivePropTexture(null); - } - } - - /// - /// 设置道具图标 - /// - public void SetActivePropTexture(Texture2D texture) - { - if (texture != null) - { - _activePropBar.L_ActivePropSprite.Instance.Texture = texture; - _activePropBar.Instance.Visible = true; - } - else - { - _activePropBar.Instance.Visible = false; - } - } - - /// - /// 设置道具数量 - /// - public void SetActivePropCount(int count) - { - if (count > 1) - { - _activePropBar.L_ActivePropCount.Instance.Visible = true; - _activePropBar.L_ActivePropCount.Instance.Text = count.ToString(); - } - else - { - _activePropBar.L_ActivePropCount.Instance.Visible = false; - } - } - - /// - /// 设置道具冷却进度 - /// - /// 进度: 0 - 1 - public void SetCooldownProgress(float progress) - { - progress = 1 - progress; - var colorRect = _activePropBar.L_CooldownProgress.Instance; - if (progress <= 0) - { - colorRect.Visible = false; - } - else - { - colorRect.Visible = true; - - //调整蒙板高度 - var rect = colorRect.RegionRect; - var size = rect.Size; - size.Y = progress; - rect.Size = size; - colorRect.RegionRect = rect; - - //调整蒙板位置 - var height = _startCooldownSize.Y * progress; - var position = colorRect.Position; - position.Y = _startCooldownPos.Y + (_startCooldownSize.Y - height); - colorRect.Position = position; - } - } - - /// - /// 设置充能进度条是否显示 - /// - public void SetChargeProgressVisible(bool visible) - { - var ninePatchRect = _activePropBar.L_ChargeProgressBar.Instance; - _activePropBar.L_ChargeProgress.Instance.Visible = visible; - if (ninePatchRect.Visible == visible && _initCooldown) - { - return; - } - - _initCooldown = true; - - var sprite = _activePropBar.L_CooldownProgress.Instance; - ninePatchRect.Visible = visible; - //调整冷却蒙板大小 - if (visible) - { - var rect = ninePatchRect.GetRect(); - - var position = sprite.Position; - position.X = _startCooldownPos.X + rect.Size.X - 1; - sprite.Position = position; - - var scale = sprite.Scale; - scale.X = _startCooldownSize.X - rect.Size.X + 1; - sprite.Scale = scale; - } - else - { - sprite.Position = _startCooldownPos; - sprite.Scale = _startCooldownSize; - } - } - - /// - /// 设置充能进度 - /// - /// 进度: 0 - 1 - public void SetChargeProgress(float progress) - { - if (progress >= 1) - { - SetChargeProgressVisible(false); - } - else - { - SetChargeProgressVisible(true); - - var height = _startChargeRect.Size.Y * progress; - var rectY = _startChargeRect.Size.Y * (1 - progress); - var posY = _startChargePos.Y + rectY; - - var sprite = _activePropBar.L_ChargeProgress.Instance; - - var position = sprite.Position; - position.Y = posY; - sprite.Position = position; - - var rect = sprite.RegionRect; - var rectPosition = rect.Position; - rectPosition.Y = rectY; - rect.Position = rectPosition; - - var rectSize = rect.Size; - rectSize.Y = height; - rect.Size = rectSize; - - sprite.RegionRect = rect; - } - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/ActivePropBarHandler.cs b/DungeonShooting_Godot/src/game/ui/roomUI/ActivePropBarHandler.cs new file mode 100644 index 0000000..f01ec1b --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/roomUI/ActivePropBarHandler.cs @@ -0,0 +1,204 @@ +using Godot; + +namespace UI.RoomUI; + +public class ActivePropBarHandler +{ + private RoomUI.ActivePropBar _activePropBar; + private ShaderMaterial _shaderMaterial; + private Vector2 _startCooldownPos; + private Vector2 _startCooldownSize; + private Vector2 _startChargePos; + private Rect2 _startChargeRect; + + private bool _initCooldown = false; + + public ActivePropBarHandler(RoomUI.ActivePropBar activePropBar) + { + _activePropBar = activePropBar; + _shaderMaterial = (ShaderMaterial)_activePropBar.L_ActivePropSprite.Instance.Material; + _startCooldownPos = _activePropBar.L_CooldownProgress.Instance.Position; + _startCooldownSize = _activePropBar.L_CooldownProgress.Instance.Scale; + _startChargePos = _activePropBar.L_ChargeProgress.Instance.Position; + _startChargeRect = _activePropBar.L_ChargeProgress.Instance.RegionRect; + + SetActivePropTexture(null); + SetChargeProgress(1); + } + + public void OnShow() + { + + } + + public void OnHide() + { + + } + + public void Process(float delta) + { + var prop = Player.Current?.ActivePropsPack.ActiveItem; + if (prop != null) + { + SetActivePropCount(prop.Count); + SetActivePropTexture(prop.GetCurrentTexture()); + + //是否可以使用该道具 + if (prop.CheckUse()) + { + _shaderMaterial.SetShaderParameter("schedule", 0); + } + else + { + _shaderMaterial.SetShaderParameter("schedule", 0.6f); + } + + //冷却 + SetCooldownProgress(prop.GetCooldownProgress()); + + //充能进度 + SetChargeProgress(prop.ChargeProgress); + } + else + { + SetActivePropTexture(null); + } + } + + /// + /// 设置道具图标 + /// + public void SetActivePropTexture(Texture2D texture) + { + if (texture != null) + { + _activePropBar.L_ActivePropSprite.Instance.Texture = texture; + _activePropBar.Instance.Visible = true; + } + else + { + _activePropBar.Instance.Visible = false; + } + } + + /// + /// 设置道具数量 + /// + public void SetActivePropCount(int count) + { + if (count > 1) + { + _activePropBar.L_ActivePropCount.Instance.Visible = true; + _activePropBar.L_ActivePropCount.Instance.Text = count.ToString(); + } + else + { + _activePropBar.L_ActivePropCount.Instance.Visible = false; + } + } + + /// + /// 设置道具冷却进度 + /// + /// 进度: 0 - 1 + public void SetCooldownProgress(float progress) + { + progress = 1 - progress; + var colorRect = _activePropBar.L_CooldownProgress.Instance; + if (progress <= 0) + { + colorRect.Visible = false; + } + else + { + colorRect.Visible = true; + + //调整蒙板高度 + var rect = colorRect.RegionRect; + var size = rect.Size; + size.Y = progress; + rect.Size = size; + colorRect.RegionRect = rect; + + //调整蒙板位置 + var height = _startCooldownSize.Y * progress; + var position = colorRect.Position; + position.Y = _startCooldownPos.Y + (_startCooldownSize.Y - height); + colorRect.Position = position; + } + } + + /// + /// 设置充能进度条是否显示 + /// + public void SetChargeProgressVisible(bool visible) + { + var ninePatchRect = _activePropBar.L_ChargeProgressBar.Instance; + _activePropBar.L_ChargeProgress.Instance.Visible = visible; + if (ninePatchRect.Visible == visible && _initCooldown) + { + return; + } + + _initCooldown = true; + + var sprite = _activePropBar.L_CooldownProgress.Instance; + ninePatchRect.Visible = visible; + //调整冷却蒙板大小 + if (visible) + { + var rect = ninePatchRect.GetRect(); + + var position = sprite.Position; + position.X = _startCooldownPos.X + rect.Size.X - 1; + sprite.Position = position; + + var scale = sprite.Scale; + scale.X = _startCooldownSize.X - rect.Size.X + 1; + sprite.Scale = scale; + } + else + { + sprite.Position = _startCooldownPos; + sprite.Scale = _startCooldownSize; + } + } + + /// + /// 设置充能进度 + /// + /// 进度: 0 - 1 + public void SetChargeProgress(float progress) + { + if (progress >= 1) + { + SetChargeProgressVisible(false); + } + else + { + SetChargeProgressVisible(true); + + var height = _startChargeRect.Size.Y * progress; + var rectY = _startChargeRect.Size.Y * (1 - progress); + var posY = _startChargePos.Y + rectY; + + var sprite = _activePropBar.L_ChargeProgress.Instance; + + var position = sprite.Position; + position.Y = posY; + sprite.Position = position; + + var rect = sprite.RegionRect; + var rectPosition = rect.Position; + rectPosition.Y = rectY; + rect.Position = rectPosition; + + var rectSize = rect.Size; + rectSize.Y = height; + rect.Size = rectSize; + + sprite.RegionRect = rect; + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBar.cs b/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBar.cs deleted file mode 100644 index 3dd9265..0000000 --- a/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBar.cs +++ /dev/null @@ -1,92 +0,0 @@ -using Godot; - -namespace UI.RoomUI; - -/// -/// 互动提示文本 -/// -public class InteractiveTipBar -{ - private RoomUI.RoomUI_InteractiveTipBar _interactiveTipBar; - private EventBinder _binder; - private ActivityObject _interactiveTarget; - - public InteractiveTipBar(RoomUI.RoomUI_InteractiveTipBar interactiveTipBar) - { - interactiveTipBar.Instance.Visible = false; - _interactiveTipBar = interactiveTipBar; - } - - public void OnShow() - { - GameCamera.Main.OnPositionUpdateEvent += OnCameraPositionUpdate; - _binder = EventManager.AddEventListener(EventEnum.OnPlayerChangeInteractiveItem, OnPlayerChangeInteractiveItem); - } - - public void OnHide() - { - GameCamera.Main.OnPositionUpdateEvent -= OnCameraPositionUpdate; - _binder.RemoveEventListener(); - _binder = null; - } - - /// - /// 隐藏互动提示ui - /// - public void HideBar() - { - _interactiveTipBar.Instance.Visible = false; - } - - /// - /// 显示互动提示ui - /// - /// 所在坐标 - /// 显示文本 - /// 显示图标 - public void ShowBar(ActivityObject target, string showText, Texture2D icon) - { - _interactiveTipBar.Instance.GlobalPosition = GameApplication.Instance.ViewToGlobalPosition(_interactiveTarget.GlobalPosition); - _interactiveTipBar.L_Icon.Instance.Texture = icon; - _interactiveTipBar.Instance.Visible = true; - _interactiveTipBar.L_NameLabel.Instance.Text = showText; - } - - public void OnPlayerChangeInteractiveItem(object o) - { - if (o == null) - { - _interactiveTarget = null; - //隐藏互动提示 - HideBar(); - } - else - { - var result = (CheckInteractiveResult)o; - var interactiveItem = Player.Current.InteractiveItem; - //if (interactiveItem is Weapon) - var icon = result.GetIcon(); - if (icon != null) - { - _interactiveTarget = interactiveItem; - //显示互动提示 - ShowBar(result.Target, result.Target.ActivityBase.Name, icon); - } - else - { - _interactiveTarget = null; - } - } - } - - /// - /// 相机更新回调 - /// - public void OnCameraPositionUpdate(float delta) - { - if (_interactiveTarget != null) - { - _interactiveTipBar.Instance.GlobalPosition = GameApplication.Instance.ViewToGlobalPosition(_interactiveTarget.GlobalPosition); - } - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBarHandler.cs b/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBarHandler.cs new file mode 100644 index 0000000..205d689 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBarHandler.cs @@ -0,0 +1,92 @@ +using Godot; + +namespace UI.RoomUI; + +/// +/// 互动提示文本 +/// +public class InteractiveTipBarHandler +{ + private RoomUI.InteractiveTipBar _interactiveTipBar; + private EventBinder _binder; + private ActivityObject _interactiveTarget; + + public InteractiveTipBarHandler(RoomUI.InteractiveTipBar interactiveTipBar) + { + interactiveTipBar.Instance.Visible = false; + _interactiveTipBar = interactiveTipBar; + } + + public void OnShow() + { + GameCamera.Main.OnPositionUpdateEvent += OnCameraPositionUpdate; + _binder = EventManager.AddEventListener(EventEnum.OnPlayerChangeInteractiveItem, OnPlayerChangeInteractiveItem); + } + + public void OnHide() + { + GameCamera.Main.OnPositionUpdateEvent -= OnCameraPositionUpdate; + _binder.RemoveEventListener(); + _binder = null; + } + + /// + /// 隐藏互动提示ui + /// + public void HideBar() + { + _interactiveTipBar.Instance.Visible = false; + } + + /// + /// 显示互动提示ui + /// + /// 所在坐标 + /// 显示文本 + /// 显示图标 + public void ShowBar(ActivityObject target, string showText, Texture2D icon) + { + _interactiveTipBar.Instance.GlobalPosition = GameApplication.Instance.ViewToGlobalPosition(_interactiveTarget.GlobalPosition); + _interactiveTipBar.L_Icon.Instance.Texture = icon; + _interactiveTipBar.Instance.Visible = true; + _interactiveTipBar.L_NameLabel.Instance.Text = showText; + } + + public void OnPlayerChangeInteractiveItem(object o) + { + if (o == null) + { + _interactiveTarget = null; + //隐藏互动提示 + HideBar(); + } + else + { + var result = (CheckInteractiveResult)o; + var interactiveItem = Player.Current.InteractiveItem; + //if (interactiveItem is Weapon) + var icon = result.GetIcon(); + if (icon != null) + { + _interactiveTarget = interactiveItem; + //显示互动提示 + ShowBar(result.Target, result.Target.ActivityBase.Name, icon); + } + else + { + _interactiveTarget = null; + } + } + } + + /// + /// 相机更新回调 + /// + public void OnCameraPositionUpdate(float delta) + { + if (_interactiveTarget != null) + { + _interactiveTipBar.Instance.GlobalPosition = GameApplication.Instance.ViewToGlobalPosition(_interactiveTarget.GlobalPosition); + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs b/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs deleted file mode 100644 index f3dcbf3..0000000 --- a/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System.Collections.Generic; -using Godot; - -namespace UI.RoomUI; - -public class LifeBar -{ - - private RoomUI.RoomUI_LifeBar _bar; - private UiGrid _grid; - private EventFactory _eventFactory; - private bool _refreshFlag = false; - - public LifeBar(RoomUI.RoomUI_LifeBar lifeBar) - { - _bar = lifeBar; - var uiNodeLife = lifeBar.L_Life; - - _grid = new UiGrid(uiNodeLife, typeof(LifeCell)); - _grid.SetColumns(20); - _grid.SetCellOffset(new Vector2I(1, 2)); - } - - public void OnShow() - { - _eventFactory = EventManager.CreateEventFactory(); - _eventFactory.AddEventListener(EventEnum.OnPlayerHpChange, o => RefreshLife()); - _eventFactory.AddEventListener(EventEnum.OnPlayerMaxHpChange, o => RefreshLife()); - _eventFactory.AddEventListener(EventEnum.OnPlayerShieldChange, o => RefreshLife()); - _eventFactory.AddEventListener(EventEnum.OnPlayerMaxShieldChange, o => RefreshLife()); - RefreshLife(); - } - - public void OnHide() - { - _eventFactory.RemoveAllEventListener(); - } - - public void Process(float delta) - { - if (_refreshFlag) - { - _refreshFlag = false; - HandlerRefreshLife(); - } - } - - public void RefreshLife() - { - _refreshFlag = true; - } - - private void HandlerRefreshLife() - { - var player = Player.Current; - if (player.MaxHp % 2 != 0) - { - Debug.LogError("玩家血量不是偶数!"); - } - - var list = new List(); - for (var i = 0; i < player.MaxHp / 2; i++) - { - if (player.Hp >= i * 2 + 2) - { - list.Add(LifeIconEnum.FullHeart); - } - else if (player.Hp >= i * 2 + 1) - { - list.Add(LifeIconEnum.HalfHeart); - } - else - { - list.Add(LifeIconEnum.EmptyHeart); - } - } - - for (var i = 0; i < player.MaxShield; i++) - { - if (player.Shield >= i + 1) - { - list.Add(LifeIconEnum.FullShield); - } - else - { - list.Add(LifeIconEnum.EmptyShield); - } - } - - //var maxHp - _grid.SetDataList(list.ToArray()); - } - -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/LifeBarHandler.cs b/DungeonShooting_Godot/src/game/ui/roomUI/LifeBarHandler.cs new file mode 100644 index 0000000..3bc3dd4 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/roomUI/LifeBarHandler.cs @@ -0,0 +1,94 @@ +using System.Collections.Generic; +using Godot; + +namespace UI.RoomUI; + +public class LifeBarHandler +{ + + private RoomUI.LifeBar _bar; + private UiGrid _grid; + private EventFactory _eventFactory; + private bool _refreshFlag = false; + + public LifeBarHandler(RoomUI.LifeBar lifeBar) + { + _bar = lifeBar; + var uiNodeLife = lifeBar.L_Life; + + _grid = new UiGrid(uiNodeLife, typeof(LifeCell)); + _grid.SetColumns(20); + _grid.SetCellOffset(new Vector2I(1, 2)); + } + + public void OnShow() + { + _eventFactory = EventManager.CreateEventFactory(); + _eventFactory.AddEventListener(EventEnum.OnPlayerHpChange, o => RefreshLife()); + _eventFactory.AddEventListener(EventEnum.OnPlayerMaxHpChange, o => RefreshLife()); + _eventFactory.AddEventListener(EventEnum.OnPlayerShieldChange, o => RefreshLife()); + _eventFactory.AddEventListener(EventEnum.OnPlayerMaxShieldChange, o => RefreshLife()); + RefreshLife(); + } + + public void OnHide() + { + _eventFactory.RemoveAllEventListener(); + } + + public void Process(float delta) + { + if (_refreshFlag) + { + _refreshFlag = false; + HandlerRefreshLife(); + } + } + + public void RefreshLife() + { + _refreshFlag = true; + } + + private void HandlerRefreshLife() + { + var player = Player.Current; + if (player.MaxHp % 2 != 0) + { + Debug.LogError("玩家血量不是偶数!"); + } + + var list = new List(); + for (var i = 0; i < player.MaxHp / 2; i++) + { + if (player.Hp >= i * 2 + 2) + { + list.Add(LifeIconEnum.FullHeart); + } + else if (player.Hp >= i * 2 + 1) + { + list.Add(LifeIconEnum.HalfHeart); + } + else + { + list.Add(LifeIconEnum.EmptyHeart); + } + } + + for (var i = 0; i < player.MaxShield; i++) + { + if (player.Shield >= i + 1) + { + list.Add(LifeIconEnum.FullShield); + } + else + { + list.Add(LifeIconEnum.EmptyShield); + } + } + + //var maxHp + _grid.SetDataList(list.ToArray()); + } + +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/LifeCell.cs b/DungeonShooting_Godot/src/game/ui/roomUI/LifeCell.cs index 6076f4e..d549158 100644 --- a/DungeonShooting_Godot/src/game/ui/roomUI/LifeCell.cs +++ b/DungeonShooting_Godot/src/game/ui/roomUI/LifeCell.cs @@ -2,7 +2,7 @@ namespace UI.RoomUI; -public class LifeCell : UiCell +public class LifeCell : UiCell { private int _type = -1; diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/ReloadBar.cs b/DungeonShooting_Godot/src/game/ui/roomUI/ReloadBar.cs deleted file mode 100644 index bb0b00b..0000000 --- a/DungeonShooting_Godot/src/game/ui/roomUI/ReloadBar.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Godot; - -namespace UI.RoomUI; - -/// -/// 换弹进度组件 -/// -public class ReloadBar -{ - private RoomUI.RoomUI_ReloadBar _reloadBar; - private int width; - private float startX = 1; - - public ReloadBar(RoomUI.RoomUI_ReloadBar reloadBar) - { - reloadBar.Instance.Visible = false; - _reloadBar = reloadBar; - width = _reloadBar.L_Slot.Instance.Texture.GetWidth(); - //startX = -(width - 3) / 2f; - } - - public void OnShow() - { - GameCamera.Main.OnPositionUpdateEvent += OnCameraPositionUpdate; - } - - public void OnHide() - { - GameCamera.Main.OnPositionUpdateEvent -= OnCameraPositionUpdate; - } - - /// - /// 隐藏换弹进度组件 - /// - public void HideBar() - { - _reloadBar.Instance.Visible = false; - } - - /// - /// 显示换弹进度组件 - /// - /// 坐标 - /// 进度, 0 - 1 - public void ShowBar(Vector2 position, float progress) - { - _reloadBar.Instance.Visible = true; - _reloadBar.Instance.GlobalPosition = GameApplication.Instance.ViewToGlobalPosition(position); - progress = Mathf.Clamp(progress, 0, 1); - _reloadBar.L_Slot.L_Block.Instance.Position = new Vector2(startX + (width - 3) * progress, 0); - } - - /// - /// 相机更新回调 - /// - public void OnCameraPositionUpdate(float delta) - { - var player = Player.Current; - if (player.WeaponPack.ActiveItem != null && player.WeaponPack.ActiveItem.Reloading) - { - ShowBar(player.GlobalPosition, player.WeaponPack.ActiveItem.ReloadProgress); - } - else - { - HideBar(); - } - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/ReloadBarHandler.cs b/DungeonShooting_Godot/src/game/ui/roomUI/ReloadBarHandler.cs new file mode 100644 index 0000000..e44c0ff --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/roomUI/ReloadBarHandler.cs @@ -0,0 +1,68 @@ +using Godot; + +namespace UI.RoomUI; + +/// +/// 换弹进度组件 +/// +public class ReloadBarHandler +{ + private RoomUI.ReloadBar _reloadBar; + private int width; + private float startX = 1; + + public ReloadBarHandler(RoomUI.ReloadBar reloadBar) + { + reloadBar.Instance.Visible = false; + _reloadBar = reloadBar; + width = _reloadBar.L_Slot.Instance.Texture.GetWidth(); + //startX = -(width - 3) / 2f; + } + + public void OnShow() + { + GameCamera.Main.OnPositionUpdateEvent += OnCameraPositionUpdate; + } + + public void OnHide() + { + GameCamera.Main.OnPositionUpdateEvent -= OnCameraPositionUpdate; + } + + /// + /// 隐藏换弹进度组件 + /// + public void HideBar() + { + _reloadBar.Instance.Visible = false; + } + + /// + /// 显示换弹进度组件 + /// + /// 坐标 + /// 进度, 0 - 1 + public void ShowBar(Vector2 position, float progress) + { + _reloadBar.Instance.Visible = true; + _reloadBar.Instance.GlobalPosition = GameApplication.Instance.ViewToGlobalPosition(position); + progress = Mathf.Clamp(progress, 0, 1); + _reloadBar.L_Slot.L_Block.Instance.Position = new Vector2(startX + (width - 3) * progress, 0); + } + + /// + /// 相机更新回调 + /// + public void OnCameraPositionUpdate(float delta) + { + var player = Player.Current; + if (player.WeaponPack.ActiveItem != null && player.WeaponPack.ActiveItem.Reloading) + { + ShowBar(player.GlobalPosition, player.WeaponPack.ActiveItem.ReloadProgress); + } + else + { + HideBar(); + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs index 6085846..2aa8ce3 100644 --- a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs +++ b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs @@ -8,655 +8,699 @@ /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.InteractiveTipBar /// - public RoomUI_InteractiveTipBar L_InteractiveTipBar + public InteractiveTipBar L_InteractiveTipBar { get { - if (_L_InteractiveTipBar == null) _L_InteractiveTipBar = new RoomUI_InteractiveTipBar(this, GetNodeOrNull("InteractiveTipBar")); + if (_L_InteractiveTipBar == null) _L_InteractiveTipBar = new InteractiveTipBar((RoomUIPanel)this, GetNode("InteractiveTipBar")); return _L_InteractiveTipBar; } } - private RoomUI_InteractiveTipBar _L_InteractiveTipBar; + private InteractiveTipBar _L_InteractiveTipBar; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.ReloadBar /// - public RoomUI_ReloadBar L_ReloadBar + public ReloadBar L_ReloadBar { get { - if (_L_ReloadBar == null) _L_ReloadBar = new RoomUI_ReloadBar(this, GetNodeOrNull("ReloadBar")); + if (_L_ReloadBar == null) _L_ReloadBar = new ReloadBar((RoomUIPanel)this, GetNode("ReloadBar")); return _L_ReloadBar; } } - private RoomUI_ReloadBar _L_ReloadBar; + private ReloadBar _L_ReloadBar; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control /// - public RoomUI_Control L_Control + public Control L_Control { get { - if (_L_Control == null) _L_Control = new RoomUI_Control(this, GetNodeOrNull("Control")); + if (_L_Control == null) _L_Control = new Control((RoomUIPanel)this, GetNode("Control")); return _L_Control; } } - private RoomUI_Control _L_Control; + private Control _L_Control; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.RoomMap + /// + public RoomMap L_RoomMap + { + get + { + if (_L_RoomMap == null) _L_RoomMap = new RoomMap((RoomUIPanel)this, GetNode("RoomMap")); + return _L_RoomMap; + } + } + private RoomMap _L_RoomMap; public RoomUI() : base(nameof(RoomUI)) { } + public sealed override void OnInitNestedUi() + { + + var inst1 = this; + RecordNestedUi(inst1.L_RoomMap.Instance, null, UiManager.RecordType.Open); + inst1.L_RoomMap.Instance.OnCreateUi(); + inst1.L_RoomMap.Instance.OnInitNestedUi(); + + } + /// /// 类型: , 路径: RoomUI.InteractiveTipBar.Icon /// - public class RoomUI_Icon : UiNode + public class Icon : UiNode { - public RoomUI_Icon(RoomUI uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } - public override RoomUI_Icon Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + public Icon(RoomUIPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override Icon Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.InteractiveTipBar.InteractiveIcon /// - public class RoomUI_InteractiveIcon : UiNode + public class InteractiveIcon : UiNode { - public RoomUI_InteractiveIcon(RoomUI uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } - public override RoomUI_InteractiveIcon Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + public InteractiveIcon(RoomUIPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override InteractiveIcon Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.InteractiveTipBar.Line2D /// - public class RoomUI_Line2D : UiNode + public class Line2D : UiNode { - public RoomUI_Line2D(RoomUI uiPanel, Godot.Line2D node) : base(uiPanel, node) { } - public override RoomUI_Line2D Clone() => new (UiPanel, (Godot.Line2D)Instance.Duplicate()); + public Line2D(RoomUIPanel uiPanel, Godot.Line2D node) : base(uiPanel, node) { } + public override Line2D Clone() => new (UiPanel, (Godot.Line2D)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.InteractiveTipBar.NameLabel /// - public class RoomUI_NameLabel : UiNode + public class NameLabel : UiNode { - public RoomUI_NameLabel(RoomUI uiPanel, Godot.Label node) : base(uiPanel, node) { } - public override RoomUI_NameLabel Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + public NameLabel(RoomUIPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override NameLabel Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.InteractiveTipBar /// - public class RoomUI_InteractiveTipBar : UiNode + public class InteractiveTipBar : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Icon /// - public RoomUI_Icon L_Icon + public Icon L_Icon { get { - if (_L_Icon == null) _L_Icon = new RoomUI_Icon(UiPanel, Instance.GetNodeOrNull("Icon")); + if (_L_Icon == null) _L_Icon = new Icon(UiPanel, Instance.GetNode("Icon")); return _L_Icon; } } - private RoomUI_Icon _L_Icon; + private Icon _L_Icon; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.InteractiveIcon /// - public RoomUI_InteractiveIcon L_InteractiveIcon + public InteractiveIcon L_InteractiveIcon { get { - if (_L_InteractiveIcon == null) _L_InteractiveIcon = new RoomUI_InteractiveIcon(UiPanel, Instance.GetNodeOrNull("InteractiveIcon")); + if (_L_InteractiveIcon == null) _L_InteractiveIcon = new InteractiveIcon(UiPanel, Instance.GetNode("InteractiveIcon")); return _L_InteractiveIcon; } } - private RoomUI_InteractiveIcon _L_InteractiveIcon; + private InteractiveIcon _L_InteractiveIcon; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Line2D /// - public RoomUI_Line2D L_Line2D + public Line2D L_Line2D { get { - if (_L_Line2D == null) _L_Line2D = new RoomUI_Line2D(UiPanel, Instance.GetNodeOrNull("Line2D")); + if (_L_Line2D == null) _L_Line2D = new Line2D(UiPanel, Instance.GetNode("Line2D")); return _L_Line2D; } } - private RoomUI_Line2D _L_Line2D; + private Line2D _L_Line2D; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.NameLabel /// - public RoomUI_NameLabel L_NameLabel + public NameLabel L_NameLabel { get { - if (_L_NameLabel == null) _L_NameLabel = new RoomUI_NameLabel(UiPanel, Instance.GetNodeOrNull("NameLabel")); + if (_L_NameLabel == null) _L_NameLabel = new NameLabel(UiPanel, Instance.GetNode("NameLabel")); return _L_NameLabel; } } - private RoomUI_NameLabel _L_NameLabel; + private NameLabel _L_NameLabel; - public RoomUI_InteractiveTipBar(RoomUI uiPanel, Godot.Control node) : base(uiPanel, node) { } - public override RoomUI_InteractiveTipBar Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate()); + public InteractiveTipBar(RoomUIPanel uiPanel, Godot.Control node) : base(uiPanel, node) { } + public override InteractiveTipBar Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.ReloadBar.Slot.Block /// - public class RoomUI_Block : UiNode + public class Block : UiNode { - public RoomUI_Block(RoomUI uiPanel, Godot.Sprite2D node) : base(uiPanel, node) { } - public override RoomUI_Block Clone() => new (UiPanel, (Godot.Sprite2D)Instance.Duplicate()); + public Block(RoomUIPanel uiPanel, Godot.Sprite2D node) : base(uiPanel, node) { } + public override Block Clone() => new (UiPanel, (Godot.Sprite2D)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.ReloadBar.Slot /// - public class RoomUI_Slot : UiNode + public class Slot : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.ReloadBar.Block /// - public RoomUI_Block L_Block + public Block L_Block { get { - if (_L_Block == null) _L_Block = new RoomUI_Block(UiPanel, Instance.GetNodeOrNull("Block")); + if (_L_Block == null) _L_Block = new Block(UiPanel, Instance.GetNode("Block")); return _L_Block; } } - private RoomUI_Block _L_Block; + private Block _L_Block; - public RoomUI_Slot(RoomUI uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } - public override RoomUI_Slot Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + public Slot(RoomUIPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override Slot Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.ReloadBar /// - public class RoomUI_ReloadBar : UiNode + public class ReloadBar : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Slot /// - public RoomUI_Slot L_Slot + public Slot L_Slot { get { - if (_L_Slot == null) _L_Slot = new RoomUI_Slot(UiPanel, Instance.GetNodeOrNull("Slot")); + if (_L_Slot == null) _L_Slot = new Slot(UiPanel, Instance.GetNode("Slot")); return _L_Slot; } } - private RoomUI_Slot _L_Slot; + private Slot _L_Slot; - public RoomUI_ReloadBar(RoomUI uiPanel, Godot.Control node) : base(uiPanel, node) { } - public override RoomUI_ReloadBar Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate()); + public ReloadBar(RoomUIPanel uiPanel, Godot.Control node) : base(uiPanel, node) { } + public override ReloadBar Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.LifeBar.Life /// - public class RoomUI_Life : UiNode + public class Life : UiNode { - public RoomUI_Life(RoomUI uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } - public override RoomUI_Life Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + public Life(RoomUIPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override Life Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.LifeBar /// - public class RoomUI_LifeBar : UiNode + public class LifeBar : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.Life /// - public RoomUI_Life L_Life + public Life L_Life { get { - if (_L_Life == null) _L_Life = new RoomUI_Life(UiPanel, Instance.GetNodeOrNull("Life")); + if (_L_Life == null) _L_Life = new Life(UiPanel, Instance.GetNode("Life")); return _L_Life; } } - private RoomUI_Life _L_Life; + private Life _L_Life; - public RoomUI_LifeBar(RoomUI uiPanel, Godot.Control node) : base(uiPanel, node) { } - public override RoomUI_LifeBar Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate()); + public LifeBar(RoomUIPanel uiPanel, Godot.Control node) : base(uiPanel, node) { } + public override LifeBar Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.MapBar /// - public class RoomUI_MapBar : UiNode + public class MapBar : UiNode { - public RoomUI_MapBar(RoomUI uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } - public override RoomUI_MapBar Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + public MapBar(RoomUIPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override MapBar Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.ActivePropBar.ActivePropBg /// - public class RoomUI_ActivePropBg : UiNode + public class ActivePropBg : UiNode { - public RoomUI_ActivePropBg(RoomUI uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } - public override RoomUI_ActivePropBg Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); + public ActivePropBg(RoomUIPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } + public override ActivePropBg Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.ActivePropBar.ActivePropSprite /// - public class RoomUI_ActivePropSprite : UiNode + public class ActivePropSprite : UiNode { - public RoomUI_ActivePropSprite(RoomUI uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } - public override RoomUI_ActivePropSprite Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + public ActivePropSprite(RoomUIPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override ActivePropSprite Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.ActivePropBar.CooldownProgress /// - public class RoomUI_CooldownProgress : UiNode + public class CooldownProgress : UiNode { - public RoomUI_CooldownProgress(RoomUI uiPanel, Godot.Sprite2D node) : base(uiPanel, node) { } - public override RoomUI_CooldownProgress Clone() => new (UiPanel, (Godot.Sprite2D)Instance.Duplicate()); + public CooldownProgress(RoomUIPanel uiPanel, Godot.Sprite2D node) : base(uiPanel, node) { } + public override CooldownProgress Clone() => new (UiPanel, (Godot.Sprite2D)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.ActivePropBar.ActivePropCount /// - public class RoomUI_ActivePropCount : UiNode + public class ActivePropCount : UiNode { - public RoomUI_ActivePropCount(RoomUI uiPanel, Godot.Label node) : base(uiPanel, node) { } - public override RoomUI_ActivePropCount Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + public ActivePropCount(RoomUIPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override ActivePropCount Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.ActivePropBar.ActivePropPanel /// - public class RoomUI_ActivePropPanel : UiNode + public class ActivePropPanel : UiNode { - public RoomUI_ActivePropPanel(RoomUI uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } - public override RoomUI_ActivePropPanel Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); + public ActivePropPanel(RoomUIPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } + public override ActivePropPanel Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.ActivePropBar.ChargeProgressBar /// - public class RoomUI_ChargeProgressBar : UiNode + public class ChargeProgressBar : UiNode { - public RoomUI_ChargeProgressBar(RoomUI uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } - public override RoomUI_ChargeProgressBar Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); + public ChargeProgressBar(RoomUIPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } + public override ChargeProgressBar Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.ActivePropBar.ChargeProgress /// - public class RoomUI_ChargeProgress : UiNode + public class ChargeProgress : UiNode { - public RoomUI_ChargeProgress(RoomUI uiPanel, Godot.Sprite2D node) : base(uiPanel, node) { } - public override RoomUI_ChargeProgress Clone() => new (UiPanel, (Godot.Sprite2D)Instance.Duplicate()); + public ChargeProgress(RoomUIPanel uiPanel, Godot.Sprite2D node) : base(uiPanel, node) { } + public override ChargeProgress Clone() => new (UiPanel, (Godot.Sprite2D)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.ActivePropBar /// - public class RoomUI_ActivePropBar : UiNode + public class ActivePropBar : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.ActivePropBg /// - public RoomUI_ActivePropBg L_ActivePropBg + public ActivePropBg L_ActivePropBg { get { - if (_L_ActivePropBg == null) _L_ActivePropBg = new RoomUI_ActivePropBg(UiPanel, Instance.GetNodeOrNull("ActivePropBg")); + if (_L_ActivePropBg == null) _L_ActivePropBg = new ActivePropBg(UiPanel, Instance.GetNode("ActivePropBg")); return _L_ActivePropBg; } } - private RoomUI_ActivePropBg _L_ActivePropBg; + private ActivePropBg _L_ActivePropBg; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.ActivePropSprite /// - public RoomUI_ActivePropSprite L_ActivePropSprite + public ActivePropSprite L_ActivePropSprite { get { - if (_L_ActivePropSprite == null) _L_ActivePropSprite = new RoomUI_ActivePropSprite(UiPanel, Instance.GetNodeOrNull("ActivePropSprite")); + if (_L_ActivePropSprite == null) _L_ActivePropSprite = new ActivePropSprite(UiPanel, Instance.GetNode("ActivePropSprite")); return _L_ActivePropSprite; } } - private RoomUI_ActivePropSprite _L_ActivePropSprite; + private ActivePropSprite _L_ActivePropSprite; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.CooldownProgress /// - public RoomUI_CooldownProgress L_CooldownProgress + public CooldownProgress L_CooldownProgress { get { - if (_L_CooldownProgress == null) _L_CooldownProgress = new RoomUI_CooldownProgress(UiPanel, Instance.GetNodeOrNull("CooldownProgress")); + if (_L_CooldownProgress == null) _L_CooldownProgress = new CooldownProgress(UiPanel, Instance.GetNode("CooldownProgress")); return _L_CooldownProgress; } } - private RoomUI_CooldownProgress _L_CooldownProgress; + private CooldownProgress _L_CooldownProgress; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.ActivePropCount /// - public RoomUI_ActivePropCount L_ActivePropCount + public ActivePropCount L_ActivePropCount { get { - if (_L_ActivePropCount == null) _L_ActivePropCount = new RoomUI_ActivePropCount(UiPanel, Instance.GetNodeOrNull("ActivePropCount")); + if (_L_ActivePropCount == null) _L_ActivePropCount = new ActivePropCount(UiPanel, Instance.GetNode("ActivePropCount")); return _L_ActivePropCount; } } - private RoomUI_ActivePropCount _L_ActivePropCount; + private ActivePropCount _L_ActivePropCount; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.ActivePropPanel /// - public RoomUI_ActivePropPanel L_ActivePropPanel + public ActivePropPanel L_ActivePropPanel { get { - if (_L_ActivePropPanel == null) _L_ActivePropPanel = new RoomUI_ActivePropPanel(UiPanel, Instance.GetNodeOrNull("ActivePropPanel")); + if (_L_ActivePropPanel == null) _L_ActivePropPanel = new ActivePropPanel(UiPanel, Instance.GetNode("ActivePropPanel")); return _L_ActivePropPanel; } } - private RoomUI_ActivePropPanel _L_ActivePropPanel; + private ActivePropPanel _L_ActivePropPanel; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.ChargeProgressBar /// - public RoomUI_ChargeProgressBar L_ChargeProgressBar + public ChargeProgressBar L_ChargeProgressBar { get { - if (_L_ChargeProgressBar == null) _L_ChargeProgressBar = new RoomUI_ChargeProgressBar(UiPanel, Instance.GetNodeOrNull("ChargeProgressBar")); + if (_L_ChargeProgressBar == null) _L_ChargeProgressBar = new ChargeProgressBar(UiPanel, Instance.GetNode("ChargeProgressBar")); return _L_ChargeProgressBar; } } - private RoomUI_ChargeProgressBar _L_ChargeProgressBar; + private ChargeProgressBar _L_ChargeProgressBar; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.ChargeProgress /// - public RoomUI_ChargeProgress L_ChargeProgress + public ChargeProgress L_ChargeProgress { get { - if (_L_ChargeProgress == null) _L_ChargeProgress = new RoomUI_ChargeProgress(UiPanel, Instance.GetNodeOrNull("ChargeProgress")); + if (_L_ChargeProgress == null) _L_ChargeProgress = new ChargeProgress(UiPanel, Instance.GetNode("ChargeProgress")); return _L_ChargeProgress; } } - private RoomUI_ChargeProgress _L_ChargeProgress; + private ChargeProgress _L_ChargeProgress; - public RoomUI_ActivePropBar(RoomUI uiPanel, Godot.Control node) : base(uiPanel, node) { } - public override RoomUI_ActivePropBar Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate()); + public ActivePropBar(RoomUIPanel uiPanel, Godot.Control node) : base(uiPanel, node) { } + public override ActivePropBar Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.WeaponBar.WeaponPanel.WeaponSprite /// - public class RoomUI_WeaponSprite : UiNode + public class WeaponSprite : UiNode { - public RoomUI_WeaponSprite(RoomUI uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } - public override RoomUI_WeaponSprite Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + public WeaponSprite(RoomUIPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override WeaponSprite Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.WeaponBar.WeaponPanel /// - public class RoomUI_WeaponPanel : UiNode + public class WeaponPanel : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.WeaponBar.WeaponSprite /// - public RoomUI_WeaponSprite L_WeaponSprite + public WeaponSprite L_WeaponSprite { get { - if (_L_WeaponSprite == null) _L_WeaponSprite = new RoomUI_WeaponSprite(UiPanel, Instance.GetNodeOrNull("WeaponSprite")); + if (_L_WeaponSprite == null) _L_WeaponSprite = new WeaponSprite(UiPanel, Instance.GetNode("WeaponSprite")); return _L_WeaponSprite; } } - private RoomUI_WeaponSprite _L_WeaponSprite; + private WeaponSprite _L_WeaponSprite; - public RoomUI_WeaponPanel(RoomUI uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } - public override RoomUI_WeaponPanel Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); + public WeaponPanel(RoomUIPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } + public override WeaponPanel Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.WeaponBar.AmmoCount /// - public class RoomUI_AmmoCount : UiNode + public class AmmoCount : UiNode { - public RoomUI_AmmoCount(RoomUI uiPanel, Godot.Label node) : base(uiPanel, node) { } - public override RoomUI_AmmoCount Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + public AmmoCount(RoomUIPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override AmmoCount Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control.WeaponBar /// - public class RoomUI_WeaponBar : UiNode + public class WeaponBar : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.WeaponPanel /// - public RoomUI_WeaponPanel L_WeaponPanel + public WeaponPanel L_WeaponPanel { get { - if (_L_WeaponPanel == null) _L_WeaponPanel = new RoomUI_WeaponPanel(UiPanel, Instance.GetNodeOrNull("WeaponPanel")); + if (_L_WeaponPanel == null) _L_WeaponPanel = new WeaponPanel(UiPanel, Instance.GetNode("WeaponPanel")); return _L_WeaponPanel; } } - private RoomUI_WeaponPanel _L_WeaponPanel; + private WeaponPanel _L_WeaponPanel; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.AmmoCount /// - public RoomUI_AmmoCount L_AmmoCount + public AmmoCount L_AmmoCount { get { - if (_L_AmmoCount == null) _L_AmmoCount = new RoomUI_AmmoCount(UiPanel, Instance.GetNodeOrNull("AmmoCount")); + if (_L_AmmoCount == null) _L_AmmoCount = new AmmoCount(UiPanel, Instance.GetNode("AmmoCount")); return _L_AmmoCount; } } - private RoomUI_AmmoCount _L_AmmoCount; + private AmmoCount _L_AmmoCount; - public RoomUI_WeaponBar(RoomUI uiPanel, Godot.Control node) : base(uiPanel, node) { } - public override RoomUI_WeaponBar Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate()); + public WeaponBar(RoomUIPanel uiPanel, Godot.Control node) : base(uiPanel, node) { } + public override WeaponBar Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate()); } /// /// 类型: , 路径: RoomUI.Control /// - public class RoomUI_Control : UiNode + public class Control : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.LifeBar /// - public RoomUI_LifeBar L_LifeBar + public LifeBar L_LifeBar { get { - if (_L_LifeBar == null) _L_LifeBar = new RoomUI_LifeBar(UiPanel, Instance.GetNodeOrNull("LifeBar")); + if (_L_LifeBar == null) _L_LifeBar = new LifeBar(UiPanel, Instance.GetNode("LifeBar")); return _L_LifeBar; } } - private RoomUI_LifeBar _L_LifeBar; + private LifeBar _L_LifeBar; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.MapBar /// - public RoomUI_MapBar L_MapBar + public MapBar L_MapBar { get { - if (_L_MapBar == null) _L_MapBar = new RoomUI_MapBar(UiPanel, Instance.GetNodeOrNull("MapBar")); + if (_L_MapBar == null) _L_MapBar = new MapBar(UiPanel, Instance.GetNode("MapBar")); return _L_MapBar; } } - private RoomUI_MapBar _L_MapBar; + private MapBar _L_MapBar; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.ActivePropBar /// - public RoomUI_ActivePropBar L_ActivePropBar + public ActivePropBar L_ActivePropBar { get { - if (_L_ActivePropBar == null) _L_ActivePropBar = new RoomUI_ActivePropBar(UiPanel, Instance.GetNodeOrNull("ActivePropBar")); + if (_L_ActivePropBar == null) _L_ActivePropBar = new ActivePropBar(UiPanel, Instance.GetNode("ActivePropBar")); return _L_ActivePropBar; } } - private RoomUI_ActivePropBar _L_ActivePropBar; + private ActivePropBar _L_ActivePropBar; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.WeaponBar /// - public RoomUI_WeaponBar L_WeaponBar + public WeaponBar L_WeaponBar { get { - if (_L_WeaponBar == null) _L_WeaponBar = new RoomUI_WeaponBar(UiPanel, Instance.GetNodeOrNull("WeaponBar")); + if (_L_WeaponBar == null) _L_WeaponBar = new WeaponBar(UiPanel, Instance.GetNode("WeaponBar")); return _L_WeaponBar; } } - private RoomUI_WeaponBar _L_WeaponBar; + private WeaponBar _L_WeaponBar; - public RoomUI_Control(RoomUI uiPanel, Godot.Control node) : base(uiPanel, node) { } - public override RoomUI_Control Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate()); + public Control(RoomUIPanel uiPanel, Godot.Control node) : base(uiPanel, node) { } + public override Control Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: RoomUI.RoomMap + /// + public class RoomMap : UiNode + { + public RoomMap(RoomUIPanel uiPanel, UI.RoomMap.RoomMapPanel node) : base(uiPanel, node) { } + public override RoomMap Clone() + { + var uiNode = new RoomMap(UiPanel, (UI.RoomMap.RoomMapPanel)Instance.Duplicate()); + UiPanel.RecordNestedUi(uiNode.Instance, this, UiManager.RecordType.Open); + uiNode.Instance.OnCreateUi(); + uiNode.Instance.OnInitNestedUi(); + return uiNode; + } } /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar.Icon /// - public RoomUI_Icon S_Icon => L_InteractiveTipBar.L_Icon; + public Icon S_Icon => L_InteractiveTipBar.L_Icon; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar.InteractiveIcon /// - public RoomUI_InteractiveIcon S_InteractiveIcon => L_InteractiveTipBar.L_InteractiveIcon; + public InteractiveIcon S_InteractiveIcon => L_InteractiveTipBar.L_InteractiveIcon; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar.Line2D /// - public RoomUI_Line2D S_Line2D => L_InteractiveTipBar.L_Line2D; + public Line2D S_Line2D => L_InteractiveTipBar.L_Line2D; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar.NameLabel /// - public RoomUI_NameLabel S_NameLabel => L_InteractiveTipBar.L_NameLabel; + public NameLabel S_NameLabel => L_InteractiveTipBar.L_NameLabel; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar /// - public RoomUI_InteractiveTipBar S_InteractiveTipBar => L_InteractiveTipBar; + public InteractiveTipBar S_InteractiveTipBar => L_InteractiveTipBar; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.ReloadBar.Slot.Block /// - public RoomUI_Block S_Block => L_ReloadBar.L_Slot.L_Block; + public Block S_Block => L_ReloadBar.L_Slot.L_Block; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.ReloadBar.Slot /// - public RoomUI_Slot S_Slot => L_ReloadBar.L_Slot; + public Slot S_Slot => L_ReloadBar.L_Slot; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.ReloadBar /// - public RoomUI_ReloadBar S_ReloadBar => L_ReloadBar; + public ReloadBar S_ReloadBar => L_ReloadBar; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.LifeBar.Life /// - public RoomUI_Life S_Life => L_Control.L_LifeBar.L_Life; + public Life S_Life => L_Control.L_LifeBar.L_Life; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.LifeBar /// - public RoomUI_LifeBar S_LifeBar => L_Control.L_LifeBar; + public LifeBar S_LifeBar => L_Control.L_LifeBar; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.MapBar /// - public RoomUI_MapBar S_MapBar => L_Control.L_MapBar; + public MapBar S_MapBar => L_Control.L_MapBar; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropBg /// - public RoomUI_ActivePropBg S_ActivePropBg => L_Control.L_ActivePropBar.L_ActivePropBg; + public ActivePropBg S_ActivePropBg => L_Control.L_ActivePropBar.L_ActivePropBg; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropSprite /// - public RoomUI_ActivePropSprite S_ActivePropSprite => L_Control.L_ActivePropBar.L_ActivePropSprite; + public ActivePropSprite S_ActivePropSprite => L_Control.L_ActivePropBar.L_ActivePropSprite; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.CooldownProgress /// - public RoomUI_CooldownProgress S_CooldownProgress => L_Control.L_ActivePropBar.L_CooldownProgress; + public CooldownProgress S_CooldownProgress => L_Control.L_ActivePropBar.L_CooldownProgress; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropCount /// - public RoomUI_ActivePropCount S_ActivePropCount => L_Control.L_ActivePropBar.L_ActivePropCount; + public ActivePropCount S_ActivePropCount => L_Control.L_ActivePropBar.L_ActivePropCount; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropPanel /// - public RoomUI_ActivePropPanel S_ActivePropPanel => L_Control.L_ActivePropBar.L_ActivePropPanel; + public ActivePropPanel S_ActivePropPanel => L_Control.L_ActivePropBar.L_ActivePropPanel; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ChargeProgressBar /// - public RoomUI_ChargeProgressBar S_ChargeProgressBar => L_Control.L_ActivePropBar.L_ChargeProgressBar; + public ChargeProgressBar S_ChargeProgressBar => L_Control.L_ActivePropBar.L_ChargeProgressBar; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ChargeProgress /// - public RoomUI_ChargeProgress S_ChargeProgress => L_Control.L_ActivePropBar.L_ChargeProgress; + public ChargeProgress S_ChargeProgress => L_Control.L_ActivePropBar.L_ChargeProgress; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar /// - public RoomUI_ActivePropBar S_ActivePropBar => L_Control.L_ActivePropBar; + public ActivePropBar S_ActivePropBar => L_Control.L_ActivePropBar; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.WeaponBar.WeaponPanel.WeaponSprite /// - public RoomUI_WeaponSprite S_WeaponSprite => L_Control.L_WeaponBar.L_WeaponPanel.L_WeaponSprite; + public WeaponSprite S_WeaponSprite => L_Control.L_WeaponBar.L_WeaponPanel.L_WeaponSprite; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.WeaponBar.WeaponPanel /// - public RoomUI_WeaponPanel S_WeaponPanel => L_Control.L_WeaponBar.L_WeaponPanel; + public WeaponPanel S_WeaponPanel => L_Control.L_WeaponBar.L_WeaponPanel; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.WeaponBar.AmmoCount /// - public RoomUI_AmmoCount S_AmmoCount => L_Control.L_WeaponBar.L_AmmoCount; + public AmmoCount S_AmmoCount => L_Control.L_WeaponBar.L_AmmoCount; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.WeaponBar /// - public RoomUI_WeaponBar S_WeaponBar => L_Control.L_WeaponBar; + public WeaponBar S_WeaponBar => L_Control.L_WeaponBar; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control /// - public RoomUI_Control S_Control => L_Control; + public Control S_Control => L_Control; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.RoomMap + /// + public RoomMap S_RoomMap => L_RoomMap; } diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUIPanel.cs b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUIPanel.cs index ad4dc59..2b9b7db 100644 --- a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUIPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUIPanel.cs @@ -9,21 +9,21 @@ /// public partial class RoomUIPanel : RoomUI { - private ReloadBar _reloadBar; - private InteractiveTipBar _interactiveTipBar; - private WeaponBar _weaponBar; - private ActivePropBar _activePropBar; - private LifeBar _lifeBar; + private ReloadBarHandler _reloadBar; + private InteractiveTipBarHandler _interactiveTipBar; + private WeaponBarHandler _weaponBar; + private ActivePropBarHandler _activePropBar; + private LifeBarHandler _lifeBar; private EventFactory _factory; public override void OnCreateUi() { - _reloadBar = new ReloadBar(L_ReloadBar); - _interactiveTipBar = new InteractiveTipBar(L_InteractiveTipBar); - _weaponBar = new WeaponBar(L_Control.L_WeaponBar); - _activePropBar = new ActivePropBar(L_Control.L_ActivePropBar); - _lifeBar = new LifeBar(L_Control.L_LifeBar); + _reloadBar = new ReloadBarHandler(L_ReloadBar); + _interactiveTipBar = new InteractiveTipBarHandler(L_InteractiveTipBar); + _weaponBar = new WeaponBarHandler(L_Control.L_WeaponBar); + _activePropBar = new ActivePropBarHandler(L_Control.L_ActivePropBar); + _lifeBar = new LifeBarHandler(L_Control.L_LifeBar); } public override void OnShowUi() diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/WeaponBar.cs b/DungeonShooting_Godot/src/game/ui/roomUI/WeaponBar.cs deleted file mode 100644 index 01423cf..0000000 --- a/DungeonShooting_Godot/src/game/ui/roomUI/WeaponBar.cs +++ /dev/null @@ -1,71 +0,0 @@ -using Godot; - -namespace UI.RoomUI; - -public class WeaponBar -{ - private RoomUI.RoomUI_WeaponBar _weaponBar; - - private int _prevAmmo = -1; - private int _prevResidue = -1; - - public WeaponBar(RoomUI.RoomUI_WeaponBar weaponBar) - { - _weaponBar = weaponBar; - SetWeaponTexture(null); - } - - public void OnShow() - { - } - - public void OnHide() - { - } - - public void Process(float delta) - { - var weapon = Player.Current?.WeaponPack.ActiveItem; - if (weapon != null) - { - SetWeaponTexture(weapon.GetCurrentTexture()); - SetWeaponAmmunition(weapon.CurrAmmo, weapon.ResidueAmmo); - } - else - { - SetWeaponTexture(null); - } - } - - /// - /// 设置显示在 ui 上武器的纹理 - /// - /// 纹理 - public void SetWeaponTexture(Texture2D texture) - { - if (texture != null) - { - _weaponBar.L_WeaponPanel.L_WeaponSprite.Instance.Texture = texture; - _weaponBar.Instance.Visible = true; - } - else - { - _weaponBar.Instance.Visible = false; - } - } - - /// - /// 设置弹药数据 - /// - /// 当前弹夹弹药量 - /// 剩余弹药总数 - public void SetWeaponAmmunition(int curr, int total) - { - if (curr != _prevAmmo || total != _prevResidue) - { - _weaponBar.L_AmmoCount.Instance.Text = curr + " / " + total; - _prevAmmo = curr; - _prevResidue = total; - } - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/WeaponBarHandler.cs b/DungeonShooting_Godot/src/game/ui/roomUI/WeaponBarHandler.cs new file mode 100644 index 0000000..0c8a67e --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/roomUI/WeaponBarHandler.cs @@ -0,0 +1,71 @@ +using Godot; + +namespace UI.RoomUI; + +public class WeaponBarHandler +{ + private RoomUI.WeaponBar _weaponBar; + + private int _prevAmmo = -1; + private int _prevResidue = -1; + + public WeaponBarHandler(RoomUI.WeaponBar weaponBar) + { + _weaponBar = weaponBar; + SetWeaponTexture(null); + } + + public void OnShow() + { + } + + public void OnHide() + { + } + + public void Process(float delta) + { + var weapon = Player.Current?.WeaponPack.ActiveItem; + if (weapon != null) + { + SetWeaponTexture(weapon.GetCurrentTexture()); + SetWeaponAmmunition(weapon.CurrAmmo, weapon.ResidueAmmo); + } + else + { + SetWeaponTexture(null); + } + } + + /// + /// 设置显示在 ui 上武器的纹理 + /// + /// 纹理 + public void SetWeaponTexture(Texture2D texture) + { + if (texture != null) + { + _weaponBar.L_WeaponPanel.L_WeaponSprite.Instance.Texture = texture; + _weaponBar.Instance.Visible = true; + } + else + { + _weaponBar.Instance.Visible = false; + } + } + + /// + /// 设置弹药数据 + /// + /// 当前弹夹弹药量 + /// 剩余弹药总数 + public void SetWeaponAmmunition(int curr, int total) + { + if (curr != _prevAmmo || total != _prevResidue) + { + _weaponBar.L_AmmoCount.Instance.Text = curr + " / " + total; + _prevAmmo = curr; + _prevResidue = total; + } + } +} \ No newline at end of file