/// <summary> /// 鼠标抬起,若无取消,则执行矩形操作 /// </summary> public override void OnMouseUp() { if (cancel) { cancel = false; HideOrShowLastCoverTiles(false); return; } var cellPositions = EX_Vector2Int.Range(cornerBegin, cornerEnd); for (int y = 0; y < cellPositions.Length; y++) { for (int x = 0; x < cellPositions[y].Length; x++) { RectOperation(cellPositions[y][x]); } } }
/// <summary> /// 鼠标网格位置发生变化时触发 /// 触发频率比OnMouseDowning更低 /// 对性能敏感的操作可放置于此 /// </summary> public override void OnMouseCellPosChange() { OnMouseDowning(); // 释放上一帧隐藏的Tile HideOrShowLastCoverTiles(false); // 暂时隐藏当前Rect覆盖位置地图中的的Tile var cellPositions = EX_Vector2Int.Range(cornerBegin, cornerEnd); lastCoverTiles = new E_PrefabTile[cellPositions.Length][]; for (int y = 0; y < cellPositions.Length; y++) { lastCoverTiles[y] = new E_PrefabTile[cellPositions[y].Length]; for (int x = 0; x < cellPositions[y].Length; x++) { lastCoverTiles[y][x] = map.GetTileByCellPos(cellPositions[y][x]); } } HideOrShowLastCoverTiles(true); }