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-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-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-02-20 09:59:37 +09:00
|
|
|
public override void AfterAwake()
|
|
|
|
|
{
|
|
|
|
|
var asset = Resources.Load<Panel_MachineDashBoard>("Prefabs/UI/PRF_Panel_MachineDashBoard");
|
|
|
|
|
var machines = FindObjectsOfType<Machine>();
|
|
|
|
|
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-03 11:53:25 +09:00
|
|
|
public void MachineDashBoardOpenFromLibrary(Machine libraryMachine)
|
2025-02-20 09:59:37 +09:00
|
|
|
{
|
2025-02-25 17:31:42 +09:00
|
|
|
if (currentDashBoard != null)
|
|
|
|
|
{
|
|
|
|
|
currentDashBoard.SetActive(false);
|
|
|
|
|
}
|
2025-04-03 11:53:25 +09:00
|
|
|
var machine = libraryMachine;
|
2025-02-25 17:31:42 +09:00
|
|
|
currentDashBoard = machineDashboardTable[machine];
|
2025-04-03 11:53:25 +09:00
|
|
|
currentDashBoard.OpenFromLibraryButton(libraryMachine);
|
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 MachineDashBoardOpenFromOnClick(Machine clickMachine)
|
|
|
|
|
{
|
2025-02-25 17:31:42 +09:00
|
|
|
if (currentDashBoard != null)
|
|
|
|
|
{
|
|
|
|
|
currentDashBoard.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
currentDashBoard = machineDashboardTable[clickMachine];
|
|
|
|
|
currentDashBoard.OpenFromMachineClick(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 MachineDashBoardClose(UI_LibraryButton button)
|
|
|
|
|
{
|
|
|
|
|
var machine = button.machine;
|
|
|
|
|
machineDashboardTable[machine].Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SimpleView(Machine machine, SimpleField data)
|
|
|
|
|
{
|
|
|
|
|
machineDashboardTable[machine].SimpleInfoView(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DetailView(Machine machine, SimpleField data)
|
|
|
|
|
{
|
|
|
|
|
machineDashboardTable[machine].DetailInfoView(data);
|
|
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|