2025-02-20 09:59:37 +09:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using WI;
|
|
|
|
|
using static MQTT;
|
|
|
|
|
|
|
|
|
|
namespace CHN
|
|
|
|
|
{
|
|
|
|
|
public class Canvas_Popup : CanvasBase
|
|
|
|
|
{
|
|
|
|
|
public Panel_CompleteAlramHistory panel_completealramhistory;
|
|
|
|
|
|
|
|
|
|
public Panel_Menu panel_menu;
|
2025-03-12 12:04:19 +09:00
|
|
|
public Panel_DashBoard panel_dashboard;
|
2025-02-20 09:59:37 +09:00
|
|
|
public Panel_Library panel_library;
|
|
|
|
|
public Panel_WorkConditionAnalysis panel_workconditionanalysis;
|
|
|
|
|
public Panel_WorkTimeAnalysis panel_worktimeanalysis;
|
|
|
|
|
public Panel_InjectionProduction panel_injectionproduction;
|
|
|
|
|
public Panel_AssemblyProduction panel_assemblyproduction;
|
2025-03-17 14:35:34 +09:00
|
|
|
public Panel_WorkProgressStatus panel_workprogressstatus;
|
2025-03-12 17:36:23 +09:00
|
|
|
public Panel_MiniMap panel_minimap;
|
2025-04-02 11:21:15 +09:00
|
|
|
public Panel_ThermostatControl panel_thermostatcontrol;
|
2025-04-09 15:12:25 +09:00
|
|
|
public Panel_ExitProgram panel_exitprogram;
|
2025-04-22 15:29:46 +09:00
|
|
|
public Panel_ToolBarAlarm panel_toolbaralarm;
|
2025-04-24 08:36:29 +09:00
|
|
|
public Panel_DetailDashBoard panel_detaildashboard;
|
2025-02-20 09:59:37 +09:00
|
|
|
//public Panel_MachineDashBoard panel_machinedashboard;
|
2025-03-18 15:34:07 +09:00
|
|
|
|
|
|
|
|
public RectTransform dashboardPoint;
|
2025-02-20 09:59:37 +09:00
|
|
|
private Dictionary<Machine, Panel_MachineDashBoard> machineDashboardTable = new();
|
|
|
|
|
|
|
|
|
|
public Action<Machine> onClickSimple;
|
|
|
|
|
public Action<Machine> onClickDetail;
|
|
|
|
|
public Action<Machine,HashSet<string>> simpleView;
|
2025-04-14 16:52:44 +09:00
|
|
|
public Action onCloseDashBoard;
|
2025-02-25 17:31:42 +09:00
|
|
|
|
2025-03-19 15:10:05 +09:00
|
|
|
public Panel_MachineDashBoard currentDashBoard;
|
|
|
|
|
public Action onOpenDashboard;
|
2025-02-25 17:31:42 +09:00
|
|
|
|
2025-04-24 08:36:29 +09:00
|
|
|
public bool isSimpleDashboardAcitve;
|
|
|
|
|
|
|
|
|
|
public void ActiveSimpleDashBoard()
|
|
|
|
|
{
|
|
|
|
|
isSimpleDashboardAcitve = true;
|
|
|
|
|
}
|
|
|
|
|
public void DeactiveSimpleDashBoard()
|
|
|
|
|
{
|
|
|
|
|
isSimpleDashboardAcitve = false;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-20 09:59:37 +09:00
|
|
|
public override void AfterAwake()
|
|
|
|
|
{
|
|
|
|
|
var asset = Resources.Load<Panel_MachineDashBoard>("Prefabs/UI/PRF_Panel_MachineDashBoard");
|
2025-04-16 13:51:42 +09:00
|
|
|
var machines = FindObjectsByType<Machine>(FindObjectsSortMode.None);
|
2025-02-20 09:59:37 +09:00
|
|
|
foreach (var machine in machines)
|
|
|
|
|
{
|
|
|
|
|
var dashboard = Instantiate<Panel_MachineDashBoard>(asset, transform);
|
|
|
|
|
dashboard.Close();
|
|
|
|
|
dashboard.simpleView += simpleView;
|
|
|
|
|
machineDashboardTable.Add(machine, dashboard);
|
|
|
|
|
dashboard.onClickSimple += onClickSimple;
|
|
|
|
|
dashboard.onClickDetail += onClickDetail;
|
2025-04-14 16:52:44 +09:00
|
|
|
dashboard.onClose += onCloseDashBoard;
|
2025-02-20 09:59:37 +09:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-14 16:52:44 +09:00
|
|
|
public void MachineDashBoardOpen(Machine clickMachine)
|
2025-02-20 09:59:37 +09:00
|
|
|
{
|
2025-04-24 08:36:29 +09:00
|
|
|
if (!isSimpleDashboardAcitve)
|
|
|
|
|
return;
|
|
|
|
|
|
2025-02-25 17:31:42 +09:00
|
|
|
if (currentDashBoard != null)
|
|
|
|
|
{
|
|
|
|
|
currentDashBoard.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
currentDashBoard = machineDashboardTable[clickMachine];
|
2025-04-14 16:52:44 +09:00
|
|
|
currentDashBoard.OpenFromMachine(clickMachine);
|
2025-02-20 09:59:37 +09:00
|
|
|
|
|
|
|
|
SetDashBoardPosition();
|
2025-03-19 15:10:05 +09:00
|
|
|
onOpenDashboard?.Invoke();
|
2025-02-20 09:59:37 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SimpleView(Machine machine, SimpleField data)
|
|
|
|
|
{
|
|
|
|
|
machineDashboardTable[machine].SimpleInfoView(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DetailView(Machine machine, SimpleField data)
|
|
|
|
|
{
|
2025-04-21 14:30:57 +09:00
|
|
|
machineDashboardTable[machine].DetailInfoView(machine, data);
|
2025-02-20 09:59:37 +09:00
|
|
|
}
|
|
|
|
|
|
2025-03-19 15:10:05 +09:00
|
|
|
public void CurrentDashoboardClose()
|
2025-02-20 09:59:37 +09:00
|
|
|
{
|
2025-03-19 15:10:05 +09:00
|
|
|
if (currentDashBoard != null)
|
|
|
|
|
{
|
|
|
|
|
currentDashBoard.Clear();
|
|
|
|
|
currentDashBoard.SetActive(false);
|
|
|
|
|
}
|
2025-02-20 09:59:37 +09:00
|
|
|
}
|
|
|
|
|
public void SetDashBoardPosition()
|
|
|
|
|
{
|
2025-03-18 15:34:07 +09:00
|
|
|
currentDashBoard.transform.position = dashboardPoint.transform.position;
|
2025-02-25 17:31:42 +09:00
|
|
|
currentDashBoard.transform.SetAsLastSibling();
|
2025-02-20 09:59:37 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Panel_ControlSetting panel_controlsetting;
|
|
|
|
|
public Panel_ProtocolSetting panel_protocolsetting;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|