코드업데이트
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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<CustomAssetRenderObject> OnSelected;
|
||||
|
||||
public string componetKey;
|
||||
public string addTopic;
|
||||
public string topic;
|
||||
public bool isAutoId;
|
||||
public string ID;
|
||||
public string code;
|
||||
private void Awake()
|
||||
{
|
||||
objectRenderer = GetComponentInChildren<MeshRenderer>();
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<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.name = name;
|
||||
this.code = code;
|
||||
this.component = component;
|
||||
this.topic = topic;
|
||||
this.isAutoCreate = isAutoId;
|
||||
this.position = position;
|
||||
this.rotation = rotation;
|
||||
this.scale = scale;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
var canvas_Popup = EventConnector.instance.GetCanvas<Canvas_Popup>();
|
||||
var result = canvas_Popup.panel_3dfactorysetting.GetAssetDatas();
|
||||
return result;
|
||||
if(componetScriptable== null)
|
||||
{
|
||||
componetScriptable = Resources.Load<AddComponetDataScriptable>("Scriptable/AddComponetData");
|
||||
componetScriptable.SetItem();
|
||||
}
|
||||
return componetScriptable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<StudioService>
|
||||
{
|
||||
private Dictionary<string, Dictionary<string, EventHandler<StudioServiceIdEventArgs>>> listenerIdMap;
|
||||
private Dictionary<string, EventHandler<StudioServiceTypeEventArgs>> listenerTypeMap;
|
||||
private Dictionary<string, Dictionary<string, EventHandler<StudioServiceIdEventArgs>>> listenerIdMap = new();
|
||||
private Dictionary<string, EventHandler<StudioServiceTypeEventArgs>> listenerTypeMap = new();
|
||||
|
||||
private StudioRepoistory repository;
|
||||
private Dictionary<string, float> updateTime = new();
|
||||
@@ -79,9 +75,6 @@ namespace Studio
|
||||
public void ConnectMQTT(string domain, string port, List<Util.Topic> topics)
|
||||
{
|
||||
this.repository = new StudioRepoistory();
|
||||
listenerIdMap = new Dictionary<string, Dictionary<string, EventHandler<StudioServiceIdEventArgs>>>();
|
||||
listenerTypeMap = new Dictionary<string, EventHandler<StudioServiceTypeEventArgs>>();
|
||||
|
||||
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<StudioServiceTypeEventArgs> listener =null)
|
||||
public void AddTypeListener(string type, EventHandler<StudioServiceTypeEventArgs> 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<string, Dictionary<string, string>> entities)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
if (listenerTypeMap.ContainsKey(type))
|
||||
{
|
||||
listenerTypeMap[type].Invoke(this, new(type, entities));
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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<string, string> CurrentEntity;
|
||||
|
||||
private bool isPlay = false;
|
||||
|
||||
private CustomAssetRenderObject renderObject;
|
||||
public override Dictionary<string, string> Info
|
||||
{
|
||||
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>
|
||||
/// Run했을때 생성되면서 배치...
|
||||
/// </summary>
|
||||
@@ -148,5 +161,10 @@ namespace Studio.Dynamic.TwinObject
|
||||
{
|
||||
rotSpeed = aGVRotateSpeed;
|
||||
}
|
||||
|
||||
public override void ChangeAutoID(bool isAuto)
|
||||
{
|
||||
AGVManager.instance.SetCopyObject(isAuto, renderObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<AGVManager>
|
||||
{
|
||||
private GameObject prf_AGV;
|
||||
private CustomAssetRenderObject agvRenderObj;
|
||||
private ConnectedAsset asset;
|
||||
private HashSet<AGV> agvs = new();
|
||||
public float AGVMoveSpeed;
|
||||
public float AGVRotateSpeed;
|
||||
public Queue<Dictionary<string, Dictionary<string, string>>> createAgvs = new();
|
||||
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
|
||||
//이벤트 걸어둔다..
|
||||
//+= OnPlayStart
|
||||
}
|
||||
public void OnPlayStart()
|
||||
{
|
||||
var type = GetComponent<CustomAssetRenderObject>().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<CustomAssetConnector>();
|
||||
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<string,string> entity)
|
||||
{
|
||||
var agv = Instantiate<GameObject>(prf_AGV,transform).AddComponent<AGV>();
|
||||
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<CustomAssetConnector>().CreateAsset(asset.assetData.assetName).AddComponent<AGV>();
|
||||
//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;
|
||||
}
|
||||
|
||||
/// <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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Studio.Staic.STKC
|
||||
}
|
||||
public void OnPlayStart()
|
||||
{
|
||||
var type = GetComponent<CustomAssetRenderObject>().addTopic;
|
||||
var type = GetComponent<CustomAssetRenderObject>().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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<GameObject> 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
|
||||
/// <param name="key"></param>
|
||||
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()
|
||||
|
||||
@@ -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<AddComponetDataScriptable>("Scriptable/AddComponetData");
|
||||
item.SetItem();
|
||||
var item = ConfigConnected.ComponetScritable;
|
||||
componetentKeyTable.Clear();
|
||||
componetentKeyTable.Add(string.Empty);
|
||||
foreach (var comp in item.compoenets)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user