ss
This commit is contained in:
@@ -26,6 +26,8 @@ public class GridSelector : MonoBehaviour
|
|||||||
public int verticalNumber { get { return Mathf.CeilToInt(map.height / map.sideHeight); } }
|
public int verticalNumber { get { return Mathf.CeilToInt(map.height / map.sideHeight); } }
|
||||||
public int totalNumber { get { return horizontalNumber * verticalNumber; } }
|
public int totalNumber { get { return horizontalNumber * verticalNumber; } }
|
||||||
|
|
||||||
|
public int moveNum;
|
||||||
|
|
||||||
private ComputeBuffer inputbuffer;
|
private ComputeBuffer inputbuffer;
|
||||||
private RenderData[] dataArray;
|
private RenderData[] dataArray;
|
||||||
|
|
||||||
@@ -39,7 +41,7 @@ public class GridSelector : MonoBehaviour
|
|||||||
public void OnMapCreated(Map map)
|
public void OnMapCreated(Map map)
|
||||||
{
|
{
|
||||||
this.map = map;
|
this.map = map;
|
||||||
|
moveNum = 0;
|
||||||
mapRenderer.material.SetVector("_Size", new Vector4(horizontalNumber, verticalNumber));
|
mapRenderer.material.SetVector("_Size", new Vector4(horizontalNumber, verticalNumber));
|
||||||
mapRenderer.material.SetFloat("_UserInput", 1);
|
mapRenderer.material.SetFloat("_UserInput", 1);
|
||||||
inputbuffer = new ComputeBuffer(totalNumber, Marshal.SizeOf(typeof(RenderData)));
|
inputbuffer = new ComputeBuffer(totalNumber, Marshal.SizeOf(typeof(RenderData)));
|
||||||
@@ -414,14 +416,14 @@ public class GridSelector : MonoBehaviour
|
|||||||
}
|
}
|
||||||
public void RefreshPlaneRender()
|
public void RefreshPlaneRender()
|
||||||
{
|
{
|
||||||
int runNum = 0;
|
moveNum = 0;
|
||||||
for (int i = 0; i < dataArray.Length; i++) {
|
for (int i = 0; i < dataArray.Length; i++) {
|
||||||
//int barrier = dataArray[i].barrier;
|
//int barrier = dataArray[i].barrier;
|
||||||
setDataColor(i);
|
setDataColor(i);
|
||||||
CellType cell = (CellType)dataArray[i].barrier;
|
CellType cell = (CellType)dataArray[i].barrier;
|
||||||
if (cell.HasFlag(CellType.Move))
|
if (cell.HasFlag(CellType.Move))
|
||||||
{
|
{
|
||||||
runNum++;
|
moveNum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inputbuffer.SetData(dataArray);
|
inputbuffer.SetData(dataArray);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public partial class MapManager : MonoBehaviour
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// <20><>ǰ<EFBFBD><C7B0>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>
|
/// <20><>ǰ<EFBFBD><C7B0>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private MapRegions _curMapRegions;
|
public MapRegions _curMapRegions;
|
||||||
public bool LoadObsXml()
|
public bool LoadObsXml()
|
||||||
{
|
{
|
||||||
if (_curOpenMapId < 0)
|
if (_curOpenMapId < 0)
|
||||||
@@ -174,6 +174,7 @@ public partial class MapManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
MapManager.Instance.ReseCamera(jpgscenew * mapColumn, jpgscenew * mapRownum);
|
MapManager.Instance.ReseCamera(jpgscenew * mapColumn, jpgscenew * mapRownum);
|
||||||
MapManager.Instance.GenerateMap(jpgscenew * mapColumn, jpgscenew * mapRownum, widthPixel / 100.0f, heightPixel / 100.0f);
|
MapManager.Instance.GenerateMap(jpgscenew * mapColumn, jpgscenew * mapRownum, widthPixel / 100.0f, heightPixel / 100.0f);
|
||||||
|
UICellInfo.Instance.ShowMapCellInfo();
|
||||||
|
|
||||||
}
|
}
|
||||||
public void ClearMapRegions()
|
public void ClearMapRegions()
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using UnityEngine.UI;
|
|||||||
///<2F><><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>
|
///<2F><><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>
|
||||||
public class UICellInfo : MonoBehaviour
|
public class UICellInfo : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public static UICellInfo Instance;
|
||||||
public Text txtMapWidth;
|
public Text txtMapWidth;
|
||||||
public Text txtMapHeight;
|
public Text txtMapHeight;
|
||||||
public Text txtTotalCells;
|
public Text txtTotalCells;
|
||||||
@@ -19,10 +20,12 @@ public class UICellInfo : MonoBehaviour
|
|||||||
|
|
||||||
public bool bMapOpened;
|
public bool bMapOpened;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
MapManager.Instance.onLoadFinishedCallback = OnLoadFinished;
|
|
||||||
|
|
||||||
Cleanup();
|
Cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,20 +43,6 @@ public class UICellInfo : MonoBehaviour
|
|||||||
bMapOpened = false;
|
bMapOpened = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnCreatedMap(int mapId, int mapWidth, int mapHeight)
|
|
||||||
{
|
|
||||||
bMapOpened = true;
|
|
||||||
txtMapWidth.text = mapWidth.ToString();
|
|
||||||
txtMapHeight.text = mapHeight.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnLoadFinished()
|
|
||||||
{
|
|
||||||
txtMapWidth.text = MapManager.Instance.mapWidth.ToString();
|
|
||||||
txtMapHeight.text = MapManager.Instance.mapHeight.ToString();
|
|
||||||
bMapOpened = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CloseMap()
|
public void CloseMap()
|
||||||
{
|
{
|
||||||
Cleanup();
|
Cleanup();
|
||||||
@@ -69,6 +58,20 @@ public class UICellInfo : MonoBehaviour
|
|||||||
{
|
{
|
||||||
MapManager.Instance.HideMapGrid();
|
MapManager.Instance.HideMapGrid();
|
||||||
}
|
}
|
||||||
|
public void ShowMapCellInfo()
|
||||||
|
{
|
||||||
|
if (MapManager.Instance.map == null || MapManager.Instance.map.selector == null)
|
||||||
|
return;
|
||||||
|
if(MapManager.Instance._curMapRegions == null) return;
|
||||||
|
txtMapWidth.text = MapManager.Instance._curMapRegions.regionColNum.ToString();
|
||||||
|
txtMapHeight.text = MapManager.Instance._curMapRegions.regionRowNum.ToString();
|
||||||
|
txtCellRows.text = MapManager.Instance.map.selector.horizontalNumber.ToString();
|
||||||
|
txtCellCols.text = MapManager.Instance.map.selector.verticalNumber.ToString();
|
||||||
|
txtTotalCells.text = MapManager.Instance.map.selector.totalNumber.ToString();
|
||||||
|
txtCellWidth.text = MapManager.widthPixel.ToString();
|
||||||
|
txtCellHeight.text = MapManager.heightPixel.ToString();
|
||||||
|
txtMoveCells.text = MapManager.Instance.map.selector.moveNum.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public void CalculationCells()
|
public void CalculationCells()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ public class UIMonsterPanel : MonoBehaviour
|
|||||||
DestroyImmediate(itemParent.GetChild(0).gameObject);
|
DestroyImmediate(itemParent.GetChild(0).gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
_dicGroupItem.Clear();
|
_dicGroupItem?.Clear();
|
||||||
itemIdx = 0;
|
itemIdx = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user