코드업데이트

This commit is contained in:
2025-05-27 15:24:25 +09:00
parent 2fee4e3fe8
commit 69080b5714
13 changed files with 260 additions and 122 deletions

View File

@@ -142,9 +142,12 @@ namespace Studio.AssetTool
selectedAssetData.AddTransformToRender(selectedItem.transform); selectedAssetData.AddTransformToRender(selectedItem.transform);
CoroutineRunner.instance.StartCoroutine(ChangeSelectedAssetTransform()); CoroutineRunner.instance.StartCoroutine(ChangeSelectedAssetTransform());
selectRenderObject.transform.position = new Vector3(asset.position.x, asset.position.y, asset.position.z); selectRenderObject.LoadCreate(asset.code, asset.topic, asset.component, asset.isAutoCreate);
selectRenderObject.transform.eulerAngles = new Vector3(asset.rotation.x, asset.rotation.y, asset.rotation.z); var pos = new Vector3(asset.position.x, asset.position.y, asset.position.z);
selectRenderObject.transform.localScale = new Vector3(asset.scale.x, asset.scale.y, asset.scale.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) public void OnAssetSelected(AssetLibraryItem item)
{ {

View File

@@ -6,6 +6,7 @@ using UnityEngine;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
using Studio.DataStructures; using Studio.DataStructures;
using Studio.UI; using Studio.UI;
using Studio.Conifg;
namespace Studio.AssetTool namespace Studio.AssetTool
{ {
@@ -35,9 +36,9 @@ namespace Studio.AssetTool
public event Action<CustomAssetRenderObject> OnSelected; public event Action<CustomAssetRenderObject> OnSelected;
public string componetKey; public string componetKey;
public string addTopic; public string topic;
public bool isAutoId; public bool isAutoId;
public string ID; public string code;
private void Awake() private void Awake()
{ {
objectRenderer = GetComponentInChildren<MeshRenderer>(); objectRenderer = GetComponentInChildren<MeshRenderer>();
@@ -262,5 +263,56 @@ namespace Studio.AssetTool
return hitInfo; 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);
}
} }
} }

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Studio.Util namespace Studio.Util
@@ -92,15 +92,36 @@ namespace Studio.Util
{ {
public int id; public int id;
public string name; public string name;
public string code;
public string component;
public string topic;
public bool isAutoCreate;
public SaveVector3 position; public SaveVector3 position;
public SaveVector3 rotation; public SaveVector3 rotation;
public SaveVector3 scale; public SaveVector3 scale;
public List<int> children; public List<int> children;
public AssetData(int id, string name, SaveVector3 position, SaveVector3 rotation, SaveVector3 scale, List<int> children) /// <summary>
///
/// </summary>
/// <param name="id">instanceID</param>
/// <param name="name">Object Name</param>
/// <param name="code">FunctionObject ID(</param>
/// <param name="component">AddComponent Key</param>
/// <param name="topic">ConnectTopic Key</param>
/// <param name="isAutoId">Assigned ID</param>
/// <param name="position">Object WorldPosition</param>
/// <param name="rotation">Object WorldRotation</param>
/// <param name="scale">Object Scale</param>
/// <param name="children"></param>
public AssetData(int id, string name,string code,string component,string topic, bool isAutoId, SaveVector3 position, SaveVector3 rotation, SaveVector3 scale, List<int> children)
{ {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.code = code;
this.component = component;
this.topic = topic;
this.isAutoCreate = isAutoId;
this.position = position; this.position = position;
this.rotation = rotation; this.rotation = rotation;
this.scale = scale; this.scale = scale;

View File

@@ -26,13 +26,27 @@ namespace Studio.Conifg
} }
} }
public static Dictionary<string,CustomAssetData> AssetSettings //public static Dictionary<string,CustomAssetData> AssetSettings
//{
// get
// {
// var canvas_Popup = EventConnector.instance.GetCanvas<Canvas_Popup>();
// var result = canvas_Popup.panel_3dfactorysetting.GetAssetDatas();
// return result;
// }
//}
private static AddComponetDataScriptable componetScriptable;
public static AddComponetDataScriptable ComponetScritable
{ {
get get
{ {
var canvas_Popup = EventConnector.instance.GetCanvas<Canvas_Popup>(); if(componetScriptable== null)
var result = canvas_Popup.panel_3dfactorysetting.GetAssetDatas(); {
return result; componetScriptable = Resources.Load<AddComponetDataScriptable>("Scriptable/AddComponetData");
componetScriptable.SetItem();
}
return componetScriptable;
} }
} }
} }

View File

@@ -1,13 +1,9 @@
using Newtonsoft.Json; using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using Studio.Conifg;
using Studio.Core; using Studio.Core;
using Studio.Setting.Connect; using Studio.Setting.Connect;
using Studio.Util; using Studio.Util;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
@@ -40,8 +36,8 @@ namespace Studio
public class StudioService : UnitySingleton<StudioService> public class StudioService : UnitySingleton<StudioService>
{ {
private Dictionary<string, Dictionary<string, EventHandler<StudioServiceIdEventArgs>>> listenerIdMap; private Dictionary<string, Dictionary<string, EventHandler<StudioServiceIdEventArgs>>> listenerIdMap = new();
private Dictionary<string, EventHandler<StudioServiceTypeEventArgs>> listenerTypeMap; private Dictionary<string, EventHandler<StudioServiceTypeEventArgs>> listenerTypeMap = new();
private StudioRepoistory repository; private StudioRepoistory repository;
private Dictionary<string, float> updateTime = new(); private Dictionary<string, float> updateTime = new();
@@ -79,9 +75,6 @@ namespace Studio
public void ConnectMQTT(string domain, string port, List<Util.Topic> topics) public void ConnectMQTT(string domain, string port, List<Util.Topic> topics)
{ {
this.repository = new StudioRepoistory(); this.repository = new StudioRepoistory();
listenerIdMap = new Dictionary<string, Dictionary<string, EventHandler<StudioServiceIdEventArgs>>>();
listenerTypeMap = new Dictionary<string, EventHandler<StudioServiceTypeEventArgs>>();
repository.OnTopicList += OnTopicList; repository.OnTopicList += OnTopicList;
var conntedInfo = $"MQTT Domain : {domain} , MQTTPORT :{port}"; var conntedInfo = $"MQTT Domain : {domain} , MQTTPORT :{port}";
@@ -90,7 +83,7 @@ namespace Studio
topicTable[conntedInfo] = topics; topicTable[conntedInfo] = topics;
repository.MQTTCreateConnect(domain, port); repository.MQTTCreateConnect(domain, port);
repository.MQTTConnect(conntedInfo); repository.MQTTConnect(conntedInfo);
} }
@@ -179,7 +172,7 @@ namespace Studio
listenerIdMap[type][id] += listener; listenerIdMap[type][id] += listener;
} }
} }
public void AddTypeListener(string type, EventHandler<StudioServiceTypeEventArgs> listener =null) public void AddTypeListener(string type, EventHandler<StudioServiceTypeEventArgs> listener = null)
{ {
listenerTypeMap[type] = listener; listenerTypeMap[type] = listener;
} }
@@ -189,7 +182,7 @@ namespace Studio
return; return;
listenerTypeMap.Remove(type); listenerTypeMap.Remove(type);
} }
public void RemoveTypeIdListener(string type,string id) public void RemoveTypeIdListener(string type, string id)
{ {
if (!listenerIdMap.ContainsKey(type)) if (!listenerIdMap.ContainsKey(type))
return; return;
@@ -214,7 +207,7 @@ namespace Studio
{ {
if (!apiData.ContainsKey(url)) if (!apiData.ContainsKey(url))
apiData.Add(url, new()); apiData.Add(url, new());
data.lastRequestTime = startTime; data.lastRequestTime = startTime;
data.lastResponseTime = endTime; data.lastResponseTime = endTime;
data.elapsedTime = sw.Elapsed; data.elapsedTime = sw.Elapsed;
@@ -326,8 +319,8 @@ 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)) if (listenerTypeMap.ContainsKey(type))
{ {
listenerTypeMap[type].Invoke(this, new(type, entities)); listenerTypeMap[type].Invoke(this, new(type, entities));

View File

@@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@@ -106,7 +106,7 @@ namespace Studio.Manage
.Where(asset => asset.hierarchyItem.linkedObject.activeSelf) .Where(asset => asset.hierarchyItem.linkedObject.activeSelf)
.OrderBy(asset => asset.hierarchyItem.layerNum) .OrderBy(asset => asset.hierarchyItem.layerNum)
.ThenBy(asset => asset.hierarchyItem.GetSiblingIndex()) .ThenBy(asset => asset.hierarchyItem.GetSiblingIndex())
.Select(asset => CreateAssetData(asset.hierarchyItem)) .Select(asset => CreateAssetData(asset))
.ToList(); .ToList();
curProjectData = CreateProjectData(assetDatas); curProjectData = CreateProjectData(assetDatas);
string json = JsonConvert.SerializeObject(curProjectData, Formatting.Indented); string json = JsonConvert.SerializeObject(curProjectData, Formatting.Indented);
@@ -117,15 +117,20 @@ namespace Studio.Manage
writer.Close(); writer.Close();
} }
public AssetData CreateAssetData(HierarchyItem hierarchyItem) public AssetData CreateAssetData(ConnectedAsset asset)
{ {
return new AssetData( return new AssetData(
hierarchyItem.linkedObject.GetInstanceID(), asset.hierarchyItem.linkedObject.GetInstanceID(),
hierarchyItem.name, asset.hierarchyItem.name,
new SaveVector3(hierarchyItem.linkedObject.transform.position), asset.renderObject.code,
new SaveVector3(hierarchyItem.linkedObject.transform.eulerAngles), asset.renderObject.componetKey,
new SaveVector3(hierarchyItem.linkedObject.transform.localScale), asset.renderObject.topic,
hierarchyItem.children.Select(x => x.linkedObject.GetInstanceID()).ToList() 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()
); );
} }

View File

@@ -18,6 +18,8 @@ namespace Studio
public virtual ObjectType ObjectType { get; set; } public virtual ObjectType ObjectType { get; set; }
public abstract void OnUpdateData(object sender, StudioServiceIdEventArgs e); public abstract void OnUpdateData(object sender, StudioServiceIdEventArgs e);
public abstract void ChangeAutoID(bool isAuto);
} }
} }

View File

@@ -1,4 +1,6 @@
using Studio.VirtualFactory.Info; using Studio.AssetTool;
using Studio.Dynamic.Manager;
using Studio.VirtualFactory.Info;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -26,7 +28,7 @@ namespace Studio.Dynamic.TwinObject
private Dictionary<string, string> CurrentEntity; private Dictionary<string, string> CurrentEntity;
private bool isPlay = false; private bool isPlay = false;
private CustomAssetRenderObject renderObject;
public override Dictionary<string, string> Info public override Dictionary<string, string> Info
{ {
get get
@@ -53,6 +55,17 @@ namespace Studio.Dynamic.TwinObject
} }
} }
public override void AfterAwake()
{
renderObject = GetComponent<CustomAssetRenderObject>();
if (!string.IsNullOrEmpty(renderObject.code))
{
Init(renderObject.componetKey, transform.position);
}
}
//최초 배치 후 하나 있고 AutoID 체크 되어 있으면..
//
/// <summary> /// <summary>
/// Run했을때 생성되면서 배치... /// Run했을때 생성되면서 배치...
/// </summary> /// </summary>
@@ -148,5 +161,10 @@ namespace Studio.Dynamic.TwinObject
{ {
rotSpeed = aGVRotateSpeed; rotSpeed = aGVRotateSpeed;
} }
public override void ChangeAutoID(bool isAuto)
{
AGVManager.instance.SetCopyObject(isAuto, renderObject);
}
} }
} }

View File

@@ -6,30 +6,27 @@ using Studio.Dynamic.TwinObject;
using Studio.Core; using Studio.Core;
using Studio.Conifg; using Studio.Conifg;
using Studio.AssetTool; using Studio.AssetTool;
using Studio.Util;
using Studio.Manage;
namespace Studio.Dynamic.M namespace Studio.Dynamic.Manager
{ {
public class AGVManager : UnitySingleton<AGVManager> public class AGVManager : UnitySingleton<AGVManager>
{ {
private GameObject prf_AGV; private CustomAssetRenderObject agvRenderObj;
private ConnectedAsset asset;
private HashSet<AGV> agvs = new(); private HashSet<AGV> agvs = new();
public float AGVMoveSpeed; public float AGVMoveSpeed;
public float AGVRotateSpeed; public float AGVRotateSpeed;
public Queue<Dictionary<string, Dictionary<string, string>>> createAgvs = new();
public void Awake()
{
//이벤트 걸어둔다..
//+= OnPlayStart
}
public void OnPlayStart() public void OnPlayStart()
{ {
var type = GetComponent<CustomAssetRenderObject>().addTopic; agvRenderObj.gameObject.SetActive(false);
var assets = ConfigConnected.AssetSettings; var type = agvRenderObj.topic;
prf_AGV = assets[type].loadedObject; var connector = ManagerHub.instance.Get<CustomAssetConnector>();
if (prf_AGV == null) asset = connector.connectedAssets.FirstOrDefault(x => x.renderObject == agvRenderObj);
if (asset == null)
{ {
//todo::팝업메시지 나주엥 설정.... //todo::팝업메시지 나주엥 설정....
return; return;
@@ -61,20 +58,20 @@ namespace Studio.Dynamic.M
private AGV CreateAGV(string type, string id ,Dictionary<string,string> entity) private AGV CreateAGV(string type, string id ,Dictionary<string,string> entity)
{ {
var agv = Instantiate<GameObject>(prf_AGV,transform).AddComponent<AGV>(); //var agv = ManagerHub.instance.Get<CustomAssetConnector>().CreateAsset(asset.assetData.assetName).AddComponent<AGV>();
agv.gameObject.SetActive(true); //agv.gameObject.SetActive(true);
agv.transform.position = Vector3.zero; //agv.transform.position = Vector3.zero;
agv.name = id; //agv.name = id;
agv.SetMoveSpeed(AGVMoveSpeed); //agv.SetMoveSpeed(AGVMoveSpeed);
agv.SetRotateSpeed(AGVRotateSpeed); //agv.SetRotateSpeed(AGVRotateSpeed);
var xPos = entity.FirstOrDefault(x => x.Key.Equals("X", StringComparison.OrdinalIgnoreCase)); //var xPos = entity.FirstOrDefault(x => x.Key.Equals("X", StringComparison.OrdinalIgnoreCase));
var yPos = entity.FirstOrDefault(x => x.Key.Equals("Y", StringComparison.OrdinalIgnoreCase)); //var yPos = entity.FirstOrDefault(x => x.Key.Equals("Y", StringComparison.OrdinalIgnoreCase));
float.TryParse(xPos.Value, out var x); //float.TryParse(xPos.Value, out var x);
float.TryParse(yPos.Value, out var y); //float.TryParse(yPos.Value, out var y);
var pos = new Vector3(x * 0.001f, 0, y * 0.001f); //var pos = new Vector3(x * 0.001f, 0, y * 0.001f);
agv.Init(type,pos); //agv.Init(type,pos);
return agv; return null;
} }
/// <summary> /// <summary>
@@ -95,6 +92,24 @@ namespace Studio.Dynamic.M
} }
public void SetCopyObject(bool isAuto ,CustomAssetRenderObject renderObject)
{
if(isAuto)
{
agvRenderObj = renderObject;
//이벤트 걸어둔다..
//+= OnPlayStart
}
else
{
agvRenderObj = null;
//이벤트해제
//-= OnPlayStart
}
}
} }
} }

View File

@@ -67,7 +67,7 @@ namespace Studio.Staic.STKC
} }
public void OnPlayStart() public void OnPlayStart()
{ {
var type = GetComponent<CustomAssetRenderObject>().addTopic; var type = GetComponent<CustomAssetRenderObject>().topic;
curType = type; curType = type;
StudioService.instance.AddTypeIdListener(type, transform.name, OnUpdateData); 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() private void StartAnim()
{ {
StopAllCoroutines(); StopAllCoroutines();
@@ -122,35 +156,6 @@ namespace Studio.Staic.STKC
liftPos.y = liftY; liftPos.y = liftY;
lift.position = liftPos; 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) private bool IsSameValue(int bank, int bay, int level)
{ {
@@ -167,6 +172,7 @@ namespace Studio.Staic.STKC
return false; return false;
} }
private void OnDestroy() private void OnDestroy()
{ {
if (curType == null) if (curType == null)
@@ -174,5 +180,7 @@ namespace Studio.Staic.STKC
StudioService.instance.RemoveTypeIdListener(curType, transform.name); StudioService.instance.RemoveTypeIdListener(curType, transform.name);
onMotionStart -= StartAnim; onMotionStart -= StartAnim;
} }
} }
} }

View File

@@ -10,6 +10,7 @@ using UnityEngine.UI;
using System; using System;
using Studio.AssetTool; using Studio.AssetTool;
using UnityEngine.Rendering.Universal; using UnityEngine.Rendering.Universal;
using Studio.Conifg;
namespace Studio.UI namespace Studio.UI
{ {
@@ -70,6 +71,11 @@ namespace Studio.UI
private CustomAssetRenderObject singleSelectObject; private CustomAssetRenderObject singleSelectObject;
private AddComponetDataScriptable componetScriptable; private AddComponetDataScriptable componetScriptable;
private string componetKey;
private string topic;
private string code;
private bool isAuto;
public override void AfterAwake() public override void AfterAwake()
{ {
InputField_PositionX.onValueChanged.AddListener(OnPosXChanged); InputField_PositionX.onValueChanged.AddListener(OnPosXChanged);
@@ -269,8 +275,8 @@ namespace Studio.UI
void OnChangedID(string Id) void OnChangedID(string Id)
{ {
var searchAsset = GetConnectAsset(singleSelectObject); this.code = Id;
searchAsset.renderObject.ID = Id; singleSelectObject.ChangeConnectData(code, componetKey, topic, isAuto);
} }
public void SetObjectInfo(string name, List<GameObject> selectedObjects) public void SetObjectInfo(string name, List<GameObject> selectedObjects)
{ {
@@ -292,20 +298,21 @@ namespace Studio.UI
{ {
singleSelectObject = renderObject; singleSelectObject = renderObject;
var searchAsset = GetConnectAsset(renderObject); var searchAsset = GetConnectAsset(renderObject);
var compKey = searchAsset.renderObject.componetKey; componetKey = searchAsset.renderObject.componetKey;
addComponetModal.ChangeItem(searchAsset.renderObject.componetKey); this.code = searchAsset.renderObject.code;
InputField_ID.SetTextWithoutNotify(searchAsset.renderObject.ID); addComponetModal.ChangeItem(componetKey);
InputField_ID.SetTextWithoutNotify(this.code);
if (!string.IsNullOrEmpty(compKey)) if (!string.IsNullOrEmpty(componetKey))
{ {
connectionModal.gameObject.SetActive(true); 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)) if (!string.IsNullOrEmpty(topic))
{ {
connectionModal.SetAutoId(isAuto);
connectionModal.Open();
connectionModal.ChangeItem(topic,isAuto); connectionModal.ChangeItem(topic,isAuto);
} }
} }
@@ -346,6 +353,7 @@ namespace Studio.UI
InputField_ScaleX.SetTextWithoutNotify("-"); InputField_ScaleX.SetTextWithoutNotify("-");
InputField_ScaleY.SetTextWithoutNotify("-"); InputField_ScaleY.SetTextWithoutNotify("-");
InputField_ScaleZ.SetTextWithoutNotify("-"); InputField_ScaleZ.SetTextWithoutNotify("-");
InputField_Name.SetTextWithoutNotify("-");
if (lastSelectedInputField.type != InputFieldType.none) if (lastSelectedInputField.type != InputFieldType.none)
{ {
lastSelectedInputField = new SelectedInput(InputFieldType.none, 0.0f); lastSelectedInputField = new SelectedInput(InputFieldType.none, 0.0f);
@@ -358,16 +366,15 @@ namespace Studio.UI
/// <param name="key"></param> /// <param name="key"></param>
private void AddCompoent(string key) 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(); var type = component.comp.GetType();
if (!singleSelectObject.TryGetComponent(type, out var com)) if (!singleSelectObject.TryGetComponent(type, out var com))
{ {
singleSelectObject.gameObject.AddComponent(component.comp.GetType()); singleSelectObject.AddComponent(type);
var obj = component.comp as AbstractFunctionObject; var obj = component.comp as AbstractFunctionObject;
var isAuto = obj.ObjectType.Equals(ObjectType.Dynamic) ? true : false; var isAuto = obj.ObjectType.Equals(ObjectType.Dynamic) ? true : false;
connectionModal.SetAutoId(isAuto); connectionModal.SetAutoId(isAuto);
} }
} }
@@ -388,11 +395,10 @@ namespace Studio.UI
private void ChangeCompoentItem(string key) private void ChangeCompoentItem(string key)
{ {
var searchObject = GetConnectAsset(singleSelectObject); var prevKey = singleSelectObject.componetKey;
var prevKey = searchObject.renderObject.componetKey;
if (!string.IsNullOrEmpty(prevKey) && !prevKey.Equals(key)) if (!string.IsNullOrEmpty(prevKey) && !prevKey.Equals(key))
{ {
RemoveAddCompoent(searchObject.renderObject.componetKey); RemoveAddCompoent(singleSelectObject.componetKey);
} }
bool isConnect = string.IsNullOrEmpty(key) ? false : true; bool isConnect = string.IsNullOrEmpty(key) ? false : true;
//이전의 키값을 가져와야 함. //이전의 키값을 가져와야 함.
@@ -401,27 +407,28 @@ namespace Studio.UI
connectionModal.gameObject.SetActive(isConnect); connectionModal.gameObject.SetActive(isConnect);
if (isConnect == false) if (isConnect == false)
{ {
searchObject.renderObject.addTopic = null; singleSelectObject.topic = null;
searchObject.renderObject.isAutoId = false; singleSelectObject.isAutoId = false;
searchObject.renderObject.componetKey = key; singleSelectObject.componetKey = key;
return; return;
} }
AddCompoent(key); AddCompoent(key);
connectionModal.Open(); connectionModal.Open();
searchObject.renderObject.componetKey = key; componetKey = key;
singleSelectObject.ChangeConnectData(code, componetKey, topic, isAuto);
} }
private void ChangeTopicItem(string key) private void ChangeTopicItem(string key)
{ {
var searchObject = GetConnectAsset(singleSelectObject); topic = key;
searchObject.renderObject.addTopic = key; singleSelectObject.ChangeConnectData(code, componetKey, topic, isAuto);
} }
private void ChangeToggleItem(bool isAuto) private void ChangeToggleItem(bool isAuto)
{ {
var searchObject = GetConnectAsset(singleSelectObject); this.isAuto = isAuto;
searchObject.renderObject.isAutoId = isAuto; singleSelectObject.ChangeConnectData(code, componetKey, topic, isAuto);
} }
private void OnClickConnectDataButton() private void OnClickConnectDataButton()

View File

@@ -1,4 +1,5 @@
using System; using Studio.Conifg;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;
@@ -44,8 +45,7 @@ namespace Studio
private void SetItem() private void SetItem()
{ {
var item = Resources.Load<AddComponetDataScriptable>("Scriptable/AddComponetData"); var item = ConfigConnected.ComponetScritable;
item.SetItem();
componetentKeyTable.Clear(); componetentKeyTable.Clear();
componetentKeyTable.Add(string.Empty); componetentKeyTable.Add(string.Empty);
foreach (var comp in item.compoenets) foreach (var comp in item.compoenets)

View File

@@ -1,7 +1,7 @@
using Studio; using Studio;
using Studio.Auth; using Studio.Auth;
using Studio.Conifg; using Studio.Conifg;
using Studio.Dynamic.M; using Studio.Dynamic.Manager;
using Studio.Staic.STKC; using Studio.Staic.STKC;
using System.Threading.Tasks; using System.Threading.Tasks;
using UnityEngine; using UnityEngine;