稍微修改

This commit is contained in:
tangbin
2025-09-10 20:01:05 +08:00
parent deab39ea12
commit c74d65a74f
6 changed files with 80 additions and 68 deletions

View File

@@ -17951,7 +17951,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -82.3, y: 215}
m_AnchoredPosition: {x: -167.3, y: 215}
m_SizeDelta: {x: 30, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &888453850
@@ -25050,7 +25050,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 49.4, y: 214.2}
m_AnchoredPosition: {x: -37.1, y: 214.2}
m_SizeDelta: {x: 50, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1278429982
@@ -29069,7 +29069,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -18.5, y: 214.5}
m_AnchoredPosition: {x: -104, y: 214.5}
m_SizeDelta: {x: 50, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1466376496

View File

@@ -22,8 +22,8 @@ public class GridSelector : MonoBehaviour
private MeshCollider mapCollider;
private Map map;
public int horizontalNumber { get { return Mathf.CeilToInt(map.width / map.sideWidth); } }
public int verticalNumber { get { return Mathf.CeilToInt(map.height / map.sideHeight); } }
public int horizontalNumber { get { return Mathf.FloorToInt(map.width / map.sideWidth); } }
public int verticalNumber { get { return Mathf.FloorToInt(map.height / map.sideHeight); } }
public int totalNumber { get { return horizontalNumber * verticalNumber; } }
public int moveNum;
@@ -335,6 +335,7 @@ public class GridSelector : MonoBehaviour
}
else if (selectedGridIndex.Count == 1)
{
#if UNITY_EDITOR
int beginIndex = selectedGridIndex[0];
GetXyByIndex(beginIndex, out int x, out int y);
string labelText = string.Format(
@@ -346,8 +347,7 @@ public class GridSelector : MonoBehaviour
labelText,
style
);
//GUI.Label(new Rect(width - 820, 20, 400, 50), string.Format("所选点XY序列({0},{1}) 高度{2} 点类型 {3}", x, y, ((dataArray[beginIndex].barrier >> 16) - 10000)/100.0f, CellTypeColors.GetAreaStr((dataArray[beginIndex].barrier)), style));
#endif
}
else
{

View File

@@ -183,7 +183,7 @@ public partial class MapManager : MonoBehaviour
{
for (int col = 0; col < mapColumn; col++)
{
string filename = $"v{mapId}_r{mapColumn - col}_c{row + 1}"; // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>v1000_r11_c1.jpg
string filename = isSmallPic ? $"v{mapId}_r{mapColumn - col}_c{row + 1}" : $"r{mapColumn - col}_c{row + 1}"; // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>v1000_r11_c1.jpg
string spPath = PathUtil.GetMapTexure(mapId, filename, "jpg");
GameObject obj = new GameObject(filename);
obj.transform.SetParent(mapRegionParent);

View File

@@ -23,6 +23,8 @@ public partial class MapManager : MonoBehaviour
//<2F><><EFBFBD>ŵ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>
public int PicMapPixel => int.Parse(mapPic.text);
public bool isSmallPic => PicMapPixel == 512;
public delegate void LoadFinishedCallback();
public LoadFinishedCallback onLoadFinishedCallback;
//public delegate void CloseMapCallback();

View File

@@ -39,7 +39,17 @@ public class UIMapPanel : MonoBehaviour
}
MapManager.Instance.allMaps.Clear();
string[] mapFolders = Directory.GetDirectories(mapsDirectory);
foreach (string folderPath in mapFolders)
// <20><> mapId <20><><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
var sortedMapFolders = mapFolders
.OrderBy(folderPath =>
{
string folderName = Path.GetFileName(folderPath); // <20><><EFBFBD><EFBFBD> "v1000"
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD>
var match = Regex.Match(folderName, @"\d+");
return match.Success ? int.Parse(match.Value) : int.MaxValue;
})
.ToArray();
foreach (string folderPath in sortedMapFolders)
{
string[] pathSplit = folderPath.Split(Path.DirectorySeparatorChar);
string mapId = pathSplit[pathSplit.Length - 1]; // <20><><EFBFBD><EFBFBD> "v1000"
@@ -50,7 +60,7 @@ public class UIMapPanel : MonoBehaviour
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
string pattern = $@"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)
@@ -159,7 +169,7 @@ public class UIMapPanel : MonoBehaviour
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 newFileName = $"r{row}_c{col}";
string newFilePath = Path.Combine(mapsDirectory, newFileName + fileExtension);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
@@ -190,7 +200,7 @@ public class UIMapPanel : MonoBehaviour
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+$";
string pattern = $"^r\\d+_c\\d+$";
var regex = new System.Text.RegularExpressions.Regex(pattern);
foreach (string filePath in imageFiles)
@@ -218,7 +228,7 @@ public class UIMapPanel : MonoBehaviour
{
bool hasMapFormat = false;
bool hasTargetFormat = false;
string pattern = $"^v{mapId}_r\\d+_c\\d+$";
string pattern = $"^r\\d+_c\\d+$";
var regex = new System.Text.RegularExpressions.Regex(pattern);
foreach (string filePath in imageFiles)