|
@@ -1,4 +1,5 @@
|
|
|
using LitJson;
|
|
|
+using Newtonsoft.Json;
|
|
|
using SC.XR.Unity.Module_InputSystem;
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
@@ -72,7 +73,15 @@ public class SpotsItem
|
|
|
obj.transform.parent = imageaction.transform;
|
|
|
obj.transform.localEulerAngles = new Vector3(90, 0, 0);
|
|
|
obj.transform.localPosition = Vector3.zero;
|
|
|
-
|
|
|
+ foreach (var mlkeys in modelList.Keys)
|
|
|
+ {
|
|
|
+ ModelList ml = modelList[mlkeys];
|
|
|
+ for (int i = 0; i < ml.materialList.Count; i++)
|
|
|
+ {
|
|
|
+ Debug.Log("DGJ2 ====> ml.materialList[i]." + ml.materialList[i].name);
|
|
|
+ Debug.Log("DGJ2 ====> ml.materialList[i]." + obVuforia.TargetName);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
GameObject obj;
|
|
|
|
|
@@ -85,13 +94,20 @@ public class SpotsItem
|
|
|
{
|
|
|
foreach (var item in usi.SpotsList.Keys)
|
|
|
{
|
|
|
- if (usi.SpotsList[item].VuforiaItem.activeSelf&& usi.SpotsList[item].id!=id)
|
|
|
+ if (usi.SpotsList[item].obVuforia.TargetName == behaviour.TargetName)
|
|
|
{
|
|
|
- usi.SpotsList[item].VuforiaItem.SetActive(false);
|
|
|
+ if (usi.SpotsList[item].VuforiaItem.activeSelf&& usi.SpotsList[item].id!=id )
|
|
|
+ {
|
|
|
+ usi.SpotsList[item].VuforiaItem.SetActive(false);
|
|
|
+ }
|
|
|
+ else if(usi.SpotsList[item].id == id)
|
|
|
+ {
|
|
|
+ VuforiaItem.SetActive(true);
|
|
|
+ }
|
|
|
}
|
|
|
- else if(usi.SpotsList[item].id == id)
|
|
|
+ else
|
|
|
{
|
|
|
- VuforiaItem.SetActive(true);
|
|
|
+ usi.SpotsList[item].VuforiaItem.SetActive(false);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -100,15 +116,43 @@ public class SpotsItem
|
|
|
TimerMgr.Instance.CreateTimer(()=> {
|
|
|
VuforiaItem.transform.position = obj.transform.position;
|
|
|
VuforiaItem.transform.eulerAngles = obj.transform.eulerAngles;
|
|
|
+ VuforiaItem.transform.eulerAngles = new Vector3(0, VuforiaItem.transform.eulerAngles.y, 0);
|
|
|
Debug.Log("OnTargetStatusChanged ·¢ÏÖ " + obj.transform.position + "status ==>" + obj.transform.eulerAngles);
|
|
|
}, 0.1f,10);
|
|
|
- if(!isInitModel)
|
|
|
+ if (!isInitModel)
|
|
|
{
|
|
|
- Dictionary<string, ModelList> NewmodelList = new Dictionary<string, ModelList>();
|
|
|
+ Dictionary<string, ModelList> NewmodelList = new Dictionary<string, ModelList>();
|
|
|
foreach (var mlkeys in modelList.Keys)
|
|
|
{
|
|
|
ModelList ml = modelList[mlkeys];
|
|
|
ml._model = GameObject.Instantiate<GameObject>(ml.Model);
|
|
|
+ JsonData msg = UserSceneManager.smsg;
|
|
|
+
|
|
|
+ for (int i = 0; i < msg["listSpoit"].Count; i++)
|
|
|
+ {
|
|
|
+ Debug.Log("DGJ2 ==New1==> " + this.id + "_" + msg["listSpoit"][i]["id"].ToString());
|
|
|
+
|
|
|
+ if (this.id == msg["listSpoit"][i]["id"].ToString())
|
|
|
+ {
|
|
|
+ for (int j = 0; j < msg["listSpoit"][i]["material"].Count; j++)
|
|
|
+ {
|
|
|
+ if (msg["listSpoit"][i]["material"][j]["materialList"] != null && msg["listSpoit"][i]["material"][j]["materialList"].IsArray)
|
|
|
+ {
|
|
|
+ for (int z = 0; z < msg["listSpoit"][i]["material"][j]["materialList"].Count; z++)
|
|
|
+ {
|
|
|
+ Debug.Log("DGJ2 ==New1==> " + this.triggerImage + "_" + msg["listSpoit"][i]["material"][j]["materialList"][z]["id"].ToJson() + "_" + (msg["listSpoit"][i]["material"][j]["materialList"][z]["objectTransform"].ToJson()));
|
|
|
+ ml.materialList[z].objectTransform = JsonConvert.DeserializeObject<ObjectTransform>(msg["listSpoit"][i]["material"][j]["materialList"][z]["objectTransform"].ToJson());
|
|
|
+
|
|
|
+ Debug.Log("DGJ2 ==New1==> " + ml.materialList[z].id + "_" + msg["listSpoit"][i]["material"][j]["materialList"][z]["id"].ToJson());
|
|
|
+ ml.materialList[z].name = this.triggerImage;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
NewmodelList.Add(mlkeys, ml);
|
|
|
for (int i = 0; i < ml.materialList.Count; i++)
|
|
|
{
|
|
@@ -119,17 +163,24 @@ public class SpotsItem
|
|
|
|
|
|
ml.materialList[i]._model = ml._model.transform.GetChild(0).GetComponent<YangShiManager>().yangshiList[i].useObj;
|
|
|
ml.materialList[i].prefabModel = ml.materialList[i]._model;
|
|
|
- }else
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
|
|
|
ml.materialList[i]._model = ml._model.transform.GetChild(0).GetComponent<YangShiManager>().yangshiText.gameObject;
|
|
|
ml.materialList[i].prefabModel = ml.materialList[i]._model;
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ml.materialList[i]._model = ml._model.transform.GetChild(i).gameObject;
|
|
|
ml.materialList[i].prefabModel = ml._model.transform.GetChild(i).gameObject;
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
ml.Model.SetActive(true);
|
|
@@ -159,16 +210,17 @@ public class SpotsItem
|
|
|
bb = modelList2.AddComponent<BoundingBox>();
|
|
|
bb.FlattenAxis = BoundingBox.FlattenModeType.FlattenZ;
|
|
|
bb.ActiveHandle = BoundingBox.HandleType.Rotation | BoundingBox.HandleType.Scale;
|
|
|
- ng= modelList2.AddComponent<NearInterationGrabbable>();
|
|
|
- mh= modelList2.AddComponent<ManipulationHandler>();
|
|
|
- TimerMgr.Instance.CreateTimer(() => {
|
|
|
-
|
|
|
- bb.enabled = GameManager.m_IsStartEditorzu;
|
|
|
- if (modelList2.transform.Find("BoundingBox") && modelList2.transform.Find("BoundingBox").gameObject != null)
|
|
|
- modelList2.transform.Find("BoundingBox").gameObject.SetActive(GameManager.m_IsStartEditorzu);
|
|
|
- if (bc)
|
|
|
- {
|
|
|
- bc.enabled = GameManager.m_IsStartEditorzu;
|
|
|
+ ng = modelList2.AddComponent<NearInterationGrabbable>();
|
|
|
+ mh = modelList2.AddComponent<ManipulationHandler>();
|
|
|
+ TimerMgr.Instance.CreateTimer(() =>
|
|
|
+ {
|
|
|
+
|
|
|
+ bb.enabled = GameManager.m_IsStartEditorzu;
|
|
|
+ if (modelList2.transform.Find("BoundingBox") && modelList2.transform.Find("BoundingBox").gameObject != null)
|
|
|
+ modelList2.transform.Find("BoundingBox").gameObject.SetActive(GameManager.m_IsStartEditorzu);
|
|
|
+ if (bc)
|
|
|
+ {
|
|
|
+ bc.enabled = GameManager.m_IsStartEditorzu;
|
|
|
}
|
|
|
if (mh)
|
|
|
mh.enabled = GameManager.m_IsStartEditorzu;
|