using System; using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; using static MapManager; using static UnityEditor.PlayerSettings; public class SceneArea : MonoBehaviour { public EditCellType editCellType; public int Idx; public void SetSceneAreaData(EditCellType editCellType,int idx) { this.editCellType = editCellType; Idx = idx; } public void OnPointerClick() { Debug.Log($"选中我了..."); switch (editCellType) { case EditCellType.MonsterArea: UIWindow.Instance.uiMonstersPanel.SelectMonsterPos(Idx); break; } } public void OnPointerDrag(Vector3 mousePosition) { Vector2Int pos = MapManager.Instance.map.selector.GetMouseByCell(); SetAreaPos(pos); switch (editCellType) { case EditCellType.MonsterArea: UIWindow.Instance.uiMonstersPanel.UpdateMonsterPos(Idx,pos); break; } } public void OnPointerUp() { Debug.Log($"松开我了..."); } public void SetAreaPos(Vector2Int pos) { Vector3 realpos = MapManager.Instance.map.selector.getPosByGrid(pos); transform.position = realpos; } }