Compare commits

..

3 Commits

13 changed files with 92 additions and 44 deletions

View File

@@ -1,4 +1,4 @@
using RTG;
using RTG;
using System.Collections.Generic;
using UnityEngine;
using Studio.Command;
@@ -62,7 +62,7 @@ namespace Studio.RuntimeGizmo
}
public void SetWorkGizmoId(GizmoId gizmoId)
{
if (ManagerHub.instance.Get<RunManager>().curState == RunManager.EState.Run)
if (ManagerHub.instance.Get<RunManager>().CurState == RunManager.EState.Run)
return;
objectMoveGizmo.Gizmo.SetEnabled(false);
objectRotationGizmo.Gizmo.SetEnabled(false);
@@ -104,7 +104,7 @@ namespace Studio.RuntimeGizmo
}
public void SetGizmoTargetObjects(List<GameObject> objects)
{
if (ManagerHub.instance.Get<RunManager>().curState == RunManager.EState.Run)
if (ManagerHub.instance.Get<RunManager>().CurState == RunManager.EState.Run)
return;
selectedObjects.Clear();
selectedObjects.AddRange(objects);

View File

@@ -293,7 +293,7 @@ namespace Studio.AssetTool
if (selectedObjects.Count == 0)
return;
var canvas_Popup = CanvasManager.instance.GetCanvas<Canvas_Popup>();
if (ManagerHub.instance.Get<RunManager>().curState == RunManager.EState.Run)
if (ManagerHub.instance.Get<RunManager>().CurState == RunManager.EState.Run)
{
canvas_Popup.panel_dynamicobjectinfo.gameObject.SetActive(false);
canvas_Popup.panel_objectdetails.SetTarget(selectedObjects);

View File

@@ -7,6 +7,9 @@ using UnityEngine.EventSystems;
using Studio.DataStructures;
using Studio.UI;
using Studio.Conifg;
using Studio.Dynamic.TwinObject;
using Studio.Dynamic.Manager;
using Studio.Manage;
namespace Studio.AssetTool
{
@@ -278,10 +281,20 @@ namespace Studio.AssetTool
return;
this.isAutoId = isAuto;
if(functionObject !=null )
if(functionObject.ObjectType.Equals(ObjectType.Dynamic))
{
functionObject.ChangeAutoID(isAuto);
//switch(functionObject)
//{
// case AGV agv:
// AGVManager.instance.SetCopyObject(isAutoId,agv.RenderObject);
// break;
//}
}
//if(functionObject !=null )
//{
// functionObject.ChangeAutoID(isAuto);
//}
}
private AbstractFunctionObject functionObject;

View File

@@ -321,7 +321,7 @@ namespace Studio
private void DispatchMachineEvent(string type, string id, Dictionary<string, string> entity)
{
if (ManagerHub.instance.Get<RunManager>().curState == RunManager.EState.Stop)
if (ManagerHub.instance.Get<RunManager>().CurState == RunManager.EState.Stop)
{
Debug.Log("Stop");
return;

View File

@@ -1,4 +1,4 @@
using NUnit.Framework;
using NUnit.Framework;
using Studio.AssetTool;
using Studio.Conifg;
using Studio.Manage;
@@ -20,8 +20,8 @@ namespace Studio.Manage
Stop,
Exit,
}
public EState curState = EState.Stop;
private EState curState = EState.Stop;
public EState CurState { get { return curState; } }
public override void Init()
{
@@ -33,7 +33,7 @@ namespace Studio.Manage
ManagerHub.instance.Get<CustomAssetConnector>().OnDeselectAll();
curState = curState == EState.Stop ? EState.Run : EState.Stop;
switch (curState)
switch (CurState)
{
case EState.Run:
Run();

View File

@@ -1,10 +1,12 @@
using Studio.AssetTool;
using Studio.Dynamic.Manager;
using Studio.Manage;
using Studio.VirtualFactory.Info;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using static Studio.Manage.RunManager;
namespace Studio.Dynamic.TwinObject
{
@@ -29,6 +31,7 @@ namespace Studio.Dynamic.TwinObject
private bool isPlay = false;
private CustomAssetRenderObject renderObject;
public CustomAssetRenderObject RenderObject { get { return renderObject; } }
public override Dictionary<string, string> Info
{
get
@@ -58,6 +61,7 @@ namespace Studio.Dynamic.TwinObject
public override void AfterAwake()
{
renderObject = GetComponent<CustomAssetRenderObject>();
AGVManager.instance.AddAGV(this);
if (!string.IsNullOrEmpty(renderObject.code))
{
moveSpeed = AGVManager.instance.AGVMoveSpeed;
@@ -139,6 +143,8 @@ namespace Studio.Dynamic.TwinObject
}
private void Update()
{
if (ManagerHub.instance.Get<RunManager>().CurState != EState.Run)
return;
if (isPlay == false)
return;
PerforcedMovement();
@@ -171,9 +177,11 @@ namespace Studio.Dynamic.TwinObject
AGVManager.instance.SetCopyObject(isAuto, renderObject);
}
protected override void OnDestroy()
private void OnDisable()
{
base.OnDestroy();
AGVManager.instance.RemoveAGV(this);
if (renderObject.topic == null)
return;
StudioService.instance.RemoveTypeIdListener(renderObject.topic, renderObject.code);
}
}

View File

@@ -17,9 +17,14 @@ namespace Studio.Dynamic.Manager
public float AGVMoveSpeed;
public float AGVRotateSpeed;
public void OnPlayStart()
private void Start()
{
ManagerHub.instance.Get<RunManager>().onRun += OnPlayStart;
}
private void OnPlayStart()
{
if (agvRenderObj == null)
return;
agvRenderObj.gameObject.SetActive(false);
var type = agvRenderObj.topic;
var connector = ManagerHub.instance.Get<CustomAssetConnector>();
@@ -32,6 +37,16 @@ namespace Studio.Dynamic.Manager
StudioService.instance.AddTypeListener(type, OnDataUpdate);
StudioService.instance.AddTypeIdListener(type);
}
public void AddAGV(AGV agv)
{
agvs.Add(agv);
}
public void RemoveAGV(AGV agv)
{
agvs.Remove(agv);
}
/// <summary>
/// MQTT
/// </summary>
@@ -101,21 +116,15 @@ namespace Studio.Dynamic.Manager
}
public void SetCopyObject(bool isAuto, CustomAssetRenderObject renderObject)
{
if (isAuto)
{
agvRenderObj = renderObject;
//이벤트 걸어둔다..
ManagerHub.instance.Get<RunManager>().onRun += OnPlayStart;
}
else
{
agvRenderObj = null;
ManagerHub.instance.Get<RunManager>().onRun -= OnPlayStart;
//이벤트해제
//-= OnPlayStart
}
}

View File

@@ -31,6 +31,13 @@ namespace Studio
return CurrentEntity;
}
}
public override ObjectType ObjectType
{
get
{
return ObjectType.Static;
}
}
public override void AfterAwake()
{
ManagerHub.instance.Get<RunManager>().onRun += OnPlayStart;
@@ -54,6 +61,7 @@ namespace Studio
private void OnDisable()
{
ManagerHub.instance.Get<RunManager>().onRun -= OnPlayStart;
if (curType == null)
return;
StudioService.instance.RemoveTypeIdListener(curType, transform.name);

View File

@@ -31,6 +31,13 @@ namespace Studio
return CurrentEntity;
}
}
public override ObjectType ObjectType
{
get
{
return ObjectType.Static;
}
}
public override void AfterAwake()
{
ManagerHub.instance.Get<RunManager>().onRun += OnPlayStart;
@@ -54,6 +61,7 @@ namespace Studio
private void OnDisable()
{
ManagerHub.instance.Get<RunManager>().onRun -= OnPlayStart;
if (curType == null)
return;
StudioService.instance.RemoveTypeIdListener(curType, transform.name);

View File

@@ -31,6 +31,13 @@ namespace Studio
return CurrentEntity;
}
}
public override ObjectType ObjectType
{
get
{
return ObjectType.Static;
}
}
public override void AfterAwake()
{
ManagerHub.instance.Get<RunManager>().onRun += OnPlayStart;
@@ -53,6 +60,7 @@ namespace Studio
private void OnDisable()
{
ManagerHub.instance.Get<RunManager>().onRun -= OnPlayStart;
if (curType == null)
return;
StudioService.instance.RemoveTypeIdListener(curType, transform.name);

View File

@@ -33,7 +33,7 @@ namespace Studio.Staic.STKC
{
get
{
return ObjectType.Dynamic;
return ObjectType.Static;
}
}
@@ -53,7 +53,7 @@ namespace Studio.Staic.STKC
public Vector3 bodyStart;
public Vector3 bodyEnd;
private Action onMotionStart;
private bool isAnimation = false;
private int[] values = new int[3];
private string curType;
@@ -63,7 +63,6 @@ namespace Studio.Staic.STKC
{
bodySpeed = 0.3f;
liftSpeed = 0.3f;
onMotionStart = StartAnim;
ManagerHub.instance.Get<RunManager>().onRun += OnPlayStart;
//이벤트 걸어둔다..
//+= OnPlayStart
@@ -113,29 +112,22 @@ namespace Studio.Staic.STKC
liftStartY = lift.position.y;
liftEndY = y;
onMotionStart?.Invoke();
isAnimation = true;
}
public override void ChangeAutoID(bool isAuto)
{
return;
}
private void StartAnim()
private void Update()
{
StopAllCoroutines();
StartCoroutine(MotionStart());
if (isAnimation == false)
return;
Sliding();
Lifiting();
if (bodyProcess >= 1f && liftProcess >= 1f)
isAnimation = false;
}
IEnumerator MotionStart()
{
while (liftProcess < 1f)
{
Sliding();
Lifiting();
yield return null;
}
}
void Sliding()
{
bodyProcess += Time.deltaTime * bodySpeed;
@@ -154,7 +146,6 @@ namespace Studio.Staic.STKC
if (liftProcess >= 1f)
{
liftProcess = 1f;
}
var liftY = math.lerp(liftStartY, liftEndY, liftProcess);
@@ -181,10 +172,11 @@ namespace Studio.Staic.STKC
private void OnDestroy()
{
isAnimation = false;
ManagerHub.instance.Get<RunManager>().onRun -= OnPlayStart;
if (curType == null)
return;
StudioService.instance.RemoveTypeIdListener(curType, transform.name);
onMotionStart -= StartAnim;
}

View File

@@ -308,9 +308,11 @@ namespace Studio.UI
{
connectionModal.gameObject.SetActive(true);
this.topic = searchAsset.renderObject.topic;
this.isAuto = searchAsset.renderObject.isAutoId;
connectionModal.Open();
if(searchAsset.renderObject.TryGetComponent<AbstractFunctionObject>(out var component))
this.isAuto = component.ObjectType.Equals(ObjectType.Dynamic) ? true : false;
connectionModal.SetAutoId(isAuto);
connectionModal.Open();
if (!string.IsNullOrEmpty(topic))
{

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
@@ -45,7 +45,7 @@ namespace Studio.UI
private void Update()
{
if (selectedObject == null || selectedObject.isCollided || ManagerHub.instance.Get<RunManager>().curState == RunManager.EState.Run)
if (selectedObject == null || selectedObject.isCollided || ManagerHub.instance.Get<RunManager>().CurState == RunManager.EState.Run)
{
DeactivateAll();
return;