using System.Collections; using System.Collections.Generic; using UnityEngine; using QFramework; using UniRx; using QFramework.MREditor; using System; using Newtonsoft.Json; using UnityEngine.UI; using System.IO; using LitJson; using Newtonsoft.Json.Linq; public class GameManager : MonoSingleton { public bool isPointColud = false; public bool isEditor = true; public Text text; public Text text2; public Text text3; public Text text4; public GameObject editorPanel; public UIMove uiMove; public List listEditorBJs; public GameObject showObjPos; private GameObject nowBJ; private ObjectTransform startObjTransform; /// /// 当前场景信息 /// public SceneValue scene = null; /// /// 素材库素材信息 /// public List listCMValue = null; List listDownLoad = new List(); public bool state = false; public GameObject Saloon; public GameObject SZG; private bool finish = true; // Start is called before the first frame update void Start() { API_GSXR_Module_InputSystem_GGT26Dof.GSXR_Disable_GGT(API_GSXR_Module_InputSystem_GGT26Dof.GGestureType.Left); API_GSXR_Module_InputSystem_GGT26Dof.GSXR_Disable_GGT(API_GSXR_Module_InputSystem_GGT26Dof.GGestureType.Right); //startObjTransform = new ObjectTransform(); //startObjTransform.startPos = Vector3.zero; //startObjTransform.startRot = Vector3.zero; //startObjTransform.startScale = Vector3.one; //startObjTransform.nowPos = Vector3.zero; //startObjTransform.nowRot = Vector3.zero; //startObjTransform.nowScale = Vector3.zero; // scene = new SceneValue(); // listCMValue = new List(); // uiMove = editorPanel.GetComponent(); // OpenPlanel(); // PlayerPrefs.DeleteAll(); state = false; GameManager.Instance.text4.text = " Test 4"; //AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayerActivity"); //AndroidJavaObject jo = jc.GetStatic("currentActivity"); } // Update is called once per frame void Update() { // text.text = editorPanel.name; // text3.text = "1111 "; // editorPanel.Show(); //if(isPointColud) // UIKit.GetPanel().SelectSpoitObj("模型景点"); // Debug.Log(state); if(state && scene !=null && listCMValue!=null&& finish) { LoadShow.Instance.text.text = "100%"; Debug.Log("素材下载结束 打开编辑界面"); text3.text = "素材下载结束 打开编辑界面"; finish = false; state = false; SandTable.Instance.OpenSandTable(); LoadShow.Instance.ViewShow(false); // OpenPlanel(); // LoginPanel.Instance.gameObject.SetActive(false); } } IEnumerator OpenSandTable( int time , string url) { yield return new WaitForSeconds(time); OpenPlanel(); } public void OpenPlanel() { // Debug.Log(listEditorBJs.Count + "@@@@@OpenPlanel"); #region NewSceneData //MaterialObjValue obj1_1 = new MaterialObjValue(); //obj1_1.Name = "SpaceStation"; //obj1_1.TextBJ = "Null"; //obj1_1.DownloadPath = "Resources/Model/SpaceStation"; //obj1_1.DataTime = DateTime.Now.ToString(); //obj1_1.Type = MaterialType.Model; //obj1_1.startPos = Vector3.zero; //obj1_1.startRot = Vector3.zero; //obj1_1.startScale = new Vector3(0.01f, 0.01f, 0.01f); //obj1_1.nowPos = Vector3.zero; //obj1_1.nowRot = Vector3.zero; //obj1_1.nowScale = Vector3.zero; //MaterialObjValue obj2_1 = new MaterialObjValue(); //obj2_1.Name = "TestText1"; //obj2_1.TextBJ = "BJ1"; //obj2_1.DownloadPath = "/Text/TestText1.json"; //obj2_1.DataTime = DateTime.Now.ToString(); //obj2_1.Type = MaterialType.Text; //obj2_1.startPos = new Vector3(0, 0.075f, 0); //obj2_1.startRot = Vector3.zero; //obj2_1.startScale = Vector3.one; //obj2_1.nowPos = Vector3.zero; //obj2_1.nowRot = Vector3.zero; //obj2_1.nowScale = Vector3.zero; //MaterialObjValue obj2_2 = new MaterialObjValue(); //obj2_2.Name = "TestImage1"; //obj2_2.TextBJ = "Null"; //obj2_2.DownloadPath = "Resources/Image/TestImage1"; //obj2_2.DataTime = DateTime.Now.ToString(); //obj2_2.Type = MaterialType.Image; //obj2_2.startPos = new Vector3(-0.085f, -0.075f, 0); //obj2_2.startRot = Vector3.zero; //obj2_2.startScale = Vector3.one; //obj2_2.nowPos = Vector3.zero; //obj2_2.nowRot = Vector3.zero; //obj2_2.nowScale = Vector3.zero; //MaterialObjValue obj2_3 = new MaterialObjValue(); //obj2_3.Name = "TestImage2"; //obj2_3.TextBJ = "Null"; //obj2_3.DownloadPath = "Resources/Image/TestImage2"; //obj2_3.DataTime = DateTime.Now.ToString(); //obj2_3.Type = MaterialType.Image; //obj2_3.startPos = new Vector3(0.085f, -0.075f, 0); //obj2_3.startRot = Vector3.zero; //obj2_3.startScale = Vector3.one; //obj2_3.nowPos = Vector3.zero; //obj2_3.nowRot = Vector3.zero; //obj2_3.nowScale = Vector3.zero; //MaterialObjValue obj3_1 = new MaterialObjValue(); //obj3_1.Name = "TestImage3"; //obj3_1.TextBJ = "Null"; //obj3_1.DownloadPath = "Resources/Image/TestImage3"; //obj3_1.DataTime = DateTime.Now.ToString(); //obj3_1.Type = MaterialType.Image; //obj3_1.startPos = new Vector3(-0.3f, 0, -0.15f); //obj3_1.startRot = new Vector3(0, -45, 0); //obj3_1.startScale = Vector3.one; //obj3_1.nowPos = Vector3.zero; //obj3_1.nowRot = Vector3.zero; //obj3_1.nowScale = Vector3.zero; //MaterialObjValue obj3_2 = new MaterialObjValue(); //obj3_2.Name = "TestImage4"; //obj3_2.TextBJ = "Null"; //obj3_2.DownloadPath = "Resources/Image/TestImage4"; //obj3_2.DataTime = DateTime.Now.ToString(); //obj3_2.Type = MaterialType.Image; //obj3_2.startPos = new Vector3(-0.17f, 0, -0.05f); //obj3_2.startRot = new Vector3(0, -30, 0); //obj3_2.startScale = Vector3.one; //obj3_2.nowPos = Vector3.zero; //obj3_2.nowRot = Vector3.zero; //obj3_2.nowScale = Vector3.zero; //MaterialObjValue obj3_3 = new MaterialObjValue(); //obj3_3.Name = "Education"; //obj3_3.TextBJ = "Null"; //obj3_3.DownloadPath = Application.streamingAssetsPath + "/Video/Education.mp4"; //obj3_3.DataTime = DateTime.Now.ToString(); //obj3_3.Type = MaterialType.Video; //obj3_3.startPos = Vector3.zero; //obj3_3.startRot = Vector3.zero; //obj3_3.startScale = Vector3.one; //obj3_3.nowPos = Vector3.zero; //obj3_3.nowRot = Vector3.zero; //obj3_3.nowScale = Vector3.zero; //MaterialObjValue obj3_4 = new MaterialObjValue(); //obj3_4.Name = "TestImage5"; //obj3_4.TextBJ = "Null"; //obj3_4.DownloadPath = "Resources/Image/TestImage5"; //obj3_4.DataTime = DateTime.Now.ToString(); //obj3_4.Type = MaterialType.Image; //obj3_4.startPos = new Vector3(0.17f, 0, -0.05f); //obj3_4.startRot = new Vector3(0, 30, 0); //obj3_4.startScale = Vector3.one; //obj3_4.nowPos = Vector3.zero; //obj3_4.nowRot = Vector3.zero; //obj3_4.nowScale = Vector3.zero; //MaterialObjValue obj3_5 = new MaterialObjValue(); //obj3_5.Name = "TestImage6"; //obj3_5.TextBJ = "Null"; //obj3_5.DownloadPath = "Resources/Image/TestImage6"; //obj3_5.DataTime = DateTime.Now.ToString(); //obj3_5.Type = MaterialType.Image; //obj3_5.startPos = new Vector3(0.3f, 0, -0.15f); //obj3_5.startRot = new Vector3(0, 45, 0); //obj3_5.startScale = Vector3.one; //obj3_5.nowPos = Vector3.zero; //obj3_5.nowRot = Vector3.zero; //obj3_5.nowScale = Vector3.zero; //SpoitValue spoit1 = new SpoitValue(); //spoit1.Name = "模型景点"; //spoit1.DataTime = DateTime.Now.ToString(); //spoit1.Type = SpoitType.Null; //spoit1.startPos = new Vector3(0, 0, 0); //spoit1.startRot = Vector3.zero; //spoit1.startScale = Vector3.one; //spoit1.nowPos = Vector3.zero; //spoit1.nowRot = Vector3.zero; //spoit1.nowScale = Vector3.zero; //spoit1.listMaterial = new List(); //spoit1.listMaterial.Add(obj1_1); //SpoitValue spoit2 = new SpoitValue(); //spoit2.Name = "视频景点"; //spoit2.DataTime = DateTime.Now.ToString(); //spoit2.Type = SpoitType.Null; //spoit2.startPos = new Vector3(0, 0, 0); //spoit2.startRot = Vector3.zero; //spoit2.startScale = Vector3.one; //spoit2.nowPos = Vector3.zero; //spoit2.nowRot = Vector3.zero; //spoit2.nowScale = Vector3.zero; //spoit2.listMaterial = new List(); //spoit2.listMaterial.Add(obj3_1); //spoit2.listMaterial.Add(obj3_2); //spoit2.listMaterial.Add(obj3_3); //spoit2.listMaterial.Add(obj3_4); //spoit2.listMaterial.Add(obj3_5); //SpoitValue spoit3 = new SpoitValue(); //spoit3.Name = "图片文字"; //spoit3.DataTime = DateTime.Now.ToString(); //spoit3.Type = SpoitType.Null; //spoit3.startPos = new Vector3(0, 0, 0); //spoit3.startRot = Vector3.zero; //spoit3.startScale = Vector3.one; //spoit3.nowPos = Vector3.zero; //spoit3.nowRot = Vector3.zero; //spoit3.nowScale = Vector3.zero; //spoit3.listMaterial = new List(); //spoit3.listMaterial.Add(obj2_1); //spoit3.listMaterial.Add(obj2_2); //spoit3.listMaterial.Add(obj2_3); //SceneValue scene = new SceneValue(); //scene.username = "VuforialEditor"; //scene.Type = SceneType.Vuforial; //scene.DataTime = DateTime.Now.ToString(); //scene.UpdatePath = ""; //scene.listSpoit = new List(); //scene.listSpoit.Add(spoit1); //scene.listSpoit.Add(spoit2); //scene.listSpoit.Add(spoit3); #endregion #region LocalMaterial //List listMaterialData = new List(); ObjectTransform startObjTransform = new ObjectTransform(); startObjTransform.startPos = Vector3.zero; startObjTransform.startRot = Vector3.zero; startObjTransform.startScale = Vector3.one; startObjTransform.nowPos = Vector3.zero; startObjTransform.nowRot = Vector3.zero; startObjTransform.nowScale = Vector3.zero; //MaterialObjValue obj1 = new MaterialObjValue(); //obj1.name = "空间站_1"; //obj1.TextBJ = "-1"; //obj1.textContent = null; //obj1.type = "3"; //obj1.DownloadPath = "Resources/LocalMaterials/Model/SpaceStation"; //obj1.DownloadPath = "Resources/LocalMaterials/Model/SpaceStation"; //obj1.ObjectTransform = startObjTransform; //obj1.ObjectTransform.startScale = new Vector3(0.01f, 0.01f, 0.01f); //obj1.textPosition = null; //MaterialObjValue obj2 = new MaterialObjValue(); //obj2.name = "LocalText1"; //obj2.TextBJ = "2"; //obj2.textContent = "This is Test "; //obj2.type = "4"; //obj2.DownloadPath = null; //obj2.localSavePath = null; //obj2.ObjectTransform = startObjTransform; //obj2.textPosition = null; MaterialObjValue obj3 = new MaterialObjValue(); obj3.name = "前进箭头"; obj3.TextBJ = "-1"; obj3.textContent = null; obj3.type = "1"; obj3.DownloadPath = "Resources/LocalMaterials/Image/Dir_0"; obj3.localSavePath = "Resources/LocalMaterials/Image/Dir_0"; obj3.ObjectTransform = startObjTransform; obj3.textPosition = null; MaterialObjValue obj4 = new MaterialObjValue(); obj4.name = "右箭头"; obj4.TextBJ = "-1"; obj4.textContent = null; obj4.type = "1"; obj4.DownloadPath = "Resources/LocalMaterials/Image/Dir_1"; obj4.localSavePath = "Resources/LocalMaterials/Image/Dir_1"; obj4.ObjectTransform = startObjTransform; obj4.textPosition = null; MaterialObjValue obj5 = new MaterialObjValue(); obj5.name = "左箭头"; obj5.TextBJ = "-1"; obj5.textContent = null; obj5.type = "1"; obj5.DownloadPath = "Resources/LocalMaterials/Image/Dir_2"; obj5.localSavePath = "Resources/LocalMaterials/Image/Dir_2"; obj5.ObjectTransform = startObjTransform; obj5.textPosition = null; MaterialObjValue obj6 = new MaterialObjValue(); obj6.name = "后转箭头"; obj6.TextBJ = "-1"; obj6.textContent = null; obj6.type = "1"; obj6.DownloadPath = "Resources/LocalMaterials/Image/Dir_3"; obj6.localSavePath = "Resources/LocalMaterials/Image/Dir_3"; obj6.ObjectTransform = startObjTransform; MaterialObjValue obj7 = new MaterialObjValue(); obj7.name = "右转箭头"; obj7.TextBJ = "-1"; obj7.textContent = null; obj7.type = "1"; obj7.DownloadPath = "Resources/LocalMaterials/Image/Dir_4"; obj7.localSavePath = "Resources/LocalMaterials/Image/Dir_4"; obj7.ObjectTransform = startObjTransform; obj7.textPosition = null; MaterialObjValue obj8 = new MaterialObjValue(); obj8.name = "左转箭头"; obj8.TextBJ = "-1"; obj8.textContent = null; obj8.type = "1"; obj8.DownloadPath = "Resources/LocalMaterials/Image/Dir_5"; obj8.localSavePath = "Resources/LocalMaterials/Image/Dir_5"; obj8.ObjectTransform = startObjTransform; obj8.textPosition = null; //CompositeMaterialValue CMV1 = new CompositeMaterialValue(); //CMV1.name = "空间站"; //CMV1.type = 3; //CMV1.template = null; //CMV1.updateTime = GetTimeStamp(); //CMV1.describe = ""; //CMV1.icon = "Resources/LocalMaterials/Image/ModelIcon"; //CMV1.objectTransform = startObjTransform; //CMV1.materialList = new List(); //CMV1.materialList.Add(obj1); //CompositeMaterialValue CMV2 = new CompositeMaterialValue(); //CMV2.name = "测试文本"; //CMV2.type = 4; //CMV2.template = "2"; //CMV2.updateTime = GetTimeStamp(); //CMV2.describe = ""; //CMV2.icon = "Resources/LocalMaterials/Image/ModelIcon"; //CMV2.objectTransform = startObjTransform; //CMV2.materialList = new List(); //CMV2.materialList.Add(obj2); CompositeMaterialValue CMV3 = new CompositeMaterialValue(); CMV3.name = "前进箭头"; CMV3.type = 1; CMV3.template = null; CMV3.updateTime = GetTimeStamp(); CMV3.describe = ""; CMV3.icon = "Resources/LocalMaterials/Image/Dir_0"; CMV3.objectTransform = startObjTransform; CMV3.materialList = new List(); CMV3.materialList.Add(obj3); CompositeMaterialValue CMV4 = new CompositeMaterialValue(); CMV4.name = "右箭头"; CMV4.type = 1; CMV4.template = null; CMV4.updateTime = GetTimeStamp(); CMV4.describe = ""; CMV4.icon = "Resources/LocalMaterials/Image/Dir_1"; CMV4.objectTransform = startObjTransform; CMV4.materialList = new List(); CMV4.materialList.Add(obj4); CompositeMaterialValue CMV5 = new CompositeMaterialValue(); CMV5.name = "左箭头"; CMV5.type = 1; CMV5.template = null; CMV5.updateTime = GetTimeStamp(); CMV5.describe = ""; CMV5.icon = "Resources/LocalMaterials/Image/Dir_2"; CMV5.objectTransform = startObjTransform; CMV5.materialList = new List(); CMV5.materialList.Add(obj5); CompositeMaterialValue CMV6 = new CompositeMaterialValue(); CMV6.name = "后转箭头"; CMV6.type = 1; CMV6.template = null; CMV6.updateTime = GetTimeStamp(); CMV6.describe = ""; CMV6.icon = "Resources/LocalMaterials/Image/Dir_3"; CMV6.objectTransform = startObjTransform; CMV6.materialList = new List(); CMV6.materialList.Add(obj6); CompositeMaterialValue CMV7 = new CompositeMaterialValue(); CMV7.name = "右转箭头"; CMV7.type = 1; CMV7.template = null; CMV7.updateTime = GetTimeStamp(); CMV7.describe = ""; CMV7.icon = "Resources/LocalMaterials/Image/Dir_4"; CMV7.objectTransform = startObjTransform; CMV7.materialList = new List(); CMV7.materialList.Add(obj7); CompositeMaterialValue CMV8 = new CompositeMaterialValue(); CMV8.name = "左转箭头"; CMV8.type = 1; CMV8.template = null; CMV8.updateTime = GetTimeStamp(); CMV8.describe = ""; CMV8.icon = "Resources/LocalMaterials/Image/Dir_5"; CMV8.objectTransform = startObjTransform; CMV8.materialList = new List(); CMV8.materialList.Add(obj8); List listLocalCMVs = new List(); //listLocalCMVs.Add(CMV1); //listLocalCMVs.Add(CMV2); listLocalCMVs.Add(CMV3); listLocalCMVs.Add(CMV4); listLocalCMVs.Add(CMV5); listLocalCMVs.Add(CMV6); listLocalCMVs.Add(CMV7); listLocalCMVs.Add(CMV8); SpoitValue spoitValue = new SpoitValue(); spoitValue.name = "景点1"; spoitValue.spoitTf = startObjTransform; spoitValue.updateTime = GetTimeStamp(); spoitValue.material = new List(); // spoitValue.material.Add(CMV1); #endregion string str = JsonConvert.SerializeObject(scene); //Debug.Log("%%%%%%%%%% " + str); // string str = JsonMapper.ToJson(scene); Debug.Log(str); text2.text = str; //Save(scene); try { text.text = "Init"; ResMgr.Init(); ResKit.Init(); Debug.Log(listCMValue.Count); // Debug.Log("@@@@ "+scene.listSpoit.Count); // LoadShow.Instance.ViewShow(false); VuforialControl.Instance.LoadARCamera(); try { UIKit.OpenPanel(new EditorPanelData() { SceneValue = scene, listLocalMaterials = listLocalCMVs, listUpLoadMaterials = listCMValue }); VuforialHint.Instance.Show(); } catch (Exception e) { ErrorLogPanel.Instance.Show(" 场景初始数据异常 "); } } catch (Exception e) { text2.text = e.ToString(); } } /// /// 更改当前所属模式 /// /// public void SetIsEditor(bool state) { //if (editorPanel == null) // return; isEditor = state; try { // editorPanel.SetActive(state); if (nowBJ.IsNotNull()) nowBJ.SetActive(state); // VuforialControl.Instance.SetEditor(state); //editorPanel.SetActive(false); //editorPanel.SetActive(true); } catch (Exception e) { // text2.text = "@@@@ " + state + e.Message; } } public void SetImageBJ(int i) { Debug.Log(i); if (nowBJ.IsNotNull()) nowBJ.SetActive(false); nowBJ = listEditorBJs[i]; nowBJ.SetActive(true); } public void Save(SceneValue scene) { List listSendData = new List(); try { for (int i = 0; i < scene.listSpoit.Count; i++) { Debug.Log("上传 " + scene.listSpoit[i].spoitTf.nowPos); GameManager.Instance.text2.text = " 上传 " + scene.listSpoit[i].spoitTf; // string spoittf = JsonMapper.ToJson(scene.listSpoit[i].spoitTf); // string spoittf = JsonConvert.SerializeObject(scene.listSpoit[i].spoitTf); SendEditorData data = new SendEditorData(); data.spoittf = new ObjectTransform(); data.material = scene.listSpoit[i].material; data.spoittf = scene.listSpoit[i].spoitTf; data.id = scene.listSpoit[i].id; // data.visitcout = 1; listSendData.Add(data); } } catch (Exception e) { GameManager.Instance.text4.text = "上传 "+ e.Message; } // 上传 try { GameManager.Instance.text4.text = " 上传保存中 "; string sendData = JsonConvert.SerializeObject(listSendData); GameManager.Instance.text4.text = " 上传保存中2 "; Debug.Log("上传 " + sendData); // text2.text = sendData; HttpTool.Instance.PostTest("/viewpoint/update", sendData, SaveCallBack); } catch (Exception e) { GameManager.Instance.text2.text = e.Message; ErrorLogPanel.Instance.Show(" 上传失败 "); Debug.LogError(e); } // string str = JsonConvert.SerializeObject(scene); // PlayerPrefs.SetString("DataScene", str); } public void SaveCallBack(string message) { Debug.Log(message); JObject jObject = JObject.Parse(message); string str = jObject["message"].ToString(); if(200==int.Parse( jObject["code"].ToString())) { // HintLogPanel.Instance.Show(" 保存成功 "); HintLogPanel.Instance.Show(" 保存成功 "); } else { HintLogPanel.Instance.Show(" 保存失败 "); } GameManager.Instance.text2.text = "CallBack上传 "+ str; } /// /// 初始化本地数据 /// public void InitData() { PlayerPrefs.DeleteKey("DataScene"); } public void Text() { } /// /// 选择场景 //根据场景信息进行初始加载 /// /// public void SelectScene(string message) { } /// /// 处理后端SceneValue 数据 /// /// /// public SceneValue ProcesSceneValueJsonData(SceneValue scene) { List listCMV = new List(); for (int i = 0; i < scene.listSpoit.Count; i++) { if (scene.listSpoit[i].spoitTf == null) { // SetObjectTransform(scene.listSpoit[i].spoittf); scene.listSpoit[i].spoitTf = new ObjectTransform(); scene.listSpoit[i].spoitTf.startPos = Vector3.zero; scene.listSpoit[i].spoitTf.startRot = Vector3.zero; scene.listSpoit[i].spoitTf.startScale = Vector3.one; scene.listSpoit[i].spoitTf.nowPos = Vector3.zero; scene.listSpoit[i].spoitTf.nowRot = Vector3.zero; scene.listSpoit[i].spoitTf.nowScale = Vector3.zero; Debug.Log(scene.listSpoit[i].spoitTf.startPos); } else { Debug.Log("SpoitTF Not NULL"); } if (scene.listSpoit[i].material == null) scene.listSpoit[i].material = new List(); for (int j = 0; j < scene.listSpoit[i].material.Count; j++) { // Debug.Log(scene.listSpoit[i].material[j].name +" @@@@@@@@@"); listCMV.Add(scene.listSpoit[i].material[j]); } } // 下载 Vuforia 识别图 和 xml 文件 List listVuforia = new List(); MaterialObjValue datFile = new MaterialObjValue(); datFile.name = "datFile"; datFile.type = "2"; datFile.DownloadPath = scene.vuforiaDat; datFile.localSavePath = Application.persistentDataPath + "/StreamingAssets/Vuforia/" + Path.GetFileName(scene.vuforiaDat); MaterialObjValue xmlFile = new MaterialObjValue(); xmlFile.name = "xmlFile"; xmlFile.type = "2"; xmlFile.DownloadPath = scene.vuforiaXML; string str = Path.GetFileName(scene.vuforiaXML); Debug.Log(str); if (str.IsNotNullAndEmpty()) { str = str.Substring(0, str.Length - 4); Debug.Log("VuforialName " + str); AppConfigConst.IMAGE_TARGET_FILE_NAME = str; } Debug.Log("VuforialName " + str); AppConfigConst.IMAGE_TARGET_FILE_NAME = str; xmlFile.localSavePath = Application.persistentDataPath + "/StreamingAssets/Vuforia/" + Path.GetFileName(scene.vuforiaXML); MaterialObjValue sandTableModel = new MaterialObjValue(); sandTableModel.name = "sandTableMoel"; sandTableModel.type = "3"; sandTableModel.DownloadPath = scene.sandTable; sandTableModel.localSavePath = Application.persistentDataPath + "/StreamingAssets/Vuforia/" + Path.GetFileName(scene.sandTable); if (sandTableModel.DownloadPath.IsNotNullAndEmpty()) { SandTable.Instance.value = sandTableModel; SandTable.Instance.updateTime = scene.updateTime; } else { SandTable.Instance.value = null; SandTable.Instance.updateTime = 0; } listDownLoad.Insert(0, new DownLoadMaterial(datFile, scene.updateTime)); listDownLoad.Insert(1, new DownLoadMaterial(xmlFile, scene.updateTime)); listDownLoad.Insert(2, new DownLoadMaterial(sandTableModel, scene.updateTime)); List listProcessCMV = ProcessCMVJsonData(listCMV, false ); if(listDownLoad.Count>2) { GameManager.Instance.text3.text = " 准备下载素材 " + listDownLoad.Count; // LoginPanel.Instance.gameObject.SetActive(false); LoadManager.Instance.InitLoad(listDownLoad); } int num = 0; for (int i = 0; i < scene.listSpoit.Count; i++) { for (int j = 0; j < scene.listSpoit[i].material.Count; j++) { scene.listSpoit[i].material[j] = listProcessCMV[num++]; // Debug.Log("!!!!!!!"+scene.listSpoit[i].material[j].name); } } return scene; } /// /// 处理上传素材数据 /// /// /// public List ProcessCMVJsonData(List listCMV,bool finish ) { bool state = false; if (listDownLoad.Count > 1) state = true; for (int i = 0; i < listCMV.Count; i++) { if (listCMV[i].objectTransform == null) SetObjectTransform(listCMV[i].objectTransform); // listCMV[i].objectTransform = startObjTransform; Debug.Log(listCMV[i].name + listCMV[i].materialList.Count); if(listCMV[i].materialList!=null) for (int j = 0; j < listCMV[i].materialList.Count; j++) { Debug.Log(listCMV[i].materialList[j].name + " " + listCMV[i].materialList[j].ObjectTransform.nowScale.x.ToString()); if (listCMV[i].materialList[j].ObjectTransform == null) SetObjectTransform(listCMV[i].materialList[j].ObjectTransform); if (listCMV[i].materialList[j].ObjectTransform.startScale != Vector3.one) listCMV[i].materialList[j].ObjectTransform.startScale = Vector3.one; // listCMV[i].materialList[j].ObjectTransform = startObjTransform; //if(listCMV[i].materialList[j].ObjectTransform.startScale != Vector3.one && listCMV[i].materialList[j].ObjectTransform.nowScale == Vector3.zero) // SetObjectTransform(listCMV[i].materialList[j].ObjectTransform); // listCMV[i].materialList[j].ObjectTransform = startObjTransform; if(listCMV[i].icon!="") { MaterialObjValue mObj = new MaterialObjValue(); mObj.name = listCMV[i].name; mObj.DownloadPath = listCMV[i].icon; mObj.type = "4"; mObj.localSavePath = Application.persistentDataPath + "/Image/" + Path.GetFileName(listCMV[i].icon); DownLoadMaterial value = new DownLoadMaterial(mObj, listCMV[i].updateTime); if (finish) AddListDaownLoad(value); //listDownLoad.Add(value); } if (listCMV[i].materialList[j].DownloadPath == listCMV[i].materialList[j].localSavePath&& listCMV[i].materialList[j].type!="4") continue; listCMV[i].materialList[j].name = listCMV[i].name +"_"+ j.ToString(); Debug.Log(listCMV[i].materialList[j].name); switch ((MaterialType)int.Parse( listCMV[i].materialList[j].type)) { case MaterialType.NULL: break; case MaterialType.Image: listCMV[i].materialList[j].localSavePath = Application.persistentDataPath + "/Image/" + Path.GetFileName(listCMV[i].materialList[j].DownloadPath); if (finish) AddListDaownLoad(new DownLoadMaterial(listCMV[i].materialList[j], listCMV[i].updateTime)); // listDownLoad.Add(new DownLoadMaterial(listCMV[i].materialList[j], listCMV[i].updateTime)); break; case MaterialType.Video: listCMV[i].materialList[j].localSavePath = Application.persistentDataPath + "/Video/" + Path.GetFileName(listCMV[i].materialList[j].DownloadPath); if (finish) AddListDaownLoad(new DownLoadMaterial(listCMV[i].materialList[j], listCMV[i].updateTime)); // listDownLoad.Add(new DownLoadMaterial(listCMV[i].materialList[j], listCMV[i].updateTime)); break; case MaterialType.Model: listCMV[i].materialList[j].localSavePath = Application.persistentDataPath + "/Model/" + Path.GetFileName(listCMV[i].materialList[j].DownloadPath); if (finish) AddListDaownLoad(new DownLoadMaterial(listCMV[i].materialList[j], listCMV[i].updateTime)); // listDownLoad.Add(new DownLoadMaterial(listCMV[i].materialList[j], listCMV[i].updateTime)); break; case MaterialType.Text: break; default: break; } } } if(finish&& state) { GameManager.Instance.text3.text = " 准备下载素材 " + listDownLoad.Count; LoginPanel.Instance.gameObject.SetActive(false); LoadManager.Instance.InitLoad(listDownLoad); } for (int i = 0; i < listCMV.Count; i++) { switch (listCMV[i].typesetting) { case "1": // 平铺 int num1 = listCMV[i].materialList.Count; for (int j = 0; j < listCMV[i].materialList.Count; j++) { if (listCMV[i].materialList[j].type == "4") num1--; } switch (num1) { case 2: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0); listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0.5f, 0, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; break; case 3: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0); listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0, 0); listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; break; case 4: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-1f, 0, 0); listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0, 0); listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(1f, 0, 0); listCMV[i].materialList[3].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one; break; case 5: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-1f, 0, 0); listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0, 0, 0); listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(0.5f, 0, 0); listCMV[i].materialList[3].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(1f, 0, 0); listCMV[i].materialList[4].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one; break; case 6: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-1.5f, 0, 0); listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(-1f, 0, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0); listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(0.5f, 0, 0); listCMV[i].materialList[3].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(1f, 0, 0); listCMV[i].materialList[4].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[5].ObjectTransform.startPos = new Vector3(1.5f, 0, 0); listCMV[i].materialList[5].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[5].ObjectTransform.startScale = Vector3.one; break; default: break; } break; case "2": // 扇形 int num2 = listCMV[i].materialList.Count; for (int j = 0; j < listCMV[i].materialList.Count; j++) { if (listCMV[i].materialList[j].type == "4") num2--; } switch (num2) { case 2: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0.26f); listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -15, 0); listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0.5f, 0, 0.26f); listCMV[i].materialList[1].ObjectTransform.startRot = new Vector3(0, 15, 0); listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; break; case 3: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-5f, 0, -0.05f); listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0); listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0, -0.05f); listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, 30, 0); listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; break; case 4: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-1f, 0, 0.16f); listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0); listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0.26f); listCMV[i].materialList[1].ObjectTransform.startRot = new Vector3(0, -15, 0); listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0, 0.26f); listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, 15, 0); listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(1f, 0, 0.16f); listCMV[i].materialList[3].ObjectTransform.startRot = new Vector3(0, 30, 0); listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one; break; case 5: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-1f, 0, -0.15f); listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -45, 0); listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(-0.5f, 0, -0.05f); listCMV[i].materialList[1].ObjectTransform.startRot = new Vector3(0, -30, 0); listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = Vector3.zero; listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(0.5f, 0, -0.05f); listCMV[i].materialList[3].ObjectTransform.startRot = new Vector3(0, 30, 0); listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(1f, 0, -0.15f); listCMV[i].materialList[4].ObjectTransform.startRot = new Vector3(0, 45, 0); listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one; break; case 6: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-1.5f, 0, 0); listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -45, 0); listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(-1f, 0, 0.16f); listCMV[i].materialList[1].ObjectTransform.startRot = new Vector3(0, -30, 0); listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0.26f); listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, -15, 0); listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(0.5f, 0, 0.26f); listCMV[i].materialList[3].ObjectTransform.startRot = new Vector3(0, 15, 0); listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(1f, 0, 0.16f); listCMV[i].materialList[4].ObjectTransform.startRot = new Vector3(0, 30, 0); listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[5].ObjectTransform.startPos = new Vector3(1.5f, 0, 0); listCMV[i].materialList[5].ObjectTransform.startRot = new Vector3(0, 45, 0); listCMV[i].materialList[5].ObjectTransform.startScale = Vector3.one; break; default: break; } break; case "3": // 双层 平铺 int num3 = listCMV[i].materialList.Count; for (int j = 0; j < listCMV[i].materialList.Count; j++) { if (listCMV[i].materialList[j].type == "4") num3--; } switch (num3) { case 2: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, 0); listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; break; case 3: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, 0); listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, 0); listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; Vector3 pos = Vector3.zero; pos.x = -0.17f; Debug.Log(pos.x); break; case 4: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, 0); listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, 0); listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(-0.5f, -0.3f, 0); listCMV[i].materialList[3].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one; break; case 5: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, 0); listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, 0); listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(-0.5f, -0.3f, 0); listCMV[i].materialList[3].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(0, -0.3f, 0); listCMV[i].materialList[4].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one; break; case 6: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, 0); listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, 0); listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(-0.5f, -0.3f, 0); listCMV[i].materialList[3].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(0, -0.3f, 0); listCMV[i].materialList[4].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[5].ObjectTransform.startPos = new Vector3(0.5f, -0.3f, 0); listCMV[i].materialList[5].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[5].ObjectTransform.startScale = Vector3.one; break; default: break; } break; case "4": //双层 扇形摆放 Debug.Log(listCMV[i].name + 2); int num4 = listCMV[i].materialList.Count; for (int j = 0; j < listCMV[i].materialList.Count; j++) { if (listCMV[i].materialList[j].type == "4") num4--; } switch (num4) { case 2: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, -0.05f); listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0); listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; break; case 3: Debug.Log("listCMV[i] " + listCMV[i].name); listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, -0.05f); listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0); listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, -0.05f); listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, 30, 0); listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; Debug.Log(listCMV[i].materialList[0].ObjectTransform.startPos); Debug.Log(listCMV[i].materialList[1].ObjectTransform.startPos); Debug.Log(listCMV[i].materialList[2].ObjectTransform.startPos); break; case 4: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, -0.05f); listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0); listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, -0.05f); listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, 30, 0); listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(-0.5f, -0.3f, 0); listCMV[i].materialList[3].ObjectTransform.startRot = new Vector3(0, -30, 0); listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one; break; case 5: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, -0.05f); listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0); listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, -0.05f); listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, 30, 0); listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(-0.5f, -0.3f, 0); listCMV[i].materialList[3].ObjectTransform.startRot = new Vector3(0, -30, 0); listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(0, -0.3f, 0); listCMV[i].materialList[4].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one; break; case 6: listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, -0.05f); listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0); listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0); listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, -0.05f); listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, 30, 0); listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(-0.5f, -0.3f, 0); listCMV[i].materialList[3].ObjectTransform.startRot = new Vector3(0, -30, 0); listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(0, -0.3f, 0); listCMV[i].materialList[4].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one; listCMV[i].materialList[5].ObjectTransform.startPos = new Vector3(0.5f, -0.3f, -0.05f); listCMV[i].materialList[5].ObjectTransform.startRot = new Vector3(0, 30, 0); listCMV[i].materialList[5].ObjectTransform.startScale = Vector3.one; break; default: break; } break; case "5": for (int j = 0; j < listCMV[i].materialList.Count; j++) { listCMV[i].materialList[j].ObjectTransform.startPos = Vector3.zero; listCMV[i].materialList[j].ObjectTransform.startRot = Vector3.zero; listCMV[i].materialList[j].ObjectTransform.startScale = new Vector3(5, 5, 5); } break; default: break; } } return listCMV; } public void AddListDaownLoad(DownLoadMaterial value) { for (int i = 0; i < listDownLoad.Count; i++) { if (listDownLoad[i].mObj.DownloadPath == value.mObj.DownloadPath ) return; } listDownLoad.Add(value); } public void SetObjectTransform( ObjectTransform obj) { obj = new ObjectTransform(); obj.Initialize(); } /// /// 获取当前时间的时间戳 /// /// public int GetTimeStamp() { TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0); return int.Parse( Convert.ToInt64(ts.TotalSeconds).ToString()); } } public enum MaterialType { NULL, Image, Video, Model, Text, ImageorViedoAndText, ModelAndText, } public enum SpoitType { Null, ShanXin, PingZiXing, BingLie, LunBo, } public enum SceneType { Vuforial, PointCloud, } /// /// 单个素材属性 /// public class MaterialObjValue { public string name { get; set; } public string type { get; set; } //图片/文字/视频/模型 public string textContent { get; set; } // 文字内容(如果类型不为文字 则为NULL) public string textPosition { get; set; }// 文字位置(如果类型不为文字 则为NULL) public string TextBJ { get; set; } // 文本框的背景 (如果类型不为文字 则为NULL) public string DownloadPath { get; set; } // 下载地址 (如果类型是文字 则为NULL) public string localSavePath { get; set; } // 保存在本地的地址默认为NULL public string cdnUrl { get; set; } // CDN 下载资源 public ObjectTransform ObjectTransform { get; set; } //坐标 旋转 尺寸 如果没有数据的话默认为NULL } /// /// 组合素材属性 /// public class CompositeMaterialValue { public int id { get; set; } public string name { get; set; } // public String textContent { get; set; } //文字内容 public int type { get; set; } //1. 图片 2.视频 3.模型 4.文字 5.图片+文字/视频+文字 6.模型+文字 public string describe { get; set; } // 简介 public List materialList { get; set; } public string icon { get; set; } // 缩略图下载地址 public int updateTime { get; set; } // 更新时间 public string template { get; set; } // 排列样式 没有的话为NULL public ObjectTransform objectTransform { get; set; } public int userId { get; set; } public string typesetting { get; set; } } /// /// 景点属性 /// public class SpoitValue { public int id { get; set; } //场景id public int projectId { get; set; } //景点名称 public string name { get; set; } //更新时间 public int updateTime { get; set; } //当前景点所有素材 public List material { get; set; } //坐标 旋转 尺寸 如果没有数据的话默认为NULL public ObjectTransform spoitTf { get; set; } public List SpoitTransform { get; set; } } /// /// 整个场景属性 /// public class SceneValue { //场景名称 public string name { get; set; } //人气 public string sentiment { get; set; } //识别图XML文件 public string vuforiaXML { get; set; } //识别图DAT文件 public string vuforiaDat { get; set; } public int updateTime { get; set; } //状态 0停用 1请用 public int status { get; set; } //描述 public string describe { get; set; } //场景照片 public string image { get; set; } //沙盘 public string sandTable { get; set; } //场景内所有景点信息 public List listSpoit { get; set; } } /// /// 坐标 旋转 尺寸 /// public class ObjectTransform { public Vector3 startPos { get; set; } public Vector3 startRot { get; set; } public Vector3 startScale { get; set; } public Vector3 nowPos { get; set; } public Vector3 nowRot { get; set; } public Vector3 nowScale { get; set; } public void Initialize() { startPos = Vector3.zero; startRot = Vector3.zero; startScale = Vector3.one; InitializeNow(); } public void InitializeNow() { nowPos = Vector3.zero; nowRot = Vector3.zero; nowScale = Vector3.zero; } public void InitializeObject(Transform objTransform) { InitializeNow(); SetObjectTransform(objTransform); } public void SetValue( Transform objTransform) { this.nowPos = objTransform.localPosition; this.nowRot = objTransform.localEulerAngles; if (objTransform.localScale == Vector3.zero) nowScale = Vector3.one; else nowScale = objTransform.localScale; } public void SetObjectTransform( Transform objTransform) { if(nowScale == Vector3.zero) { if (startScale == Vector3.zero) Initialize(); objTransform.localPosition = startPos; objTransform.localEulerAngles = startRot; objTransform.localScale = startScale; }else { objTransform.localPosition = nowPos; objTransform.localEulerAngles = nowRot; objTransform.localScale = nowScale; } } } public class ScenesPage { public string name { get; set; } public int id { get; set; } } public class ObjectTData { public Vector3 pos; public Vector3 rot; public Vector3 scale; } public class MapPos { public double X { get; set; } public double Y { get; set; } public double Z { get; set; } public double T { get; set; } } class ValueObjs { public Transform all; public List showObj; public ValueObjs(Transform allObj) { showObj = new List(); all = allObj; for (int i = 0; i < allObj.childCount; i++) { showObj.Add(allObj.GetChild(i)); } } } public class SendInit { public string sn {get;set;} public int projectId { get; set; } } public class SendLogin { public string email { get; set; } public string password { get; set; } } public class SendMaterials { public string url { get; set; } } public class SendEditorData { public int id { get; set; } public List material { get; set; } public ObjectTransform spoittf { get; set; } // public int visitcout { get; set; } } // 电量 public class SendNetConnectElectricity { public string sn { get; set; } public int projectId { get; set; } public int electricity { get; set; } public string status { get; set; } } public class SendNetConnectAlert { public string sn { get; set; } public int projectId { get; set; } public string message { get; set; } } //触发 public class SendNetConnectPointTrigger { //projectId:"", //sn:"", //cmdType:"increasePointTrigger", //viewpointId:"", //triggerTs: // public string name { get; set; } public int projectId { get; set; } public string sn { get; set; } } //位置 public class SendNetConnectPointCloud { public int projectId { get; set; } public string sn { get; set; } public string positionType { get; set; } public Position position; public SendNetConnectPointCloud() { this.position = new Position(); } } public class Position { public float x { get; set; } public float y { get; set; } public float z { get; set; } } public class AppConfigConst { public static string IMAGE_TARGET_FILE_PATH = ""; //http url http://29.193.45.32:8080/U3dFileToServer/upLoad/AssetBundle/ 存放目录 public static string IMAGE_TARGET_FILE_NAME = "YCYL3_3Test"; } //public class JsonSceneValue //{ // //场景名称 // public string name { get; set; } // //人气 // public string sentiment { get; set; } // //识别图XML文件 // public string vuforiaXML { get; set; } // //识别图DAT文件 // public string vuforiaDat { get; set; } // public long updateTime { get; set; } // //状态 0停用 1请用 // public int status { get; set; } // //描述 // public string describe { get; set; } // //场景照片 // public string image { get; set; } // //场景内所有景点信息 // public List listSpoit { get; set; } //} //public class JsonSpoitValue //{ // //场景id // public int projectId { get; set; } // //景点名称 // public String name { get; set; } // //更新时间 // public long updateTime { get; set; } // //当前景点所有素材 // public List listMaterial { get; set; } // //坐标 旋转 尺寸 如果没有数据的话默认为NULL // public ObjectTransform spoitTransform { get; set; } //} //public class JsonMaterialValue //{ // public string Name { get; set; } // public String textContent { get; set; } //文字内容 // public long updateTime { get; set; } // 更新时间 // public string template { get; set; } // 排列样式 // public string describe { get; set; } // 简介 // public MaterialType type { get; set; } // 图片/视频/模型/ // public int textStyle { get; set; } // 文本框的背景 // public string icon { get; set; } // 缩略图下载地址 // public List listDownloadPath { get; set; } // 下载地址组 // public List localSavePath { get; set; } // 保存在本地的地址组 默认为NULL // public ObjectTransform textTransform { get; set; } // public ObjectTransform materialTransform { get; set; } // 坐标 旋转 尺寸 //}