tttt
This commit is contained in:
@@ -156,9 +156,11 @@ 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)
|
||||
|
||||
@@ -3,6 +3,7 @@ using Newtonsoft.Json.Linq;
|
||||
using NUnit.Framework;
|
||||
using Studio.Conifg;
|
||||
using Studio.Core;
|
||||
using Studio.Manage;
|
||||
using Studio.Setting.Connect;
|
||||
using Studio.Util;
|
||||
using System;
|
||||
@@ -83,6 +84,12 @@ namespace Studio
|
||||
}
|
||||
public void ConnectMQTT(string domain, string port, List<Util.Topic> topics)
|
||||
{
|
||||
if (repository == null)
|
||||
{
|
||||
Init();
|
||||
ManagerHub.instance.Get<RunManager>().onStop += DisConnectMQTT;
|
||||
}
|
||||
|
||||
var conntedInfo = $"MQTT Domain : {domain} , MQTTPORT :{port}";
|
||||
if (!topicTable.ContainsKey(conntedInfo))
|
||||
topicTable.Add(conntedInfo, new());
|
||||
@@ -92,7 +99,7 @@ namespace Studio
|
||||
repository.MQTTConnect(conntedInfo);
|
||||
}
|
||||
|
||||
public void DisConnectMQTT()
|
||||
private void DisConnectMQTT()
|
||||
{
|
||||
repository.DisConnectMQTT();
|
||||
}
|
||||
@@ -179,6 +186,9 @@ namespace Studio
|
||||
}
|
||||
else
|
||||
{
|
||||
if (listenerIdMap[type][id] == listener)
|
||||
return;
|
||||
|
||||
listenerIdMap[type][id] += listener;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework;
|
||||
using Studio.Conifg;
|
||||
using Studio.Manage;
|
||||
using Studio.Util;
|
||||
@@ -24,9 +24,6 @@ namespace Studio.Manage
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
StudioService.instance.Init();
|
||||
onRun += Dynamic.M.AGVManager.instance.OnPlayStart;
|
||||
onStop += StudioService.instance.DisConnectMQTT;
|
||||
}
|
||||
|
||||
public void ChangeState()
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
using System;
|
||||
using Studio.AssetTool;
|
||||
using Studio.Core;
|
||||
using Studio.Dynamic.TwinObject;
|
||||
using Studio.Manage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Studio.Dynamic.TwinObject;
|
||||
using Studio.Core;
|
||||
using Studio.Conifg;
|
||||
using Studio.AssetTool;
|
||||
using Studio.Util;
|
||||
using Studio.Manage;
|
||||
|
||||
namespace Studio.Dynamic.Manager
|
||||
{
|
||||
@@ -42,7 +40,7 @@ namespace Studio.Dynamic.Manager
|
||||
private void OnDataUpdate(object sender, StudioServiceTypeEventArgs e)
|
||||
{
|
||||
var entities = e.Entitis;
|
||||
foreach(var entity in entities)
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
var key = entity.Key;
|
||||
var value = entity.Value;
|
||||
@@ -51,27 +49,33 @@ namespace Studio.Dynamic.Manager
|
||||
Debug.Log($"중복된 ID {key}");
|
||||
continue;
|
||||
}
|
||||
var item = CreateAGV(e.Type, key,value);
|
||||
var item = CreateAGV(e.Type, key, value);
|
||||
SetRenderObject(item.GetComponent<CustomAssetRenderObject>());
|
||||
agvs.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private AGV CreateAGV(string type, string id ,Dictionary<string,string> entity)
|
||||
private AGV CreateAGV(string type, string id, Dictionary<string, string> entity)
|
||||
{
|
||||
//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 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 null;
|
||||
var pos = new Vector3(x * 0.001f, 0, y * 0.001f);
|
||||
agv.Init(type, pos);
|
||||
return agv;
|
||||
}
|
||||
|
||||
private void SetRenderObject(CustomAssetRenderObject obj)
|
||||
{
|
||||
obj.LoadCreate(asset.renderObject.code, asset.renderObject.topic, asset.renderObject.componetKey, asset.renderObject.isAutoId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -83,26 +87,27 @@ namespace Studio.Dynamic.Manager
|
||||
var agvKey = baseDatas.Keys.FirstOrDefault(x => x.Contains("AGV", StringComparison.OrdinalIgnoreCase));
|
||||
var agvDatas = baseDatas[agvKey].Entity;
|
||||
|
||||
foreach(var data in agvDatas)
|
||||
foreach (var data in agvDatas)
|
||||
{
|
||||
var id = data.FirstOrDefault(x => x.Key.Equals("ID", StringComparison.OrdinalIgnoreCase));
|
||||
CreateAGV("AGV", id.Value, data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void SetCopyObject(bool isAuto ,CustomAssetRenderObject renderObject)
|
||||
public void SetCopyObject(bool isAuto, CustomAssetRenderObject renderObject)
|
||||
{
|
||||
if(isAuto)
|
||||
if (isAuto)
|
||||
{
|
||||
agvRenderObj = renderObject;
|
||||
//이벤트 걸어둔다..
|
||||
//+= OnPlayStart
|
||||
ManagerHub.instance.Get<RunManager>().onRun += OnPlayStart;
|
||||
}
|
||||
else
|
||||
{
|
||||
agvRenderObj = null;
|
||||
ManagerHub.instance.Get<RunManager>().onRun -= OnPlayStart;
|
||||
//이벤트해제
|
||||
//-= OnPlayStart
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace Studio.Staic.STKC
|
||||
public string BAY;
|
||||
public string LEVEL;
|
||||
|
||||
private float startPos;
|
||||
private float liftSpeed;
|
||||
private float bodySpeed;
|
||||
private float bodyProcess;
|
||||
@@ -88,7 +89,6 @@ namespace Studio.Staic.STKC
|
||||
{
|
||||
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;
|
||||
@@ -97,6 +97,8 @@ namespace Studio.Staic.STKC
|
||||
var y = int.Parse(LEVEL);
|
||||
var z = int.Parse(BAY);
|
||||
|
||||
if (x == 0 && y == 0 && z == 0)
|
||||
startPos = transform.localPosition.z;
|
||||
if (IsSameValue(x, y, z))
|
||||
return;
|
||||
|
||||
@@ -104,7 +106,8 @@ namespace Studio.Staic.STKC
|
||||
liftProcess = 0f;
|
||||
bodyStart = transform.localPosition;
|
||||
bodyEnd = bodyStart;
|
||||
bodyEnd.z = z;
|
||||
bodyEnd.z = startPos;
|
||||
bodyEnd.z += z;
|
||||
|
||||
liftStartY = lift.position.y;
|
||||
liftEndY = y;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Studio.Dynamic.TwinObject;
|
||||
using Studio.Dynamic.M;
|
||||
using Studio.Dynamic.TwinObject;
|
||||
using Studio.Dynamic.Manager;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -272,6 +272,7 @@ namespace Studio.UI
|
||||
void OnChangedID(string Id)
|
||||
{
|
||||
this.code = Id;
|
||||
singleSelectObject.name = Id;
|
||||
singleSelectObject.ChangeConnectData(code, componetKey, topic, isAuto);
|
||||
}
|
||||
public void SetObjectInfo(string name, List<GameObject> selectedObjects)
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace Studio
|
||||
public void Open()
|
||||
{
|
||||
SetItem();
|
||||
autoIDCheck.gameObject.SetActive(false);
|
||||
ActiveToggle();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user