123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695 |
- 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<GameManager>
- {
-
- 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<GameObject> listEditorBJs;
- public GameObject showObjPos;
- private GameObject nowBJ;
- private ObjectTransform startObjTransform;
- /// <summary>
- /// 当前场景信息
- /// </summary>
- public SceneValue scene = null;
- /// <summary>
- /// 素材库素材信息
- /// </summary>
- public List<CompositeMaterialValue> listCMValue = null;
- List<DownLoadMaterial> listDownLoad = new List<DownLoadMaterial>();
- 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<CompositeMaterialValue>();
- // uiMove = editorPanel.GetComponent<UIMove>();
- // OpenPlanel();
- // PlayerPrefs.DeleteAll();
- state = false;
- GameManager.Instance.text4.text = " Test 4";
- //AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayerActivity");
- //AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
- }
- // Update is called once per frame
- void Update()
- {
- // text.text = editorPanel.name;
- // text3.text = "1111 ";
- // editorPanel.Show();
- //if(isPointColud)
- // UIKit.GetPanel<EditorPanel>().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<MaterialObjValue>();
- //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<MaterialObjValue>();
- //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<MaterialObjValue>();
- //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<SpoitValue>();
- //scene.listSpoit.Add(spoit1);
- //scene.listSpoit.Add(spoit2);
- //scene.listSpoit.Add(spoit3);
- #endregion
- #region LocalMaterial
- //List<MaterialObjValue> listMaterialData = new List<MaterialObjValue>();
- 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<MaterialObjValue>();
- //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<MaterialObjValue>();
- //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<MaterialObjValue>();
- 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<MaterialObjValue>();
- 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<MaterialObjValue>();
- 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<MaterialObjValue>();
- 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<MaterialObjValue>();
- 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<MaterialObjValue>();
- CMV8.materialList.Add(obj8);
- List<CompositeMaterialValue> listLocalCMVs = new List<CompositeMaterialValue>();
- //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<CompositeMaterialValue>();
- // 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<EditorPanel>(new EditorPanelData() { SceneValue = scene, listLocalMaterials = listLocalCMVs, listUpLoadMaterials = listCMValue });
- VuforialHint.Instance.Show();
- }
- catch (Exception e)
- {
- ErrorLogPanel.Instance.Show(" 场景初始数据异常 ");
- }
-
- }
- catch (Exception e)
- {
- text2.text = e.ToString();
- }
- }
- /// <summary>
- /// 更改当前所属模式
- /// </summary>
- /// <param name="state"></param>
- 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<SendEditorData> listSendData = new List<SendEditorData>();
- 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;
- }
- /// <summary>
- /// 初始化本地数据
- /// </summary>
- public void InitData()
- {
- PlayerPrefs.DeleteKey("DataScene");
- }
-
- public void Text()
- {
-
- }
- /// <summary>
- /// 选择场景 //根据场景信息进行初始加载
- /// </summary>
- /// <param name="message"></param>
- public void SelectScene(string message)
- {
- }
- /// <summary>
- /// 处理后端SceneValue 数据
- /// </summary>
- /// <param name="scene"></param>
- /// <returns></returns>
- public SceneValue ProcesSceneValueJsonData(SceneValue scene)
- {
- List<CompositeMaterialValue> listCMV = new List<CompositeMaterialValue>();
-
- 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<CompositeMaterialValue>();
- 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<DownLoadMaterial> listVuforia = new List<DownLoadMaterial>();
- 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<CompositeMaterialValue> 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;
- }
- /// <summary>
- /// 处理上传素材数据
- /// </summary>
- /// <param name="listCMV"></param>
- /// <returns></returns>
- public List<CompositeMaterialValue> ProcessCMVJsonData(List<CompositeMaterialValue> 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();
- }
- /// <summary>
- /// 获取当前时间的时间戳
- /// </summary>
- /// <returns></returns>
- 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,
- }
- /// <summary>
- /// 单个素材属性
- /// </summary>
- 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
- }
- /// <summary>
- /// 组合素材属性
- /// </summary>
- 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<MaterialObjValue> 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; }
- }
- /// <summary>
- /// 景点属性
- /// </summary>
- 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<CompositeMaterialValue> material { get; set; }
- //坐标 旋转 尺寸 如果没有数据的话默认为NULL
- public ObjectTransform spoitTf { get; set; }
- public List<MapPos> SpoitTransform { get; set; }
- }
- /// <summary>
- /// 整个场景属性
- /// </summary>
- 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<SpoitValue> listSpoit { get; set; }
- }
- /// <summary>
- /// 坐标 旋转 尺寸
- /// </summary>
- 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<Transform> showObj;
-
- public ValueObjs(Transform allObj)
- {
- showObj = new List<Transform>();
- 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<CompositeMaterialValue> 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:"<uuid>",
- //sn:"<string>",
- //cmdType:"increasePointTrigger",
- //viewpointId:"<uuid>",
- //triggerTs:<int64>
- //
- 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<JsonSpoitValue> listSpoit { get; set; }
- //}
- //public class JsonSpoitValue
- //{
- // //场景id
- // public int projectId { get; set; }
- // //景点名称
- // public String name { get; set; }
- // //更新时间
- // public long updateTime { get; set; }
- // //当前景点所有素材
- // public List<JsonMaterialValue> 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<string> listDownloadPath { get; set; } // 下载地址组
- // public List<string> localSavePath { get; set; } // 保存在本地的地址组 默认为NULL
- // public ObjectTransform textTransform { get; set; }
- // public ObjectTransform materialTransform { get; set; } // 坐标 旋转 尺寸
- //}
|