GameManager.cs 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using QFramework;
  5. using UniRx;
  6. using QFramework.MREditor;
  7. using System;
  8. using Newtonsoft.Json;
  9. using UnityEngine.UI;
  10. using System.IO;
  11. using LitJson;
  12. using Newtonsoft.Json.Linq;
  13. public class GameManager : MonoSingleton<GameManager>
  14. {
  15. public bool isPointColud = false;
  16. public bool isEditor = true;
  17. public Text text;
  18. public Text text2;
  19. public Text text3;
  20. public Text text4;
  21. public GameObject editorPanel;
  22. public UIMove uiMove;
  23. public List<GameObject> listEditorBJs;
  24. public GameObject showObjPos;
  25. private GameObject nowBJ;
  26. private ObjectTransform startObjTransform;
  27. /// <summary>
  28. /// 当前场景信息
  29. /// </summary>
  30. public SceneValue scene = null;
  31. /// <summary>
  32. /// 素材库素材信息
  33. /// </summary>
  34. public List<CompositeMaterialValue> listCMValue = null;
  35. List<DownLoadMaterial> listDownLoad = new List<DownLoadMaterial>();
  36. public bool state = false;
  37. public GameObject Saloon;
  38. public GameObject SZG;
  39. private bool finish = true;
  40. // Start is called before the first frame update
  41. void Start()
  42. {
  43. API_GSXR_Module_InputSystem_GGT26Dof.GSXR_Disable_GGT(API_GSXR_Module_InputSystem_GGT26Dof.GGestureType.Left);
  44. API_GSXR_Module_InputSystem_GGT26Dof.GSXR_Disable_GGT(API_GSXR_Module_InputSystem_GGT26Dof.GGestureType.Right);
  45. //startObjTransform = new ObjectTransform();
  46. //startObjTransform.startPos = Vector3.zero;
  47. //startObjTransform.startRot = Vector3.zero;
  48. //startObjTransform.startScale = Vector3.one;
  49. //startObjTransform.nowPos = Vector3.zero;
  50. //startObjTransform.nowRot = Vector3.zero;
  51. //startObjTransform.nowScale = Vector3.zero;
  52. // scene = new SceneValue();
  53. // listCMValue = new List<CompositeMaterialValue>();
  54. // uiMove = editorPanel.GetComponent<UIMove>();
  55. // OpenPlanel();
  56. // PlayerPrefs.DeleteAll();
  57. state = false;
  58. GameManager.Instance.text4.text = " Test 4";
  59. //AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayerActivity");
  60. //AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
  61. }
  62. // Update is called once per frame
  63. void Update()
  64. {
  65. // text.text = editorPanel.name;
  66. // text3.text = "1111 ";
  67. // editorPanel.Show();
  68. //if(isPointColud)
  69. // UIKit.GetPanel<EditorPanel>().SelectSpoitObj("模型景点");
  70. // Debug.Log(state);
  71. if(state && scene !=null && listCMValue!=null&& finish)
  72. {
  73. LoadShow.Instance.text.text = "100%";
  74. Debug.Log("素材下载结束 打开编辑界面");
  75. text3.text = "素材下载结束 打开编辑界面";
  76. finish = false;
  77. state = false;
  78. SandTable.Instance.OpenSandTable();
  79. LoadShow.Instance.ViewShow(false);
  80. // OpenPlanel();
  81. // LoginPanel.Instance.gameObject.SetActive(false);
  82. }
  83. }
  84. IEnumerator OpenSandTable( int time , string url)
  85. {
  86. yield return new WaitForSeconds(time);
  87. OpenPlanel();
  88. }
  89. public void OpenPlanel()
  90. {
  91. // Debug.Log(listEditorBJs.Count + "@@@@@OpenPlanel");
  92. #region NewSceneData
  93. //MaterialObjValue obj1_1 = new MaterialObjValue();
  94. //obj1_1.Name = "SpaceStation";
  95. //obj1_1.TextBJ = "Null";
  96. //obj1_1.DownloadPath = "Resources/Model/SpaceStation";
  97. //obj1_1.DataTime = DateTime.Now.ToString();
  98. //obj1_1.Type = MaterialType.Model;
  99. //obj1_1.startPos = Vector3.zero;
  100. //obj1_1.startRot = Vector3.zero;
  101. //obj1_1.startScale = new Vector3(0.01f, 0.01f, 0.01f);
  102. //obj1_1.nowPos = Vector3.zero;
  103. //obj1_1.nowRot = Vector3.zero;
  104. //obj1_1.nowScale = Vector3.zero;
  105. //MaterialObjValue obj2_1 = new MaterialObjValue();
  106. //obj2_1.Name = "TestText1";
  107. //obj2_1.TextBJ = "BJ1";
  108. //obj2_1.DownloadPath = "/Text/TestText1.json";
  109. //obj2_1.DataTime = DateTime.Now.ToString();
  110. //obj2_1.Type = MaterialType.Text;
  111. //obj2_1.startPos = new Vector3(0, 0.075f, 0);
  112. //obj2_1.startRot = Vector3.zero;
  113. //obj2_1.startScale = Vector3.one;
  114. //obj2_1.nowPos = Vector3.zero;
  115. //obj2_1.nowRot = Vector3.zero;
  116. //obj2_1.nowScale = Vector3.zero;
  117. //MaterialObjValue obj2_2 = new MaterialObjValue();
  118. //obj2_2.Name = "TestImage1";
  119. //obj2_2.TextBJ = "Null";
  120. //obj2_2.DownloadPath = "Resources/Image/TestImage1";
  121. //obj2_2.DataTime = DateTime.Now.ToString();
  122. //obj2_2.Type = MaterialType.Image;
  123. //obj2_2.startPos = new Vector3(-0.085f, -0.075f, 0);
  124. //obj2_2.startRot = Vector3.zero;
  125. //obj2_2.startScale = Vector3.one;
  126. //obj2_2.nowPos = Vector3.zero;
  127. //obj2_2.nowRot = Vector3.zero;
  128. //obj2_2.nowScale = Vector3.zero;
  129. //MaterialObjValue obj2_3 = new MaterialObjValue();
  130. //obj2_3.Name = "TestImage2";
  131. //obj2_3.TextBJ = "Null";
  132. //obj2_3.DownloadPath = "Resources/Image/TestImage2";
  133. //obj2_3.DataTime = DateTime.Now.ToString();
  134. //obj2_3.Type = MaterialType.Image;
  135. //obj2_3.startPos = new Vector3(0.085f, -0.075f, 0);
  136. //obj2_3.startRot = Vector3.zero;
  137. //obj2_3.startScale = Vector3.one;
  138. //obj2_3.nowPos = Vector3.zero;
  139. //obj2_3.nowRot = Vector3.zero;
  140. //obj2_3.nowScale = Vector3.zero;
  141. //MaterialObjValue obj3_1 = new MaterialObjValue();
  142. //obj3_1.Name = "TestImage3";
  143. //obj3_1.TextBJ = "Null";
  144. //obj3_1.DownloadPath = "Resources/Image/TestImage3";
  145. //obj3_1.DataTime = DateTime.Now.ToString();
  146. //obj3_1.Type = MaterialType.Image;
  147. //obj3_1.startPos = new Vector3(-0.3f, 0, -0.15f);
  148. //obj3_1.startRot = new Vector3(0, -45, 0);
  149. //obj3_1.startScale = Vector3.one;
  150. //obj3_1.nowPos = Vector3.zero;
  151. //obj3_1.nowRot = Vector3.zero;
  152. //obj3_1.nowScale = Vector3.zero;
  153. //MaterialObjValue obj3_2 = new MaterialObjValue();
  154. //obj3_2.Name = "TestImage4";
  155. //obj3_2.TextBJ = "Null";
  156. //obj3_2.DownloadPath = "Resources/Image/TestImage4";
  157. //obj3_2.DataTime = DateTime.Now.ToString();
  158. //obj3_2.Type = MaterialType.Image;
  159. //obj3_2.startPos = new Vector3(-0.17f, 0, -0.05f);
  160. //obj3_2.startRot = new Vector3(0, -30, 0);
  161. //obj3_2.startScale = Vector3.one;
  162. //obj3_2.nowPos = Vector3.zero;
  163. //obj3_2.nowRot = Vector3.zero;
  164. //obj3_2.nowScale = Vector3.zero;
  165. //MaterialObjValue obj3_3 = new MaterialObjValue();
  166. //obj3_3.Name = "Education";
  167. //obj3_3.TextBJ = "Null";
  168. //obj3_3.DownloadPath = Application.streamingAssetsPath + "/Video/Education.mp4";
  169. //obj3_3.DataTime = DateTime.Now.ToString();
  170. //obj3_3.Type = MaterialType.Video;
  171. //obj3_3.startPos = Vector3.zero;
  172. //obj3_3.startRot = Vector3.zero;
  173. //obj3_3.startScale = Vector3.one;
  174. //obj3_3.nowPos = Vector3.zero;
  175. //obj3_3.nowRot = Vector3.zero;
  176. //obj3_3.nowScale = Vector3.zero;
  177. //MaterialObjValue obj3_4 = new MaterialObjValue();
  178. //obj3_4.Name = "TestImage5";
  179. //obj3_4.TextBJ = "Null";
  180. //obj3_4.DownloadPath = "Resources/Image/TestImage5";
  181. //obj3_4.DataTime = DateTime.Now.ToString();
  182. //obj3_4.Type = MaterialType.Image;
  183. //obj3_4.startPos = new Vector3(0.17f, 0, -0.05f);
  184. //obj3_4.startRot = new Vector3(0, 30, 0);
  185. //obj3_4.startScale = Vector3.one;
  186. //obj3_4.nowPos = Vector3.zero;
  187. //obj3_4.nowRot = Vector3.zero;
  188. //obj3_4.nowScale = Vector3.zero;
  189. //MaterialObjValue obj3_5 = new MaterialObjValue();
  190. //obj3_5.Name = "TestImage6";
  191. //obj3_5.TextBJ = "Null";
  192. //obj3_5.DownloadPath = "Resources/Image/TestImage6";
  193. //obj3_5.DataTime = DateTime.Now.ToString();
  194. //obj3_5.Type = MaterialType.Image;
  195. //obj3_5.startPos = new Vector3(0.3f, 0, -0.15f);
  196. //obj3_5.startRot = new Vector3(0, 45, 0);
  197. //obj3_5.startScale = Vector3.one;
  198. //obj3_5.nowPos = Vector3.zero;
  199. //obj3_5.nowRot = Vector3.zero;
  200. //obj3_5.nowScale = Vector3.zero;
  201. //SpoitValue spoit1 = new SpoitValue();
  202. //spoit1.Name = "模型景点";
  203. //spoit1.DataTime = DateTime.Now.ToString();
  204. //spoit1.Type = SpoitType.Null;
  205. //spoit1.startPos = new Vector3(0, 0, 0);
  206. //spoit1.startRot = Vector3.zero;
  207. //spoit1.startScale = Vector3.one;
  208. //spoit1.nowPos = Vector3.zero;
  209. //spoit1.nowRot = Vector3.zero;
  210. //spoit1.nowScale = Vector3.zero;
  211. //spoit1.listMaterial = new List<MaterialObjValue>();
  212. //spoit1.listMaterial.Add(obj1_1);
  213. //SpoitValue spoit2 = new SpoitValue();
  214. //spoit2.Name = "视频景点";
  215. //spoit2.DataTime = DateTime.Now.ToString();
  216. //spoit2.Type = SpoitType.Null;
  217. //spoit2.startPos = new Vector3(0, 0, 0);
  218. //spoit2.startRot = Vector3.zero;
  219. //spoit2.startScale = Vector3.one;
  220. //spoit2.nowPos = Vector3.zero;
  221. //spoit2.nowRot = Vector3.zero;
  222. //spoit2.nowScale = Vector3.zero;
  223. //spoit2.listMaterial = new List<MaterialObjValue>();
  224. //spoit2.listMaterial.Add(obj3_1);
  225. //spoit2.listMaterial.Add(obj3_2);
  226. //spoit2.listMaterial.Add(obj3_3);
  227. //spoit2.listMaterial.Add(obj3_4);
  228. //spoit2.listMaterial.Add(obj3_5);
  229. //SpoitValue spoit3 = new SpoitValue();
  230. //spoit3.Name = "图片文字";
  231. //spoit3.DataTime = DateTime.Now.ToString();
  232. //spoit3.Type = SpoitType.Null;
  233. //spoit3.startPos = new Vector3(0, 0, 0);
  234. //spoit3.startRot = Vector3.zero;
  235. //spoit3.startScale = Vector3.one;
  236. //spoit3.nowPos = Vector3.zero;
  237. //spoit3.nowRot = Vector3.zero;
  238. //spoit3.nowScale = Vector3.zero;
  239. //spoit3.listMaterial = new List<MaterialObjValue>();
  240. //spoit3.listMaterial.Add(obj2_1);
  241. //spoit3.listMaterial.Add(obj2_2);
  242. //spoit3.listMaterial.Add(obj2_3);
  243. //SceneValue scene = new SceneValue();
  244. //scene.username = "VuforialEditor";
  245. //scene.Type = SceneType.Vuforial;
  246. //scene.DataTime = DateTime.Now.ToString();
  247. //scene.UpdatePath = "";
  248. //scene.listSpoit = new List<SpoitValue>();
  249. //scene.listSpoit.Add(spoit1);
  250. //scene.listSpoit.Add(spoit2);
  251. //scene.listSpoit.Add(spoit3);
  252. #endregion
  253. #region LocalMaterial
  254. //List<MaterialObjValue> listMaterialData = new List<MaterialObjValue>();
  255. ObjectTransform startObjTransform = new ObjectTransform();
  256. startObjTransform.startPos = Vector3.zero;
  257. startObjTransform.startRot = Vector3.zero;
  258. startObjTransform.startScale = Vector3.one;
  259. startObjTransform.nowPos = Vector3.zero;
  260. startObjTransform.nowRot = Vector3.zero;
  261. startObjTransform.nowScale = Vector3.zero;
  262. //MaterialObjValue obj1 = new MaterialObjValue();
  263. //obj1.name = "空间站_1";
  264. //obj1.TextBJ = "-1";
  265. //obj1.textContent = null;
  266. //obj1.type = "3";
  267. //obj1.DownloadPath = "Resources/LocalMaterials/Model/SpaceStation";
  268. //obj1.DownloadPath = "Resources/LocalMaterials/Model/SpaceStation";
  269. //obj1.ObjectTransform = startObjTransform;
  270. //obj1.ObjectTransform.startScale = new Vector3(0.01f, 0.01f, 0.01f);
  271. //obj1.textPosition = null;
  272. //MaterialObjValue obj2 = new MaterialObjValue();
  273. //obj2.name = "LocalText1";
  274. //obj2.TextBJ = "2";
  275. //obj2.textContent = "This is Test ";
  276. //obj2.type = "4";
  277. //obj2.DownloadPath = null;
  278. //obj2.localSavePath = null;
  279. //obj2.ObjectTransform = startObjTransform;
  280. //obj2.textPosition = null;
  281. MaterialObjValue obj3 = new MaterialObjValue();
  282. obj3.name = "前进箭头";
  283. obj3.TextBJ = "-1";
  284. obj3.textContent = null;
  285. obj3.type = "1";
  286. obj3.DownloadPath = "Resources/LocalMaterials/Image/Dir_0";
  287. obj3.localSavePath = "Resources/LocalMaterials/Image/Dir_0";
  288. obj3.ObjectTransform = startObjTransform;
  289. obj3.textPosition = null;
  290. MaterialObjValue obj4 = new MaterialObjValue();
  291. obj4.name = "右箭头";
  292. obj4.TextBJ = "-1";
  293. obj4.textContent = null;
  294. obj4.type = "1";
  295. obj4.DownloadPath = "Resources/LocalMaterials/Image/Dir_1";
  296. obj4.localSavePath = "Resources/LocalMaterials/Image/Dir_1";
  297. obj4.ObjectTransform = startObjTransform;
  298. obj4.textPosition = null;
  299. MaterialObjValue obj5 = new MaterialObjValue();
  300. obj5.name = "左箭头";
  301. obj5.TextBJ = "-1";
  302. obj5.textContent = null;
  303. obj5.type = "1";
  304. obj5.DownloadPath = "Resources/LocalMaterials/Image/Dir_2";
  305. obj5.localSavePath = "Resources/LocalMaterials/Image/Dir_2";
  306. obj5.ObjectTransform = startObjTransform;
  307. obj5.textPosition = null;
  308. MaterialObjValue obj6 = new MaterialObjValue();
  309. obj6.name = "后转箭头";
  310. obj6.TextBJ = "-1";
  311. obj6.textContent = null;
  312. obj6.type = "1";
  313. obj6.DownloadPath = "Resources/LocalMaterials/Image/Dir_3";
  314. obj6.localSavePath = "Resources/LocalMaterials/Image/Dir_3";
  315. obj6.ObjectTransform = startObjTransform;
  316. MaterialObjValue obj7 = new MaterialObjValue();
  317. obj7.name = "右转箭头";
  318. obj7.TextBJ = "-1";
  319. obj7.textContent = null;
  320. obj7.type = "1";
  321. obj7.DownloadPath = "Resources/LocalMaterials/Image/Dir_4";
  322. obj7.localSavePath = "Resources/LocalMaterials/Image/Dir_4";
  323. obj7.ObjectTransform = startObjTransform;
  324. obj7.textPosition = null;
  325. MaterialObjValue obj8 = new MaterialObjValue();
  326. obj8.name = "左转箭头";
  327. obj8.TextBJ = "-1";
  328. obj8.textContent = null;
  329. obj8.type = "1";
  330. obj8.DownloadPath = "Resources/LocalMaterials/Image/Dir_5";
  331. obj8.localSavePath = "Resources/LocalMaterials/Image/Dir_5";
  332. obj8.ObjectTransform = startObjTransform;
  333. obj8.textPosition = null;
  334. //CompositeMaterialValue CMV1 = new CompositeMaterialValue();
  335. //CMV1.name = "空间站";
  336. //CMV1.type = 3;
  337. //CMV1.template = null;
  338. //CMV1.updateTime = GetTimeStamp();
  339. //CMV1.describe = "";
  340. //CMV1.icon = "Resources/LocalMaterials/Image/ModelIcon";
  341. //CMV1.objectTransform = startObjTransform;
  342. //CMV1.materialList = new List<MaterialObjValue>();
  343. //CMV1.materialList.Add(obj1);
  344. //CompositeMaterialValue CMV2 = new CompositeMaterialValue();
  345. //CMV2.name = "测试文本";
  346. //CMV2.type = 4;
  347. //CMV2.template = "2";
  348. //CMV2.updateTime = GetTimeStamp();
  349. //CMV2.describe = "";
  350. //CMV2.icon = "Resources/LocalMaterials/Image/ModelIcon";
  351. //CMV2.objectTransform = startObjTransform;
  352. //CMV2.materialList = new List<MaterialObjValue>();
  353. //CMV2.materialList.Add(obj2);
  354. CompositeMaterialValue CMV3 = new CompositeMaterialValue();
  355. CMV3.name = "前进箭头";
  356. CMV3.type = 1;
  357. CMV3.template = null;
  358. CMV3.updateTime = GetTimeStamp();
  359. CMV3.describe = "";
  360. CMV3.icon = "Resources/LocalMaterials/Image/Dir_0";
  361. CMV3.objectTransform = startObjTransform;
  362. CMV3.materialList = new List<MaterialObjValue>();
  363. CMV3.materialList.Add(obj3);
  364. CompositeMaterialValue CMV4 = new CompositeMaterialValue();
  365. CMV4.name = "右箭头";
  366. CMV4.type = 1;
  367. CMV4.template = null;
  368. CMV4.updateTime = GetTimeStamp();
  369. CMV4.describe = "";
  370. CMV4.icon = "Resources/LocalMaterials/Image/Dir_1";
  371. CMV4.objectTransform = startObjTransform;
  372. CMV4.materialList = new List<MaterialObjValue>();
  373. CMV4.materialList.Add(obj4);
  374. CompositeMaterialValue CMV5 = new CompositeMaterialValue();
  375. CMV5.name = "左箭头";
  376. CMV5.type = 1;
  377. CMV5.template = null;
  378. CMV5.updateTime = GetTimeStamp();
  379. CMV5.describe = "";
  380. CMV5.icon = "Resources/LocalMaterials/Image/Dir_2";
  381. CMV5.objectTransform = startObjTransform;
  382. CMV5.materialList = new List<MaterialObjValue>();
  383. CMV5.materialList.Add(obj5);
  384. CompositeMaterialValue CMV6 = new CompositeMaterialValue();
  385. CMV6.name = "后转箭头";
  386. CMV6.type = 1;
  387. CMV6.template = null;
  388. CMV6.updateTime = GetTimeStamp();
  389. CMV6.describe = "";
  390. CMV6.icon = "Resources/LocalMaterials/Image/Dir_3";
  391. CMV6.objectTransform = startObjTransform;
  392. CMV6.materialList = new List<MaterialObjValue>();
  393. CMV6.materialList.Add(obj6);
  394. CompositeMaterialValue CMV7 = new CompositeMaterialValue();
  395. CMV7.name = "右转箭头";
  396. CMV7.type = 1;
  397. CMV7.template = null;
  398. CMV7.updateTime = GetTimeStamp();
  399. CMV7.describe = "";
  400. CMV7.icon = "Resources/LocalMaterials/Image/Dir_4";
  401. CMV7.objectTransform = startObjTransform;
  402. CMV7.materialList = new List<MaterialObjValue>();
  403. CMV7.materialList.Add(obj7);
  404. CompositeMaterialValue CMV8 = new CompositeMaterialValue();
  405. CMV8.name = "左转箭头";
  406. CMV8.type = 1;
  407. CMV8.template = null;
  408. CMV8.updateTime = GetTimeStamp();
  409. CMV8.describe = "";
  410. CMV8.icon = "Resources/LocalMaterials/Image/Dir_5";
  411. CMV8.objectTransform = startObjTransform;
  412. CMV8.materialList = new List<MaterialObjValue>();
  413. CMV8.materialList.Add(obj8);
  414. List<CompositeMaterialValue> listLocalCMVs = new List<CompositeMaterialValue>();
  415. //listLocalCMVs.Add(CMV1);
  416. //listLocalCMVs.Add(CMV2);
  417. listLocalCMVs.Add(CMV3);
  418. listLocalCMVs.Add(CMV4);
  419. listLocalCMVs.Add(CMV5);
  420. listLocalCMVs.Add(CMV6);
  421. listLocalCMVs.Add(CMV7);
  422. listLocalCMVs.Add(CMV8);
  423. SpoitValue spoitValue = new SpoitValue();
  424. spoitValue.name = "景点1";
  425. spoitValue.spoitTf = startObjTransform;
  426. spoitValue.updateTime = GetTimeStamp();
  427. spoitValue.material = new List<CompositeMaterialValue>();
  428. // spoitValue.material.Add(CMV1);
  429. #endregion
  430. string str = JsonConvert.SerializeObject(scene);
  431. //Debug.Log("%%%%%%%%%% " + str);
  432. // string str = JsonMapper.ToJson(scene);
  433. Debug.Log(str);
  434. text2.text = str;
  435. //Save(scene);
  436. try
  437. {
  438. text.text = "Init";
  439. ResMgr.Init();
  440. ResKit.Init();
  441. Debug.Log(listCMValue.Count);
  442. // Debug.Log("@@@@ "+scene.listSpoit.Count);
  443. // LoadShow.Instance.ViewShow(false);
  444. VuforialControl.Instance.LoadARCamera();
  445. try
  446. {
  447. UIKit.OpenPanel<EditorPanel>(new EditorPanelData() { SceneValue = scene, listLocalMaterials = listLocalCMVs, listUpLoadMaterials = listCMValue });
  448. VuforialHint.Instance.Show();
  449. }
  450. catch (Exception e)
  451. {
  452. ErrorLogPanel.Instance.Show(" 场景初始数据异常 ");
  453. }
  454. }
  455. catch (Exception e)
  456. {
  457. text2.text = e.ToString();
  458. }
  459. }
  460. /// <summary>
  461. /// 更改当前所属模式
  462. /// </summary>
  463. /// <param name="state"></param>
  464. public void SetIsEditor(bool state)
  465. {
  466. //if (editorPanel == null)
  467. // return;
  468. isEditor = state;
  469. try
  470. {
  471. // editorPanel.SetActive(state);
  472. if (nowBJ.IsNotNull())
  473. nowBJ.SetActive(state);
  474. // VuforialControl.Instance.SetEditor(state);
  475. //editorPanel.SetActive(false);
  476. //editorPanel.SetActive(true);
  477. }
  478. catch (Exception e)
  479. {
  480. // text2.text = "@@@@ " + state + e.Message;
  481. }
  482. }
  483. public void SetImageBJ(int i)
  484. {
  485. Debug.Log(i);
  486. if (nowBJ.IsNotNull())
  487. nowBJ.SetActive(false);
  488. nowBJ = listEditorBJs[i];
  489. nowBJ.SetActive(true);
  490. }
  491. public void Save(SceneValue scene)
  492. {
  493. List<SendEditorData> listSendData = new List<SendEditorData>();
  494. try
  495. {
  496. for (int i = 0; i < scene.listSpoit.Count; i++)
  497. {
  498. Debug.Log("上传 " + scene.listSpoit[i].spoitTf.nowPos);
  499. GameManager.Instance.text2.text = " 上传 " + scene.listSpoit[i].spoitTf;
  500. // string spoittf = JsonMapper.ToJson(scene.listSpoit[i].spoitTf);
  501. // string spoittf = JsonConvert.SerializeObject(scene.listSpoit[i].spoitTf);
  502. SendEditorData data = new SendEditorData();
  503. data.spoittf = new ObjectTransform();
  504. data.material = scene.listSpoit[i].material;
  505. data.spoittf = scene.listSpoit[i].spoitTf;
  506. data.id = scene.listSpoit[i].id;
  507. // data.visitcout = 1;
  508. listSendData.Add(data);
  509. }
  510. }
  511. catch (Exception e)
  512. {
  513. GameManager.Instance.text4.text = "上传 "+ e.Message;
  514. }
  515. // 上传
  516. try
  517. {
  518. GameManager.Instance.text4.text = " 上传保存中 ";
  519. string sendData = JsonConvert.SerializeObject(listSendData);
  520. GameManager.Instance.text4.text = " 上传保存中2 ";
  521. Debug.Log("上传 " + sendData);
  522. // text2.text = sendData;
  523. HttpTool.Instance.PostTest("/viewpoint/update", sendData, SaveCallBack);
  524. }
  525. catch (Exception e)
  526. {
  527. GameManager.Instance.text2.text = e.Message;
  528. ErrorLogPanel.Instance.Show(" 上传失败 ");
  529. Debug.LogError(e);
  530. }
  531. // string str = JsonConvert.SerializeObject(scene);
  532. // PlayerPrefs.SetString("DataScene", str);
  533. }
  534. public void SaveCallBack(string message)
  535. {
  536. Debug.Log(message);
  537. JObject jObject = JObject.Parse(message);
  538. string str = jObject["message"].ToString();
  539. if(200==int.Parse( jObject["code"].ToString()))
  540. {
  541. // HintLogPanel.Instance.Show(" 保存成功 ");
  542. HintLogPanel.Instance.Show(" 保存成功 ");
  543. }
  544. else
  545. {
  546. HintLogPanel.Instance.Show(" 保存失败 ");
  547. }
  548. GameManager.Instance.text2.text = "CallBack上传 "+ str;
  549. }
  550. /// <summary>
  551. /// 初始化本地数据
  552. /// </summary>
  553. public void InitData()
  554. {
  555. PlayerPrefs.DeleteKey("DataScene");
  556. }
  557. public void Text()
  558. {
  559. }
  560. /// <summary>
  561. /// 选择场景 //根据场景信息进行初始加载
  562. /// </summary>
  563. /// <param name="message"></param>
  564. public void SelectScene(string message)
  565. {
  566. }
  567. /// <summary>
  568. /// 处理后端SceneValue 数据
  569. /// </summary>
  570. /// <param name="scene"></param>
  571. /// <returns></returns>
  572. public SceneValue ProcesSceneValueJsonData(SceneValue scene)
  573. {
  574. List<CompositeMaterialValue> listCMV = new List<CompositeMaterialValue>();
  575. for (int i = 0; i < scene.listSpoit.Count; i++)
  576. {
  577. if (scene.listSpoit[i].spoitTf == null)
  578. {
  579. // SetObjectTransform(scene.listSpoit[i].spoittf);
  580. scene.listSpoit[i].spoitTf = new ObjectTransform();
  581. scene.listSpoit[i].spoitTf.startPos = Vector3.zero;
  582. scene.listSpoit[i].spoitTf.startRot = Vector3.zero;
  583. scene.listSpoit[i].spoitTf.startScale = Vector3.one;
  584. scene.listSpoit[i].spoitTf.nowPos = Vector3.zero;
  585. scene.listSpoit[i].spoitTf.nowRot = Vector3.zero;
  586. scene.listSpoit[i].spoitTf.nowScale = Vector3.zero;
  587. Debug.Log(scene.listSpoit[i].spoitTf.startPos);
  588. }
  589. else
  590. {
  591. Debug.Log("SpoitTF Not NULL");
  592. }
  593. if (scene.listSpoit[i].material == null)
  594. scene.listSpoit[i].material = new List<CompositeMaterialValue>();
  595. for (int j = 0; j < scene.listSpoit[i].material.Count; j++)
  596. {
  597. // Debug.Log(scene.listSpoit[i].material[j].name +" @@@@@@@@@");
  598. listCMV.Add(scene.listSpoit[i].material[j]);
  599. }
  600. }
  601. // 下载 Vuforia 识别图 和 xml 文件
  602. List<DownLoadMaterial> listVuforia = new List<DownLoadMaterial>();
  603. MaterialObjValue datFile = new MaterialObjValue();
  604. datFile.name = "datFile";
  605. datFile.type = "2";
  606. datFile.DownloadPath = scene.vuforiaDat;
  607. datFile.localSavePath = Application.persistentDataPath + "/StreamingAssets/Vuforia/" + Path.GetFileName(scene.vuforiaDat);
  608. MaterialObjValue xmlFile = new MaterialObjValue();
  609. xmlFile.name = "xmlFile";
  610. xmlFile.type = "2";
  611. xmlFile.DownloadPath = scene.vuforiaXML;
  612. string str = Path.GetFileName(scene.vuforiaXML);
  613. Debug.Log(str);
  614. if (str.IsNotNullAndEmpty())
  615. {
  616. str = str.Substring(0, str.Length - 4);
  617. Debug.Log("VuforialName " + str);
  618. AppConfigConst.IMAGE_TARGET_FILE_NAME = str;
  619. }
  620. Debug.Log("VuforialName " + str);
  621. AppConfigConst.IMAGE_TARGET_FILE_NAME = str;
  622. xmlFile.localSavePath = Application.persistentDataPath + "/StreamingAssets/Vuforia/" + Path.GetFileName(scene.vuforiaXML);
  623. MaterialObjValue sandTableModel = new MaterialObjValue();
  624. sandTableModel.name = "sandTableMoel";
  625. sandTableModel.type = "3";
  626. sandTableModel.DownloadPath = scene.sandTable;
  627. sandTableModel.localSavePath = Application.persistentDataPath + "/StreamingAssets/Vuforia/" + Path.GetFileName(scene.sandTable);
  628. if (sandTableModel.DownloadPath.IsNotNullAndEmpty())
  629. {
  630. SandTable.Instance.value = sandTableModel;
  631. SandTable.Instance.updateTime = scene.updateTime;
  632. }
  633. else
  634. {
  635. SandTable.Instance.value = null;
  636. SandTable.Instance.updateTime = 0;
  637. }
  638. listDownLoad.Insert(0, new DownLoadMaterial(datFile, scene.updateTime));
  639. listDownLoad.Insert(1, new DownLoadMaterial(xmlFile, scene.updateTime));
  640. listDownLoad.Insert(2, new DownLoadMaterial(sandTableModel, scene.updateTime));
  641. List<CompositeMaterialValue> listProcessCMV = ProcessCMVJsonData(listCMV, false );
  642. if(listDownLoad.Count>2)
  643. {
  644. GameManager.Instance.text3.text = " 准备下载素材 " + listDownLoad.Count;
  645. // LoginPanel.Instance.gameObject.SetActive(false);
  646. LoadManager.Instance.InitLoad(listDownLoad);
  647. }
  648. int num = 0;
  649. for (int i = 0; i < scene.listSpoit.Count; i++)
  650. {
  651. for (int j = 0; j < scene.listSpoit[i].material.Count; j++)
  652. {
  653. scene.listSpoit[i].material[j] = listProcessCMV[num++];
  654. // Debug.Log("!!!!!!!"+scene.listSpoit[i].material[j].name);
  655. }
  656. }
  657. return scene;
  658. }
  659. /// <summary>
  660. /// 处理上传素材数据
  661. /// </summary>
  662. /// <param name="listCMV"></param>
  663. /// <returns></returns>
  664. public List<CompositeMaterialValue> ProcessCMVJsonData(List<CompositeMaterialValue> listCMV,bool finish )
  665. {
  666. bool state = false;
  667. if (listDownLoad.Count > 1)
  668. state = true;
  669. for (int i = 0; i < listCMV.Count; i++)
  670. {
  671. if (listCMV[i].objectTransform == null)
  672. SetObjectTransform(listCMV[i].objectTransform);
  673. // listCMV[i].objectTransform = startObjTransform;
  674. Debug.Log(listCMV[i].name + listCMV[i].materialList.Count);
  675. if(listCMV[i].materialList!=null)
  676. for (int j = 0; j < listCMV[i].materialList.Count; j++)
  677. {
  678. Debug.Log(listCMV[i].materialList[j].name + " " + listCMV[i].materialList[j].ObjectTransform.nowScale.x.ToString());
  679. if (listCMV[i].materialList[j].ObjectTransform == null)
  680. SetObjectTransform(listCMV[i].materialList[j].ObjectTransform);
  681. if (listCMV[i].materialList[j].ObjectTransform.startScale != Vector3.one)
  682. listCMV[i].materialList[j].ObjectTransform.startScale = Vector3.one;
  683. // listCMV[i].materialList[j].ObjectTransform = startObjTransform;
  684. //if(listCMV[i].materialList[j].ObjectTransform.startScale != Vector3.one && listCMV[i].materialList[j].ObjectTransform.nowScale == Vector3.zero)
  685. // SetObjectTransform(listCMV[i].materialList[j].ObjectTransform);
  686. // listCMV[i].materialList[j].ObjectTransform = startObjTransform;
  687. if(listCMV[i].icon!="")
  688. {
  689. MaterialObjValue mObj = new MaterialObjValue();
  690. mObj.name = listCMV[i].name;
  691. mObj.DownloadPath = listCMV[i].icon;
  692. mObj.type = "4";
  693. mObj.localSavePath = Application.persistentDataPath + "/Image/" + Path.GetFileName(listCMV[i].icon);
  694. DownLoadMaterial value = new DownLoadMaterial(mObj, listCMV[i].updateTime);
  695. if (finish)
  696. AddListDaownLoad(value);
  697. //listDownLoad.Add(value);
  698. }
  699. if (listCMV[i].materialList[j].DownloadPath == listCMV[i].materialList[j].localSavePath&& listCMV[i].materialList[j].type!="4")
  700. continue;
  701. listCMV[i].materialList[j].name = listCMV[i].name +"_"+ j.ToString();
  702. Debug.Log(listCMV[i].materialList[j].name);
  703. switch ((MaterialType)int.Parse( listCMV[i].materialList[j].type))
  704. {
  705. case MaterialType.NULL:
  706. break;
  707. case MaterialType.Image:
  708. listCMV[i].materialList[j].localSavePath = Application.persistentDataPath + "/Image/" + Path.GetFileName(listCMV[i].materialList[j].DownloadPath);
  709. if (finish)
  710. AddListDaownLoad(new DownLoadMaterial(listCMV[i].materialList[j], listCMV[i].updateTime));
  711. // listDownLoad.Add(new DownLoadMaterial(listCMV[i].materialList[j], listCMV[i].updateTime));
  712. break;
  713. case MaterialType.Video:
  714. listCMV[i].materialList[j].localSavePath = Application.persistentDataPath + "/Video/" + Path.GetFileName(listCMV[i].materialList[j].DownloadPath);
  715. if (finish)
  716. AddListDaownLoad(new DownLoadMaterial(listCMV[i].materialList[j], listCMV[i].updateTime));
  717. // listDownLoad.Add(new DownLoadMaterial(listCMV[i].materialList[j], listCMV[i].updateTime));
  718. break;
  719. case MaterialType.Model:
  720. listCMV[i].materialList[j].localSavePath = Application.persistentDataPath + "/Model/" + Path.GetFileName(listCMV[i].materialList[j].DownloadPath);
  721. if (finish)
  722. AddListDaownLoad(new DownLoadMaterial(listCMV[i].materialList[j], listCMV[i].updateTime));
  723. // listDownLoad.Add(new DownLoadMaterial(listCMV[i].materialList[j], listCMV[i].updateTime));
  724. break;
  725. case MaterialType.Text:
  726. break;
  727. default:
  728. break;
  729. }
  730. }
  731. }
  732. if(finish&& state)
  733. {
  734. GameManager.Instance.text3.text = " 准备下载素材 " + listDownLoad.Count;
  735. LoginPanel.Instance.gameObject.SetActive(false);
  736. LoadManager.Instance.InitLoad(listDownLoad);
  737. }
  738. for (int i = 0; i < listCMV.Count; i++)
  739. {
  740. switch (listCMV[i].typesetting)
  741. {
  742. case "1": // 平铺
  743. int num1 = listCMV[i].materialList.Count;
  744. for (int j = 0; j < listCMV[i].materialList.Count; j++)
  745. {
  746. if (listCMV[i].materialList[j].type == "4")
  747. num1--;
  748. }
  749. switch (num1)
  750. {
  751. case 2:
  752. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0);
  753. listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero;
  754. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  755. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0.5f, 0, 0);
  756. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  757. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  758. break;
  759. case 3:
  760. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0);
  761. listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero;
  762. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  763. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0, 0);
  764. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  765. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  766. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0, 0);
  767. listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero;
  768. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  769. break;
  770. case 4:
  771. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-1f, 0, 0);
  772. listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero;
  773. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  774. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0);
  775. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  776. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  777. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0, 0);
  778. listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero;
  779. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  780. listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(1f, 0, 0);
  781. listCMV[i].materialList[3].ObjectTransform.startRot = Vector3.zero;
  782. listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one;
  783. break;
  784. case 5:
  785. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-1f, 0, 0);
  786. listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero;
  787. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  788. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0);
  789. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  790. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  791. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0, 0, 0);
  792. listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero;
  793. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  794. listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(0.5f, 0, 0);
  795. listCMV[i].materialList[3].ObjectTransform.startRot = Vector3.zero;
  796. listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one;
  797. listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(1f, 0, 0);
  798. listCMV[i].materialList[4].ObjectTransform.startRot = Vector3.zero;
  799. listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one;
  800. break;
  801. case 6:
  802. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-1.5f, 0, 0);
  803. listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero;
  804. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  805. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(-1f, 0, 0);
  806. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  807. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  808. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0);
  809. listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero;
  810. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  811. listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(0.5f, 0, 0);
  812. listCMV[i].materialList[3].ObjectTransform.startRot = Vector3.zero;
  813. listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one;
  814. listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(1f, 0, 0);
  815. listCMV[i].materialList[4].ObjectTransform.startRot = Vector3.zero;
  816. listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one;
  817. listCMV[i].materialList[5].ObjectTransform.startPos = new Vector3(1.5f, 0, 0);
  818. listCMV[i].materialList[5].ObjectTransform.startRot = Vector3.zero;
  819. listCMV[i].materialList[5].ObjectTransform.startScale = Vector3.one;
  820. break;
  821. default:
  822. break;
  823. }
  824. break;
  825. case "2": // 扇形
  826. int num2 = listCMV[i].materialList.Count;
  827. for (int j = 0; j < listCMV[i].materialList.Count; j++)
  828. {
  829. if (listCMV[i].materialList[j].type == "4")
  830. num2--;
  831. }
  832. switch (num2)
  833. {
  834. case 2:
  835. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0.26f);
  836. listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -15, 0);
  837. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  838. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0.5f, 0, 0.26f);
  839. listCMV[i].materialList[1].ObjectTransform.startRot = new Vector3(0, 15, 0);
  840. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  841. break;
  842. case 3:
  843. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-5f, 0, -0.05f);
  844. listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0);
  845. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  846. listCMV[i].materialList[1].ObjectTransform.startPos = Vector3.zero;
  847. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  848. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  849. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0, -0.05f);
  850. listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, 30, 0);
  851. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  852. break;
  853. case 4:
  854. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-1f, 0, 0.16f);
  855. listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0);
  856. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  857. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0.26f);
  858. listCMV[i].materialList[1].ObjectTransform.startRot = new Vector3(0, -15, 0);
  859. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  860. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0, 0.26f);
  861. listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, 15, 0);
  862. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  863. listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(1f, 0, 0.16f);
  864. listCMV[i].materialList[3].ObjectTransform.startRot = new Vector3(0, 30, 0);
  865. listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one;
  866. break;
  867. case 5:
  868. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-1f, 0, -0.15f);
  869. listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -45, 0);
  870. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  871. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(-0.5f, 0, -0.05f);
  872. listCMV[i].materialList[1].ObjectTransform.startRot = new Vector3(0, -30, 0);
  873. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  874. listCMV[i].materialList[2].ObjectTransform.startPos = Vector3.zero;
  875. listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero;
  876. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  877. listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(0.5f, 0, -0.05f);
  878. listCMV[i].materialList[3].ObjectTransform.startRot = new Vector3(0, 30, 0);
  879. listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one;
  880. listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(1f, 0, -0.15f);
  881. listCMV[i].materialList[4].ObjectTransform.startRot = new Vector3(0, 45, 0);
  882. listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one;
  883. break;
  884. case 6:
  885. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-1.5f, 0, 0);
  886. listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -45, 0);
  887. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  888. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(-1f, 0, 0.16f);
  889. listCMV[i].materialList[1].ObjectTransform.startRot = new Vector3(0, -30, 0);
  890. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  891. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(-0.5f, 0, 0.26f);
  892. listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, -15, 0);
  893. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  894. listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(0.5f, 0, 0.26f);
  895. listCMV[i].materialList[3].ObjectTransform.startRot = new Vector3(0, 15, 0);
  896. listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one;
  897. listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(1f, 0, 0.16f);
  898. listCMV[i].materialList[4].ObjectTransform.startRot = new Vector3(0, 30, 0);
  899. listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one;
  900. listCMV[i].materialList[5].ObjectTransform.startPos = new Vector3(1.5f, 0, 0);
  901. listCMV[i].materialList[5].ObjectTransform.startRot = new Vector3(0, 45, 0);
  902. listCMV[i].materialList[5].ObjectTransform.startScale = Vector3.one;
  903. break;
  904. default:
  905. break;
  906. }
  907. break;
  908. case "3": // 双层 平铺
  909. int num3 = listCMV[i].materialList.Count;
  910. for (int j = 0; j < listCMV[i].materialList.Count; j++)
  911. {
  912. if (listCMV[i].materialList[j].type == "4")
  913. num3--;
  914. }
  915. switch (num3)
  916. {
  917. case 2:
  918. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, 0);
  919. listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero;
  920. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  921. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0);
  922. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  923. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  924. break;
  925. case 3:
  926. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, 0);
  927. listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero;
  928. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  929. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0);
  930. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  931. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  932. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, 0);
  933. listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero;
  934. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  935. Vector3 pos = Vector3.zero;
  936. pos.x = -0.17f;
  937. Debug.Log(pos.x);
  938. break;
  939. case 4:
  940. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, 0);
  941. listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero;
  942. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  943. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0);
  944. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  945. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  946. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, 0);
  947. listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero;
  948. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  949. listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(-0.5f, -0.3f, 0);
  950. listCMV[i].materialList[3].ObjectTransform.startRot = Vector3.zero;
  951. listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one;
  952. break;
  953. case 5:
  954. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, 0);
  955. listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero;
  956. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  957. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0);
  958. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  959. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  960. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, 0);
  961. listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero;
  962. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  963. listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(-0.5f, -0.3f, 0);
  964. listCMV[i].materialList[3].ObjectTransform.startRot = Vector3.zero;
  965. listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one;
  966. listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(0, -0.3f, 0);
  967. listCMV[i].materialList[4].ObjectTransform.startRot = Vector3.zero;
  968. listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one;
  969. break;
  970. case 6:
  971. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, 0);
  972. listCMV[i].materialList[0].ObjectTransform.startRot = Vector3.zero;
  973. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  974. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0);
  975. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  976. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  977. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, 0);
  978. listCMV[i].materialList[2].ObjectTransform.startRot = Vector3.zero;
  979. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  980. listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(-0.5f, -0.3f, 0);
  981. listCMV[i].materialList[3].ObjectTransform.startRot = Vector3.zero;
  982. listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one;
  983. listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(0, -0.3f, 0);
  984. listCMV[i].materialList[4].ObjectTransform.startRot = Vector3.zero;
  985. listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one;
  986. listCMV[i].materialList[5].ObjectTransform.startPos = new Vector3(0.5f, -0.3f, 0);
  987. listCMV[i].materialList[5].ObjectTransform.startRot = Vector3.zero;
  988. listCMV[i].materialList[5].ObjectTransform.startScale = Vector3.one;
  989. break;
  990. default:
  991. break;
  992. }
  993. break;
  994. case "4": //双层 扇形摆放
  995. Debug.Log(listCMV[i].name + 2);
  996. int num4 = listCMV[i].materialList.Count;
  997. for (int j = 0; j < listCMV[i].materialList.Count; j++)
  998. {
  999. if (listCMV[i].materialList[j].type == "4")
  1000. num4--;
  1001. }
  1002. switch (num4)
  1003. {
  1004. case 2:
  1005. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, -0.05f);
  1006. listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0);
  1007. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  1008. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0);
  1009. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  1010. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  1011. break;
  1012. case 3:
  1013. Debug.Log("listCMV[i] " + listCMV[i].name);
  1014. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, -0.05f);
  1015. listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0);
  1016. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  1017. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0);
  1018. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  1019. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  1020. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, -0.05f);
  1021. listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, 30, 0);
  1022. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  1023. Debug.Log(listCMV[i].materialList[0].ObjectTransform.startPos);
  1024. Debug.Log(listCMV[i].materialList[1].ObjectTransform.startPos);
  1025. Debug.Log(listCMV[i].materialList[2].ObjectTransform.startPos);
  1026. break;
  1027. case 4:
  1028. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, -0.05f);
  1029. listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0);
  1030. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  1031. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0);
  1032. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  1033. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  1034. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, -0.05f);
  1035. listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, 30, 0);
  1036. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  1037. listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(-0.5f, -0.3f, 0);
  1038. listCMV[i].materialList[3].ObjectTransform.startRot = new Vector3(0, -30, 0);
  1039. listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one;
  1040. break;
  1041. case 5:
  1042. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, -0.05f);
  1043. listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0);
  1044. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  1045. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0);
  1046. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  1047. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  1048. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, -0.05f);
  1049. listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, 30, 0);
  1050. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  1051. listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(-0.5f, -0.3f, 0);
  1052. listCMV[i].materialList[3].ObjectTransform.startRot = new Vector3(0, -30, 0);
  1053. listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one;
  1054. listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(0, -0.3f, 0);
  1055. listCMV[i].materialList[4].ObjectTransform.startRot = Vector3.zero;
  1056. listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one;
  1057. break;
  1058. case 6:
  1059. listCMV[i].materialList[0].ObjectTransform.startPos = new Vector3(-0.5f, 0.3f, -0.05f);
  1060. listCMV[i].materialList[0].ObjectTransform.startRot = new Vector3(0, -30, 0);
  1061. listCMV[i].materialList[0].ObjectTransform.startScale = Vector3.one;
  1062. listCMV[i].materialList[1].ObjectTransform.startPos = new Vector3(0, 0.3f, 0);
  1063. listCMV[i].materialList[1].ObjectTransform.startRot = Vector3.zero;
  1064. listCMV[i].materialList[1].ObjectTransform.startScale = Vector3.one;
  1065. listCMV[i].materialList[2].ObjectTransform.startPos = new Vector3(0.5f, 0.3f, -0.05f);
  1066. listCMV[i].materialList[2].ObjectTransform.startRot = new Vector3(0, 30, 0);
  1067. listCMV[i].materialList[2].ObjectTransform.startScale = Vector3.one;
  1068. listCMV[i].materialList[3].ObjectTransform.startPos = new Vector3(-0.5f, -0.3f, 0);
  1069. listCMV[i].materialList[3].ObjectTransform.startRot = new Vector3(0, -30, 0);
  1070. listCMV[i].materialList[3].ObjectTransform.startScale = Vector3.one;
  1071. listCMV[i].materialList[4].ObjectTransform.startPos = new Vector3(0, -0.3f, 0);
  1072. listCMV[i].materialList[4].ObjectTransform.startRot = Vector3.zero;
  1073. listCMV[i].materialList[4].ObjectTransform.startScale = Vector3.one;
  1074. listCMV[i].materialList[5].ObjectTransform.startPos = new Vector3(0.5f, -0.3f, -0.05f);
  1075. listCMV[i].materialList[5].ObjectTransform.startRot = new Vector3(0, 30, 0);
  1076. listCMV[i].materialList[5].ObjectTransform.startScale = Vector3.one;
  1077. break;
  1078. default:
  1079. break;
  1080. }
  1081. break;
  1082. case "5":
  1083. for (int j = 0; j < listCMV[i].materialList.Count; j++)
  1084. {
  1085. listCMV[i].materialList[j].ObjectTransform.startPos = Vector3.zero;
  1086. listCMV[i].materialList[j].ObjectTransform.startRot = Vector3.zero;
  1087. listCMV[i].materialList[j].ObjectTransform.startScale = new Vector3(5, 5, 5);
  1088. }
  1089. break;
  1090. default:
  1091. break;
  1092. }
  1093. }
  1094. return listCMV;
  1095. }
  1096. public void AddListDaownLoad(DownLoadMaterial value)
  1097. {
  1098. for (int i = 0; i < listDownLoad.Count; i++)
  1099. {
  1100. if (listDownLoad[i].mObj.DownloadPath == value.mObj.DownloadPath )
  1101. return;
  1102. }
  1103. listDownLoad.Add(value);
  1104. }
  1105. public void SetObjectTransform( ObjectTransform obj)
  1106. {
  1107. obj = new ObjectTransform();
  1108. obj.Initialize();
  1109. }
  1110. /// <summary>
  1111. /// 获取当前时间的时间戳
  1112. /// </summary>
  1113. /// <returns></returns>
  1114. public int GetTimeStamp()
  1115. {
  1116. TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
  1117. return int.Parse( Convert.ToInt64(ts.TotalSeconds).ToString());
  1118. }
  1119. }
  1120. public enum MaterialType
  1121. {
  1122. NULL,
  1123. Image,
  1124. Video,
  1125. Model,
  1126. Text,
  1127. ImageorViedoAndText,
  1128. ModelAndText,
  1129. }
  1130. public enum SpoitType
  1131. {
  1132. Null,
  1133. ShanXin,
  1134. PingZiXing,
  1135. BingLie,
  1136. LunBo,
  1137. }
  1138. public enum SceneType
  1139. {
  1140. Vuforial,
  1141. PointCloud,
  1142. }
  1143. /// <summary>
  1144. /// 单个素材属性
  1145. /// </summary>
  1146. public class MaterialObjValue
  1147. {
  1148. public string name { get; set; }
  1149. public string type { get; set; } //图片/文字/视频/模型
  1150. public string textContent { get; set; } // 文字内容(如果类型不为文字 则为NULL)
  1151. public string textPosition { get; set; }// 文字位置(如果类型不为文字 则为NULL)
  1152. public string TextBJ { get; set; } // 文本框的背景 (如果类型不为文字 则为NULL)
  1153. public string DownloadPath { get; set; } // 下载地址 (如果类型是文字 则为NULL)
  1154. public string localSavePath { get; set; } // 保存在本地的地址默认为NULL
  1155. public string cdnUrl { get; set; } // CDN 下载资源
  1156. public ObjectTransform ObjectTransform { get; set; } //坐标 旋转 尺寸 如果没有数据的话默认为NULL
  1157. }
  1158. /// <summary>
  1159. /// 组合素材属性
  1160. /// </summary>
  1161. public class CompositeMaterialValue
  1162. {
  1163. public int id { get; set; }
  1164. public string name { get; set; }
  1165. // public String textContent { get; set; } //文字内容
  1166. public int type { get; set; } //1. 图片 2.视频 3.模型 4.文字 5.图片+文字/视频+文字 6.模型+文字
  1167. public string describe { get; set; } // 简介
  1168. public List<MaterialObjValue> materialList { get; set; }
  1169. public string icon { get; set; } // 缩略图下载地址
  1170. public int updateTime { get; set; } // 更新时间
  1171. public string template { get; set; } // 排列样式 没有的话为NULL
  1172. public ObjectTransform objectTransform { get; set; }
  1173. public int userId { get; set; }
  1174. public string typesetting { get; set; }
  1175. }
  1176. /// <summary>
  1177. /// 景点属性
  1178. /// </summary>
  1179. public class SpoitValue
  1180. {
  1181. public int id { get; set; }
  1182. //场景id
  1183. public int projectId { get; set; }
  1184. //景点名称
  1185. public string name { get; set; }
  1186. //更新时间
  1187. public int updateTime { get; set; }
  1188. //当前景点所有素材
  1189. public List<CompositeMaterialValue> material { get; set; }
  1190. //坐标 旋转 尺寸 如果没有数据的话默认为NULL
  1191. public ObjectTransform spoitTf { get; set; }
  1192. public List<MapPos> SpoitTransform { get; set; }
  1193. }
  1194. /// <summary>
  1195. /// 整个场景属性
  1196. /// </summary>
  1197. public class SceneValue
  1198. {
  1199. //场景名称
  1200. public string name { get; set; }
  1201. //人气
  1202. public string sentiment { get; set; }
  1203. //识别图XML文件
  1204. public string vuforiaXML { get; set; }
  1205. //识别图DAT文件
  1206. public string vuforiaDat { get; set; }
  1207. public int updateTime { get; set; }
  1208. //状态 0停用 1请用
  1209. public int status { get; set; }
  1210. //描述
  1211. public string describe { get; set; }
  1212. //场景照片
  1213. public string image { get; set; }
  1214. //沙盘
  1215. public string sandTable { get; set; }
  1216. //场景内所有景点信息
  1217. public List<SpoitValue> listSpoit { get; set; }
  1218. }
  1219. /// <summary>
  1220. /// 坐标 旋转 尺寸
  1221. /// </summary>
  1222. public class ObjectTransform
  1223. {
  1224. public Vector3 startPos { get; set; }
  1225. public Vector3 startRot { get; set; }
  1226. public Vector3 startScale { get; set; }
  1227. public Vector3 nowPos { get; set; }
  1228. public Vector3 nowRot { get; set; }
  1229. public Vector3 nowScale { get; set; }
  1230. public void Initialize()
  1231. {
  1232. startPos = Vector3.zero;
  1233. startRot = Vector3.zero;
  1234. startScale = Vector3.one;
  1235. InitializeNow();
  1236. }
  1237. public void InitializeNow()
  1238. {
  1239. nowPos = Vector3.zero;
  1240. nowRot = Vector3.zero;
  1241. nowScale = Vector3.zero;
  1242. }
  1243. public void InitializeObject(Transform objTransform)
  1244. {
  1245. InitializeNow();
  1246. SetObjectTransform(objTransform);
  1247. }
  1248. public void SetValue( Transform objTransform)
  1249. {
  1250. this.nowPos = objTransform.localPosition;
  1251. this.nowRot = objTransform.localEulerAngles;
  1252. if (objTransform.localScale == Vector3.zero)
  1253. nowScale = Vector3.one;
  1254. else
  1255. nowScale = objTransform.localScale;
  1256. }
  1257. public void SetObjectTransform( Transform objTransform)
  1258. {
  1259. if(nowScale == Vector3.zero)
  1260. {
  1261. if (startScale == Vector3.zero)
  1262. Initialize();
  1263. objTransform.localPosition = startPos;
  1264. objTransform.localEulerAngles = startRot;
  1265. objTransform.localScale = startScale;
  1266. }else
  1267. {
  1268. objTransform.localPosition = nowPos;
  1269. objTransform.localEulerAngles = nowRot;
  1270. objTransform.localScale = nowScale;
  1271. }
  1272. }
  1273. }
  1274. public class ScenesPage
  1275. {
  1276. public string name { get; set; }
  1277. public int id { get; set; }
  1278. }
  1279. public class ObjectTData
  1280. {
  1281. public Vector3 pos;
  1282. public Vector3 rot;
  1283. public Vector3 scale;
  1284. }
  1285. public class MapPos
  1286. {
  1287. public double X { get; set; }
  1288. public double Y { get; set; }
  1289. public double Z { get; set; }
  1290. public double T { get; set; }
  1291. }
  1292. class ValueObjs
  1293. {
  1294. public Transform all;
  1295. public List<Transform> showObj;
  1296. public ValueObjs(Transform allObj)
  1297. {
  1298. showObj = new List<Transform>();
  1299. all = allObj;
  1300. for (int i = 0; i < allObj.childCount; i++)
  1301. {
  1302. showObj.Add(allObj.GetChild(i));
  1303. }
  1304. }
  1305. }
  1306. public class SendInit
  1307. {
  1308. public string sn {get;set;}
  1309. public int projectId { get; set; }
  1310. }
  1311. public class SendLogin
  1312. {
  1313. public string email { get; set; }
  1314. public string password { get; set; }
  1315. }
  1316. public class SendMaterials
  1317. {
  1318. public string url { get; set; }
  1319. }
  1320. public class SendEditorData
  1321. {
  1322. public int id { get; set; }
  1323. public List<CompositeMaterialValue> material { get; set; }
  1324. public ObjectTransform spoittf { get; set; }
  1325. // public int visitcout { get; set; }
  1326. }
  1327. // 电量
  1328. public class SendNetConnectElectricity
  1329. {
  1330. public string sn { get; set; }
  1331. public int projectId { get; set; }
  1332. public int electricity { get; set; }
  1333. public string status { get; set; }
  1334. }
  1335. public class SendNetConnectAlert
  1336. {
  1337. public string sn { get; set; }
  1338. public int projectId { get; set; }
  1339. public string message { get; set; }
  1340. }
  1341. //触发
  1342. public class SendNetConnectPointTrigger
  1343. {
  1344. //projectId:"<uuid>",
  1345. //sn:"<string>",
  1346. //cmdType:"increasePointTrigger",
  1347. //viewpointId:"<uuid>",
  1348. //triggerTs:<int64>
  1349. //
  1350. public string name { get; set; }
  1351. public int projectId { get; set; }
  1352. public string sn { get; set; }
  1353. }
  1354. //位置
  1355. public class SendNetConnectPointCloud
  1356. {
  1357. public int projectId { get; set; }
  1358. public string sn { get; set; }
  1359. public string positionType { get; set; }
  1360. public Position position;
  1361. public SendNetConnectPointCloud()
  1362. {
  1363. this.position = new Position();
  1364. }
  1365. }
  1366. public class Position
  1367. {
  1368. public float x { get; set; }
  1369. public float y { get; set; }
  1370. public float z { get; set; }
  1371. }
  1372. public class AppConfigConst
  1373. {
  1374. public static string IMAGE_TARGET_FILE_PATH = ""; //http url http://29.193.45.32:8080/U3dFileToServer/upLoad/AssetBundle/ 存放目录
  1375. public static string IMAGE_TARGET_FILE_NAME = "YCYL3_3Test";
  1376. }
  1377. //public class JsonSceneValue
  1378. //{
  1379. // //场景名称
  1380. // public string name { get; set; }
  1381. // //人气
  1382. // public string sentiment { get; set; }
  1383. // //识别图XML文件
  1384. // public string vuforiaXML { get; set; }
  1385. // //识别图DAT文件
  1386. // public string vuforiaDat { get; set; }
  1387. // public long updateTime { get; set; }
  1388. // //状态 0停用 1请用
  1389. // public int status { get; set; }
  1390. // //描述
  1391. // public string describe { get; set; }
  1392. // //场景照片
  1393. // public string image { get; set; }
  1394. // //场景内所有景点信息
  1395. // public List<JsonSpoitValue> listSpoit { get; set; }
  1396. //}
  1397. //public class JsonSpoitValue
  1398. //{
  1399. // //场景id
  1400. // public int projectId { get; set; }
  1401. // //景点名称
  1402. // public String name { get; set; }
  1403. // //更新时间
  1404. // public long updateTime { get; set; }
  1405. // //当前景点所有素材
  1406. // public List<JsonMaterialValue> listMaterial { get; set; }
  1407. // //坐标 旋转 尺寸 如果没有数据的话默认为NULL
  1408. // public ObjectTransform spoitTransform { get; set; }
  1409. //}
  1410. //public class JsonMaterialValue
  1411. //{
  1412. // public string Name { get; set; }
  1413. // public String textContent { get; set; } //文字内容
  1414. // public long updateTime { get; set; } // 更新时间
  1415. // public string template { get; set; } // 排列样式
  1416. // public string describe { get; set; } // 简介
  1417. // public MaterialType type { get; set; } // 图片/视频/模型/
  1418. // public int textStyle { get; set; } // 文本框的背景
  1419. // public string icon { get; set; } // 缩略图下载地址
  1420. // public List<string> listDownloadPath { get; set; } // 下载地址组
  1421. // public List<string> localSavePath { get; set; } // 保存在本地的地址组 默认为NULL
  1422. // public ObjectTransform textTransform { get; set; }
  1423. // public ObjectTransform materialTransform { get; set; } // 坐标 旋转 尺寸
  1424. //}