diff --git a/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs b/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs
index 3c694ff..714e16f 100644
--- a/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs
+++ b/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs
@@ -28,6 +28,9 @@
public string IconPath;
}
+ ///
+ /// 当前插件实例
+ ///
public static Plugin Instance { get; private set; }
//工具面板
@@ -71,6 +74,8 @@
),
};
+ private bool _clickSave = false;
+
public override void _Process(double delta)
{
Instance = this;
@@ -78,6 +83,20 @@
{
_uiMonitor.Process((float) delta);
}
+
+ //按下 ctrl + s 保存
+ if (Input.IsKeyPressed(Key.Ctrl) && Input.IsKeyPressed(Key.S))
+ {
+ if (!_clickSave)
+ {
+ OnSaveClick();
+ }
+ _clickSave = true;
+ }
+ else
+ {
+ _clickSave = false;
+ }
}
public override void _EnterTree()
@@ -154,7 +173,6 @@
if (_editorTools != null)
{
- //RemoveControlFromDocks(dock);
try
{
_editorTools.OnHideUi();
@@ -209,6 +227,19 @@
}
}
+ //当ctrl+s按下
+ private void OnSaveClick()
+ {
+ var root = GetEditorInterface().GetEditedSceneRoot();
+ if (root != null)
+ {
+ if (CheckIsUi(root)) //生成ui代码
+ {
+ OnUiSceneChange(root);
+ }
+ }
+ }
+
///
/// 切换场景
///
@@ -217,7 +248,6 @@
_uiMonitor.ChangeCurrentNode(null);
if (CheckIsUi(node))
{
- OnUiSceneChange(node);
_uiMonitor.ChangeCurrentNode(node);
}
}
@@ -247,13 +277,14 @@
return false;
}
+ //ui场景存在修改
private void OnUiSceneChange(Node node)
{
try
{
var uiName = node.Name.ToString();
var path = GameConfig.UiCodeDir + uiName.FirstToLower() + "/" + uiName + ".cs";
- GD.Print("检测到ui: '" + uiName + "'有变动, 重新生成ui代码: " + path);
+ GD.Print("重新生成ui代码: " + path);
//生成ui代码
UiGenerator.GenerateUiFromEditor(node, path);
}
diff --git a/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs
index a17e8e6..06107c8 100644
--- a/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs
@@ -16,6 +16,8 @@
L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer3.L_Button.Instance.Pressed -= OnCreateUI;
}
+
+
private void OnCreateUI()
{
var text = L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer3.L_LineEdit.Instance.Text;