66 lines
1.8 KiB
C#
66 lines
1.8 KiB
C#
using Studio;
|
|
using Studio.Auth;
|
|
using Studio.Conifg;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
namespace XED
|
|
{
|
|
public class RJHTest : MonoBehaviour
|
|
{
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
private StudioService tt;
|
|
private int aa;
|
|
void Start()
|
|
{
|
|
Constants.MQTTDomain = "220.90.135.190";
|
|
Constants.APIDomain = "220.90.135.190";
|
|
Constants.APIPort = 23000;
|
|
Constants.MQTTPort = 8088;
|
|
StudioService.Instance.ConnectMQTT();
|
|
}
|
|
|
|
private async void Test()
|
|
{
|
|
await AuthService.Instance.Login("xr", "@dbqlTl1");
|
|
|
|
await StudioService.Instance.LoadBaseData("/api/agv");
|
|
Debug.Log(AuthService.Instance.Entiti.accessToken);
|
|
}
|
|
private void Update()
|
|
{
|
|
if(Input.GetKeyDown(KeyCode.V))
|
|
{
|
|
Test();
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.I))
|
|
{
|
|
StudioService.Instance.SubscribeMQTT("STOCKER_CRANE");
|
|
|
|
}
|
|
if(Input.GetKeyDown(KeyCode.U))
|
|
{
|
|
StudioService.Instance.SubscribeMQTT("AGV");
|
|
}
|
|
if(Input.GetKeyDown(KeyCode.T))
|
|
{
|
|
|
|
TestTask();
|
|
}
|
|
}
|
|
|
|
private async Task TestTask()
|
|
{
|
|
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
|
|
sw.Start();
|
|
var task = Task.Run(async () =>
|
|
{
|
|
var i = aa++;
|
|
await Task.Delay(3000);
|
|
sw.Stop();
|
|
Debug.Log(sw.ElapsedMilliseconds);
|
|
});
|
|
}
|
|
}
|
|
}
|