NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Level/Level.Select.cs

69 lines
1.6 KiB
C#
Raw Normal View History

2024-12-11 19:10:39 +08:00
using Gameplay.Common;
2024-09-27 19:05:49 +08:00
using Gameplay.Level.Select;
2023-12-13 16:20:41 +08:00
using Gameplay.Unit;
using PhxhSDK;
2023-08-22 19:08:45 +08:00
namespace Gameplay.Level
{
public partial class Level
{
2024-09-27 19:05:49 +08:00
public GameUnit selectUnit
{
get
{
return selectView.selectUnit;
}
}
public SelectView selectView { get; private set; }
2023-08-22 19:08:45 +08:00
public void SelectUnit(GameUnit newUnit)
{
if (selectUnit == newUnit) return;
2023-10-19 15:00:19 +08:00
if (!newUnit.commonData.canSelect)
2023-08-22 19:08:45 +08:00
return;
UnSelectUnit();
newUnit.OnSelect();
2024-09-27 19:05:49 +08:00
selectView.SetOwner(newUnit);
_ShowGrid();
}
2024-11-27 16:14:44 +08:00
private void _ShowGrid()
{
if (!GameSettingManager.Instance.SettingData.IsOpenGrid)
{
if (IsInBattle())
{
_map.ShowInfo(Map.InfoMask.ShowCells, true);
}
}
2023-08-22 19:08:45 +08:00
}
2024-12-11 19:10:39 +08:00
2023-08-22 19:08:45 +08:00
public void SelectUnit(uint id)
{
2023-12-14 18:25:52 +08:00
var newUnit = GameUnitManager.instance.infightUnits.Search(id);
2024-09-27 19:05:49 +08:00
SelectUnit(newUnit);
2023-08-22 19:08:45 +08:00
}
public void UnSelectUnit()
{
if (selectUnit == null) return;
selectUnit.OnUnSelect();
2024-09-27 19:05:49 +08:00
selectView.SetOwner(null);
2024-11-27 16:14:44 +08:00
_HideGrid();
}
private void _HideGrid()
{
if (!GameSettingManager.Instance.SettingData.IsOpenGrid)
2024-11-27 16:14:44 +08:00
{
if (IsInBattle())
{
_map.ShowInfo(Map.InfoMask.ShowCells, false);
}
2024-11-27 16:14:44 +08:00
}
2023-08-22 19:08:45 +08:00
}
2024-12-11 19:10:39 +08:00
2023-08-22 19:08:45 +08:00
}
}