错误提交
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using HxGame;
|
||||
using HxGame.Data;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -89,6 +90,49 @@ public partial class MapManager : MonoBehaviour
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public void LoadRegionXML(int mapId)
|
||||
{
|
||||
Transform regionsTrans = UIWindow.Instance.mapTrans.Find("Regions");
|
||||
if (regionsTrans == null)
|
||||
{
|
||||
UIWindow.Instance.ShowMessage("û<><C3BB><EFBFBD>ҵ<EFBFBD>Regions<6E>ڵ<EFBFBD>");
|
||||
return;
|
||||
}
|
||||
|
||||
MapRegions mapRegions = new MapRegions();
|
||||
mapRegions.mapWidth = Convert.ToInt32(txtMapWidth.text);
|
||||
mapRegions.mapHeight = Convert.ToInt32(txtMapHeight.text);
|
||||
mapRegions.regionWidth = Convert.ToInt32(txtRegionWidth.text);
|
||||
mapRegions.regionHeight = Convert.ToInt32(txtRegionHeight.text);
|
||||
|
||||
int row = mapRegions.mapWidth / MapManager.CELLSCALE / mapRegions.regionWidth;
|
||||
int col = mapRegions.mapHeight / MapManager.CELLSCALE / mapRegions.regionHeight;
|
||||
|
||||
Transform trans = null;
|
||||
mapRegions.regions = new Region[row, col];
|
||||
for (int i = 0; i < row; i++)
|
||||
{
|
||||
for (int j = 0; j < col; j++)
|
||||
{
|
||||
mapRegions.regions[i, j] = new Region();
|
||||
mapRegions.regions[i, j].indexX = i;
|
||||
mapRegions.regions[i, j].indexY = j;
|
||||
|
||||
string regionName = $"{i}_{j}";
|
||||
trans = regionsTrans.Find(regionName);
|
||||
if (trans == null)
|
||||
{
|
||||
UIWindow.Instance.ShowMessage($"û<><C3BB><EFBFBD>ҵ<EFBFBD>region<6F>ڵ<EFBFBD> name={regionName}");
|
||||
return;
|
||||
}
|
||||
|
||||
//mapRegions.regions[i, j].regionName = trans.GetComponent<Image>().sprite.name;
|
||||
mapRegions.regions[i, j].regionName = trans.GetComponent<RawImage>().texture.name;
|
||||
}
|
||||
}
|
||||
|
||||
mapRegions.SaveXML(mapId);
|
||||
}
|
||||
|
||||
public void LoadMapRegions(int mapId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user