2025-06-14 13:46:24 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
2025-06-19 01:31:00 +08:00
|
|
|
|
using System.Data.Common;
|
2025-06-14 13:46:24 +08:00
|
|
|
|
using System.IO;
|
2025-08-22 16:02:14 +08:00
|
|
|
|
using System.Linq;
|
2025-06-16 00:15:41 +08:00
|
|
|
|
using System.Text.RegularExpressions;
|
2025-06-25 15:57:50 +08:00
|
|
|
|
using UnityEditor;
|
2025-06-14 13:46:24 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
///<2F><><EFBFBD>ܣ<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>رյ<D8B1>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
public class UIMapPanel : MonoBehaviour
|
|
|
|
|
|
{
|
2025-07-19 12:48:11 +08:00
|
|
|
|
public ToggleGroup mapEditorGroup;
|
2025-06-14 13:46:24 +08:00
|
|
|
|
public Dropdown dropMap;
|
|
|
|
|
|
private bool _saving;
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
|
void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
_saving = false;
|
2025-08-22 16:02:14 +08:00
|
|
|
|
dropMap.onValueChanged.AddListener(delegate {
|
|
|
|
|
|
if (dropMap.options.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
int mapId = Convert.ToInt32(dropMap.options[dropMap.value].text);
|
|
|
|
|
|
UICellInfo.Instance.ShowMapWidthAndHeight(mapId);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2025-06-14 13:46:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
void OnDataLoaded()
|
|
|
|
|
|
{
|
2025-06-16 00:15:41 +08:00
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>е<EFBFBD>ͼ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
|
|
|
string mapsDirectory = Path.Combine(Application.dataPath, "GameAssets", "Maps");
|
|
|
|
|
|
if (!Directory.Exists(mapsDirectory))
|
2025-06-14 13:46:24 +08:00
|
|
|
|
{
|
2025-06-16 00:15:41 +08:00
|
|
|
|
Debug.LogError($"Maps directory not found: {mapsDirectory}");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-08-22 16:02:14 +08:00
|
|
|
|
MapManager.Instance.allMaps.Clear();
|
2025-06-16 00:15:41 +08:00
|
|
|
|
string[] mapFolders = Directory.GetDirectories(mapsDirectory);
|
|
|
|
|
|
foreach (string folderPath in mapFolders)
|
|
|
|
|
|
{
|
|
|
|
|
|
string[] pathSplit = folderPath.Split(Path.DirectorySeparatorChar);
|
|
|
|
|
|
string mapId = pathSplit[pathSplit.Length - 1]; // <20><><EFBFBD><EFBFBD> "v1000"
|
|
|
|
|
|
|
|
|
|
|
|
string textureDirectory = Path.Combine(folderPath, "Texture");
|
|
|
|
|
|
if (Directory.Exists(textureDirectory))
|
|
|
|
|
|
{
|
|
|
|
|
|
string[] imageFiles = Directory.GetFiles(textureDirectory, "*.jpg");
|
|
|
|
|
|
int maxRow = 0;
|
|
|
|
|
|
int maxCol = 0;
|
|
|
|
|
|
string pattern = $@"{mapId}_r(\d+)_c(\d+)"; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ƥ<EFBFBD><C6A5> v1000_rXX_cYY
|
|
|
|
|
|
Regex regex = new Regex(pattern);
|
|
|
|
|
|
|
|
|
|
|
|
foreach (string filePath in imageFiles)
|
|
|
|
|
|
{
|
|
|
|
|
|
string fileName = Path.GetFileNameWithoutExtension(filePath); // <20><><EFBFBD><EFBFBD> "v1000_r11_c14"
|
|
|
|
|
|
Match match = regex.Match(fileName);
|
|
|
|
|
|
if (match.Success)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (int.TryParse(match.Groups[1].Value, out int row) && int.TryParse(match.Groups[2].Value, out int col))
|
|
|
|
|
|
{
|
|
|
|
|
|
maxRow = Mathf.Max(maxRow, row);
|
|
|
|
|
|
maxCol = Mathf.Max(maxCol, col);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.LogWarning($"Filename {fileName} does not match expected pattern: {pattern}");
|
|
|
|
|
|
}
|
2025-08-22 16:02:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MapManager.Instance.allMaps[mapId] = (maxCol, maxRow, imageFiles.Length);
|
2025-06-16 00:15:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.LogWarning($"Texture directory not found for map {mapId}: {textureDirectory}");
|
|
|
|
|
|
}
|
2025-06-14 13:46:24 +08:00
|
|
|
|
}
|
2025-08-22 16:02:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC>ʽ<EFBFBD><CABD> map_x <20><> v{mapId}_rx_cx <20><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD>飩
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void ReNamePicFormat()
|
|
|
|
|
|
{
|
|
|
|
|
|
int mapId = Convert.ToInt32(dropMap.options[dropMap.value].text);
|
|
|
|
|
|
int width = UICellInfo.Instance.CustomMapWidth; // <20><>ͼ<EFBFBD><CDBC><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
string mapsDirectory = Path.Combine(Application.dataPath, "GameAssets", "Maps", $"{mapId}", "Texture");
|
|
|
|
|
|
|
|
|
|
|
|
if (!Directory.Exists(mapsDirectory))
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.LogError($"Maps directory not found: {mapsDirectory}");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>jpg<70>ļ<EFBFBD>
|
|
|
|
|
|
string[] imageFiles = Directory.GetFiles(mapsDirectory, "*.jpg");
|
|
|
|
|
|
int totalFiles = imageFiles.Length;
|
|
|
|
|
|
|
|
|
|
|
|
if (totalFiles == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
UIWindow.Instance.ShowMessage($"No jpg files found in directory: {mapsDirectory}");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
|
if (IsAlreadyRenamed(imageFiles, mapId))
|
|
|
|
|
|
{
|
|
|
|
|
|
UIWindow.Instance.ShowMessage($"<22>ļ<EFBFBD><C4BC><EFBFBD> {mapId} <20>Ѿ<EFBFBD><D1BE><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ϸ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
if (IsMixedFormat(imageFiles, mapId))
|
|
|
|
|
|
{
|
|
|
|
|
|
UIWindow.Instance.ShowMessage($"<22>ļ<EFBFBD><C4BC><EFBFBD> {mapId} <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>map_<70><5F>ʽ<EFBFBD><CABD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
|
var mapFiles = imageFiles
|
|
|
|
|
|
.Where(file => Path.GetFileNameWithoutExtension(file).StartsWith("map_"))
|
|
|
|
|
|
.OrderBy(file =>
|
|
|
|
|
|
{
|
|
|
|
|
|
string fileName = Path.GetFileNameWithoutExtension(file);
|
|
|
|
|
|
if (int.TryParse(fileName.Substring(4), out int number))
|
|
|
|
|
|
{
|
|
|
|
|
|
return number;
|
|
|
|
|
|
}
|
|
|
|
|
|
return int.MaxValue;
|
|
|
|
|
|
})
|
|
|
|
|
|
.ToArray();
|
|
|
|
|
|
|
|
|
|
|
|
if (mapFiles.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
UIWindow.Instance.ShowMessage($"û<><C3BB><EFBFBD>ҵ<EFBFBD>map_<70><5F>ʽ<EFBFBD><CABD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>ʽ");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int height = Mathf.CeilToInt((float)mapFiles.Length / width);
|
|
|
|
|
|
UIWindow.Instance.ShowMessage($"Renaming {mapFiles.Length} files with grid size: {width}x{height}");
|
|
|
|
|
|
|
|
|
|
|
|
int renamedCount = 0;
|
|
|
|
|
|
int errorCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
for (int index = 0; index < mapFiles.Length; index++)
|
|
|
|
|
|
{
|
|
|
|
|
|
string oldFilePath = mapFiles[index];
|
|
|
|
|
|
string fileName = Path.GetFileNameWithoutExtension(oldFilePath);
|
|
|
|
|
|
string fileExtension = Path.GetExtension(oldFilePath);
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD>1<EFBFBD><31>ʼ<EFBFBD><CABC>
|
|
|
|
|
|
int row = (index / width) + 1;
|
|
|
|
|
|
int col = (index % width) + 1;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD>ͼID<49><44>
|
|
|
|
|
|
string newFileName = $"v{mapId}_r{row}_c{col}";
|
|
|
|
|
|
string newFilePath = Path.Combine(mapsDirectory, newFileName + fileExtension);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
|
File.Move(oldFilePath, newFilePath);
|
|
|
|
|
|
renamedCount++;
|
|
|
|
|
|
|
|
|
|
|
|
Debug.Log($"Renamed: {fileName} -> {newFileName}");
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
errorCount++;
|
|
|
|
|
|
Debug.LogError($"Error renaming file {fileName}: {ex.Message}");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Debug.Log($"Rename completed. Success: {renamedCount}, Errors: {errorCount}");
|
|
|
|
|
|
|
|
|
|
|
|
// ˢ<><CBA2>AssetDatabase
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
|
|
UnityEditor.AssetDatabase.Refresh();
|
|
|
|
|
|
#endif
|
|
|
|
|
|
OnDataLoaded();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private bool IsAlreadyRenamed(string[] imageFiles, int mapId)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Ŀ<><C4BF><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>v{mapId}_r<5F><72><EFBFBD><EFBFBD>_c<5F><63><EFBFBD><EFBFBD>
|
|
|
|
|
|
string pattern = $"^v{mapId}_r\\d+_c\\d+$";
|
|
|
|
|
|
var regex = new System.Text.RegularExpressions.Regex(pattern);
|
|
|
|
|
|
|
|
|
|
|
|
foreach (string filePath in imageFiles)
|
|
|
|
|
|
{
|
|
|
|
|
|
string fileName = Path.GetFileNameWithoutExtension(filePath);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κη<CEBA>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
|
|
|
|
|
if (!regex.IsMatch(fileName) && !fileName.StartsWith("map_"))
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
|
bool hasTargetFormat = imageFiles.Any(file =>
|
|
|
|
|
|
regex.IsMatch(Path.GetFileNameWithoutExtension(file)));
|
|
|
|
|
|
|
|
|
|
|
|
return hasTargetFormat;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ϸ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>map_<70><5F>ʽ<EFBFBD><CABD>
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private bool IsMixedFormat(string[] imageFiles, int mapId)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool hasMapFormat = false;
|
|
|
|
|
|
bool hasTargetFormat = false;
|
|
|
|
|
|
string pattern = $"^v{mapId}_r\\d+_c\\d+$";
|
|
|
|
|
|
var regex = new System.Text.RegularExpressions.Regex(pattern);
|
|
|
|
|
|
|
|
|
|
|
|
foreach (string filePath in imageFiles)
|
|
|
|
|
|
{
|
|
|
|
|
|
string fileName = Path.GetFileNameWithoutExtension(filePath);
|
|
|
|
|
|
|
|
|
|
|
|
if (fileName.StartsWith("map_"))
|
|
|
|
|
|
{
|
|
|
|
|
|
hasMapFormat = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (regex.IsMatch(fileName))
|
|
|
|
|
|
{
|
|
|
|
|
|
hasTargetFormat = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD>״̬
|
|
|
|
|
|
if (hasMapFormat && hasTargetFormat)
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
2025-06-14 13:46:24 +08:00
|
|
|
|
}
|
2025-07-25 15:36:10 +08:00
|
|
|
|
public void ExportMap()
|
|
|
|
|
|
{
|
|
|
|
|
|
MapManager.Instance.SaveAtlasToFile();
|
|
|
|
|
|
}
|
2025-06-14 13:46:24 +08:00
|
|
|
|
public void ScanMap()
|
2025-06-16 00:15:41 +08:00
|
|
|
|
{
|
|
|
|
|
|
MapManager.Instance.allMaps.Clear();
|
2025-06-14 13:46:24 +08:00
|
|
|
|
|
|
|
|
|
|
OnDataLoaded();
|
|
|
|
|
|
|
|
|
|
|
|
dropMap.options.Clear();
|
2025-06-16 00:15:41 +08:00
|
|
|
|
foreach (var map in MapManager.Instance.allMaps)
|
|
|
|
|
|
{
|
2025-06-14 13:46:24 +08:00
|
|
|
|
Dropdown.OptionData od = new Dropdown.OptionData();
|
2025-06-16 00:15:41 +08:00
|
|
|
|
od.text = map.Key;
|
2025-06-14 13:46:24 +08:00
|
|
|
|
dropMap.options.Add(od);
|
|
|
|
|
|
}
|
|
|
|
|
|
dropMap.value = 1;
|
|
|
|
|
|
dropMap.value = 0; //Ϊ<><CEAA>Ĭ<EFBFBD><C4AC>ѡ<EFBFBD>е<EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OpenMap()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(dropMap.options.Count == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
UIWindow.Instance.ShowMessage("<22><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD>ͼ");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-30 15:22:56 +08:00
|
|
|
|
if(MapManager.Instance._curOpenMapId > 0)
|
2025-06-14 13:46:24 +08:00
|
|
|
|
{
|
|
|
|
|
|
UIWindow.Instance.ShowMessage("<22><><EFBFBD>ȹر<C8B9><D8B1><EFBFBD><EFBFBD>е<EFBFBD>ͼ");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-06-16 21:26:36 +08:00
|
|
|
|
int mapId = Convert.ToInt32(dropMap.options[dropMap.value].text);
|
2025-07-30 15:22:56 +08:00
|
|
|
|
MapManager.Instance._curOpenMapId = mapId;
|
|
|
|
|
|
MapManager.Instance.LoadMapRegionSprites(mapId);
|
|
|
|
|
|
MapManager.Instance.LoadMapObs(mapId);
|
2025-06-19 13:32:33 +08:00
|
|
|
|
UIWindow.Instance.uiEditMapConfig.LoadMapConfig(mapId);
|
|
|
|
|
|
UIWindow.Instance.uiMonstersPanel.LoadMonsterConfig(mapId);
|
|
|
|
|
|
UIWindow.Instance.uiNpcsPanel.LoadNpcsConfig(mapId);
|
|
|
|
|
|
UIWindow.Instance.uiTriggersPanel.LoadTriggersConfig(mapId);
|
|
|
|
|
|
UIWindow.Instance.uiFuBensPanel.LoadFuBenConfig(mapId);
|
|
|
|
|
|
UIWindow.Instance.uiJuBaosPanel.LoadJuBaoConfig(mapId);
|
2025-06-19 01:31:00 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
if (MapManager.Instance.map == null)
|
|
|
|
|
|
{
|
2025-07-30 15:22:56 +08:00
|
|
|
|
MapManager.Instance.CreateObs(mapId);
|
2025-06-19 13:32:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
UICellInfo.Instance.ShowMapCellInfo();
|
2025-06-14 13:46:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void CloseMap()
|
|
|
|
|
|
{
|
|
|
|
|
|
MapManager.Instance.CloseMap();
|
2025-07-30 15:22:56 +08:00
|
|
|
|
MapManager.Instance._curOpenMapId = -1;
|
2025-07-19 12:48:11 +08:00
|
|
|
|
foreach (var toggle in mapEditorGroup.ActiveToggles())
|
|
|
|
|
|
{
|
|
|
|
|
|
toggle.isOn = false;
|
|
|
|
|
|
}
|
2025-06-14 13:46:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool HasMap(string mapId)
|
|
|
|
|
|
{
|
2025-06-16 00:15:41 +08:00
|
|
|
|
return MapManager.Instance.allMaps.ContainsKey(mapId);
|
2025-06-14 13:46:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.S))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_saving)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
SaveAll();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SaveAll()
|
|
|
|
|
|
{
|
|
|
|
|
|
_saving = true;
|
|
|
|
|
|
Debug.Log("<22><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
2025-06-16 23:59:28 +08:00
|
|
|
|
MapManager.Instance.SaveRegionXML();
|
2025-06-19 13:32:33 +08:00
|
|
|
|
MapManager.Instance.SaveMapObs();
|
|
|
|
|
|
UIWindow.Instance.uiEditMapConfig.SaveMapConfig();
|
|
|
|
|
|
UIWindow.Instance.uiMonstersPanel.SaveMonsterConfig();
|
|
|
|
|
|
UIWindow.Instance.uiNpcsPanel.SaveNpcsConfig();
|
|
|
|
|
|
UIWindow.Instance.uiTriggersPanel.SaveTriggersConfig();
|
|
|
|
|
|
UIWindow.Instance.uiJuBaosPanel.SaveJuBaoConfig();
|
|
|
|
|
|
UIWindow.Instance.uiFuBensPanel.SaveFuBenConfig();
|
|
|
|
|
|
UIWindow.Instance.ShowMessage("<22><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
2025-06-25 15:57:50 +08:00
|
|
|
|
_saving = false;
|
|
|
|
|
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
|
|
AssetDatabase.Refresh();
|
|
|
|
|
|
#endif
|
2025-06-14 13:46:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|