using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using ColdMint.scripts.levelGraphEditor;
using ColdMint.scripts.serialization;
using ColdMint.scripts.utils;
using Godot;
using Godot.Collections;
using FileAccess = Godot.FileAccess;
namespace ColdMint.scripts.loader.uiLoader;
///
/// Level graph editor
/// 关卡图编辑器
///
public partial class LevelGraphEditorLoader : UiLoaderTemplate
{
private GraphEdit? _graphEdit;
///
/// Button to display the room creation panel.
/// 用于展示房间创建面板的按钮。
///
private Button? _showCreateRoomPanelButton;
private PackedScene? _roomNodeScene;
private Panel? _createOrEditorPanel;
private Button? _hideCreateRoomPanelButton;
private LineEdit? _roomNameLineEdit;
private LineEdit? _roomDescriptionLineEdit;
private Button? _createRoomButton;
private Button? _returnButton;
private string? _defaultRoomName;
private int _roomIndex = 1;
private TextEdit? _roomTemplateCollectionTextEdit;
private Label? _roomTemplateTipsLabel;
private Button? _saveButton;
private Button? _openExportFolderButton;
private HBoxContainer? _hBoxContainer;
public override void InitializeData()
{
base.InitializeData();
_roomNodeScene = (PackedScene)GD.Load("res://prefab/ui/RoomNode.tscn");
_defaultRoomName = TranslationServer.Translate("default_room_name");
var folder = Config.GetLevelGraphExportDirectory();
if (!Directory.Exists(folder))
{
Directory.CreateDirectory(folder);
}
}
public override void InitializeUi()
{
base.InitializeUi();
_roomTemplateTipsLabel = GetNode