150 lines
4.5 KiB
C#
150 lines
4.5 KiB
C#
using ARLocation;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
using UnityEngine.UI;
|
|
|
|
namespace ARPlus
|
|
{
|
|
public class ARSceneManager : MonoBehaviour
|
|
{
|
|
|
|
public GameObject renderCLLinePrefab;
|
|
|
|
[System.NonSerialized]
|
|
public GameObject renderRoot;
|
|
|
|
Button btnConnect;
|
|
Button btnReset;
|
|
Button btnAddCL;
|
|
Button btnAddBW;
|
|
Button btnAddMax;
|
|
ARDataManager ardatamgr_;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
// var go11 = GameObject.Find("/ARLocationInfo/ButtonCanvas/ButtonConnect");
|
|
btnConnect = GameObject.Find("/ARLocationInfo/ButtonCanvas/ButtonConnect").GetComponent<Button>();
|
|
btnConnect.onClick.AddListener(OnClickButtonConnect);
|
|
|
|
// var go12 = GameObject.Find("/ARLocationInfo/ButtonCanvas/ButtonReset");
|
|
btnReset = GameObject.Find("/ARLocationInfo/ButtonCanvas/ButtonReset").GetComponent<Button>();
|
|
btnReset.onClick.AddListener(OnClickButtonReset);
|
|
|
|
// var go13 = GameObject.Find("/ARLocationInfo/ButtonCanvas/ButtonAddCL");
|
|
btnAddCL = GameObject.Find("/ARLocationInfo/ButtonCanvas/ButtonAddCL").GetComponent<Button>();
|
|
btnAddCL.onClick.AddListener(OnClickButtonCL);
|
|
|
|
// var go14 = GameObject.Find("/ARLocationInfo/ButtonCanvas/ButtonAddBW");
|
|
btnAddBW = GameObject.Find("/ARLocationInfo/ButtonCanvas/ButtonAddBW").GetComponent<Button>();
|
|
btnAddBW.onClick.AddListener(OnClickButtonBW);
|
|
|
|
btnAddMax = GameObject.Find("/ARLocationInfo/ButtonCanvas/ButtonAddMax").GetComponent<Button>();
|
|
btnAddMax.onClick.AddListener(OnClickButtonMax);
|
|
|
|
renderRoot = GameObject.Find("/RenderRoot");
|
|
|
|
// var go31 = GameObject.Find("/ARDataManager");
|
|
ardatamgr_ = GameObject.Find("/ARDataManager").GetComponent<ARDataManager>();
|
|
|
|
|
|
}
|
|
|
|
public GameObject GetRenderCL()
|
|
{
|
|
var go = GameObject.Find("/RenderRoot/RenderCL");
|
|
if (go == null)
|
|
{
|
|
go = Instantiate(renderCLLinePrefab, renderRoot.transform);
|
|
go.name = "RenderCL";
|
|
|
|
RenderOption option = go.GetComponent<RenderOption>();
|
|
|
|
option.pathSettings = new MoveAlongPath.PathSettingsData();
|
|
option.placementSettings = new MoveAlongPath.PlacementSettingsData();
|
|
|
|
option.pathSettings.LineRenderer = go.GetComponent<LineRenderer>();
|
|
}
|
|
|
|
return go;
|
|
}
|
|
|
|
public GameObject GetRenderBW()
|
|
{
|
|
var go = GameObject.Find("/RenderRoot/RenderBW");
|
|
if (go == null)
|
|
{
|
|
go = Instantiate(renderCLLinePrefab, renderRoot.transform);
|
|
go.name = "RenderBW";
|
|
|
|
RenderOption option = go.GetComponent<RenderOption>();
|
|
|
|
option.pathSettings = new MoveAlongPath.PathSettingsData();
|
|
option.placementSettings = new MoveAlongPath.PlacementSettingsData();
|
|
|
|
option.pathSettings.LineRenderer = go.GetComponent<LineRenderer>();
|
|
option.pathSettings.LineRenderer.loop = true;
|
|
}
|
|
|
|
return go;
|
|
}
|
|
|
|
public GameObject GetRenderMax()
|
|
{
|
|
var go = GameObject.Find("/RenderRoot/RenderMax");
|
|
if (go == null)
|
|
{
|
|
go = Instantiate(renderCLLinePrefab, renderRoot.transform);
|
|
go.name = "RenderMax";
|
|
|
|
RenderOption option = go.GetComponent<RenderOption>();
|
|
|
|
option.pathSettings = new MoveAlongPath.PathSettingsData();
|
|
option.placementSettings = new MoveAlongPath.PlacementSettingsData();
|
|
|
|
option.pathSettings.LineRenderer = go.GetComponent<LineRenderer>();
|
|
option.pathSettings.LineRenderer.loop = true;
|
|
}
|
|
|
|
return go;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OnClickButtonCL()
|
|
{
|
|
ardatamgr_.AddClToScene();
|
|
}
|
|
|
|
|
|
void OnClickButtonBW()
|
|
{
|
|
ardatamgr_.AddBwToScene();
|
|
}
|
|
|
|
void OnClickButtonMax()
|
|
{
|
|
ardatamgr_.AddMaxToScene();
|
|
}
|
|
|
|
|
|
void OnClickButtonReset()
|
|
{
|
|
ARLocationManager.Instance.ResetARSession();
|
|
}
|
|
|
|
|
|
void OnClickButtonConnect()
|
|
{
|
|
//ardatamgr_.AddRC2Scene();
|
|
|
|
if (RTKDev.GetConnectState() == 0)
|
|
RTKDev.Connect();
|
|
|
|
}
|
|
|
|
}
|
|
}
|