147 lines
3.6 KiB
C#
147 lines
3.6 KiB
C#
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
public class UIWindow : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
private static UIWindow _instance;
|
|||
|
|
public static UIWindow Instance
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
if (_instance == null)
|
|||
|
|
_instance = FindObjectOfType<UIWindow>();
|
|||
|
|
|
|||
|
|
return _instance;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private Transform _mapTrans = null;
|
|||
|
|
public Transform mapTrans
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
if (_mapTrans == null)
|
|||
|
|
{
|
|||
|
|
_mapTrans = newMapTrans;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return _mapTrans;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public UIMapPanel uiMapPanel;
|
|||
|
|
public UICellInfo uiCellInfo;
|
|||
|
|
public UICellEditor uiCellEditor;
|
|||
|
|
public UICreateMap uiCreateMap;
|
|||
|
|
public UIEditMapConfig uiEditMapConfig;
|
|||
|
|
public UITeleportPanel uiTeleportPanel;
|
|||
|
|
public UIRelivesPanel uiRelivesPanel;
|
|||
|
|
public UIAudioTriggerPanel uiAudioTriggerPanel;
|
|||
|
|
public UISellAreasPanel uiSellAreasPanel;
|
|||
|
|
//public UIMonstersPanel_old uiMonstersPanel_old;
|
|||
|
|
public UIMonsterPanel uiMonstersPanel;
|
|||
|
|
public UINpcsPanel uiNpcsPanel;
|
|||
|
|
public UITriggerPanel uiTriggersPanel;
|
|||
|
|
public UIConditionPanel uiConditionsPanel;
|
|||
|
|
public UIFuBensPanel uiFuBensPanel;
|
|||
|
|
public UIJuBaoPanel uiJuBaosPanel;
|
|||
|
|
|
|||
|
|
public UIMessageBox uiMessageBox;
|
|||
|
|
|
|||
|
|
|
|||
|
|
public Transform newMapTrans;
|
|||
|
|
|
|||
|
|
private bool bCreatedMap = false;
|
|||
|
|
public bool bOvering = false;
|
|||
|
|
|
|||
|
|
private void Start()
|
|||
|
|
{
|
|||
|
|
uiCreateMap.onCreatedMapCallback += OnCreatedMap;
|
|||
|
|
uiMonstersPanel.gameObject.SetActive(false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void OnCreatedMap(int mapId, int mapWidth, int mapHeight)
|
|||
|
|
{
|
|||
|
|
bCreatedMap = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void ShowMessage(string message, string title="ϵͳ<CFB5><CDB3>ʾ")
|
|||
|
|
{
|
|||
|
|
uiMessageBox.title.text = title;
|
|||
|
|
uiMessageBox.message.text = message;
|
|||
|
|
uiMessageBox.gameObject.SetActive(true);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void ShowMouseOver()
|
|||
|
|
{
|
|||
|
|
newMapTrans.GetComponent<UIMouseOver>().enabled = true;
|
|||
|
|
bOvering = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void HideMouseOver()
|
|||
|
|
{
|
|||
|
|
newMapTrans.GetComponent<UIMouseOver>().enabled = false;
|
|||
|
|
bOvering = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void Update()
|
|||
|
|
{
|
|||
|
|
if (mapTrans == null)
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
if (!bCreatedMap)
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
if (Input.GetKey(KeyCode.W))
|
|||
|
|
{
|
|||
|
|
if (Input.GetMouseButton(1))
|
|||
|
|
mapTrans.position += Vector3.forward * 7;
|
|||
|
|
else
|
|||
|
|
mapTrans.position += Vector3.forward * 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (Input.GetKey(KeyCode.S))
|
|||
|
|
{
|
|||
|
|
if (Input.GetMouseButton(1))
|
|||
|
|
mapTrans.position += Vector3.back * 7;
|
|||
|
|
else
|
|||
|
|
mapTrans.position += Vector3.back * 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (Input.GetKey(KeyCode.A))
|
|||
|
|
{
|
|||
|
|
if (Input.GetMouseButton(1))
|
|||
|
|
mapTrans.position += Vector3.left * 7;
|
|||
|
|
else
|
|||
|
|
mapTrans.position += Vector3.left * 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (Input.GetKey(KeyCode.D))
|
|||
|
|
{
|
|||
|
|
if (Input.GetMouseButton(1))
|
|||
|
|
mapTrans.position += Vector3.right * 7;
|
|||
|
|
else
|
|||
|
|
mapTrans.position += Vector3.right * 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (bOvering)
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>Ч<EFBFBD><D0A7>
|
|||
|
|
if (Input.GetAxis("Mouse ScrollWheel") < 0)
|
|||
|
|
{
|
|||
|
|
if (Input.GetMouseButton(1))
|
|||
|
|
mapTrans.position += Vector3.down * 7;
|
|||
|
|
else
|
|||
|
|
mapTrans.position += Vector3.down * 1;
|
|||
|
|
}
|
|||
|
|
else if (Input.GetAxis("Mouse ScrollWheel") > 0)
|
|||
|
|
{
|
|||
|
|
if (Input.GetMouseButton(1))
|
|||
|
|
mapTrans.position += Vector3.up * 7;
|
|||
|
|
else
|
|||
|
|
mapTrans.position += Vector3.up * 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|