완료 시간 알람 클릭 기능 개발
This commit is contained in:
@@ -26,6 +26,7 @@ namespace CHN
|
||||
{
|
||||
public static string filePath = "./CompleteTimeAlarmInfo.json";
|
||||
|
||||
public List<Machine> machines = new List<Machine>();
|
||||
public List<CompleteTimeAlarmData> currentData = new List<CompleteTimeAlarmData>();
|
||||
|
||||
public static Dictionary<string, CompleteTimeAlarmData> saveData = new Dictionary<string, CompleteTimeAlarmData>();
|
||||
@@ -42,6 +43,11 @@ namespace CHN
|
||||
{
|
||||
LoadCompleteTimeData();
|
||||
}
|
||||
public override void AfterStart()
|
||||
{
|
||||
var building = FindSingle<Building>();
|
||||
machines = building.floors.SelectMany(f => f.machines).ToList();
|
||||
}
|
||||
public void SetCurrentData(List<CompleteInfo> completeInfos)
|
||||
{
|
||||
currentData.Clear();
|
||||
@@ -160,6 +166,72 @@ namespace CHN
|
||||
File.WriteAllText(filePath, json);
|
||||
}
|
||||
}
|
||||
public void MachineCorrespondingToAlarm(string machineCode)
|
||||
{
|
||||
foreach(var machine in machines)
|
||||
{
|
||||
if(machine.code == machineCode)
|
||||
{
|
||||
SetTargetPosToMachine(machine);
|
||||
ActivateMachinesHighlight(machine);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void ResetMachinesHighLight(string dashboardKey)
|
||||
{
|
||||
ResetAllMachinesHighLight();
|
||||
}
|
||||
|
||||
private void ResetAllMachinesHighLight()
|
||||
{
|
||||
foreach (var machine in machines)
|
||||
{
|
||||
machine.DeactivateTranslucent();
|
||||
machine.StopFlash();
|
||||
}
|
||||
}
|
||||
|
||||
private void ActivateMachinesHighlight(Machine alarmMachine)
|
||||
{
|
||||
ResetAllMachinesHighLight();
|
||||
|
||||
foreach (Machine machine in machines)
|
||||
{
|
||||
if (alarmMachine != machine)
|
||||
{
|
||||
machine.ActivateTranslucent();
|
||||
}
|
||||
else
|
||||
{
|
||||
machine.StartFlash();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void SetTargetPosToMachine(Machine machine)
|
||||
{
|
||||
OrbitalController controller = FindSingle<OrbitalController>();
|
||||
if (controller.viewMode != ViewMode.PerspectiveView)
|
||||
{
|
||||
controller.SetViewMode(ViewMode.PerspectiveView);
|
||||
}
|
||||
|
||||
var building = FindSingle<Building>();
|
||||
int changeFloor = building.floors[0].floorIndex;
|
||||
|
||||
int libraryMachineFloor = machine.GetMachineFloorIndex();
|
||||
if (libraryMachineFloor > changeFloor)
|
||||
{
|
||||
changeFloor = libraryMachineFloor;
|
||||
}
|
||||
|
||||
var centerPos = machine.centerPos;
|
||||
|
||||
var slider = FindSingle<Canvas_Right>().panel_floorcontrol;
|
||||
slider.ChangeValueFromOutside(changeFloor);
|
||||
|
||||
controller.option.currentDistance = 20f;
|
||||
controller.SetTargetPos(centerPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace CHN
|
||||
비가동,
|
||||
계획정지
|
||||
}
|
||||
public class UI_CompleteTimeAlarmInfo : UIBase, IPointerEnterHandler
|
||||
public class UI_CompleteTimeAlarmInfo : UIBase, IPointerClickHandler
|
||||
{
|
||||
public MachineStatusnm statusnm;
|
||||
|
||||
@@ -77,7 +77,8 @@ namespace CHN
|
||||
}
|
||||
Statusnm.color = color;
|
||||
}
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
isCheck = true;
|
||||
onCheck?.Invoke(this);
|
||||
|
||||
Reference in New Issue
Block a user