Files
XRLib/Assets/Scripts/SampleProject/AppMain.cs

87 lines
2.9 KiB
C#
Raw Normal View History

using SampleProject.Config;
2025-06-20 17:37:20 +09:00
using System;
2025-06-04 23:10:11 +09:00
using UnityEngine;
2025-06-20 17:37:20 +09:00
using UVC.Core;
2025-06-04 23:10:11 +09:00
using UVC.Data;
using UVC.Locale;
using UVC.Util;
2025-06-04 23:10:11 +09:00
2025-06-05 20:09:28 +09:00
namespace SampleProject
2025-06-04 23:10:11 +09:00
{
2025-06-23 20:06:15 +09:00
[DefaultExecutionOrder(100)]
2025-06-20 17:37:20 +09:00
public class AppMain : SingletonApp<AppMain>
2025-06-04 23:10:11 +09:00
{
2025-06-20 17:37:20 +09:00
public Action Initialized;
private MQTTPipeLine mqttPipeLine;
public MQTTPipeLine MQTTPipeLine => mqttPipeLine;
/// <summary>
/// <20>ʱ<EFBFBD> ȭ <20>޼<EFBFBD><DEBC><EFBFBD><EFBFBD>Դϴ<D4B4>.
/// Awake <20>޼<EFBFBD><DEBC><EFBFBD><E5BFA1> ȣ<><C8A3><EFBFBD>Ǹ<EFBFBD>, MonoBehaviour<75><72> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>˴ϴ<CBB4>.
/// </summary>
protected override void Init()
2025-06-04 23:10:11 +09:00
{
SettupConfig();
2025-06-20 17:37:20 +09:00
SetNetworkInfo();
if (Initialized != null)
{
Initialized.Invoke();
}
}
void Start()
{
//Tester.RunAllTests();
2025-06-20 17:37:20 +09:00
}
private void SettupConfig()
{
if (AppConfig.LoadConfig())
{
//<2F><20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
bool success = LocalizationManager.Instance.LoadDefaultLocalizationData(AppConfig.Config.Language);
Debug.Log($"LocalizationManager: LoadDefaultLocalizationData success: {success}");
if (!Application.isEditor && Application.platform == RuntimePlatform.WindowsPlayer)
{
//â <20><><EFBFBD><EFBFBD>
if (AppConfig.Config.Window != null)
{
WindowTools.Instance.Init(AppConfig.Config.Window);
}
}
}
}
2025-06-20 17:37:20 +09:00
private void SetNetworkInfo()
{
URLList.Add("baseinfo", "http://localhost:8888/baseinfo/00:00");
URLList.Add("AGV", "http://localhost:8888/AGV/00:00");
URLList.Add("STOCKER_STACK", "http://localhost:8888/STOCKER_STACK/00:00");
URLList.Add("CARRIER", "http://localhost:8888/CARRIER/00:00");
URLList.Add("EQUIPMENT", "http://localhost:8888/EQUIPMENT/00:00");
URLList.Add("PORT", "http://localhost:8888/PORT/00:00");
URLList.Add("RACK", "http://localhost:8888/RACK/00:00");
URLList.Add("TWIN_FORK", "http://localhost:8888/TWIN_FORK/00:00");
URLList.Add("HVC_PLC", "http://localhost:8888/HVC_PLC/00:00");
URLList.Add("HVC_CRANE", "http://localhost:8888/HVC_CRANE/00:00");
URLList.Add("ALARM", "http://localhost:8888/ALARM/00:00");
URLList.Add("Dashboard", "http://localhost:8888/Dashboard/00:00");
URLList.Add("SIMULATION_RANK", "http://localhost:8888/SIMULATION_RANK/00:00");
mqttPipeLine = new MQTTPipeLine("localhost", 1883);
mqttPipeLine.AddTopic("AGV");
2025-07-01 20:10:15 +09:00
mqttPipeLine.AddTopic("ALARM");
mqttPipeLine.Execute();
//10<31><30> <20><> <20><><EFBFBD><EFBFBD>
//UniTask.Delay(TimeSpan.FromSeconds(10)).ContinueWith(() =>
//{
// mqttPipeLine.Stop();
//});
2025-06-04 23:10:11 +09:00
}
}
}