编辑器
This commit is contained in:
@@ -22,8 +22,8 @@ public class GridSelector : MonoBehaviour
|
||||
private MeshCollider mapCollider;
|
||||
|
||||
private Map map;
|
||||
public int horizontalNumber { get { return Mathf.FloorToInt(map.width / map.sideWidth); } }
|
||||
public int verticalNumber { get { return Mathf.FloorToInt(map.height / map.sideHeight); } }
|
||||
public int horizontalNumber => map.horizontalNumber;
|
||||
public int verticalNumber => map.verticalNumber;
|
||||
public int totalNumber { get { return horizontalNumber * verticalNumber; } }
|
||||
|
||||
public int moveNum;
|
||||
|
||||
@@ -213,7 +213,9 @@ public partial class MapManager : MonoBehaviour
|
||||
{
|
||||
if(_curMapRegions == null) return;
|
||||
float jpgscenew = PicMapPixel / 100.0f;
|
||||
MapManager.Instance.GenerateMap(mapid, jpgscenew * _curMapRegions.regionRowNum, jpgscenew * _curMapRegions.regionColNum, _curMapRegions.cellWidthPixel / 100.0f, _curMapRegions.cellHeightPixel / 100.0f);
|
||||
int horizontalNumber = Mathf.FloorToInt((jpgscenew * _curMapRegions.regionRowNum) / (_curMapRegions.cellWidthPixel / 100.0f));
|
||||
int verticalNumber = Mathf.FloorToInt((jpgscenew * _curMapRegions.regionColNum) / (_curMapRegions.cellHeightPixel / 100.0f));
|
||||
MapManager.Instance.GenerateMap(mapid, horizontalNumber, verticalNumber, _curMapRegions.cellWidthPixel / 100.0f, _curMapRegions.cellHeightPixel / 100.0f);
|
||||
}
|
||||
private async void multithreadLoadTextrue(string fullPath,SpriteRenderer sr, HxGame.Data.Region region)
|
||||
{
|
||||
|
||||
@@ -14,10 +14,10 @@ public partial class MapManager : MonoBehaviour
|
||||
public event Action onMapCreated;
|
||||
|
||||
public CellType cellType;
|
||||
public Map GenerateMap(int mapid, float width, float height, float sideWidth, float sideHeight)
|
||||
public Map GenerateMap(int mapid, int horizontalNumber, int verticalNumber, float sideWidth, float sideHeight)
|
||||
{
|
||||
ClearMapGrid();
|
||||
map = new Map(width, height, sideWidth, sideHeight);
|
||||
map = new Map(horizontalNumber, verticalNumber, sideWidth, sideHeight);
|
||||
map.SetMapId(mapid);
|
||||
//默认设置半透明0.3
|
||||
map.ChangeGridAlpha(0.25f);
|
||||
@@ -128,11 +128,15 @@ public partial class Map
|
||||
public float height { get; private set; }
|
||||
public float sideWidth { get; private set; }
|
||||
public float sideHeight { get; private set; }
|
||||
public int horizontalNumber { get; private set; }
|
||||
public int verticalNumber { get; private set; }
|
||||
|
||||
public Map(float width, float height, float sideWidth,float sideHeight)
|
||||
public Map(int horizontalNumber, int verticalNumber, float sideWidth,float sideHeight)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.horizontalNumber = horizontalNumber;
|
||||
this.verticalNumber = verticalNumber;
|
||||
this.width = horizontalNumber * sideWidth;
|
||||
this.height = verticalNumber * sideHeight;
|
||||
this.sideWidth = sideWidth;
|
||||
this.sideHeight = sideHeight;
|
||||
mapGrid = CreateMapGrid();
|
||||
@@ -216,7 +220,7 @@ public partial class Map
|
||||
int verticalNumber = br.ReadInt32();
|
||||
float sideWidth = br.ReadInt32() / 100f; // 读取时直接除以 100
|
||||
float sideHeight = br.ReadInt32() / 100f; // 读取时直接除以 100
|
||||
var map = MapManager.Instance.GenerateMap(mapId,horizontalNumber * sideWidth, verticalNumber * sideHeight, sideWidth, sideHeight);
|
||||
var map = MapManager.Instance.GenerateMap(mapId,horizontalNumber, verticalNumber, sideWidth, sideHeight);
|
||||
GridSelector.RenderData[] data = map.selector.GetGridData();
|
||||
for (int i = 0; i < horizontalNumber * verticalNumber; i++) {
|
||||
data[i].barrier = br.ReadInt32();
|
||||
|
||||
@@ -120,7 +120,10 @@ public class SceneArea : MonoBehaviour
|
||||
|
||||
break;
|
||||
case EditCellType.TeleportCell:
|
||||
|
||||
if(baseItem is UITeleportItem teleportItem)
|
||||
{
|
||||
transform.Find("Txt").GetComponent<TextMeshPro>().text = "map:" + teleportItem.txtNextMapID.text;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user