..
This commit is contained in:
238
Assets/Resources/TestAGV.prefab
Normal file
238
Assets/Resources/TestAGV.prefab
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &1505508720499862715
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 421374873455346910}
|
||||||
|
- component: {fileID: 802422837581587047}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: TestAGV
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &421374873455346910
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1505508720499862715}
|
||||||
|
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:
|
||||||
|
- {fileID: 3909547189796084948}
|
||||||
|
- {fileID: 1627652318861080814}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &802422837581587047
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1505508720499862715}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 84ad40885a5aaa04e85eb7de0489cc8d, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!1 &4488530822671186643
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1627652318861080814}
|
||||||
|
- component: {fileID: 5506305391979457121}
|
||||||
|
- component: {fileID: 4473865689154435547}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Sensor
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1627652318861080814
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4488530822671186643}
|
||||||
|
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: 421374873455346910}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!135 &5506305391979457121
|
||||||
|
SphereCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4488530822671186643}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_LayerOverridePriority: 0
|
||||||
|
m_IsTrigger: 1
|
||||||
|
m_ProvidesContacts: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 3
|
||||||
|
m_Radius: 10
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &4473865689154435547
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4488530822671186643}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: a65fe5e7ae0d6a74dbe40d269a1cb6f7, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
obstacleLayer:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 256
|
||||||
|
--- !u!1 &7175446550791974323
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 8278436267998297966}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Pallet_Socket
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &8278436267998297966
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7175446550791974323}
|
||||||
|
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: 7020894527220248915}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1001 &154300052577553464
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 421374873455346910}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4046099219731300723, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Palletrobot
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects:
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 7154835845995298155, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
insertIndex: -1
|
||||||
|
addedObject: {fileID: 8278436267998297966}
|
||||||
|
m_AddedComponents:
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 6070737613420926900, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
insertIndex: -1
|
||||||
|
addedObject: {fileID: 5083700428396174471}
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
--- !u!4 &3909547189796084948 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 3775616689855107308, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 154300052577553464}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!1 &6204755932358581132 stripped
|
||||||
|
GameObject:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 6070737613420926900, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 154300052577553464}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!114 &5083700428396174471
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6204755932358581132}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5fb7059a769257346badd43882bceb27, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!4 &7020894527220248915 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 7154835845995298155, guid: 586ca79ec44844746b347929276fc0e6, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 154300052577553464}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
7
Assets/Resources/TestAGV.prefab.meta
Normal file
7
Assets/Resources/TestAGV.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 53db74a6e1101d2438a0c0083c5c232b
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@@ -197,7 +197,7 @@ public class VirtualFactoryManager : MonoBehaviour
|
|||||||
agvWorker.onCompleteTask += OnAGVIdle;
|
agvWorker.onCompleteTask += OnAGVIdle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnAGVIdle(AGV worker)
|
void OnAGVIdle(Studio.VirtualFactory.AGV worker)
|
||||||
{
|
{
|
||||||
Debug.Log($"{worker.name} is On Enter idle");
|
Debug.Log($"{worker.name} is On Enter idle");
|
||||||
stackerNeedsChecker.Scanning();
|
stackerNeedsChecker.Scanning();
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ namespace Studio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OnStateChangedMQTT(MQTTClient client, ClientStates oldState, ClientStates newState)
|
private void OnStateChangedMQTT(MQTTClient client, ClientStates oldState, ClientStates newState)
|
||||||
{
|
{
|
||||||
Debug.Log($"{oldState} => {newState}");
|
Debug.Log($"{oldState} => {newState}");
|
||||||
@@ -139,13 +140,12 @@ namespace Studio
|
|||||||
{
|
{
|
||||||
string key = prop.Name.ToString();
|
string key = prop.Name.ToString();
|
||||||
string value = prop.Value.ToString();
|
string value = prop.Value.ToString();
|
||||||
// Debug.Log($"kEY : {key}, Value:{value}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var T = json["data"];
|
var T = json["data"];
|
||||||
var split = T.ToString().Split('[');
|
var split = T.ToString().Split('[');
|
||||||
var t = $"[{split[1]}";
|
var t = $"[{split[1]}";
|
||||||
//Debug.Log(T.ToString());
|
|
||||||
JArray jarray = JArray.Parse(t);
|
JArray jarray = JArray.Parse(t);
|
||||||
var list = new Dictionary<string, Dictionary<string, string>>();
|
var list = new Dictionary<string, Dictionary<string, string>>();
|
||||||
foreach (JObject obj in jarray.Children())
|
foreach (JObject obj in jarray.Children())
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Studio.Setting.Connect;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Threading;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Studio;
|
using Studio;
|
||||||
using Studio.Core;
|
using Studio.Core;
|
||||||
@@ -10,30 +11,51 @@ using Studio.Conifg;
|
|||||||
|
|
||||||
namespace Studio
|
namespace Studio
|
||||||
{
|
{
|
||||||
|
public class StudioServiceIdEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public readonly string Type;
|
||||||
|
public Dictionary<string, string> Entity;
|
||||||
|
|
||||||
|
public StudioServiceIdEventArgs(string type, Dictionary<string, string> entity)
|
||||||
|
{
|
||||||
|
Type = type;
|
||||||
|
Entity = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class StudioServiceTypeEventArgs : EventArgs
|
public class StudioServiceTypeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
public readonly string Type;
|
public readonly string Type;
|
||||||
Dictionary<string, string> Entitis;
|
public Dictionary<string,Dictionary<string, string>> Entitis;
|
||||||
|
|
||||||
public StudioServiceTypeEventArgs(string type, Dictionary<string, string> entity)
|
public StudioServiceTypeEventArgs(string type, Dictionary<string, Dictionary<string, string>> entitis)
|
||||||
{
|
{
|
||||||
Type = type;
|
Type = type;
|
||||||
Entitis = entity;
|
Entitis = entitis;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StudioService : UnitySingleton<StudioService>
|
public class StudioService : UnitySingleton<StudioService>
|
||||||
{
|
{
|
||||||
private Dictionary<string, Dictionary<string, EventHandler<StudioServiceTypeEventArgs>>> listenerIdMap;
|
#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 StudioRepoistory repository;
|
||||||
private Dictionary<string, float> updateTime = new();
|
private Dictionary<string, float> updateTime = new();
|
||||||
|
|
||||||
|
#region 패킷계산
|
||||||
private int totalRequestPacket;
|
private int totalRequestPacket;
|
||||||
private int totalResponsePacket;
|
private int totalResponsePacket;
|
||||||
private long maxElapsedTime;
|
private long maxElapsedTime;
|
||||||
private long totalElapsedTime;
|
private long totalElapsedTime;
|
||||||
private int maxReponesSize;
|
private int maxReponesSize;
|
||||||
private int maxReuqestSize;
|
private int maxReuqestSize;
|
||||||
|
|
||||||
private string maxReuqestApi;
|
private string maxReuqestApi;
|
||||||
private string maxResponseApi;
|
private string maxResponseApi;
|
||||||
private string maxResponseTimeApi;
|
private string maxResponseTimeApi;
|
||||||
@@ -48,14 +70,10 @@ namespace Studio
|
|||||||
|
|
||||||
public void ConnectMQTT()
|
public void ConnectMQTT()
|
||||||
{
|
{
|
||||||
this.repository = new StudioRepoistory();
|
this.repository = repository;
|
||||||
|
listenerIdMap = new Dictionary<string, Dictionary<string, EventHandler<StudioServiceIdEventArgs>>>();
|
||||||
|
listenerTypeMap = new Dictionary<string, EventHandler<StudioServiceTypeEventArgs>>();
|
||||||
|
|
||||||
// ✅ 명시적으로 필요한 Dictionary들 초기화
|
|
||||||
listenerIdMap = new Dictionary<string, Dictionary<string, EventHandler<StudioServiceTypeEventArgs>>>();
|
|
||||||
lastUpdateTime = new Dictionary<string, DateTime>();
|
|
||||||
updateTime = new Dictionary<string, float>();
|
|
||||||
apiData = new Dictionary<string, StudioEntityWithState<object>>();
|
|
||||||
mqttData = new Dictionary<string, (Dictionary<string, Dictionary<string, string>>, TimeSpan)>();
|
|
||||||
|
|
||||||
repository.OnTopicList += OnTopicList;
|
repository.OnTopicList += OnTopicList;
|
||||||
repository.MQTTConnect();
|
repository.MQTTConnect();
|
||||||
@@ -65,7 +83,6 @@ namespace Studio
|
|||||||
{
|
{
|
||||||
repository.Subscribe(topic);
|
repository.Subscribe(topic);
|
||||||
}
|
}
|
||||||
//Que에 담아둔다?
|
|
||||||
private void OnTopicList(string type, Dictionary<string, Dictionary<string, string>> entities)
|
private void OnTopicList(string type, Dictionary<string, Dictionary<string, string>> entities)
|
||||||
{
|
{
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
@@ -98,24 +115,19 @@ namespace Studio
|
|||||||
mqttData[type] = (entities, elapsedTime);
|
mqttData[type] = (entities, elapsedTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMQTTDataLoaded?.Invoke(type, entities, elapsedTime); // 나중에 클래스 밖으로 이동 필요
|
private void UpdateTopicData(string type, string id, Dictionary<string, string> entity)
|
||||||
}
|
|
||||||
|
|
||||||
private async Task UpdateTopicData(string type, string id, Dictionary<string, string> entity)
|
|
||||||
{
|
{
|
||||||
if (!updateTime.ContainsKey(type))
|
if (!updateTime.ContainsKey(type))
|
||||||
updateTime.Add(type, 0.5f);
|
updateTime.Add(type, 0.5f);
|
||||||
var time = updateTime[type];
|
var time = updateTime[type];
|
||||||
|
var task = Task.Factory.StartNew(async () =>
|
||||||
var task = Task.Run(async () =>
|
|
||||||
{
|
{
|
||||||
var st = string.Empty;
|
|
||||||
st = $"{type}:";
|
|
||||||
int delayTime = (int)(time * 1000);
|
int delayTime = (int)(time * 1000);
|
||||||
await Task.Delay(delayTime);
|
await Task.Delay(delayTime);
|
||||||
|
|
||||||
DispatchMachineEvent(type, id, entity);
|
DispatchMachineEvent(type, id, entity);
|
||||||
});
|
},CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<string, Dictionary<string, Dictionary<string, string>>> timelineEntity = new();
|
private Dictionary<string, Dictionary<string, Dictionary<string, string>>> timelineEntity = new();
|
||||||
@@ -137,12 +149,13 @@ namespace Studio
|
|||||||
return result != null;
|
return result != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTypeListener(string type, string id, EventHandler<StudioServiceTypeEventArgs> listener)
|
public void AddTypeIdListener(string type, string id = null, EventHandler<StudioServiceIdEventArgs> listener=null)
|
||||||
{
|
{
|
||||||
if (!listenerIdMap.ContainsKey(type))
|
if (!listenerIdMap.ContainsKey(type))
|
||||||
{
|
{
|
||||||
listenerIdMap.Add(type, new());
|
listenerIdMap.Add(type, new());
|
||||||
//Debug.LogError($"Key Value is missing!!!! -Key:{type}-");
|
Debug.Log("딱한번들어옴");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!listenerIdMap[type].ContainsKey(id))
|
if (!listenerIdMap[type].ContainsKey(id))
|
||||||
{
|
{
|
||||||
@@ -153,7 +166,17 @@ namespace Studio
|
|||||||
listenerIdMap[type][id] += listener;
|
listenerIdMap[type][id] += listener;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void AddTypeListener(string type, EventHandler<StudioServiceTypeEventArgs> listener)
|
||||||
|
{
|
||||||
|
if (!listenerTypeMap.ContainsKey(type))
|
||||||
|
{
|
||||||
|
listenerTypeMap[type] = listener;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
listenerTypeMap[type] += listener;
|
||||||
|
}
|
||||||
|
}
|
||||||
public async Task LoadBaseData(string url)
|
public async Task LoadBaseData(string url)
|
||||||
{
|
{
|
||||||
DateTime startTime = DateTime.Now;
|
DateTime startTime = DateTime.Now;
|
||||||
@@ -223,7 +246,6 @@ namespace Studio
|
|||||||
boardEntity.MaximumResponsePacketAPI = maxResponseApi;
|
boardEntity.MaximumResponsePacketAPI = maxResponseApi;
|
||||||
boardEntity.MaximumResponseTimeAPI = maxResponseTimeApi;
|
boardEntity.MaximumResponseTimeAPI = maxResponseTimeApi;
|
||||||
return boardEntity;
|
return boardEntity;
|
||||||
//JsonUtility.ToJson()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateEntity(string type, string data)
|
public void UpdateEntity(string type, string data)
|
||||||
@@ -238,24 +260,19 @@ namespace Studio
|
|||||||
}
|
}
|
||||||
|
|
||||||
var datas = json["rows"].ToString();
|
var datas = json["rows"].ToString();
|
||||||
|
var list = new List<Dictionary<string, string>>();
|
||||||
JArray jarray = JArray.Parse(datas);
|
JArray jarray = JArray.Parse(datas);
|
||||||
foreach (JObject obj in jarray.Children())
|
foreach (JObject obj in jarray.Children())
|
||||||
{
|
{
|
||||||
Dictionary<string, string> keyvalue = new();
|
Dictionary<string, string> keyvalue = new();
|
||||||
int index = 0;
|
|
||||||
string id = string.Empty;
|
string id = string.Empty;
|
||||||
foreach (JProperty prop in obj.Children())
|
foreach (JProperty prop in obj.Children())
|
||||||
{
|
{
|
||||||
string key = prop.Name.ToString();
|
string key = prop.Name.ToString();
|
||||||
string value = prop.Value.ToString();
|
string value = prop.Value.ToString();
|
||||||
if (index == 0)
|
|
||||||
{
|
|
||||||
id = value;
|
|
||||||
index = 1;
|
|
||||||
}
|
|
||||||
keyvalue.Add(key, value);
|
keyvalue.Add(key, value);
|
||||||
}
|
}
|
||||||
DispatchMachineEvent(type, id, keyvalue);
|
list.Add(keyvalue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,13 +280,34 @@ namespace Studio
|
|||||||
{
|
{
|
||||||
if (!listenerIdMap.ContainsKey(type))
|
if (!listenerIdMap.ContainsKey(type))
|
||||||
{
|
{
|
||||||
Debug.LogError($"Key Value is missing!!!! -Key:{type}-");
|
Debug.Log($"Key Value is missing!!!! -Key:{type}-");
|
||||||
}
|
}
|
||||||
if (listenerIdMap[type].ContainsKey(id))
|
if (listenerIdMap[type].ContainsKey(id))
|
||||||
{
|
{
|
||||||
listenerIdMap[type][id].Invoke(this, new StudioServiceTypeEventArgs(type, entity));
|
listenerIdMap[type][id].Invoke(this, new StudioServiceIdEventArgs(type, entity));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var data = new Dictionary<string, Dictionary<string, string>>();
|
||||||
|
data.Add(id, entity);
|
||||||
|
if (entity == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DispatchTypeMachineEvent(type, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DispatchTypeMachineEvent(string type, Dictionary<string,Dictionary<string, string>> entities)
|
||||||
|
{
|
||||||
|
if (!listenerTypeMap.ContainsKey(type))
|
||||||
|
{
|
||||||
|
Debug.LogError($"Key Value is missing!!!! -Key:{type}-");
|
||||||
|
}
|
||||||
|
if (listenerTypeMap.ContainsKey(type))
|
||||||
|
{
|
||||||
|
listenerTypeMap[type].Invoke(this, new(type, entities));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -340,5 +340,7 @@ namespace Studio.Test
|
|||||||
{
|
{
|
||||||
updateAction.Invoke();
|
updateAction.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Studio.Test;
|
using Studio.Test;
|
||||||
@@ -8,9 +8,9 @@ namespace Studio.Manage
|
|||||||
{
|
{
|
||||||
public class AGVManager : Manager
|
public class AGVManager : Manager
|
||||||
{
|
{
|
||||||
public AGV prf_AGV;
|
public Studio.VirtualFactory.AGV prf_AGV;
|
||||||
public AGVSpec prf_Spec;
|
public AGVSpec prf_Spec;
|
||||||
public HashSet<AGV> agvs = new();
|
public HashSet<Studio.VirtualFactory.AGV> agvs = new();
|
||||||
public bool autoIndexing;
|
public bool autoIndexing;
|
||||||
|
|
||||||
public override void Init()
|
public override void Init()
|
||||||
@@ -18,7 +18,7 @@ namespace Studio.Manage
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetIdleAGV(out AGV result)
|
public bool TryGetIdleAGV(out Studio.VirtualFactory.AGV result)
|
||||||
{
|
{
|
||||||
//Debug.Log($"Try Get Idle AGV");
|
//Debug.Log($"Try Get Idle AGV");
|
||||||
foreach (var agv in agvs)
|
foreach (var agv in agvs)
|
||||||
@@ -35,7 +35,7 @@ namespace Studio.Manage
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AGV CreateEmptyAGV()
|
public Studio.VirtualFactory.AGV CreateEmptyAGV()
|
||||||
{
|
{
|
||||||
var agv = UnityEngine.Object.Instantiate(prf_AGV);
|
var agv = UnityEngine.Object.Instantiate(prf_AGV);
|
||||||
agvs.Add(agv);
|
agvs.Add(agv);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System;
|
using System;
|
||||||
@@ -26,7 +27,7 @@ public class DataReader : MonoBehaviour
|
|||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
//ReplayTimer.gameObject.SetActive(true);
|
//ReplayTimer.gameObject.SetActive(true);
|
||||||
// Resources 폴더에서 파일을 불러옵니다.
|
// Resources 폴더에서 파일을 불러옵니다.
|
||||||
csvFile = Resources.Load<TextAsset>($"LogData/DataLog");
|
csvFile = Resources.Load<TextAsset>($"LogData/DataLog");
|
||||||
|
|
||||||
if (csvFile != null)
|
if (csvFile != null)
|
||||||
@@ -38,7 +39,7 @@ public class DataReader : MonoBehaviour
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogError("CSV 파일을 찾을 수 없습니다.");
|
Debug.LogError("CSV 파일을 찾을 수 없습니다.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using UnityEngine;
|
using Studio.Core;
|
||||||
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using Studio.Core;
|
using XED.Core;
|
||||||
using XRLib;
|
using XRLib;
|
||||||
|
|
||||||
namespace Studio.UI.Modal
|
namespace Studio.UI.Modal
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using UnityEngine;
|
using Studio.Core;
|
||||||
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using Studio.Core;
|
using XED.Core;
|
||||||
using XRLib;
|
using XRLib;
|
||||||
|
|
||||||
namespace Studio.UI.Popup
|
namespace Studio.UI.Popup
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using Studio.Core;
|
||||||
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using Studio.Core;
|
|
||||||
using XRLib;
|
using XRLib;
|
||||||
|
|
||||||
namespace Studio.UI.Popup
|
namespace Studio.UI.Popup
|
||||||
|
|||||||
Reference in New Issue
Block a user