From 69080b57145bc294d6712fd9a1f1f506c09a608f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A4=80=ED=95=99=20=EB=85=B8?= Date: Tue, 27 May 2025 15:24:25 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=94=EB=93=9C=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Studio/AssetTool/CustomAssetConnector.cs | 9 ++- .../AssetTool/CustomAssetRenderObject.cs | 56 ++++++++++++++- Assets/Scripts/Studio/Common/ProejctData.cs | 25 ++++++- .../Scripts/Studio/Connect/ConfigConnected.cs | 22 ++++-- .../Scripts/Studio/Connect/StudioService.cs | 25 +++---- .../Scripts/Studio/Managers/ProjectManager.cs | 23 ++++--- .../TwinObject/AbstractFunctionObject.cs | 2 + .../Studio/TwinObject/DynamicObject/AGV.cs | 22 +++++- .../TwinObject/DynamicObject/AGVManager.cs | 67 +++++++++++------- .../TwinObject/StaticObject/StackerCrane.cs | 68 +++++++++++-------- .../UI/Panel/Panel_DynamicObjectInfo.cs | 55 ++++++++------- .../Studio/UI/Panel_3DDy/AddComponetModal.cs | 6 +- Assets/TMPFolder/RJHTest.cs | 2 +- 13 files changed, 260 insertions(+), 122 deletions(-) diff --git a/Assets/Scripts/Studio/AssetTool/CustomAssetConnector.cs b/Assets/Scripts/Studio/AssetTool/CustomAssetConnector.cs index 20ff5c32..1b7cc822 100644 --- a/Assets/Scripts/Studio/AssetTool/CustomAssetConnector.cs +++ b/Assets/Scripts/Studio/AssetTool/CustomAssetConnector.cs @@ -142,9 +142,12 @@ namespace Studio.AssetTool selectedAssetData.AddTransformToRender(selectedItem.transform); CoroutineRunner.instance.StartCoroutine(ChangeSelectedAssetTransform()); - selectRenderObject.transform.position = new Vector3(asset.position.x, asset.position.y, asset.position.z); - selectRenderObject.transform.eulerAngles = new Vector3(asset.rotation.x, asset.rotation.y, asset.rotation.z); - selectRenderObject.transform.localScale = new Vector3(asset.scale.x, asset.scale.y, asset.scale.z); + selectRenderObject.LoadCreate(asset.code, asset.topic, asset.component, asset.isAutoCreate); + var pos = new Vector3(asset.position.x, asset.position.y, asset.position.z); + var angles =selectRenderObject.transform.eulerAngles = new Vector3(asset.rotation.x, asset.rotation.y, asset.rotation.z); + var scale = new Vector3(asset.scale.x, asset.scale.y, asset.scale.z); + selectRenderObject.SetTransform(pos, angles, scale); + } public void OnAssetSelected(AssetLibraryItem item) { diff --git a/Assets/Scripts/Studio/AssetTool/CustomAssetRenderObject.cs b/Assets/Scripts/Studio/AssetTool/CustomAssetRenderObject.cs index 547e4f80..4bf0217b 100644 --- a/Assets/Scripts/Studio/AssetTool/CustomAssetRenderObject.cs +++ b/Assets/Scripts/Studio/AssetTool/CustomAssetRenderObject.cs @@ -6,6 +6,7 @@ using UnityEngine; using UnityEngine.EventSystems; using Studio.DataStructures; using Studio.UI; +using Studio.Conifg; namespace Studio.AssetTool { @@ -35,9 +36,9 @@ namespace Studio.AssetTool public event Action OnSelected; public string componetKey; - public string addTopic; + public string topic; public bool isAutoId; - public string ID; + public string code; private void Awake() { objectRenderer = GetComponentInChildren(); @@ -262,5 +263,56 @@ namespace Studio.AssetTool return hitInfo; } + + public void ChangeConnectData(string id,string compoenet,string topic,bool isAuto) + { + this.code = id; + this.componetKey = compoenet; + this.topic = topic; + ChangeIsAuto(isAuto); + } + + private void ChangeIsAuto(bool isAuto) + { + if (this.isAutoId == isAuto) + return; + + this.isAutoId = isAuto; + if(functionObject !=null ) + { + functionObject.ChangeAutoID(isAuto); + } + } + + private AbstractFunctionObject functionObject; + public void LoadCreate(string code,string topic, string component, bool isAuto) + { + this.code = code; + this.topic = topic; + this.componetKey = component; + this.isAutoId = isAuto; + + if (string.IsNullOrEmpty(componetKey)) + return; + var compo = ConfigConnected.ComponetScritable.compoenets.FirstOrDefault(x => x.key.Equals(componetKey)); + var type = compo.comp.GetType(); + AddComponent(type); + } + + public void AddComponent(Type type) + { + if (!transform.TryGetComponent(type, out var com)) + { + var comp = transform.gameObject.AddComponent(type); + functionObject = comp as AbstractFunctionObject; + } + } + + public void SetTransform(Vector3 position,Vector3 angles, Vector3 scale) + { + transform.position = new Vector3(position.x, position.y, position.z); + transform.eulerAngles = new Vector3(angles.x, angles.y, angles.z); + transform.localScale = new Vector3(scale.x, scale.y, scale.z); + } } } \ No newline at end of file diff --git a/Assets/Scripts/Studio/Common/ProejctData.cs b/Assets/Scripts/Studio/Common/ProejctData.cs index 3c70cbda..a331a935 100644 --- a/Assets/Scripts/Studio/Common/ProejctData.cs +++ b/Assets/Scripts/Studio/Common/ProejctData.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using UnityEngine; namespace Studio.Util @@ -92,15 +92,36 @@ namespace Studio.Util { public int id; public string name; + public string code; + public string component; + public string topic; + public bool isAutoCreate; public SaveVector3 position; public SaveVector3 rotation; public SaveVector3 scale; public List children; - public AssetData(int id, string name, SaveVector3 position, SaveVector3 rotation, SaveVector3 scale, List children) + /// + /// + /// + /// instanceID + /// Object Name + /// FunctionObject ID( + /// AddComponent Key + /// ConnectTopic Key + /// Assigned ID + /// Object WorldPosition + /// Object WorldRotation + /// Object Scale + /// + public AssetData(int id, string name,string code,string component,string topic, bool isAutoId, SaveVector3 position, SaveVector3 rotation, SaveVector3 scale, List children) { this.id = id; this.name = name; + this.code = code; + this.component = component; + this.topic = topic; + this.isAutoCreate = isAutoId; this.position = position; this.rotation = rotation; this.scale = scale; diff --git a/Assets/Scripts/Studio/Connect/ConfigConnected.cs b/Assets/Scripts/Studio/Connect/ConfigConnected.cs index d6bbbe3a..4c4903de 100644 --- a/Assets/Scripts/Studio/Connect/ConfigConnected.cs +++ b/Assets/Scripts/Studio/Connect/ConfigConnected.cs @@ -26,13 +26,27 @@ namespace Studio.Conifg } } - public static Dictionary AssetSettings + //public static Dictionary AssetSettings + //{ + // get + // { + // var canvas_Popup = EventConnector.instance.GetCanvas(); + // var result = canvas_Popup.panel_3dfactorysetting.GetAssetDatas(); + // return result; + // } + //} + + private static AddComponetDataScriptable componetScriptable; + public static AddComponetDataScriptable ComponetScritable { get { - var canvas_Popup = EventConnector.instance.GetCanvas(); - var result = canvas_Popup.panel_3dfactorysetting.GetAssetDatas(); - return result; + if(componetScriptable== null) + { + componetScriptable = Resources.Load("Scriptable/AddComponetData"); + componetScriptable.SetItem(); + } + return componetScriptable; } } } diff --git a/Assets/Scripts/Studio/Connect/StudioService.cs b/Assets/Scripts/Studio/Connect/StudioService.cs index fbbbbde3..4ce042cb 100644 --- a/Assets/Scripts/Studio/Connect/StudioService.cs +++ b/Assets/Scripts/Studio/Connect/StudioService.cs @@ -1,13 +1,9 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using NUnit.Framework; -using Studio.Conifg; +using Newtonsoft.Json.Linq; using Studio.Core; using Studio.Setting.Connect; using Studio.Util; using System; using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; using UnityEngine; @@ -40,8 +36,8 @@ namespace Studio public class StudioService : UnitySingleton { - private Dictionary>> listenerIdMap; - private Dictionary> listenerTypeMap; + private Dictionary>> listenerIdMap = new(); + private Dictionary> listenerTypeMap = new(); private StudioRepoistory repository; private Dictionary updateTime = new(); @@ -79,9 +75,6 @@ namespace Studio public void ConnectMQTT(string domain, string port, List topics) { this.repository = new StudioRepoistory(); - listenerIdMap = new Dictionary>>(); - listenerTypeMap = new Dictionary>(); - repository.OnTopicList += OnTopicList; var conntedInfo = $"MQTT Domain : {domain} , MQTTPORT :{port}"; @@ -90,7 +83,7 @@ namespace Studio topicTable[conntedInfo] = topics; repository.MQTTCreateConnect(domain, port); - + repository.MQTTConnect(conntedInfo); } @@ -179,7 +172,7 @@ namespace Studio listenerIdMap[type][id] += listener; } } - public void AddTypeListener(string type, EventHandler listener =null) + public void AddTypeListener(string type, EventHandler listener = null) { listenerTypeMap[type] = listener; } @@ -189,7 +182,7 @@ namespace Studio return; listenerTypeMap.Remove(type); } - public void RemoveTypeIdListener(string type,string id) + public void RemoveTypeIdListener(string type, string id) { if (!listenerIdMap.ContainsKey(type)) return; @@ -214,7 +207,7 @@ namespace Studio { if (!apiData.ContainsKey(url)) apiData.Add(url, new()); - + data.lastRequestTime = startTime; data.lastResponseTime = endTime; data.elapsedTime = sw.Elapsed; @@ -326,8 +319,8 @@ namespace Studio private void DispatchTypeMachineEvent(string type, Dictionary> entities) { - - + + if (listenerTypeMap.ContainsKey(type)) { listenerTypeMap[type].Invoke(this, new(type, entities)); diff --git a/Assets/Scripts/Studio/Managers/ProjectManager.cs b/Assets/Scripts/Studio/Managers/ProjectManager.cs index aa051f22..a258776e 100644 --- a/Assets/Scripts/Studio/Managers/ProjectManager.cs +++ b/Assets/Scripts/Studio/Managers/ProjectManager.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; @@ -106,7 +106,7 @@ namespace Studio.Manage .Where(asset => asset.hierarchyItem.linkedObject.activeSelf) .OrderBy(asset => asset.hierarchyItem.layerNum) .ThenBy(asset => asset.hierarchyItem.GetSiblingIndex()) - .Select(asset => CreateAssetData(asset.hierarchyItem)) + .Select(asset => CreateAssetData(asset)) .ToList(); curProjectData = CreateProjectData(assetDatas); string json = JsonConvert.SerializeObject(curProjectData, Formatting.Indented); @@ -117,15 +117,20 @@ namespace Studio.Manage writer.Close(); } - public AssetData CreateAssetData(HierarchyItem hierarchyItem) + public AssetData CreateAssetData(ConnectedAsset asset) { return new AssetData( - hierarchyItem.linkedObject.GetInstanceID(), - hierarchyItem.name, - new SaveVector3(hierarchyItem.linkedObject.transform.position), - new SaveVector3(hierarchyItem.linkedObject.transform.eulerAngles), - new SaveVector3(hierarchyItem.linkedObject.transform.localScale), - hierarchyItem.children.Select(x => x.linkedObject.GetInstanceID()).ToList() + asset.hierarchyItem.linkedObject.GetInstanceID(), + asset.hierarchyItem.name, + asset.renderObject.code, + asset.renderObject.componetKey, + asset.renderObject.topic, + asset.renderObject.isAutoId, + new SaveVector3(asset.hierarchyItem.linkedObject.transform.position), + new SaveVector3(asset.hierarchyItem.linkedObject.transform.eulerAngles), + new SaveVector3(asset.hierarchyItem.linkedObject.transform.localScale), + + asset.hierarchyItem.children.Select(x => x.linkedObject.GetInstanceID()).ToList() ); } diff --git a/Assets/Scripts/Studio/TwinObject/AbstractFunctionObject.cs b/Assets/Scripts/Studio/TwinObject/AbstractFunctionObject.cs index e99c4daa..12322c4a 100644 --- a/Assets/Scripts/Studio/TwinObject/AbstractFunctionObject.cs +++ b/Assets/Scripts/Studio/TwinObject/AbstractFunctionObject.cs @@ -18,6 +18,8 @@ namespace Studio public virtual ObjectType ObjectType { get; set; } public abstract void OnUpdateData(object sender, StudioServiceIdEventArgs e); + + public abstract void ChangeAutoID(bool isAuto); } } diff --git a/Assets/Scripts/Studio/TwinObject/DynamicObject/AGV.cs b/Assets/Scripts/Studio/TwinObject/DynamicObject/AGV.cs index fc88f4c1..35cbb36a 100644 --- a/Assets/Scripts/Studio/TwinObject/DynamicObject/AGV.cs +++ b/Assets/Scripts/Studio/TwinObject/DynamicObject/AGV.cs @@ -1,4 +1,6 @@ -using Studio.VirtualFactory.Info; +using Studio.AssetTool; +using Studio.Dynamic.Manager; +using Studio.VirtualFactory.Info; using System; using System.Collections.Generic; using System.Linq; @@ -26,7 +28,7 @@ namespace Studio.Dynamic.TwinObject private Dictionary CurrentEntity; private bool isPlay = false; - + private CustomAssetRenderObject renderObject; public override Dictionary Info { get @@ -53,6 +55,17 @@ namespace Studio.Dynamic.TwinObject } } + public override void AfterAwake() + { + renderObject = GetComponent(); + if (!string.IsNullOrEmpty(renderObject.code)) + { + Init(renderObject.componetKey, transform.position); + } + } + //최초 배치 후 하나 있고 AutoID 체크 되어 있으면.. + // + /// /// Run했을때 생성되면서 배치... /// @@ -148,5 +161,10 @@ namespace Studio.Dynamic.TwinObject { rotSpeed = aGVRotateSpeed; } + + public override void ChangeAutoID(bool isAuto) + { + AGVManager.instance.SetCopyObject(isAuto, renderObject); + } } } diff --git a/Assets/Scripts/Studio/TwinObject/DynamicObject/AGVManager.cs b/Assets/Scripts/Studio/TwinObject/DynamicObject/AGVManager.cs index ecd38e92..50bff1fc 100644 --- a/Assets/Scripts/Studio/TwinObject/DynamicObject/AGVManager.cs +++ b/Assets/Scripts/Studio/TwinObject/DynamicObject/AGVManager.cs @@ -6,30 +6,27 @@ using Studio.Dynamic.TwinObject; using Studio.Core; using Studio.Conifg; using Studio.AssetTool; +using Studio.Util; +using Studio.Manage; -namespace Studio.Dynamic.M +namespace Studio.Dynamic.Manager { public class AGVManager : UnitySingleton { - private GameObject prf_AGV; + private CustomAssetRenderObject agvRenderObj; + private ConnectedAsset asset; private HashSet agvs = new(); public float AGVMoveSpeed; public float AGVRotateSpeed; - public Queue>> createAgvs = new(); - public void Awake() - { - - //이벤트 걸어둔다.. - //+= OnPlayStart - } public void OnPlayStart() { - var type = GetComponent().addTopic; - var assets = ConfigConnected.AssetSettings; - prf_AGV = assets[type].loadedObject; - if (prf_AGV == null) + agvRenderObj.gameObject.SetActive(false); + var type = agvRenderObj.topic; + var connector = ManagerHub.instance.Get(); + asset = connector.connectedAssets.FirstOrDefault(x => x.renderObject == agvRenderObj); + if (asset == null) { //todo::팝업메시지 나주엥 설정.... return; @@ -61,20 +58,20 @@ namespace Studio.Dynamic.M private AGV CreateAGV(string type, string id ,Dictionary entity) { - var agv = Instantiate(prf_AGV,transform).AddComponent(); - agv.gameObject.SetActive(true); - agv.transform.position = Vector3.zero; - agv.name = id; - agv.SetMoveSpeed(AGVMoveSpeed); - agv.SetRotateSpeed(AGVRotateSpeed); - var xPos = entity.FirstOrDefault(x => x.Key.Equals("X", StringComparison.OrdinalIgnoreCase)); - var yPos = entity.FirstOrDefault(x => x.Key.Equals("Y", StringComparison.OrdinalIgnoreCase)); - float.TryParse(xPos.Value, out var x); - float.TryParse(yPos.Value, out var y); + //var agv = ManagerHub.instance.Get().CreateAsset(asset.assetData.assetName).AddComponent(); + //agv.gameObject.SetActive(true); + //agv.transform.position = Vector3.zero; + //agv.name = id; + //agv.SetMoveSpeed(AGVMoveSpeed); + //agv.SetRotateSpeed(AGVRotateSpeed); + //var xPos = entity.FirstOrDefault(x => x.Key.Equals("X", StringComparison.OrdinalIgnoreCase)); + //var yPos = entity.FirstOrDefault(x => x.Key.Equals("Y", StringComparison.OrdinalIgnoreCase)); + //float.TryParse(xPos.Value, out var x); + //float.TryParse(yPos.Value, out var y); - var pos = new Vector3(x * 0.001f, 0, y * 0.001f); - agv.Init(type,pos); - return agv; + //var pos = new Vector3(x * 0.001f, 0, y * 0.001f); + //agv.Init(type,pos); + return null; } /// @@ -95,6 +92,24 @@ namespace Studio.Dynamic.M } + public void SetCopyObject(bool isAuto ,CustomAssetRenderObject renderObject) + { + if(isAuto) + { + agvRenderObj = renderObject; + //이벤트 걸어둔다.. + //+= OnPlayStart + } + else + { + agvRenderObj = null; + //이벤트해제 + //-= OnPlayStart + } + + } + + } } diff --git a/Assets/Scripts/Studio/TwinObject/StaticObject/StackerCrane.cs b/Assets/Scripts/Studio/TwinObject/StaticObject/StackerCrane.cs index c4b90d8b..395ef7d0 100644 --- a/Assets/Scripts/Studio/TwinObject/StaticObject/StackerCrane.cs +++ b/Assets/Scripts/Studio/TwinObject/StaticObject/StackerCrane.cs @@ -67,7 +67,7 @@ namespace Studio.Staic.STKC } public void OnPlayStart() { - var type = GetComponent().addTopic; + var type = GetComponent().topic; curType = type; StudioService.instance.AddTypeIdListener(type, transform.name, OnUpdateData); } @@ -81,6 +81,40 @@ namespace Studio.Staic.STKC { } + + public override void OnUpdateData(object sender, StudioServiceIdEventArgs e) + { + CurrentEntity = e.Entity; + + + BANK = CurrentEntity.FirstOrDefault(x => x.Key.Equals(nameof(BANK), StringComparison.OrdinalIgnoreCase)).Value; + BAY = CurrentEntity.FirstOrDefault(x => x.Key.Equals(nameof(BAY), StringComparison.OrdinalIgnoreCase)).Value; + LEVEL = CurrentEntity.FirstOrDefault(x => x.Key.Equals(nameof(LEVEL), StringComparison.OrdinalIgnoreCase)).Value; + + var x = int.Parse(BANK); + var y = int.Parse(LEVEL); + var z = int.Parse(BAY); + + if (IsSameValue(x, y, z)) + return; + + bodyProcess = 0f; + liftProcess = 0f; + bodyStart = transform.localPosition; + bodyEnd = bodyStart; + bodyEnd.z = z; + + liftStartY = lift.position.y; + liftEndY = y; + + onMotionStart?.Invoke(); + } + public override void ChangeAutoID(bool isAuto) + { + return; + } + + private void StartAnim() { StopAllCoroutines(); @@ -122,35 +156,6 @@ namespace Studio.Staic.STKC liftPos.y = liftY; lift.position = liftPos; } - - public override void OnUpdateData(object sender, StudioServiceIdEventArgs e) - { - CurrentEntity = e.Entity; - - - BANK = CurrentEntity.FirstOrDefault(x => x.Key.Equals(nameof(BANK), StringComparison.OrdinalIgnoreCase)).Value; - BAY = CurrentEntity.FirstOrDefault(x => x.Key.Equals(nameof(BAY), StringComparison.OrdinalIgnoreCase)).Value; - LEVEL = CurrentEntity.FirstOrDefault(x => x.Key.Equals(nameof(LEVEL), StringComparison.OrdinalIgnoreCase)).Value; - - var x = int.Parse(BANK); - var y = int.Parse(LEVEL); - var z = int.Parse(BAY); - - if (IsSameValue(x, y, z)) - return; - - bodyProcess = 0f; - liftProcess = 0f; - bodyStart = transform.localPosition; - bodyEnd = bodyStart; - bodyEnd.z = z; - - liftStartY = lift.position.y; - liftEndY = y; - - onMotionStart?.Invoke(); - } - private bool IsSameValue(int bank, int bay, int level) { @@ -167,6 +172,7 @@ namespace Studio.Staic.STKC return false; } + private void OnDestroy() { if (curType == null) @@ -174,5 +180,7 @@ namespace Studio.Staic.STKC StudioService.instance.RemoveTypeIdListener(curType, transform.name); onMotionStart -= StartAnim; } + + } } diff --git a/Assets/Scripts/Studio/UI/Panel/Panel_DynamicObjectInfo.cs b/Assets/Scripts/Studio/UI/Panel/Panel_DynamicObjectInfo.cs index f56f5d68..c915086a 100644 --- a/Assets/Scripts/Studio/UI/Panel/Panel_DynamicObjectInfo.cs +++ b/Assets/Scripts/Studio/UI/Panel/Panel_DynamicObjectInfo.cs @@ -10,6 +10,7 @@ using UnityEngine.UI; using System; using Studio.AssetTool; using UnityEngine.Rendering.Universal; +using Studio.Conifg; namespace Studio.UI { @@ -70,6 +71,11 @@ namespace Studio.UI private CustomAssetRenderObject singleSelectObject; private AddComponetDataScriptable componetScriptable; + + private string componetKey; + private string topic; + private string code; + private bool isAuto; public override void AfterAwake() { InputField_PositionX.onValueChanged.AddListener(OnPosXChanged); @@ -269,8 +275,8 @@ namespace Studio.UI void OnChangedID(string Id) { - var searchAsset = GetConnectAsset(singleSelectObject); - searchAsset.renderObject.ID = Id; + this.code = Id; + singleSelectObject.ChangeConnectData(code, componetKey, topic, isAuto); } public void SetObjectInfo(string name, List selectedObjects) { @@ -292,20 +298,21 @@ namespace Studio.UI { singleSelectObject = renderObject; var searchAsset = GetConnectAsset(renderObject); - var compKey = searchAsset.renderObject.componetKey; - addComponetModal.ChangeItem(searchAsset.renderObject.componetKey); - InputField_ID.SetTextWithoutNotify(searchAsset.renderObject.ID); + componetKey = searchAsset.renderObject.componetKey; + this.code = searchAsset.renderObject.code; + addComponetModal.ChangeItem(componetKey); + InputField_ID.SetTextWithoutNotify(this.code); - if (!string.IsNullOrEmpty(compKey)) + if (!string.IsNullOrEmpty(componetKey)) { connectionModal.gameObject.SetActive(true); + this.topic = searchAsset.renderObject.topic; + this.isAuto = searchAsset.renderObject.isAutoId; + connectionModal.Open(); + connectionModal.SetAutoId(isAuto); - var topic = searchAsset.renderObject.addTopic; - var isAuto = searchAsset.renderObject.isAutoId; if (!string.IsNullOrEmpty(topic)) { - connectionModal.SetAutoId(isAuto); - connectionModal.Open(); connectionModal.ChangeItem(topic,isAuto); } } @@ -346,6 +353,7 @@ namespace Studio.UI InputField_ScaleX.SetTextWithoutNotify("-"); InputField_ScaleY.SetTextWithoutNotify("-"); InputField_ScaleZ.SetTextWithoutNotify("-"); + InputField_Name.SetTextWithoutNotify("-"); if (lastSelectedInputField.type != InputFieldType.none) { lastSelectedInputField = new SelectedInput(InputFieldType.none, 0.0f); @@ -358,16 +366,15 @@ namespace Studio.UI /// private void AddCompoent(string key) { - var component = componetScriptable.compoenets.FirstOrDefault(x => x.key.Equals(key)); + var component = ConfigConnected.ComponetScritable.compoenets.FirstOrDefault(x => x.key.Equals(key)); var type = component.comp.GetType(); if (!singleSelectObject.TryGetComponent(type, out var com)) { - singleSelectObject.gameObject.AddComponent(component.comp.GetType()); + singleSelectObject.AddComponent(type); var obj = component.comp as AbstractFunctionObject; var isAuto = obj.ObjectType.Equals(ObjectType.Dynamic) ? true : false; connectionModal.SetAutoId(isAuto); - } } @@ -388,11 +395,10 @@ namespace Studio.UI private void ChangeCompoentItem(string key) { - var searchObject = GetConnectAsset(singleSelectObject); - var prevKey = searchObject.renderObject.componetKey; + var prevKey = singleSelectObject.componetKey; if (!string.IsNullOrEmpty(prevKey) && !prevKey.Equals(key)) { - RemoveAddCompoent(searchObject.renderObject.componetKey); + RemoveAddCompoent(singleSelectObject.componetKey); } bool isConnect = string.IsNullOrEmpty(key) ? false : true; //이전의 키값을 가져와야 함. @@ -401,27 +407,28 @@ namespace Studio.UI connectionModal.gameObject.SetActive(isConnect); if (isConnect == false) { - searchObject.renderObject.addTopic = null; - searchObject.renderObject.isAutoId = false; - searchObject.renderObject.componetKey = key; + singleSelectObject.topic = null; + singleSelectObject.isAutoId = false; + singleSelectObject.componetKey = key; return; } AddCompoent(key); connectionModal.Open(); - searchObject.renderObject.componetKey = key; + componetKey = key; + singleSelectObject.ChangeConnectData(code, componetKey, topic, isAuto); } private void ChangeTopicItem(string key) { - var searchObject = GetConnectAsset(singleSelectObject); - searchObject.renderObject.addTopic = key; + topic = key; + singleSelectObject.ChangeConnectData(code, componetKey, topic, isAuto); } private void ChangeToggleItem(bool isAuto) { - var searchObject = GetConnectAsset(singleSelectObject); - searchObject.renderObject.isAutoId = isAuto; + this.isAuto = isAuto; + singleSelectObject.ChangeConnectData(code, componetKey, topic, isAuto); } private void OnClickConnectDataButton() diff --git a/Assets/Scripts/Studio/UI/Panel_3DDy/AddComponetModal.cs b/Assets/Scripts/Studio/UI/Panel_3DDy/AddComponetModal.cs index 1c2e983e..6e43ff22 100644 --- a/Assets/Scripts/Studio/UI/Panel_3DDy/AddComponetModal.cs +++ b/Assets/Scripts/Studio/UI/Panel_3DDy/AddComponetModal.cs @@ -1,4 +1,5 @@ -using System; +using Studio.Conifg; +using System; using System.Collections.Generic; using TMPro; using UnityEngine; @@ -44,8 +45,7 @@ namespace Studio private void SetItem() { - var item = Resources.Load("Scriptable/AddComponetData"); - item.SetItem(); + var item = ConfigConnected.ComponetScritable; componetentKeyTable.Clear(); componetentKeyTable.Add(string.Empty); foreach (var comp in item.compoenets) diff --git a/Assets/TMPFolder/RJHTest.cs b/Assets/TMPFolder/RJHTest.cs index a4919856..1a9e94ef 100644 --- a/Assets/TMPFolder/RJHTest.cs +++ b/Assets/TMPFolder/RJHTest.cs @@ -1,7 +1,7 @@ using Studio; using Studio.Auth; using Studio.Conifg; -using Studio.Dynamic.M; +using Studio.Dynamic.Manager; using Studio.Staic.STKC; using System.Threading.Tasks; using UnityEngine;