76 lines
2.2 KiB
C#
76 lines
2.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
///格子信息 - 绿色块
|
|
///功能:加载格子数据,重新计算格子,显示格子,隐藏格子
|
|
public class UICellInfo : MonoBehaviour
|
|
{
|
|
public static UICellInfo Instance;
|
|
public Text txtMapWidth;
|
|
public Text txtMapHeight;
|
|
public Text txtTotalCells;
|
|
public Text txtMoveCells;
|
|
public Text txtCellRows;
|
|
public Text txtCellCols;
|
|
public InputField txtCellWidth;
|
|
public InputField txtCellHeight;
|
|
|
|
public bool bMapOpened;
|
|
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
private void Start()
|
|
{
|
|
Cleanup();
|
|
}
|
|
|
|
void Cleanup()
|
|
{
|
|
txtMapWidth.text = string.Empty;
|
|
txtMapHeight.text = string.Empty;
|
|
txtTotalCells.text = string.Empty;
|
|
txtMoveCells.text = string.Empty;
|
|
txtCellRows.text = string.Empty;
|
|
txtCellCols.text = string.Empty;
|
|
|
|
txtCellWidth.text = string.Empty;
|
|
txtCellHeight.text = string.Empty;
|
|
bMapOpened = false;
|
|
}
|
|
|
|
public void CloseMap()
|
|
{
|
|
Cleanup();
|
|
UIWindow.Instance.uiCellEditor.togEdit.isOn = false;
|
|
UIWindow.Instance.uiCellEditor.togPathTest.isOn = false;
|
|
}
|
|
public void ShowCells()
|
|
{
|
|
MapManager.Instance.ShowMapGrid();
|
|
}
|
|
|
|
public void HideCells()
|
|
{
|
|
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.regionRowNum.ToString();
|
|
txtMapHeight.text = MapManager.Instance._curMapRegions.regionColNum.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();
|
|
}
|
|
}
|