diff --git a/DungeonShooting_Godot/prefab/ui/Encyclopedia.tscn b/DungeonShooting_Godot/prefab/ui/Encyclopedia.tscn index 3a8adcc..11f9821 100644 --- a/DungeonShooting_Godot/prefab/ui/Encyclopedia.tscn +++ b/DungeonShooting_Godot/prefab/ui/Encyclopedia.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=9 format=3 uid="uid://b2xq02i3vxct"] +[gd_scene load_steps=10 format=3 uid="uid://b2xq02i3vxct"] [ext_resource type="Script" path="res://src/game/ui/encyclopedia/EncyclopediaPanel.cs" id="1_hd86y"] [ext_resource type="Texture2D" uid="uid://c0st2iiql8igg" path="res://resource/sprite/ui/encyclopedia/TitleBg.png" id="3_gdtik"] [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="3_o1xl7"] +[ext_resource type="Texture2D" uid="uid://dahib4qcevboo" path="res://resource/sprite/ui/encyclopedia/Panel2.png" id="4_21546"] [ext_resource type="Texture2D" uid="uid://brevrlfdtllmk" path="res://resource/sprite/ui/encyclopedia/Select.png" id="5_f0anf"] [ext_resource type="Texture2D" uid="uid://cu5y32wfai4pn" path="res://resource/sprite/ui/encyclopedia/Item.png" id="5_niceh"] [ext_resource type="Texture2D" uid="uid://conjg6fw6670x" path="res://resource/sprite/ui/encyclopedia/Panel.png" id="7_hfdat"] @@ -106,7 +107,7 @@ [node name="NinePatchRect" type="NinePatchRect" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer2"] layout_mode = 2 size_flags_vertical = 3 -texture = ExtResource("7_hfdat") +texture = ExtResource("4_21546") region_rect = Rect2(0, 0, 128, 128) patch_margin_left = 56 patch_margin_top = 56 @@ -181,7 +182,7 @@ [node name="NinePatchRect" type="NinePatchRect" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer3"] layout_mode = 2 size_flags_vertical = 3 -texture = ExtResource("7_hfdat") +texture = ExtResource("4_21546") patch_margin_left = 56 patch_margin_top = 56 patch_margin_right = 56 @@ -192,45 +193,46 @@ anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = 20.0 -offset_top = 20.0 -offset_right = -20.0 -offset_bottom = -20.0 +offset_left = 28.0 +offset_top = 28.0 +offset_right = -28.0 +offset_bottom = -28.0 grow_horizontal = 2 grow_vertical = 2 theme_override_constants/separation = 16 -[node name="Label" type="Label" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer3/NinePatchRect/VBoxContainer"] +[node name="ItemName" type="Label" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer3/NinePatchRect/VBoxContainer"] layout_mode = 2 text = "名称" horizontal_alignment = 1 vertical_alignment = 1 [node name="NinePatchRect" type="NinePatchRect" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer3/NinePatchRect/VBoxContainer"] -custom_minimum_size = Vector2(396, 320) +custom_minimum_size = Vector2(396, 300) layout_mode = 2 -texture = ExtResource("7_hfdat") +texture = ExtResource("4_21546") patch_margin_left = 56 patch_margin_top = 56 patch_margin_right = 56 patch_margin_bottom = 56 -[node name="TextureRect" type="TextureRect" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer3/NinePatchRect/VBoxContainer/NinePatchRect"] +[node name="ItemTexture" type="TextureRect" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer3/NinePatchRect/VBoxContainer/NinePatchRect"] material = ExtResource("7_yd5ks") layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = 5.0 -offset_top = 5.0 -offset_right = -4.0 -offset_bottom = -5.0 +offset_left = 20.0 +offset_top = 20.0 +offset_right = -287.0 +offset_bottom = -215.0 grow_horizontal = 2 grow_vertical = 2 +scale = Vector2(4, 4) size_flags_vertical = 3 stretch_mode = 3 -[node name="RichTextLabel" type="RichTextLabel" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer3/NinePatchRect/VBoxContainer"] +[node name="ItemDes" type="RichTextLabel" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer3/NinePatchRect/VBoxContainer"] layout_mode = 2 size_flags_vertical = 3 text = "文本描述" diff --git a/DungeonShooting_Godot/resource/sprite/ui/encyclopedia/Panel2.png b/DungeonShooting_Godot/resource/sprite/ui/encyclopedia/Panel2.png new file mode 100644 index 0000000..ba3d483 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/encyclopedia/Panel2.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/encyclopedia/Panel2.png.import b/DungeonShooting_Godot/resource/sprite/ui/encyclopedia/Panel2.png.import new file mode 100644 index 0000000..f296aec --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/encyclopedia/Panel2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dahib4qcevboo" +path="res://.godot/imported/Panel2.png-1945b16de121d7dd89f800804a09b2e8.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/encyclopedia/Panel2.png" +dest_files=["res://.godot/imported/Panel2.png-1945b16de121d7dd89f800804a09b2e8.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 diff --git a/DungeonShooting_Godot/src/game/ui/encyclopedia/Encyclopedia.cs b/DungeonShooting_Godot/src/game/ui/encyclopedia/Encyclopedia.cs index 0130536..4234b5a 100644 --- a/DungeonShooting_Godot/src/game/ui/encyclopedia/Encyclopedia.cs +++ b/DungeonShooting_Godot/src/game/ui/encyclopedia/Encyclopedia.cs @@ -223,21 +223,21 @@ } /// - /// 类型: , 路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer.Label + /// 类型: , 路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer.ItemName /// - public class Label_1 : UiNode + public class ItemName : UiNode { - public Label_1(EncyclopediaPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } - public override Label_1 Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + public ItemName(EncyclopediaPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override ItemName Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); } /// - /// 类型: , 路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer.NinePatchRect.TextureRect + /// 类型: , 路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer.NinePatchRect.ItemTexture /// - public class TextureRect_1 : UiNode + public class ItemTexture : UiNode { - public TextureRect_1(EncyclopediaPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } - public override TextureRect_1 Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + public ItemTexture(EncyclopediaPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override ItemTexture Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); } /// @@ -246,29 +246,29 @@ public class NinePatchRect_3 : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer.TextureRect + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer.ItemTexture /// - public TextureRect_1 L_TextureRect + public ItemTexture L_ItemTexture { get { - if (_L_TextureRect == null) _L_TextureRect = new TextureRect_1(UiPanel, Instance.GetNode("TextureRect")); - return _L_TextureRect; + if (_L_ItemTexture == null) _L_ItemTexture = new ItemTexture(UiPanel, Instance.GetNode("ItemTexture")); + return _L_ItemTexture; } } - private TextureRect_1 _L_TextureRect; + private ItemTexture _L_ItemTexture; public NinePatchRect_3(EncyclopediaPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } public override NinePatchRect_3 Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); } /// - /// 类型: , 路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer.RichTextLabel + /// 类型: , 路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer.ItemDes /// - public class RichTextLabel : UiNode + public class ItemDes : UiNode { - public RichTextLabel(EncyclopediaPanel uiPanel, Godot.RichTextLabel node) : base(uiPanel, node) { } - public override RichTextLabel Clone() => new (UiPanel, (Godot.RichTextLabel)Instance.Duplicate()); + public ItemDes(EncyclopediaPanel uiPanel, Godot.RichTextLabel node) : base(uiPanel, node) { } + public override ItemDes Clone() => new (UiPanel, (Godot.RichTextLabel)Instance.Duplicate()); } /// @@ -277,17 +277,17 @@ public class VBoxContainer : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.Label + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.ItemName /// - public Label_1 L_Label + public ItemName L_ItemName { get { - if (_L_Label == null) _L_Label = new Label_1(UiPanel, Instance.GetNode("Label")); - return _L_Label; + if (_L_ItemName == null) _L_ItemName = new ItemName(UiPanel, Instance.GetNode("ItemName")); + return _L_ItemName; } } - private Label_1 _L_Label; + private ItemName _L_ItemName; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.NinePatchRect @@ -303,17 +303,17 @@ private NinePatchRect_3 _L_NinePatchRect; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.RichTextLabel + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.ItemDes /// - public RichTextLabel L_RichTextLabel + public ItemDes L_ItemDes { get { - if (_L_RichTextLabel == null) _L_RichTextLabel = new RichTextLabel(UiPanel, Instance.GetNode("RichTextLabel")); - return _L_RichTextLabel; + if (_L_ItemDes == null) _L_ItemDes = new ItemDes(UiPanel, Instance.GetNode("ItemDes")); + return _L_ItemDes; } } - private RichTextLabel _L_RichTextLabel; + private ItemDes _L_ItemDes; public VBoxContainer(EncyclopediaPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); @@ -462,6 +462,16 @@ public ColorRect S_ColorRect => L_ColorRect; /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.TextureRect.Label + /// + public Label S_Label => L_NinePatchRect.L_TextureRect.L_Label; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.TextureRect + /// + public TextureRect S_TextureRect => L_NinePatchRect.L_TextureRect; + + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer2.NinePatchRect.ScrollContainer.ObjectButton.Bg /// public Bg S_Bg => L_NinePatchRect.L_MarginContainer.L_HBoxContainer.L_VBoxContainer2.L_NinePatchRect.L_ScrollContainer.L_ObjectButton.L_Bg; @@ -492,9 +502,19 @@ public VBoxContainer2 S_VBoxContainer2 => L_NinePatchRect.L_MarginContainer.L_HBoxContainer.L_VBoxContainer2; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer.RichTextLabel + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer.ItemName /// - public RichTextLabel S_RichTextLabel => L_NinePatchRect.L_MarginContainer.L_HBoxContainer.L_VBoxContainer3.L_NinePatchRect.L_VBoxContainer.L_RichTextLabel; + public ItemName S_ItemName => L_NinePatchRect.L_MarginContainer.L_HBoxContainer.L_VBoxContainer3.L_NinePatchRect.L_VBoxContainer.L_ItemName; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer.NinePatchRect.ItemTexture + /// + public ItemTexture S_ItemTexture => L_NinePatchRect.L_MarginContainer.L_HBoxContainer.L_VBoxContainer3.L_NinePatchRect.L_VBoxContainer.L_NinePatchRect.L_ItemTexture; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer.ItemDes + /// + public ItemDes S_ItemDes => L_NinePatchRect.L_MarginContainer.L_HBoxContainer.L_VBoxContainer3.L_NinePatchRect.L_VBoxContainer.L_ItemDes; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: Encyclopedia.NinePatchRect.MarginContainer.HBoxContainer.VBoxContainer3.NinePatchRect.VBoxContainer diff --git a/DungeonShooting_Godot/src/game/ui/encyclopedia/EncyclopediaPanel.cs b/DungeonShooting_Godot/src/game/ui/encyclopedia/EncyclopediaPanel.cs index 3d16e87..060d35d 100644 --- a/DungeonShooting_Godot/src/game/ui/encyclopedia/EncyclopediaPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/encyclopedia/EncyclopediaPanel.cs @@ -34,4 +34,17 @@ ); } + /// + /// 设置选中的物体 + /// + public void SelectItem(ExcelConfig.ActivityBase config) + { + if (config != null) + { + S_ItemName.Instance.Text = config.Name; + S_ItemTexture.Instance.Texture = ResourceManager.LoadTexture2D(config.Icon); + S_ItemDes.Instance.Text = config.Details; + } + } + } diff --git a/DungeonShooting_Godot/src/game/ui/encyclopedia/ItemCell.cs b/DungeonShooting_Godot/src/game/ui/encyclopedia/ItemCell.cs index ed018ed..376a2dd 100644 --- a/DungeonShooting_Godot/src/game/ui/encyclopedia/ItemCell.cs +++ b/DungeonShooting_Godot/src/game/ui/encyclopedia/ItemCell.cs @@ -19,6 +19,7 @@ public override void OnSelect() { CellNode.L_Select.Instance.Visible = true; + CellNode.UiPanel.SelectItem(Data); } public override void OnUnSelect()