diff --git a/DungeonShooting_Godot/prefab/ui/EditorTileImage.tscn b/DungeonShooting_Godot/prefab/ui/EditorTileImage.tscn
index 991d05e..9435d0a 100644
--- a/DungeonShooting_Godot/prefab/ui/EditorTileImage.tscn
+++ b/DungeonShooting_Godot/prefab/ui/EditorTileImage.tscn
@@ -1,8 +1,9 @@
-[gd_scene load_steps=4 format=3 uid="uid://c506mkdjqua2r"]
+[gd_scene load_steps=5 format=3 uid="uid://c0j60lj0euk3y"]
[ext_resource type="Script" path="res://src/game/ui/editorTileImage/EditorTileImagePanel.cs" id="1_y1hns"]
[ext_resource type="Texture2D" uid="uid://d2wslibovwv7w" path="res://resource/sprite/ui/commonIcon/CenterTool.png" id="2_ntsra"]
[ext_resource type="Script" path="res://src/game/ui/editorTileImage/ImageBg.cs" id="2_qkj2u"]
+[ext_resource type="Script" path="res://src/game/ui/editorTileImage/RectBrush.cs" id="3_fic1t"]
[node name="EditorTileImage" type="Control"]
layout_mode = 3
@@ -67,6 +68,7 @@
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
+script = ExtResource("3_fic1t")
[node name="FocusBtn" type="TextureButton" parent="HBoxContainer/Left/Bg"]
layout_mode = 1
@@ -84,7 +86,7 @@
stretch_mode = 5
[node name="Right" type="Panel" parent="HBoxContainer"]
-custom_minimum_size = Vector2(400, 0)
+custom_minimum_size = Vector2(370, 0)
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/Right"]
@@ -92,12 +94,13 @@
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
-offset_left = 2.0
-offset_top = 2.0
-offset_right = -2.0
-offset_bottom = -2.0
+offset_left = 4.0
+offset_top = 4.0
+offset_right = -4.0
+offset_bottom = -5.0
grow_horizontal = 2
grow_vertical = 2
+theme_override_constants/separation = 14
[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer/Right/VBoxContainer"]
layout_mode = 2
@@ -105,11 +108,12 @@
[node name="Label" type="Label" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(160, 0)
layout_mode = 2
-text = "起始X:"
+text = "起始X"
-[node name="SpinBox" type="SpinBox" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer"]
+[node name="StartX" type="SpinBox" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
+max_value = 9999.0
[node name="HBoxContainer2" type="HBoxContainer" parent="HBoxContainer/Right/VBoxContainer"]
layout_mode = 2
@@ -117,11 +121,12 @@
[node name="Label" type="Label" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer2"]
custom_minimum_size = Vector2(160, 0)
layout_mode = 2
-text = "起始Y:"
+text = "起始Y"
-[node name="SpinBox" type="SpinBox" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer2"]
+[node name="StartY" type="SpinBox" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer2"]
layout_mode = 2
size_flags_horizontal = 3
+max_value = 9999.0
[node name="HBoxContainer3" type="HBoxContainer" parent="HBoxContainer/Right/VBoxContainer"]
layout_mode = 2
@@ -129,11 +134,12 @@
[node name="Label" type="Label" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer3"]
custom_minimum_size = Vector2(160, 0)
layout_mode = 2
-text = "间距Y:"
+text = "间距X"
-[node name="SpinBox" type="SpinBox" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer3"]
+[node name="OffsetX" type="SpinBox" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer3"]
layout_mode = 2
size_flags_horizontal = 3
+max_value = 9999.0
[node name="HBoxContainer4" type="HBoxContainer" parent="HBoxContainer/Right/VBoxContainer"]
layout_mode = 2
@@ -141,8 +147,35 @@
[node name="Label" type="Label" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer4"]
custom_minimum_size = Vector2(160, 0)
layout_mode = 2
-text = "间距Y:"
+text = "间距Y"
-[node name="SpinBox" type="SpinBox" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer4"]
+[node name="OffsetY" type="SpinBox" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer4"]
layout_mode = 2
size_flags_horizontal = 3
+max_value = 9999.0
+
+[node name="HBoxContainer5" type="HBoxContainer" parent="HBoxContainer/Right/VBoxContainer"]
+layout_mode = 2
+
+[node name="Label" type="Label" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer5"]
+custom_minimum_size = Vector2(160, 0)
+layout_mode = 2
+text = "横轴数量"
+
+[node name="HCount" type="SpinBox" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer5"]
+layout_mode = 2
+size_flags_horizontal = 3
+max_value = 9999.0
+
+[node name="HBoxContainer6" type="HBoxContainer" parent="HBoxContainer/Right/VBoxContainer"]
+layout_mode = 2
+
+[node name="Label" type="Label" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer6"]
+custom_minimum_size = Vector2(160, 0)
+layout_mode = 2
+text = "纵轴数量"
+
+[node name="VCount" type="SpinBox" parent="HBoxContainer/Right/VBoxContainer/HBoxContainer6"]
+layout_mode = 2
+size_flags_horizontal = 3
+max_value = 9999.0
diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
index 19638b2..925aa2d 100644
--- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
+++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
@@ -755,7 +755,13 @@
);
}
- public static void ShowImportTileImage(Image image, UiBase parentUi = null)
+ ///
+ /// 显示导入纹理的面板
+ ///
+ /// 初始纹理
+ /// 点击确定后的回调
+ /// 所属父级Ui
+ public static void ShowImportTileImage(Image image, Action onCreate, UiBase parentUi = null)
{
var window = CreateWindowInstance(parentUi);
window.SetWindowTitle("导入纹理");
@@ -765,7 +771,9 @@
window.SetButtonList(
new EditorWindowPanel.ButtonData("确定", () =>
{
+ var img = body.GetImage();
window.CloseWindow();
+ onCreate(img);
}),
new EditorWindowPanel.ButtonData("取消", () =>
{
diff --git a/DungeonShooting_Godot/src/game/ui/editorTileImage/EditorTileImage.cs b/DungeonShooting_Godot/src/game/ui/editorTileImage/EditorTileImage.cs
index b6152a5..35dcabb 100644
--- a/DungeonShooting_Godot/src/game/ui/editorTileImage/EditorTileImage.cs
+++ b/DungeonShooting_Godot/src/game/ui/editorTileImage/EditorTileImage.cs
@@ -26,6 +26,7 @@
public sealed override void OnInitNestedUi()
{
_ = L_HBoxContainer.L_Left.L_Bg;
+ _ = L_HBoxContainer.L_Left.L_Bg.L_TextureRoot.L_Brush;
}
@@ -39,12 +40,12 @@
}
///
- /// 类型: , 路径: EditorTileImage.HBoxContainer.Left.Bg.TextureRoot.Brush
+ /// 类型: , 路径: EditorTileImage.HBoxContainer.Left.Bg.TextureRoot.Brush
///
- public class Brush : UiNode
+ public class Brush : UiNode
{
- public Brush(EditorTileImagePanel uiPanel, Godot.Control node) : base(uiPanel, node) { }
- public override Brush Clone() => new (UiPanel, (Godot.Control)Instance.Duplicate());
+ public Brush(EditorTileImagePanel uiPanel, UI.EditorTileImage.RectBrush node) : base(uiPanel, node) { }
+ public override Brush Clone() => new (UiPanel, (UI.EditorTileImage.RectBrush)Instance.Duplicate());
}
///
@@ -66,13 +67,13 @@
private TileSprite _L_TileSprite;
///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Left.Bg.Brush
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Left.Bg.Brush
///
public Brush L_Brush
{
get
{
- if (_L_Brush == null) _L_Brush = new Brush(UiPanel, Instance.GetNode("Brush"));
+ if (_L_Brush == null) _L_Brush = new Brush(UiPanel, Instance.GetNode("Brush"));
return _L_Brush;
}
}
@@ -158,12 +159,12 @@
}
///
- /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer.SpinBox
+ /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer.StartX
///
- public class SpinBox : UiNode
+ public class StartX : UiNode
{
- public SpinBox(EditorTileImagePanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { }
- public override SpinBox Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate());
+ public StartX(EditorTileImagePanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { }
+ public override StartX Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate());
}
///
@@ -185,17 +186,17 @@
private Label _L_Label;
///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.SpinBox
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.StartX
///
- public SpinBox L_SpinBox
+ public StartX L_StartX
{
get
{
- if (_L_SpinBox == null) _L_SpinBox = new SpinBox(UiPanel, Instance.GetNode("SpinBox"));
- return _L_SpinBox;
+ if (_L_StartX == null) _L_StartX = new StartX(UiPanel, Instance.GetNode("StartX"));
+ return _L_StartX;
}
}
- private SpinBox _L_SpinBox;
+ private StartX _L_StartX;
public HBoxContainer_1(EditorTileImagePanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
public override HBoxContainer_1 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
@@ -211,12 +212,12 @@
}
///
- /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer2.SpinBox
+ /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer2.StartY
///
- public class SpinBox_1 : UiNode
+ public class StartY : UiNode
{
- public SpinBox_1(EditorTileImagePanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { }
- public override SpinBox_1 Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate());
+ public StartY(EditorTileImagePanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { }
+ public override StartY Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate());
}
///
@@ -238,17 +239,17 @@
private Label_1 _L_Label;
///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.SpinBox
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.StartY
///
- public SpinBox_1 L_SpinBox
+ public StartY L_StartY
{
get
{
- if (_L_SpinBox == null) _L_SpinBox = new SpinBox_1(UiPanel, Instance.GetNode("SpinBox"));
- return _L_SpinBox;
+ if (_L_StartY == null) _L_StartY = new StartY(UiPanel, Instance.GetNode("StartY"));
+ return _L_StartY;
}
}
- private SpinBox_1 _L_SpinBox;
+ private StartY _L_StartY;
public HBoxContainer2(EditorTileImagePanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
public override HBoxContainer2 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
@@ -264,12 +265,12 @@
}
///
- /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer3.SpinBox
+ /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer3.OffsetX
///
- public class SpinBox_2 : UiNode
+ public class OffsetX : UiNode
{
- public SpinBox_2(EditorTileImagePanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { }
- public override SpinBox_2 Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate());
+ public OffsetX(EditorTileImagePanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { }
+ public override OffsetX Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate());
}
///
@@ -291,17 +292,17 @@
private Label_2 _L_Label;
///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.SpinBox
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.OffsetX
///
- public SpinBox_2 L_SpinBox
+ public OffsetX L_OffsetX
{
get
{
- if (_L_SpinBox == null) _L_SpinBox = new SpinBox_2(UiPanel, Instance.GetNode("SpinBox"));
- return _L_SpinBox;
+ if (_L_OffsetX == null) _L_OffsetX = new OffsetX(UiPanel, Instance.GetNode("OffsetX"));
+ return _L_OffsetX;
}
}
- private SpinBox_2 _L_SpinBox;
+ private OffsetX _L_OffsetX;
public HBoxContainer3(EditorTileImagePanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
public override HBoxContainer3 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
@@ -317,12 +318,12 @@
}
///
- /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer4.SpinBox
+ /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer4.OffsetY
///
- public class SpinBox_3 : UiNode
+ public class OffsetY : UiNode
{
- public SpinBox_3(EditorTileImagePanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { }
- public override SpinBox_3 Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate());
+ public OffsetY(EditorTileImagePanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { }
+ public override OffsetY Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate());
}
///
@@ -344,23 +345,129 @@
private Label_3 _L_Label;
///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.SpinBox
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.OffsetY
///
- public SpinBox_3 L_SpinBox
+ public OffsetY L_OffsetY
{
get
{
- if (_L_SpinBox == null) _L_SpinBox = new SpinBox_3(UiPanel, Instance.GetNode("SpinBox"));
- return _L_SpinBox;
+ if (_L_OffsetY == null) _L_OffsetY = new OffsetY(UiPanel, Instance.GetNode("OffsetY"));
+ return _L_OffsetY;
}
}
- private SpinBox_3 _L_SpinBox;
+ private OffsetY _L_OffsetY;
public HBoxContainer4(EditorTileImagePanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
public override HBoxContainer4 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
}
///
+ /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer5.Label
+ ///
+ public class Label_4 : UiNode
+ {
+ public Label_4(EditorTileImagePanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
+ public override Label_4 Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer5.HCount
+ ///
+ public class HCount : UiNode
+ {
+ public HCount(EditorTileImagePanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { }
+ public override HCount Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer5
+ ///
+ public class HBoxContainer5 : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.Label
+ ///
+ public Label_4 L_Label
+ {
+ get
+ {
+ if (_L_Label == null) _L_Label = new Label_4(UiPanel, Instance.GetNode("Label"));
+ return _L_Label;
+ }
+ }
+ private Label_4 _L_Label;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HCount
+ ///
+ public HCount L_HCount
+ {
+ get
+ {
+ if (_L_HCount == null) _L_HCount = new HCount(UiPanel, Instance.GetNode("HCount"));
+ return _L_HCount;
+ }
+ }
+ private HCount _L_HCount;
+
+ public HBoxContainer5(EditorTileImagePanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
+ public override HBoxContainer5 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer6.Label
+ ///
+ public class Label_5 : UiNode
+ {
+ public Label_5(EditorTileImagePanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
+ public override Label_5 Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer6.VCount
+ ///
+ public class VCount : UiNode
+ {
+ public VCount(EditorTileImagePanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { }
+ public override VCount Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer6
+ ///
+ public class HBoxContainer6 : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.Label
+ ///
+ public Label_5 L_Label
+ {
+ get
+ {
+ if (_L_Label == null) _L_Label = new Label_5(UiPanel, Instance.GetNode("Label"));
+ return _L_Label;
+ }
+ }
+ private Label_5 _L_Label;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.VCount
+ ///
+ public VCount L_VCount
+ {
+ get
+ {
+ if (_L_VCount == null) _L_VCount = new VCount(UiPanel, Instance.GetNode("VCount"));
+ return _L_VCount;
+ }
+ }
+ private VCount _L_VCount;
+
+ public HBoxContainer6(EditorTileImagePanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
+ public override HBoxContainer6 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
+ }
+
+ ///
/// 类型: , 路径: EditorTileImage.HBoxContainer.Right.VBoxContainer
///
public class VBoxContainer : UiNode
@@ -417,6 +524,32 @@
}
private HBoxContainer4 _L_HBoxContainer4;
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.HBoxContainer5
+ ///
+ public HBoxContainer5 L_HBoxContainer5
+ {
+ get
+ {
+ if (_L_HBoxContainer5 == null) _L_HBoxContainer5 = new HBoxContainer5(UiPanel, Instance.GetNode("HBoxContainer5"));
+ return _L_HBoxContainer5;
+ }
+ }
+ private HBoxContainer5 _L_HBoxContainer5;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.HBoxContainer6
+ ///
+ public HBoxContainer6 L_HBoxContainer6
+ {
+ get
+ {
+ if (_L_HBoxContainer6 == null) _L_HBoxContainer6 = new HBoxContainer6(UiPanel, Instance.GetNode("HBoxContainer6"));
+ return _L_HBoxContainer6;
+ }
+ }
+ private HBoxContainer6 _L_HBoxContainer6;
+
public VBoxContainer(EditorTileImagePanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { }
public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate());
}
@@ -485,7 +618,7 @@
public TileSprite S_TileSprite => L_HBoxContainer.L_Left.L_Bg.L_TextureRoot.L_TileSprite;
///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Left.Bg.TextureRoot.Brush
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Left.Bg.TextureRoot.Brush
///
public Brush S_Brush => L_HBoxContainer.L_Left.L_Bg.L_TextureRoot.L_Brush;
@@ -510,21 +643,61 @@
public Left S_Left => L_HBoxContainer.L_Left;
///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer.StartX
+ ///
+ public StartX S_StartX => L_HBoxContainer.L_Right.L_VBoxContainer.L_HBoxContainer.L_StartX;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer2.StartY
+ ///
+ public StartY S_StartY => L_HBoxContainer.L_Right.L_VBoxContainer.L_HBoxContainer2.L_StartY;
+
+ ///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer2
///
public HBoxContainer2 S_HBoxContainer2 => L_HBoxContainer.L_Right.L_VBoxContainer.L_HBoxContainer2;
///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer3.OffsetX
+ ///
+ public OffsetX S_OffsetX => L_HBoxContainer.L_Right.L_VBoxContainer.L_HBoxContainer3.L_OffsetX;
+
+ ///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer3
///
public HBoxContainer3 S_HBoxContainer3 => L_HBoxContainer.L_Right.L_VBoxContainer.L_HBoxContainer3;
///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer4.OffsetY
+ ///
+ public OffsetY S_OffsetY => L_HBoxContainer.L_Right.L_VBoxContainer.L_HBoxContainer4.L_OffsetY;
+
+ ///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer4
///
public HBoxContainer4 S_HBoxContainer4 => L_HBoxContainer.L_Right.L_VBoxContainer.L_HBoxContainer4;
///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer5.HCount
+ ///
+ public HCount S_HCount => L_HBoxContainer.L_Right.L_VBoxContainer.L_HBoxContainer5.L_HCount;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer5
+ ///
+ public HBoxContainer5 S_HBoxContainer5 => L_HBoxContainer.L_Right.L_VBoxContainer.L_HBoxContainer5;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer6.VCount
+ ///
+ public VCount S_VCount => L_HBoxContainer.L_Right.L_VBoxContainer.L_HBoxContainer6.L_VCount;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer.HBoxContainer6
+ ///
+ public HBoxContainer6 S_HBoxContainer6 => L_HBoxContainer.L_Right.L_VBoxContainer.L_HBoxContainer6;
+
+ ///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTileImage.HBoxContainer.Right.VBoxContainer
///
public VBoxContainer S_VBoxContainer => L_HBoxContainer.L_Right.L_VBoxContainer;
diff --git a/DungeonShooting_Godot/src/game/ui/editorTileImage/EditorTileImagePanel.cs b/DungeonShooting_Godot/src/game/ui/editorTileImage/EditorTileImagePanel.cs
index cf59d89..3cb8860 100644
--- a/DungeonShooting_Godot/src/game/ui/editorTileImage/EditorTileImagePanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/editorTileImage/EditorTileImagePanel.cs
@@ -4,20 +4,79 @@
public partial class EditorTileImagePanel : EditorTileImage
{
- private Image _image;
+ ///
+ /// 起始X
+ ///
+ public int StartXValue { get; private set; }
+ ///
+ /// 起始Y
+ ///
+ public int StartYValue { get; private set; }
+ ///
+ /// 间距X
+ ///
+ public int OffsetXValue { get; private set; }
+ ///
+ /// 间距Y
+ ///
+ public int OffsetYValue { get; private set; }
+ ///
+ /// 横轴数量
+ ///
+ public int HCountValue { get; private set; }
+ ///
+ /// 纵轴数量
+ ///
+ public int VCountValue { get; private set; }
+ ///
+ /// 纹理大小
+ ///
+ public Vector2I ImageSize { get; private set; }
+ ///
+ /// 使用的Image对象
+ ///
+ public Image UseImage { get; private set; }
+
private ImageTexture _texture;
public override void OnCreateUi()
{
-
+ S_StartX.Instance.ValueChanged += (v) =>
+ {
+ StartXValue = (int)v;
+ RefreshHVMaxCount();
+ };
+ S_StartY.Instance.ValueChanged += (v) =>
+ {
+ StartYValue = (int)v;
+ RefreshHVMaxCount();
+ };
+ S_OffsetX.Instance.ValueChanged += (v) =>
+ {
+ OffsetXValue = (int)v;
+ RefreshHVMaxCount();
+ };
+ S_OffsetY.Instance.ValueChanged += (v) =>
+ {
+ OffsetYValue = (int)v;
+ RefreshHVMaxCount();
+ };
+ S_HCount.Instance.ValueChanged += (v) =>
+ {
+ HCountValue = (int)v;
+ };
+ S_VCount.Instance.ValueChanged += (v) =>
+ {
+ VCountValue = (int)v;
+ };
}
public override void OnDestroyUi()
{
- if (_image != null)
+ if (UseImage != null)
{
- _image.Dispose();
- _image = null;
+ UseImage.Dispose();
+ UseImage = null;
}
if (_texture != null)
@@ -32,10 +91,49 @@
///
public void InitData(Image image)
{
- _image = image;
+ UseImage = image;
+ ImageSize = image.GetSize();
_texture = ImageTexture.CreateFromImage(image);
S_TileSprite.Instance.Texture = _texture;
S_Bg.Instance.DoFocus();
+ S_TextureRoot.Instance.Size = image.GetSize();
+
+ RefreshHVMaxCount();
+ S_HCount.Instance.Value = S_HCount.Instance.MaxValue;
+ S_VCount.Instance.Value = S_VCount.Instance.MaxValue;
}
+ ///
+ /// 获取处理后的图像
+ ///
+ public Image GetImage()
+ {
+ var image = Image.Create(HCountValue * GameConfig.TileCellSize, VCountValue * GameConfig.TileCellSize, false, Image.Format.Rgba8);
+ var start = new Vector2I(StartXValue, StartYValue);
+ for (int i = 0; i < HCountValue; i++)
+ {
+ for (int j = 0; j < VCountValue; j++)
+ {
+ var offset = new Vector2I(i * (OffsetXValue + GameConfig.TileCellSize), j * (OffsetYValue + GameConfig.TileCellSize));
+ image.BlitRect(UseImage,
+ new Rect2I(
+ start + offset,
+ GameConfig.TileCellSizeVector2I
+ ),
+ new Vector2I(i * GameConfig.TileCellSize, j * GameConfig.TileCellSize)
+ );
+ }
+ }
+
+ return image;
+ }
+
+ //更新最大计数的水平和垂直方向的值
+ private void RefreshHVMaxCount()
+ {
+ var hv = Mathf.FloorToInt(((float)ImageSize.X - StartXValue + OffsetXValue) / (GameConfig.TileCellSize + OffsetXValue));
+ var vv = Mathf.FloorToInt(((float)ImageSize.Y - StartYValue + OffsetYValue) / (GameConfig.TileCellSize + OffsetYValue));
+ S_HCount.Instance.MaxValue = hv;
+ S_VCount.Instance.MaxValue = vv;
+ }
}
diff --git a/DungeonShooting_Godot/src/game/ui/editorTileImage/RectBrush.cs b/DungeonShooting_Godot/src/game/ui/editorTileImage/RectBrush.cs
new file mode 100644
index 0000000..7d17e7a
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/editorTileImage/RectBrush.cs
@@ -0,0 +1,56 @@
+using Godot;
+
+namespace UI.EditorTileImage;
+
+public partial class RectBrush : Control, IUiNodeScript
+{
+ private Control _parent;
+ private EditorTileImage.Brush UiNode;
+
+ public void SetUiNode(IUiNode uiNode)
+ {
+ UiNode = (EditorTileImage.Brush)uiNode;
+ _parent = GetParent();
+ }
+
+ public void OnDestroy()
+ {
+
+ }
+ public override void _Process(double delta)
+ {
+ if (UiNode.UiPanel.UseImage != null)
+ {
+ QueueRedraw();
+ }
+ }
+
+ public override void _Draw()
+ {
+ var panel = UiNode.UiPanel;
+ if (panel.UseImage != null)
+ {
+ var sx = _parent.Scale.X;
+ var size = panel.ImageSize;
+ var lineWidth = 2f / sx;
+ var lineWidthHalf = new Vector2(lineWidth / 2f, lineWidth / 2f);
+ DrawRect(new Rect2(Vector2.Zero, size), Colors.Yellow, false, lineWidth);
+
+ var start = new Vector2(panel.StartXValue, panel.StartYValue);
+ for (int i = 0; i < panel.HCountValue; i++)
+ {
+ for (int j = 0; j < panel.VCountValue; j++)
+ {
+ var offset = new Vector2(i * (panel.OffsetXValue + GameConfig.TileCellSize), j * (panel.OffsetYValue + GameConfig.TileCellSize));
+ DrawRect(
+ new Rect2(
+ start + offset + lineWidthHalf,
+ new Vector2(GameConfig.TileCellSize, GameConfig.TileCellSize) - new Vector2(lineWidth, lineWidth)
+ ),
+ new Color(0, 1, 0, 0.5f), false, lineWidth
+ );
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorImport/TileSetEditorImportPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorImport/TileSetEditorImportPanel.cs
index 2130246..54e55f4 100644
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorImport/TileSetEditorImportPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorImport/TileSetEditorImportPanel.cs
@@ -181,10 +181,12 @@
Debug.Log("导入文件: " + file);
var image = Image.LoadFromFile(file);
- EditorWindowManager.ShowImportTileImage(image, null);
- // tileSetSourceInfo.SourcePath = GameConfig.RoomTileSetDir + _tileSetEditor.TileSetInfo.Name + "/" + tileSetSourceInfo.Name + ".png";
- // tileSetSourceInfo.SetSourceImage(image);
- // _tileSetEditor.SetTextureData(image);
- // EventManager.EmitEvent(EventEnum.OnTileSetDirty);
+ EditorWindowManager.ShowImportTileImage(image, (result) =>
+ {
+ tileSetSourceInfo.SourcePath = GameConfig.RoomTileSetDir + _tileSetEditor.TileSetInfo.Name + "/" + tileSetSourceInfo.Name + ".png";
+ tileSetSourceInfo.SetSourceImage(result);
+ _tileSetEditor.SetTextureData(result);
+ EventManager.EmitEvent(EventEnum.OnTileSetDirty);
+ });
}
}