完善坐标系
This commit is contained in:
@@ -69,26 +69,28 @@ public partial class MapManager : MonoBehaviour
|
||||
_curMapRegions.cellWidthPixel = widthPixel;
|
||||
_curMapRegions.cellHeightPixel = heightPixel;
|
||||
_curMapRegions.regions = new Region[mapRownum, mapColumn];
|
||||
|
||||
int maxRow = mapColumn;
|
||||
int maxCol = mapRownum;
|
||||
float jpgscenew = PicMapPixel / 100.0f;
|
||||
for (int row = 0; row < mapRownum; row++)
|
||||
|
||||
for (int row = 0; row < mapRownum; row++) //14 * 11
|
||||
{
|
||||
for (int col = 0; col < mapColumn; col++)
|
||||
{
|
||||
string filename = $"v{mapId}_r{row + 1}_c{col + 1}"; // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>v1000_r1_c1.jpg
|
||||
string filename = $"v{mapId}_r{mapColumn - col}_c{row + 1}"; // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>v1000_r11_c1.jpg
|
||||
string spPath = PathUtil.GetMapTexure(1000, filename, "jpg");
|
||||
GameObject obj = new GameObject(filename);
|
||||
obj.transform.SetParent(mapRegionParent);
|
||||
SpriteRenderer sr = obj.AddComponent<SpriteRenderer>();
|
||||
float x = col * jpgscenew;
|
||||
float y = (mapRownum - row - 1) * jpgscenew;
|
||||
float x = row * jpgscenew;
|
||||
float y = col * jpgscenew;
|
||||
obj.transform.position = new Vector2(x, y);
|
||||
_curMapRegions.regions[row, col] = new Region();
|
||||
_curMapRegions.regions[row, col].indexX = row;
|
||||
_curMapRegions.regions[row, col].indexY = col;
|
||||
multithreadLoadTextrue(spPath, sr);
|
||||
int ldx = mapRownum - row;
|
||||
int ldy = col + 1;
|
||||
_curMapRegions.regions[row, col].regionName = $"v{mapId}_r{ldx}_c{ldy}"; // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>v1000_r1_c1.jpg
|
||||
_curMapRegions.regions[row, col].regionName = filename;
|
||||
}
|
||||
}
|
||||
MapManager.Instance.ReseCamera(jpgscenew * mapColumn, jpgscenew * mapRownum);
|
||||
@@ -106,7 +108,7 @@ public partial class MapManager : MonoBehaviour
|
||||
{
|
||||
if(_curMapRegions == null) return;
|
||||
float jpgscenew = PicMapPixel / 100.0f;
|
||||
MapManager.Instance.GenerateMap(jpgscenew * _curMapRegions.regionColNum, jpgscenew * _curMapRegions.regionRowNum, _curMapRegions.cellWidthPixel / 100.0f, _curMapRegions.cellHeightPixel / 100.0f);
|
||||
MapManager.Instance.GenerateMap(jpgscenew * _curMapRegions.regionRowNum, jpgscenew * _curMapRegions.regionColNum, _curMapRegions.cellWidthPixel / 100.0f, _curMapRegions.cellHeightPixel / 100.0f);
|
||||
}
|
||||
private async void multithreadLoadTextrue(string fullPath,SpriteRenderer sr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user