(client) feat:彻底完成瓦片地图模块化加载和索引
This commit is contained in:
@ -31,9 +31,8 @@ namespace Managers
|
||||
|
||||
void SplitTextureIntoSprites(string name, Texture2D texture, int rows, int cols, int pixelsPerUnit)
|
||||
{
|
||||
if (texture == null || rows <= 0 || cols <= 0)
|
||||
if (texture == null || rows <= 1 || cols <= 1)
|
||||
{
|
||||
Debug.LogError("Invalid parameters for splitting texture.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -61,7 +60,7 @@ namespace Managers
|
||||
// 创建Sprite
|
||||
var sprite = Sprite.Create(texture, (Rect)spriteRect, new Vector2(0.5f, 0.5f), pixelsPerUnit);
|
||||
|
||||
var index = row * cols + col;
|
||||
var index = (rows-row-1) * cols + col;
|
||||
sprites[name + $"_{index}"] = sprite;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user