STK
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -14,7 +14,7 @@ OcclusionCullingSettings:
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 10
|
||||
m_Fog: 0
|
||||
m_Fog: 1
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
@@ -682,6 +682,65 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: a2cabb78a78db4a4fa8074f87fa77991, type: 3}
|
||||
--- !u!1 &328392813
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 328392815}
|
||||
- component: {fileID: 328392814}
|
||||
- component: {fileID: 328392816}
|
||||
m_Layer: 0
|
||||
m_Name: GameObject
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &328392814
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 328392813}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 86d8ea1a81790154fa1c1c2be6398b6a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!4 &328392815
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 328392813}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &328392816
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 328392813}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1af5890e725b4a74397a6abcbc5c8b43, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
AGVMoveSpeed: 0.35
|
||||
AGVRotateSpeed: 1
|
||||
--- !u!1 &349372256
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -864,6 +923,34 @@ PrefabInstance:
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 917407026338800721, guid: 13ace7584c1d4514cb2218354647e355, type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 917407026338800721, guid: 13ace7584c1d4514cb2218354647e355, type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 917407026338800721, guid: 13ace7584c1d4514cb2218354647e355, type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
|
||||
value:
|
||||
objectReference: {fileID: 328392814}
|
||||
- target: {fileID: 917407026338800721, guid: 13ace7584c1d4514cb2218354647e355, type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 917407026338800721, guid: 13ace7584c1d4514cb2218354647e355, type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
|
||||
value: TestConeect
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 917407026338800721, guid: 13ace7584c1d4514cb2218354647e355, type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
|
||||
value: Studio.RJHTest, Assembly-CSharp
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 917407026338800721, guid: 13ace7584c1d4514cb2218354647e355, type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
|
||||
value: UnityEngine.Object, UnityEngine
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1105169851982576340, guid: 13ace7584c1d4514cb2218354647e355, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Panel_StudioTopbar
|
||||
@@ -12065,3 +12152,4 @@ SceneRoots:
|
||||
- {fileID: 216528118}
|
||||
- {fileID: 481136644}
|
||||
- {fileID: 1833346089}
|
||||
- {fileID: 328392815}
|
||||
|
||||
@@ -197,7 +197,7 @@ public class VirtualFactoryManager : MonoBehaviour
|
||||
agvWorker.onCompleteTask += OnAGVIdle;
|
||||
}
|
||||
|
||||
void OnAGVIdle(Studio.VirtualFactory.AGV worker)
|
||||
void OnAGVIdle(AGV worker)
|
||||
{
|
||||
Debug.Log($"{worker.name} is On Enter idle");
|
||||
stackerNeedsChecker.Scanning();
|
||||
|
||||
29
Assets/Scripts/Studio/Connect/ConfigConnected.cs
Normal file
29
Assets/Scripts/Studio/Connect/ConfigConnected.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Studio.Manage;
|
||||
using Studio.Util;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Conifg
|
||||
{
|
||||
public class ConfigConnected
|
||||
{
|
||||
public static APISetting APISettings
|
||||
{
|
||||
get
|
||||
{
|
||||
var canvas_Popup = EventConnector.instance.GetCanvas<Canvas_Popup>();
|
||||
var result = canvas_Popup.panel_apisetting.GetAPISetting();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
public static MQTTSetting MQTTSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
var canvas_Popup = EventConnector.instance.GetCanvas<Canvas_Popup>();
|
||||
var result = canvas_Popup.panel_mqttsetting.GetMQTTSetting();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Studio/Connect/ConfigConnected.cs.meta
Normal file
2
Assets/Scripts/Studio/Connect/ConfigConnected.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8082f730ac49974286f2c71561152dd
|
||||
@@ -1,12 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.Conifg
|
||||
{
|
||||
public class Constants
|
||||
{
|
||||
public static string APIDomain;
|
||||
public static int APIPort;
|
||||
public static string MQTTDomain;
|
||||
public static int MQTTPort;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcc5387e9d1cf9943b3e1d36a9b2bf17
|
||||
@@ -39,7 +39,7 @@ namespace Studio.Conifg
|
||||
bodyString = JsonUtility.ToJson(body);
|
||||
}
|
||||
}
|
||||
url = $"http://{Constants.APIDomain}:{Constants.APIPort}{url}";
|
||||
// url = $"http://{ConfigConnected.APIDomain}:{ConfigConnected.APIPort}{url}";
|
||||
|
||||
var request = SelectHTTPRequest(method, url);
|
||||
//
|
||||
|
||||
@@ -32,26 +32,30 @@ namespace Studio
|
||||
//MQTTCreateConnect();
|
||||
Application.quitting += OnDestroy;
|
||||
}
|
||||
private Dictionary<string, MQTTClient> clients =new();
|
||||
|
||||
public void MQTTCreateConnect()
|
||||
public void MQTTCreateConnect(string MQTTDomain,string MQTTPort)
|
||||
{
|
||||
Debug.Log($"MQTT Domain{Constants.MQTTDomain} , MQTTPORT{Constants.MQTTPort}");
|
||||
var conntedInfo = $"MQTT Domain : {MQTTDomain} , MQTTPORT :{MQTTPort}";
|
||||
Debug.Log(conntedInfo);
|
||||
var port = int.Parse(MQTTPort);
|
||||
var options = new ConnectionOptionsBuilder()
|
||||
.WithTCP(Constants.MQTTDomain, Constants.MQTTPort)
|
||||
.WithTCP(MQTTDomain, port)
|
||||
.Build();
|
||||
|
||||
if (client != null)
|
||||
if(clients.ContainsKey(conntedInfo))
|
||||
{
|
||||
client.OnConnected -= OnConnectedMQTT;
|
||||
client.OnStateChanged -= OnStateChangedMQTT;
|
||||
client.OnDisconnect -= OnDisconnectedMQTT;
|
||||
client.OnError -= OnErrorMQTT;
|
||||
clients[conntedInfo].OnConnected -= OnConnectedMQTT;
|
||||
clients[conntedInfo].OnStateChanged -= OnStateChangedMQTT;
|
||||
clients[conntedInfo].OnDisconnect -= OnDisconnectedMQTT;
|
||||
clients[conntedInfo].OnError -= OnErrorMQTT;
|
||||
}
|
||||
client = new MQTTClient(options);
|
||||
client.OnConnected += OnConnectedMQTT;
|
||||
client.OnStateChanged += OnStateChangedMQTT;
|
||||
client.OnDisconnect += OnDisconnectedMQTT;
|
||||
client.OnError += OnErrorMQTT;
|
||||
|
||||
clients[conntedInfo] = new MQTTClient(options);
|
||||
clients[conntedInfo].OnConnected += OnConnectedMQTT;
|
||||
clients[conntedInfo].OnStateChanged += OnStateChangedMQTT;
|
||||
clients[conntedInfo].OnDisconnect += OnDisconnectedMQTT;
|
||||
clients[conntedInfo].OnError += OnErrorMQTT;
|
||||
}
|
||||
private ConnectPacketBuilder ConnectPacketBuilderCallback(MQTTClient client, ConnectPacketBuilder builder)
|
||||
{
|
||||
@@ -78,9 +82,9 @@ namespace Studio
|
||||
}
|
||||
}
|
||||
|
||||
public void MQTTConnect()
|
||||
public void MQTTConnect(string key)
|
||||
{
|
||||
client.BeginConnect(ConnectPacketBuilderCallback);
|
||||
clients[key].BeginConnect(ConnectPacketBuilderCallback);
|
||||
}
|
||||
|
||||
private void OnErrorMQTT(MQTTClient client, string error)
|
||||
@@ -105,6 +109,12 @@ namespace Studio
|
||||
|
||||
private void OnConnectedMQTT(MQTTClient client)
|
||||
{
|
||||
var conntedInfo = $"MQTT Domain : {client.Options.Host} , MQTTPORT :{client.Options.Port}";
|
||||
var topics = StudioService.instance.TopciTable[conntedInfo];
|
||||
foreach(var topic in topics)
|
||||
{
|
||||
Subscribe(client, topic.topic);
|
||||
}
|
||||
Debug.Log($"MQTT OnConnected");
|
||||
}
|
||||
|
||||
@@ -112,7 +122,7 @@ namespace Studio
|
||||
/// 구독
|
||||
/// </summary>
|
||||
/// <param name="topic"></param>
|
||||
public void Subscribe(string topic)
|
||||
private void Subscribe(MQTTClient client,string topic)
|
||||
{
|
||||
client.CreateBulkSubscriptionBuilder()
|
||||
.WithTopic(new SubscribeTopicBuilder(topic).WithMessageCallback(OnTopic))
|
||||
@@ -123,7 +133,7 @@ namespace Studio
|
||||
/// 구독 취소
|
||||
/// </summary>
|
||||
/// <param name="topic"></param>
|
||||
public void UnSubscibe(string topic)
|
||||
public void UnSubscibe(MQTTClient client, string topic)
|
||||
{
|
||||
client.CreateUnsubscribePacketBuilder(topic)
|
||||
.WithAcknowledgementCallback((client, topicFilter, reasonCode) => Debug.Log($"Unsubscribe request to topic filter '{topicFilter}' returned with code: {reasonCode}"))
|
||||
@@ -181,10 +191,14 @@ namespace Studio
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
client?.CreateDisconnectPacketBuilder()
|
||||
.WithReasonCode(DisconnectReasonCodes.NormalDisconnection)
|
||||
.WithReasonString($"{Constants.MQTTDomain} Disconnecting")
|
||||
.BeginDisconnect();
|
||||
foreach(var client in clients)
|
||||
{
|
||||
client.Value?.CreateDisconnectPacketBuilder()
|
||||
.WithReasonCode(DisconnectReasonCodes.NormalDisconnection)
|
||||
.WithReasonString($"{client.Value.Options.Host} Disconnecting")
|
||||
.BeginDisconnect();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NUnit.Framework;
|
||||
using Studio.Conifg;
|
||||
using Studio.Core;
|
||||
using Studio.Setting.Connect;
|
||||
using Studio.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Studio;
|
||||
using Studio.Core;
|
||||
using Studio.Conifg;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
@@ -26,7 +29,7 @@ namespace Studio
|
||||
public class StudioServiceTypeEventArgs : EventArgs
|
||||
{
|
||||
public readonly string Type;
|
||||
public Dictionary<string,Dictionary<string, string>> Entitis;
|
||||
public Dictionary<string, Dictionary<string, string>> Entitis;
|
||||
|
||||
public StudioServiceTypeEventArgs(string type, Dictionary<string, Dictionary<string, string>> entitis)
|
||||
{
|
||||
@@ -37,17 +40,18 @@ namespace Studio
|
||||
|
||||
public class StudioService : UnitySingleton<StudioService>
|
||||
{
|
||||
#region Singleton
|
||||
private static readonly StudioService instance = new StudioService(new StudioRepoistory());
|
||||
public static StudioService Instance => instance;
|
||||
static StudioService() { }
|
||||
#endregion
|
||||
|
||||
private Dictionary<string, Dictionary<string, EventHandler<StudioServiceIdEventArgs>>> listenerIdMap;
|
||||
private Dictionary<string, EventHandler<StudioServiceTypeEventArgs>> listenerTypeMap;
|
||||
|
||||
private StudioRepoistory repository;
|
||||
private Dictionary<string, float> updateTime = new();
|
||||
public bool isConnected
|
||||
{
|
||||
get
|
||||
{
|
||||
return repository.isConnected;
|
||||
}
|
||||
}
|
||||
|
||||
#region 패킷계산
|
||||
private int totalRequestPacket;
|
||||
@@ -59,8 +63,9 @@ namespace Studio
|
||||
private string maxReuqestApi;
|
||||
private string maxResponseApi;
|
||||
private string maxResponseTimeApi;
|
||||
#endregion
|
||||
|
||||
public Dictionary<string, StudioEntityWithState<object>> apiData = new();
|
||||
public Dictionary<string, StudioEntityWithState<List<Dictionary<string, string>>>> apiData = new();
|
||||
public Dictionary<string, (Dictionary<string, Dictionary<string, string>>, TimeSpan)> mqttData = new();
|
||||
|
||||
private Dictionary<string, DateTime> lastUpdateTime = new();
|
||||
@@ -68,21 +73,27 @@ namespace Studio
|
||||
public event Action<string, StudioEntityWithState<object>> onAPIDataLoaded;
|
||||
public event Action<string, Dictionary<string, Dictionary<string, string>>, TimeSpan> onMQTTDataLoaded;
|
||||
|
||||
public void ConnectMQTT()
|
||||
private Dictionary<string, List<Topic>> topicTable = new();
|
||||
public Dictionary<string, List<Topic>> TopciTable { get { return topicTable; } }
|
||||
|
||||
public void ConnectMQTT(string domain, string port, List<Util.Topic> topics)
|
||||
{
|
||||
this.repository = repository;
|
||||
this.repository = new StudioRepoistory();
|
||||
listenerIdMap = new Dictionary<string, Dictionary<string, EventHandler<StudioServiceIdEventArgs>>>();
|
||||
listenerTypeMap = new Dictionary<string, EventHandler<StudioServiceTypeEventArgs>>();
|
||||
|
||||
|
||||
repository.OnTopicList += OnTopicList;
|
||||
repository.MQTTConnect();
|
||||
|
||||
var conntedInfo = $"MQTT Domain : {domain} , MQTTPORT :{port}";
|
||||
if (!topicTable.ContainsKey(conntedInfo))
|
||||
topicTable.Add(conntedInfo, new());
|
||||
topicTable[conntedInfo] = topics;
|
||||
|
||||
repository.MQTTCreateConnect(domain, port);
|
||||
|
||||
repository.MQTTConnect(conntedInfo);
|
||||
}
|
||||
|
||||
public void SubscribeMQTT(string topic)
|
||||
{
|
||||
repository.Subscribe(topic);
|
||||
}
|
||||
private void OnTopicList(string type, Dictionary<string, Dictionary<string, string>> entities)
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
@@ -114,6 +125,7 @@ namespace Studio
|
||||
{
|
||||
mqttData[type] = (entities, elapsedTime);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateTopicData(string type, string id, Dictionary<string, string> entity)
|
||||
{
|
||||
@@ -126,12 +138,11 @@ namespace Studio
|
||||
await Task.Delay(delayTime);
|
||||
|
||||
DispatchMachineEvent(type, id, entity);
|
||||
},CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
|
||||
}, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
|
||||
|
||||
}
|
||||
|
||||
private Dictionary<string, Dictionary<string, Dictionary<string, string>>> timelineEntity = new();
|
||||
|
||||
public bool TryGetRecentTimelineEntity(string type, string id, out Dictionary<string, string> result)
|
||||
{
|
||||
result = null;
|
||||
@@ -149,14 +160,13 @@ namespace Studio
|
||||
return result != null;
|
||||
}
|
||||
|
||||
public void AddTypeIdListener(string type, string id = null, EventHandler<StudioServiceIdEventArgs> listener=null)
|
||||
public void AddTypeIdListener(string type, string id = null, EventHandler<StudioServiceIdEventArgs> listener = null)
|
||||
{
|
||||
if (!listenerIdMap.ContainsKey(type))
|
||||
{
|
||||
listenerIdMap.Add(type, new());
|
||||
Debug.Log("딱한번들어옴");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!listenerIdMap[type].ContainsKey(id))
|
||||
{
|
||||
listenerIdMap[type][id] = listener;
|
||||
@@ -177,6 +187,20 @@ namespace Studio
|
||||
listenerTypeMap[type] += listener;
|
||||
}
|
||||
}
|
||||
public void RemoveTypeListener(string type)
|
||||
{
|
||||
if (!listenerTypeMap.ContainsKey(type))
|
||||
return;
|
||||
listenerTypeMap.Remove(type);
|
||||
}
|
||||
public void RemoveTypeIdListener(string type,string id)
|
||||
{
|
||||
if (!listenerIdMap[type].ContainsKey(id))
|
||||
return;
|
||||
|
||||
listenerIdMap[type].Remove(id);
|
||||
}
|
||||
|
||||
public async Task LoadBaseData(string url)
|
||||
{
|
||||
DateTime startTime = DateTime.Now;
|
||||
@@ -192,13 +216,14 @@ namespace Studio
|
||||
{
|
||||
if (!apiData.ContainsKey(url))
|
||||
apiData.Add(url, new());
|
||||
|
||||
|
||||
data.lastRequestTime = startTime;
|
||||
data.lastResponseTime = endTime;
|
||||
data.elapsedTime = sw.Elapsed;
|
||||
apiData[url] = data;
|
||||
CheckAPIBoarder(data.Entity.ToString(), data.ReqSize, url, t);
|
||||
UpdateEntity(url, data.Entity.ToString());
|
||||
var entity = UpdateEntity(url, data.Entity.ToString());
|
||||
StudioEntityWithState<List<Dictionary<string, string>>> convertData = new(data.State, entity, data.ReqSize, data.Message);
|
||||
apiData[url] = convertData;
|
||||
}
|
||||
else if (data.State == APIState.Error)
|
||||
{
|
||||
@@ -248,7 +273,7 @@ namespace Studio
|
||||
return boardEntity;
|
||||
}
|
||||
|
||||
public void UpdateEntity(string type, string data)
|
||||
public List<Dictionary<string, string>> UpdateEntity(string type, string data)
|
||||
{
|
||||
//Dcitionary 형으로 바꿈
|
||||
JObject json = JObject.Parse(data);
|
||||
@@ -274,6 +299,8 @@ namespace Studio
|
||||
}
|
||||
list.Add(keyvalue);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private void DispatchMachineEvent(string type, string id, Dictionary<string, string> entity)
|
||||
@@ -298,7 +325,7 @@ namespace Studio
|
||||
}
|
||||
}
|
||||
|
||||
private void DispatchTypeMachineEvent(string type, Dictionary<string,Dictionary<string, string>> entities)
|
||||
private void DispatchTypeMachineEvent(string type, Dictionary<string, Dictionary<string, string>> entities)
|
||||
{
|
||||
if (!listenerTypeMap.ContainsKey(type))
|
||||
{
|
||||
@@ -309,5 +336,6 @@ namespace Studio
|
||||
listenerTypeMap[type].Invoke(this, new(type, entities));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using Best.MQTT;
|
||||
using Best.MQTT;
|
||||
using Best.MQTT.Packets.Builders;
|
||||
using Studio.Util;
|
||||
using System;
|
||||
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
namespace Studio.Connection
|
||||
{
|
||||
//연결 실패시, 메시지 1회 수신시 사라지는 임시 클라이언트. 토픽 하나만 받을수 있음.
|
||||
//연결 실패시, 메시지 1회 수신시 사라지는 임시 클라이언트. 토픽 하나만 받을수 있음.
|
||||
public class TemporaryMQTTClient
|
||||
{
|
||||
MQTTClient client;
|
||||
@@ -53,8 +53,8 @@ namespace Studio.Connection
|
||||
}
|
||||
void Disconnect()
|
||||
{
|
||||
client.CreateUnsubscribePacketBuilder(topic)
|
||||
.BeginUnsubscribe();
|
||||
//client.CreateUnsubscribePacketBuilder(topic)
|
||||
//.BeginUnsubscribe();
|
||||
client.CreateDisconnectPacketBuilder()
|
||||
.BeginDisconnect();
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ namespace Studio.Manage
|
||||
{
|
||||
public class AGVManager : Manager
|
||||
{
|
||||
public Studio.VirtualFactory.AGV prf_AGV;
|
||||
public AGV prf_AGV;
|
||||
public AGVSpec prf_Spec;
|
||||
public HashSet<Studio.VirtualFactory.AGV> agvs = new();
|
||||
public HashSet<AGV> agvs = new();
|
||||
public bool autoIndexing;
|
||||
|
||||
public override void Init()
|
||||
@@ -18,7 +18,7 @@ namespace Studio.Manage
|
||||
|
||||
}
|
||||
|
||||
public bool TryGetIdleAGV(out Studio.VirtualFactory.AGV result)
|
||||
public bool TryGetIdleAGV(out AGV result)
|
||||
{
|
||||
//Debug.Log($"Try Get Idle AGV");
|
||||
foreach (var agv in agvs)
|
||||
@@ -35,7 +35,7 @@ namespace Studio.Manage
|
||||
return false;
|
||||
}
|
||||
|
||||
public Studio.VirtualFactory.AGV CreateEmptyAGV()
|
||||
public AGV CreateEmptyAGV()
|
||||
{
|
||||
var agv = UnityEngine.Object.Instantiate(prf_AGV);
|
||||
agvs.Add(agv);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using XRLib.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
@@ -49,9 +49,9 @@ namespace Studio
|
||||
{
|
||||
onTestAPI?.Invoke();
|
||||
|
||||
// API ¿¬°á
|
||||
Constants.APIDomain = InputField_Domain.text;
|
||||
Constants.APIPort = int.Parse(InputField_Port.text);
|
||||
// API 연결
|
||||
//ConfigConnected.APIDomain = InputField_Domain.text;
|
||||
// ConfigConnected.APIPort = int.Parse(InputField_Port.text);
|
||||
//StudioService.instance.ConnectMQTT();
|
||||
|
||||
await AuthService.Instance.Login("xr", "@dbqlTl1");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Studio.Core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using XED.Core;
|
||||
using XRLib;
|
||||
|
||||
namespace Studio.UI.Modal
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
||||
using Newtonsoft.Json;
|
||||
using Studio.Setting.Connect;
|
||||
using System.Collections.Generic;
|
||||
@@ -29,7 +29,7 @@ namespace Studio.UI
|
||||
RawDataFoldButton.GetComponent<Button>().onClick.AddListener(OnClickRawDataFoldButton);
|
||||
}
|
||||
|
||||
public void ShowData(StudioEntityWithState<object> data)
|
||||
public void ShowData<T>(StudioEntityWithState<T> data)
|
||||
{
|
||||
RawData.text = JsonConvert.SerializeObject(data.Entity, Formatting.Indented);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
||||
using Studio;
|
||||
using Studio.Setting.Connect;
|
||||
using Studio.UI;
|
||||
@@ -114,11 +114,11 @@ namespace Studio
|
||||
StudioService.instance.onMQTTDataLoaded -= UpdateMQTTDataButton;
|
||||
}
|
||||
|
||||
void UpdateAPIDataButton(string name, StudioEntityWithState<object> value)
|
||||
void UpdateAPIDataButton<T>(string name, StudioEntityWithState<T> value)
|
||||
{
|
||||
if (!apiButtons.ContainsKey(name))
|
||||
{
|
||||
// 버튼 새로 생성
|
||||
// 버튼 새로 생성
|
||||
var button = Instantiate(apiDataButtonPrefab, APIDataList.transform);
|
||||
apiButtons.Add(name, button);
|
||||
button.panel_Repository = this;
|
||||
@@ -128,8 +128,8 @@ namespace Studio
|
||||
}
|
||||
else
|
||||
{
|
||||
// 버튼 데이터 업데이트
|
||||
apiButtons[name].SetButtonData(name, value);
|
||||
// 버튼 데이터 업데이트
|
||||
apiButtons[name].SetButtonData<T>(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace Studio
|
||||
Panel_MQTTDataInfo.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void ShowInformation_APIData(StudioEntityWithState<object> baseDataValue)
|
||||
public void ShowInformation_APIData<T>(StudioEntityWithState<T> baseDataValue)
|
||||
{
|
||||
Panel_APIDataInfo.GetComponent<Panel_APIDataInfo>().ShowData(baseDataValue);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Studio.Core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using XED.Core;
|
||||
using XRLib;
|
||||
|
||||
namespace Studio.UI.Popup
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Studio;
|
||||
using Studio.Auth;
|
||||
using Studio.Conifg;
|
||||
using Studio.Dynamic.M;
|
||||
using Studio.Staic.STKC;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -10,15 +12,27 @@ namespace Studio
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
private int aa;
|
||||
public StockerCrane testcrane;
|
||||
void Awake()
|
||||
{
|
||||
Constants.MQTTDomain = "220.90.135.190";
|
||||
Constants.APIDomain = "220.90.135.190";
|
||||
Constants.APIPort = 23000;
|
||||
Constants.MQTTPort = 8088;
|
||||
StudioService.instance.ConnectMQTT();
|
||||
//ConfigConnected.MQTTDomain = "220.90.135.190";
|
||||
//ConfigConnected.APIDomain = "220.90.135.190";
|
||||
//ConfigConnected.APIPort = 23000;
|
||||
//ConfigConnected.MQTTPort = 8088;
|
||||
}
|
||||
|
||||
public void TestConeect()
|
||||
{
|
||||
var mqttsettings = ConfigConnected.MQTTSettings;
|
||||
|
||||
foreach(var mqtt in mqttsettings.mqttConnections)
|
||||
{
|
||||
StudioService.instance.ConnectMQTT(mqtt.domain,mqtt.port,mqtt.topics);
|
||||
}
|
||||
testcrane.Init("STOCKER_CRANE");
|
||||
AGVManager.instance.Init();
|
||||
|
||||
}
|
||||
private async void Test()
|
||||
{
|
||||
await AuthService.Instance.Login("xr", "@dbqlTl1");
|
||||
@@ -34,12 +48,12 @@ namespace Studio
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.I))
|
||||
{
|
||||
StudioService.instance.SubscribeMQTT("STOCKER_CRANE");
|
||||
// StudioService.instance.SubscribeMQTT("STOCKER_CRANE");
|
||||
|
||||
}
|
||||
if(Input.GetKeyDown(KeyCode.U))
|
||||
{
|
||||
StudioService.instance.SubscribeMQTT("AGV");
|
||||
// StudioService.instance.SubscribeMQTT("AGV");
|
||||
}
|
||||
if(Input.GetKeyDown(KeyCode.T))
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using TMPro;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Studio.UI;
|
||||
@@ -31,10 +31,10 @@ namespace Studio
|
||||
panel_Repository.ShowInformation_APIData(dataValue);
|
||||
}
|
||||
|
||||
public void SetButtonData(string name, StudioEntityWithState<object> data)
|
||||
public void SetButtonData<T>(string name, StudioEntityWithState<T> data)
|
||||
{
|
||||
baseDataKey = name;
|
||||
dataValue = data;
|
||||
dataValue = data as StudioEntityWithState<object>;
|
||||
|
||||
buttonName.text = name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user