12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691 |
- 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 ImageTargetManager targetManager;
- 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;
- /// <summary>
- /// ARCore 识别图
- /// </summary>
- public List<String> listImageTracked = new List<string>();
- public Dictionary<string, Sprite> dicImageTracked = new Dictionary<string, Sprite>();
- List<DownLoadMaterial> listDownLoad = new List<DownLoadMaterial>();
-
- public bool state = false;
- public bool finish = true; // ARCore 动态识别图加载完毕
- public GameObject uiMove;
- public GameObject Saloon;
- // Start is called before the first frame update
- void Start()
- {
- 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;
- finish = false;
-
- }
- // 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)
- {
- Debug.Log("素材下载结束 ARCore识别图加载完成 打开编辑界面");
- text3.text = "素材下载结束 ARCore识别图加载完成 打开编辑界面";
- finish = false;
- state = false;
- SandTable.Instance.OpenSandTable();
- LoadShow.Instance.ViewShow(false);
- // OpenPlanel();
- // LoginPanel.Instance.gameObject.SetActive(false);
- }
- }
- 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(listLocalCMVs);
- //Debug.Log("%%%%%%%%%% " + str);
- //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);
- // VuforialControl.Instance.LoadARCamera();
- scene.listSpoit.ForEach(item =>
- {
- Debug.Log(item.name + " @@@@#### " + item.spoitTf.nowPos);
- // LoadSpoitObj(item.name, item);
- });
- UIKit.OpenPanel<EditorPanel>(new EditorPanelData() { SceneValue = scene, listLocalMaterials = listLocalCMVs, listUpLoadMaterials = listCMValue });
-
- // targetManager.enabled = true;
- uiMove.SetActive(true);
- }
- 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>();
-
- // 上传
- for (int i = 0; i < scene.listSpoit.Count; i++)
- {
- Debug.Log("a上传 " + scene.listSpoit[i].spoitTf.nowPos);
- // string spoittf = JsonMapper.ToJson(scene.listSpoit[i].spoitTf);
- SendEditorData data = new SendEditorData();
- data.material = scene.listSpoit[i].material;
- data.spoittf = scene.listSpoit[i].spoitTf;
- data.id = scene.listSpoit[i].id;
- // data.visitcout = 1;
- listSendData.Add(data);
-
- }
- try
- {
- // string sendData = JsonMapper.ToJson(listSendData);
- string sendData = JsonConvert.SerializeObject(listSendData);
- Debug.Log("b上传 " + sendData);
- text2.text = sendData;
- HttpTool.Instance.PostTest("/viewpoint/update", sendData, SaveCallBack);
- }
- catch (Exception e)
- {
- Debug.LogError(e);
- ErrorLogPanel.Instance.Show(" 上传失败 ");
- }
-
- // 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");
- }
-
-
- /// <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)
- scene.listSpoit[i].spoitTf = startObjTransform;
- 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].type +" @@@@@@@@@");
- 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);
- if (str.IsNotNullAndEmpty())
- {
- str = str.Substring(0, str.Length - 4);
- 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<DownLoadMaterial> listDownload2 = new List<DownLoadMaterial>();
- for (int i = 0; i < scene.listSpoit.Count; i++)
- {
- scene.listSpoit[i].localTriggerImage = Application.persistentDataPath + "/ImageTracked/" + Path.GetFileName(scene.listSpoit[i].triggerImage);
- Debug.Log(scene.listSpoit[i].triggerImage);
- Debug.Log(scene.listSpoit[i].localTriggerImage);
- MaterialObjValue imageTracked = new MaterialObjValue();
- imageTracked.name = scene.listSpoit[i].name;
- imageTracked.type = "1";
- imageTracked.DownloadPath = scene.listSpoit[i].triggerImage;
- imageTracked.localSavePath = scene.listSpoit[i].localTriggerImage;
- listDownLoad.Add(new DownLoadMaterial(imageTracked, scene.listSpoit[i].updateTime));
-
- }
- SettingImageTarked( scene );
- //Debug.Log(listDownload2.Count);
- //for (int i = 0; i < listDownload2.Count; i++)
- //{
- // Debug.Log(listDownload2[i].mObj.localSavePath);
- //}
- 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);
- }
-
- //for (int i = 0; i < listProcessCMV.Count; i++)
- //{
- // Debug.Log("######### "+listProcessCMV[i].name);
- //}
- 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);
- 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);
-
-
- // listCMV[i].materialList[j].ObjectTransform = startObjTransform;
- 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].icon != "")
- {
- MaterialObjValue mObj = new MaterialObjValue();
- mObj.name = listCMV[i].name;
- mObj.DownloadPath = listCMV[i].icon;
- mObj.type = "1";
- mObj.localSavePath = Application.persistentDataPath + "/Image/" + Path.GetFileName(listCMV[i].icon);
- DownLoadMaterial value = new DownLoadMaterial(mObj, listCMV[i].updateTime);
- if (finish)
- AddListDaownLoad(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 +" "+ listCMV[i].materialList[j].type);
- 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));
- 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));
- 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));
- 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;
- }
- }
- //for (int i = 0; i < listCMV.Count; i++)
- //{
- // for (int j = 0; j < listCMV[i].materialList.Count; j++)
- // {
- // Debug.Log(listCMV[i].materialList[j].name + " " + listCMV[i].materialList[j].ObjectTransform.startPos.x);
- // }
- //}
- return listCMV;
- }
- public void AddListDaownLoad(DownLoadMaterial value)
- {
- for (int i = 0; i < listDownLoad.Count; i++)
- {
- if (listDownLoad[i].mObj.DownloadPath == value.mObj.DownloadPath || listDownLoad[i].mObj.type=="4")
- return;
- }
- listDownLoad.Add(value);
- }
- public void SetObjectTransform(ObjectTransform obj)
- {
- obj = new ObjectTransform();
- obj.startPos = Vector3.zero;
- obj.startRot = Vector3.zero;
- obj.startScale = Vector3.one;
- obj.nowPos = Vector3.zero;
- obj.nowRot = Vector3.zero;
- obj.nowScale = Vector3.zero;
- }
- /// <summary>
- /// ARCore 识别图排序
- /// </summary>
- /// <param name="scene"></param>
- public void SettingImageTarked( SceneValue scene )
- {
-
- List<SpoitImage> list_spoitImage = new List<SpoitImage>();
- for (int i = 0; i < scene.listSpoit.Count; i++)
- {
- list_spoitImage.Add(new SpoitImage(scene.listSpoit[i].id, scene.listSpoit[i].localTriggerImage));
- }
- SpoitImage spoitImage = null;
- for (int i = 0; i < list_spoitImage.Count; i++)
- {
- for (int j = 0; j < list_spoitImage.Count ; j++)
- {
- if(list_spoitImage[i].id<list_spoitImage[j].id)
- {
- spoitImage = list_spoitImage[i];
- list_spoitImage[i] = list_spoitImage[j];
- list_spoitImage[j] = spoitImage;
- spoitImage = null;
- }
- }
- }
- for (int i = 0; i < list_spoitImage.Count; i++)
- {
- Debug.Log(list_spoitImage[i].id + " ###@@@ " + list_spoitImage[i].localSave);
- listImageTracked.Add(list_spoitImage[i].localSave);
- }
- for (int i = 0; i < listImageTracked.Count; i++)
- {
- Debug.Log(listImageTracked[i] + " ####@@@@@");
- }
- //for (int i = 0; i < list_Spoit.Count; i++)
- //{
- // Debug.Log("#############" + list_Spoit[i].name);
- // listImageTracked.Add(list_Spoit[i].localTriggerImage);
- // // dicImageTracked.Add(list_Spoit[i].localTriggerImage, null);
- //}
- }
- /// <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; }
- 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 string triggerImage { get; set; }
- // 识别图本地地址
- public string localTriggerImage { 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 class SpoitImage
- {
- public int id { get; set; }
- public string localSave { get; set; }
- public SpoitImage( int ID, string LocalSave)
- {
- this.id = ID;
- this.localSave = LocalSave;
- }
- }
- public class ObjectTData
- {
- public Vector3 pos;
- public Vector3 rot;
- public Vector3 scale;
- }
- public class ScenesPage
- {
- public string name { get; set; }
- public int id { get; set; }
- }
- 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 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; } // 坐标 旋转 尺寸
- //}
|