From e0723ec261820c8e1564cd7bc0d67b043773c723 Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Thu, 16 May 2024 22:46:03 +0800 Subject: [PATCH] =?UTF-8?q?Supports=20loading=20and=20saving=20hierarchy?= =?UTF-8?q?=20diagrams=20from=20json=20files=20now.=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=92=8C=E4=BF=9D=E5=AD=98=E5=B1=82=E7=BA=A7?= =?UTF-8?q?=E5=9B=BE=E4=BB=8Ejson=E6=96=87=E4=BB=B6=E4=BA=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locals/UI.csv | 5 +- locals/UI.en.translation | Bin 1590 -> 1610 bytes locals/UI.jp.translation | Bin 1949 -> 1973 bytes locals/UI.zh.translation | Bin 1649 -> 1673 bytes project.godot | 1 + scenes/LevelGraphEditor.tscn | 20 +- scripts/levelGraphEditor/IRoomNodeData.cs | 18 - .../LevelGraphEditorSaveData.cs | 2 +- scripts/levelGraphEditor/RoomNode.cs | 4 +- scripts/levelGraphEditor/RoomNodeData.cs | 2 +- .../loader/uiLoader/LevelGraphEditorLoader.cs | 416 ++++++++++++++---- 11 files changed, 347 insertions(+), 121 deletions(-) delete mode 100644 scripts/levelGraphEditor/IRoomNodeData.cs diff --git a/locals/UI.csv b/locals/UI.csv index 0f22d2d..8bee363 100644 --- a/locals/UI.csv +++ b/locals/UI.csv @@ -9,7 +9,7 @@ jump,跳跃,Jump,飛 throw,抛出,Throw a ,ほうしゅつ use_item,使用,Use,しよう jump_down,跳下平台,Jump off platform,踊り場から飛び降ります -de,的,'s,の +de,的,"'s",の default_player_name,白纸,blankPaper,しらかみ item_prompt_debug,ID:{0}\n名称:{1}\n数量:{2}\n最大叠加数量:{3}\n数据类型:{4}\n描述:{5},ID: {0}\nName: {1}\nQuantity: {2}\nMaximum stacking quantity: {3}\nData type: {4}\nDescription:{5},id:{0}\n名称:{1}\nの数は最大{2}\nシナジー数:{3}\nデータタイプ:{4}\n述べ表わす:{5} level_graph_editor,关卡图编辑器,Level graph editor,ステージマップエディター @@ -25,4 +25,5 @@ line_errors_must_start_with_res,位于{0}错误,必须以res://开头。,"Loca open_the_export_directory,打开导出目录,Open the export directory,エクスポートディレクトリを開きます save,保存,Save,保留 filename,文件名,File name,ファイル名 -cancel,取消,Cancel,キャンセル \ No newline at end of file +cancel,取消,Cancel,キャンセル +load,加载,Load,ろーど \ No newline at end of file diff --git a/locals/UI.en.translation b/locals/UI.en.translation index 7add42571b9fa7eedd19a19e7ec041cdc58beb3a..aed4396b7092aa25b788a00310fed6131409434f 100644 GIT binary patch delta 170 zcmdnSbBbq!G$U(Xrm=C(WCg}mzA+383`szo0mMZ>{2vKaK>2k*x&?^4fOrB_45n-v zkk1Ol3P3z(vpADCqbd`S$q2+83&p1j0%pVh{2vLFK>1Zbx&esWfVc;Uk(B(O z1mv>ug!*euTE%_zzUWP&iqLh-4BK$;7Pxi_~nb2Bn7+&r0O2_rvHfE|cIih_cJ FoB;vaE{OmD diff --git a/locals/UI.jp.translation b/locals/UI.jp.translation index b887b84e97f322f11d5ad715444580f72df507e1..9b74fe83aa341c4294131694309be8a317da2d45 100644 GIT binary patch delta 175 zcmbQszm{2vKaK>2k*x&?^4fOrB_45n-v zkk1Ol3P3z(vl^2(qbd`S$q2+83&p330clAnUihX={3lS73&`i%+{Vn!$i&RNc{0my bCh^Bjy^ovsJZ@acz`zca1?dh74sr$nq24%s delta 151 zcmdnWKbL=lG$X5dsYzpVh{2vLFK>1Zbx&esWfVc;Uk(B(O z1mv>ug!*sR9n%_zzUWP&iqLh-3$Kw1)nH&0{cW@P%ww0SYhZzg`A2s;piR0RbG GIRgM@E-%Ue diff --git a/locals/UI.zh.translation b/locals/UI.zh.translation index b5dd9cecbff35029605207d47557c54d07497a03..9774ac0aeaea4e4e991e8c5472a31ada3a7e03a0 100644 GIT binary patch delta 173 zcmey!)5*I*nvvBa+cYh2vI65y-xvl4h9n@)0OBGb{*MGIp!_-@-2%j2Ks*5|22(Z- z$Y%v&1t6ZYS&hk?QI!eEWCUW4h2m3rfiw&+d{ZWV4k*D66l34q#>~ygcy;q6mWzyH VPrDYp*t-`f43-1w4GIo&1^^KBHueAj delta 149 zcmeC={m8RHnvpfHET<@UvI65y-v|ZewNJ{=s z0`ggbSOJJN C;V - /// Title - /// 标题 - /// - string? Title { get; set; } - - /// - /// 描述 - /// Description - /// - string? Description { get; set; } -} \ No newline at end of file diff --git a/scripts/levelGraphEditor/LevelGraphEditorSaveData.cs b/scripts/levelGraphEditor/LevelGraphEditorSaveData.cs index 566ae3c..240c43e 100644 --- a/scripts/levelGraphEditor/LevelGraphEditorSaveData.cs +++ b/scripts/levelGraphEditor/LevelGraphEditorSaveData.cs @@ -10,5 +10,5 @@ public class LevelGraphEditorSaveData { public List? ConnectionDataList { get; set; } - public List? RoomNodeDataList { get; set; } + public List? RoomNodeDataList { get; set; } } \ No newline at end of file diff --git a/scripts/levelGraphEditor/RoomNode.cs b/scripts/levelGraphEditor/RoomNode.cs index 4b99858..de40f56 100644 --- a/scripts/levelGraphEditor/RoomNode.cs +++ b/scripts/levelGraphEditor/RoomNode.cs @@ -5,9 +5,9 @@ namespace ColdMint.scripts.levelGraphEditor; public partial class RoomNode : GraphNode { private Label? _describeLabel; - private IRoomNodeData? _roomNodeData; + private RoomNodeData? _roomNodeData; - public IRoomNodeData? RoomNodeData + public RoomNodeData? RoomNodeData { get => _roomNodeData; set diff --git a/scripts/levelGraphEditor/RoomNodeData.cs b/scripts/levelGraphEditor/RoomNodeData.cs index 8bcb935..0b92f0f 100644 --- a/scripts/levelGraphEditor/RoomNodeData.cs +++ b/scripts/levelGraphEditor/RoomNodeData.cs @@ -1,6 +1,6 @@ namespace ColdMint.scripts.levelGraphEditor; -public class RoomNodeData : IRoomNodeData +public class RoomNodeData { public string? Id { get; set; } public string? Title { get; set; } diff --git a/scripts/loader/uiLoader/LevelGraphEditorLoader.cs b/scripts/loader/uiLoader/LevelGraphEditorLoader.cs index de299cb..4dc8992 100644 --- a/scripts/loader/uiLoader/LevelGraphEditorLoader.cs +++ b/scripts/loader/uiLoader/LevelGraphEditorLoader.cs @@ -31,12 +31,37 @@ public partial class LevelGraphEditorLoader : UiLoaderTemplate private Button? _createRoomButton; private Button? _returnButton; private string? _defaultRoomName; + + /// + /// Index of the room + /// 房间的索引 + /// private int _roomIndex = 1; + private TextEdit? _roomTemplateCollectionTextEdit; private Label? _roomTemplateTipsLabel; - private Button? _saveButton; + private Button? _showSavePanelButton; private Button? _openExportFolderButton; private HBoxContainer? _hBoxContainer; + private Panel? _saveOrLoadPanel; + private Button? _cancelButton; + private Button? _actionButton; + private Label? _saveOrLoadPanelTitleLabel; + private LineEdit? _fileNameLineEdit; + private Button? _showLoadPanelButton; + + /// + /// Offset to append when a new node is created. + /// 创建新节点时追加的偏移量。 + /// + private Vector2 _positionOffset = new Vector2(100, 100); + + /// + /// Is the press event of an active button saved? + /// 活动按钮的按下事件是否为保存? + /// + private bool _saveMode; + public override void InitializeData() { @@ -68,8 +93,14 @@ public partial class LevelGraphEditorLoader : UiLoaderTemplate _openExportFolderButton.Visible = ExplorerUtils.SupportOpenDirectory(); } + _showLoadPanelButton = GetNode