12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888 |
- <!-- 实现具体3d逻辑使用 -->
- <script setup lang="ts">
- import CourseChapter3dMain from '@/components/student/CourseChapter3dMain.vue';
- import { threeWorld } from "@/stores/threeWorld.ts";
- import { courseChapter3dShow } from "@/stores/courseChapter3dShow.ts";
- import { HighlightLayerEvent } from "@/components/student/event/HighlightLayerEvent.ts";
- import { DragAndDropEvent } from "@/components/student/event/DragAndDropEvent.ts";
- import { TypeViewEvent } from "@/components/student/event/TypeViewEvent.ts";
- import { RenderEvent } from "@/components/student/event/RenderEvent.ts";
- import { ref, watch } from "vue";
- const props = defineProps({
- config : {
- type: Object
- },
- // 获取当前学生任务ID缺陷列表
- studentTaskIdList : {
- type: Object
- },
- });
- // 定义发射给父组件的方法
- const emits = defineEmits([
- // 上一步是否显示
- 'tipsBtnsUpOpen',
- // 下一步是否显示
- 'tipsBtnsDownOpen',
- ]);
- // setInterval(function() {
- // console.log(
- // "3d场景参数", props.config
- // );
- // }, 1000);
- // 处理哪些物体显示高光效果
- let objHighlightLayerEvent = new HighlightLayerEvent();
- // 处理指定物体拖拽逻辑
- let objDragAndDropEvent = new DragAndDropEvent();
- // 根据配置的流程切换对应的3d界面逻辑
- let objTypeViewEvent = new TypeViewEvent();
- // 3d渲染帧事件处理
- let objRenderEvent = new RenderEvent();
- // // 【开发的时候】3d场景,iframe地址
- // let threeWorldUrl = "3dMain/index.html#/main?id=zidingyi";
- // babylon 对象
- let BABYLON : any = null;
- // let commonconfig = "http://localhost:5173/3dMain/model2/";
- // let commonmodel = "http://localhost:5173/3dMain/model2/";
- // let threeWorldUrl = "3dMain/index.html#/main?id=zidingyi_lu_cun&user=zidingyi"
- // + '&commonconfig=' + commonconfig
- // + '&commonmodel=' + commonmodel;
- // // 【发布的时候】3d场景,iframe地址
- // // 配置文件地址
- // // let commonconfig = "https://www.3dyzt.com/eduTrain/3dMain/model/";
- // let commonconfig = "https://www.3dyzt.com/ShiZhengGuanWangZhiNengJianCeYuWeiHu/user_web/3dMain/model2/";// 正式
- // // let commonconfig = "https://www.3dyzt.com/eduTrain/3dMain/model3/";// 临时测试
- // // 模型地址
- // // let commonmodel = "https://www.3dyzt.com/eduTrain/3dMain/model/";
- // let commonmodel = "https://www.3dyzt.com/ShiZhengGuanWangZhiNengJianCeYuWeiHu/user_web/3dMain/model2/";// 正式
- // // let commonmodel = "https://www.3dyzt.com/eduTrain/3dMain/model3/";// 临时测试
- // // 发布后的地址
- // let threeWorldUrl = "https://www.3dyzt.com/main/index.html#/main?id=zidingyi&user=zidingyi&commonconfig=" + commonconfig + "&commonmodel=" + commonmodel;
- let threeWorldHost = import.meta.env.VITE_APP_THREE_WORLD_URL;
- // let commonconfig = threeWorldHost + "3dMain/model2/";
- // let commonmodel = threeWorldHost + "3dMain/model2/";
- let commonconfig = threeWorldHost + "3dMain/model_cctv/";
- let commonmodel = threeWorldHost + "3dMain/model_cctv/";
- let threeWorldUrl = "3dMain/index.html#/main?id=zidingyi_lu_cun&user=zidingyi"
- + '&commonconfig=' + commonconfig
- + '&commonmodel=' + commonmodel;
- /**
- * 上一步是否显示
- * open true - 显示, false - 隐藏
- */
- const tipsBtnsUpOpenEvent = (open : Boolean) => {
- emits('tipsBtnsUpOpen', open);
- }
- /**
- * 下一步是否显示
- * open true - 显示, false - 隐藏
- */
- const tipsBtnsDownOpenEvent = (open : Boolean) => {
- emits('tipsBtnsDownOpen', open);
-
- }
- // 记录当前的流程
- let thisFlowPath : any = null;
- // 记录最后一次播放完成的状态
- let thisFlowPathEnd : any = null;
- /**
- * 监听发送参数变化,流程完成的时候
- */
- watch(
- () => courseChapter3dShow().show.showEndViewBool,
- (newVal, oldVal) => {
- // console.log(
- // newVal, oldVal,
- // props.config
- // );
-
- // 如果没有加载完成,则不触发后面的逻辑
- if (courseChapter3dShow().show.showEndViewBool == false) {
- return;
- }
- if (thisFlowPathEnd != thisFlowPath) {
- thisFlowPathEnd = thisFlowPath;
- // 启动播放声音
- objTypeViewEvent.musicConfigPlay(
- thisFlowPath, "end"
- );
- }
- }
- );
- /**
- * 监听发送参数变化,来控制切换3d的逻辑
- */
- watch(
- () => props.config,
- (newVal, oldVal) => {
- // console.log(
- // newVal, oldVal,
- // props.config
- // );
-
- // 如果没有加载完成,则不触发后面的逻辑
- if (threeWorld().loadSuccess == false) {
- return;
- }
- typeEvent(props.config?.threeDimensionalConfig);
- }
- );
- /**
- * 监听弹出提示隐藏后来触发不同的逻辑
- */
- watch(
- () => courseChapter3dShow().show.showToastViewBool,
- (newVal, oldVal) => {
- if (courseChapter3dShow().show.showToastViewBool == true) {
- return;
- }
-
- console.log(
- " () => courseChapter3dShow().show.showToastState 2222222222 ",
- courseChapter3dShow().show.showToastState
- );
- switch (courseChapter3dShow().show.showToastState) {
- case '立即穿戴':
- objTypeViewEvent.workRoleClothingUpdate("yes", false);
- break;
- case '去摆放':
- console.log(
- "去摆放触发了 animationSecurityZoneStart(安全桩001|西区实训基地-烘|BaseLayer)",
- courseChapter3dShow().show.showToastViewBool
- );
- objTypeViewEvent.animationSecurityZoneStart("安全桩001|西区实训基地-烘|BaseLayer");
- break;
- case '将抬升支架降至最低':
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo("相机上升");
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(false);
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "主机升降", 'start', 1, null, null, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- break;
- case '镜头旋转至正上方':
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo("镜头归位");
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(false);
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "相机", 'start', 1, 0, 60, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- break;
- case '摆放线缆盘线缆盘方向与爬行器爬行的方向一致':
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo("连接电缆");
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(false);
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "电缆拔出", 'start', 1, null, null, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
-
- break;
- case '镜头归位':
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo("镜头归位");
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(false);
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "相机", 'start', 1, 60, 240, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- break;
- case '调节行驶方向正确放置过线滑轮':
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo("相机上升");
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(false);
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "轮子滚动", 'start', 1, null, null, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- break;
-
- }
-
- }
- );
- /**
- * 监听发送参数变化
- * 控制主光强度
- */
- watch(
- () => courseChapter3dShow().show.lightMain,
- (newVal, oldVal) => {
-
- // 如果没有加载完成,则不触发后面的逻辑
- if (threeWorld().loadSuccess == false) {
- return;
- }
- // 最大强度值
- // let intensityMax = 99999 * 2;
- // let intensityMax = 200 * 2;
- // let intensityMax = 100 * 2;
- let intensityMax = 100;
- let newIntensity = courseChapter3dShow().show.lightMain / 100 * intensityMax;
- objTypeViewEvent.spotLightCameraUpdateConfig(newIntensity);
-
- }
- );
- /**
- * 监听发送参数变化
- * 控制辅光强度
- */
- watch(
- () => courseChapter3dShow().show.lightAssist,
- (newVal, oldVal) => {
-
- // 如果没有加载完成,则不触发后面的逻辑
- if (threeWorld().loadSuccess == false) {
- return;
- }
- // 最大强度值
- // let intensityMax = 999 * 1;
- // let intensityMax = 800 * 1;
- // let intensityMax = 10;
- let intensityMax = 8;
- let newIntensity = courseChapter3dShow().show.lightAssist / 100 * intensityMax;
- objTypeViewEvent.pointLightCameraUpdateConfig(newIntensity);
-
- }
- );
- /**
- * 回调加载百分比
- */
- const callbackLoadPercentageEvent = (json: { loadPercentage: any; }) => {
- // console.log("回调加载百分比", json)
- const loadPercentage = parseFloat(json["loadPercentage"]);
- // 加载小于百分比
- if (loadPercentage < 100) {
- // ##############################【这里只做控制】隐藏其他按钮界面等
- threeWorld().loadSuccess = false;
- goPlayCallbackEventMain();
- return
- }
- }
- /**
- * 回调加载完成
- */
- const callbackLoadEndEvent = (json : { 'roleChoiceOpenBool' : true }) => {
- // console.log("回调加载完成", json)
- // 此时是显示角色的界面
- if (json["roleChoiceOpenBool"] === true) {
- // ############################## 隐藏其他按钮界面等
- threeWorld().loadSuccess = false;
-
- return;
- }
- // ############################## 这个时候,是真正的进入3d画面了,才显示其他按钮界面等
- threeWorld().loadSuccess = true;
- // @ts-ignore
- BABYLON = threeWorld().obj.newIframe.objIframe.BABYLON;
- objHighlightLayerEventInit();
- objDragAndDropEventInit();
- objTypeViewEventInit();
- objRenderEventInit();
- threeEvent();
- animationAllFpsToZero();
- pipelineProblemsJsonInitEvent();
- birthPointInit();
- carMoveSpeedInitEvent();
- // @ts-ignore 设置鼠标右键平移
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CameraArray.find().jsonCamera.panningSensibility = 8;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CameraArray.find().activeCameraConfigUpdate();
-
- try {
-
- // 更新角色的固定皮肤
- // @ts-ignore
- let roleCode = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().roleCode;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().roleCodeAllConfig[roleCode]["skinUpdate"] = "exhibition_html_1709861931375_";
- } catch (e) {
- }
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(true);
- // @ts-ignore 解决角色有时候出现不了的问题
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.EventMoveRole.find().roleRotationYMove(180);
- setTimeout(function() {
- initScene();
- getRndArrayDemoEvent();
- workRoleTexture();
- }, 3000);
-
- }
- /**
- * 回调距离范围内
- */
- const callbackDistanceYesEvent = (json : any) => {
- // console.log("回调距离范围内", json);
- }
- /**
- * 回调距离范围外
- */
- const callbackDistanceNoEvent = (json : any) => {
- // console.log("回调距离范围外", json);
- }
- /**
- * 回调视角切换完成
- */
- const callbackCameraVisualAngleJsonToLookEvent = (json : any) => {
- // console.log("视角触发完成", json);
- }
- /**
- * 记录出生点
- */
- const birthPointInit = () => {
- courseChapter3dShow().show.birthPoint = {};
- // @ts-ignore
- for (let i = 0; i < threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonBirthplace.find().list.length; i++) {
- // @ts-ignore
- let json = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonBirthplace.find().list[i];
- // console.log(
- // "json", json
- // );
- // @ts-ignore
- courseChapter3dShow().show.birthPoint[json.name] = json;
- }
- // console.log(
- // "courseChapter3dShow().show.birthPoint = {};",
- // courseChapter3dShow().show.birthPoint
- // );
-
- }
- /**
- * 记录3d里配置的移动速度
- */
- const carMoveSpeedInitEvent = () => {
- // // @ts-ignore
- // let objRoleConfig = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().roleCodeAllConfig[
- // // @ts-ignore
- // threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().roleCode
- // ];
- // @ts-ignore
- let roleConfig = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().roleConfig;
-
- courseChapter3dShow().show.carMoveSpeed = parseFloat("" + roleConfig.speedMove);
- // console.log(
- // "roleConfig",
- // roleConfig,
- // "courseChapter3dShow().show.carMoveSpeed",
- // courseChapter3dShow().show.carMoveSpeed
- // );
-
- }
- /**
- * 初始化 处理高光效果的对象
- */
- const objHighlightLayerEventInit = () => {
-
- // @ts-ignore
- objHighlightLayerEvent.BABYLON = threeWorld().obj.newIframe.objIframe.BABYLON;
- // @ts-ignore
- objHighlightLayerEvent.ChengGuangYuanJing = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing;
- // @ts-ignore
- objHighlightLayerEvent.objIframe = threeWorld().obj.newIframe.objIframe;
- // 设置回调方法
- objHighlightLayerEvent.tipsBtnsUpOpenEventCallback = function(open : Boolean) {
- tipsBtnsUpOpenEvent(open);
- }
- objHighlightLayerEvent.tipsBtnsDownOpenEventCallback = function(open : Boolean) {
- tipsBtnsDownOpenEvent(open);
- }
-
- }
- /**
- * 初始化 处理指定物体拖拽逻辑
- */
- const objDragAndDropEventInit = () => {
-
- // @ts-ignore
- objDragAndDropEvent.BABYLON = threeWorld().obj.newIframe.objIframe.BABYLON;
- // @ts-ignore
- objDragAndDropEvent.ChengGuangYuanJing = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing;
- // @ts-ignore
- objDragAndDropEvent.objIframe = threeWorld().obj.newIframe.objIframe;
- objDragAndDropEvent.objHighlightLayerEvent = objHighlightLayerEvent;
- // 设置回调方法
- objDragAndDropEvent.tipsBtnsUpOpenEventCallback = function(open : Boolean) {
- tipsBtnsUpOpenEvent(open);
- }
- objDragAndDropEvent.tipsBtnsDownOpenEventCallback = function(open : Boolean) {
- tipsBtnsDownOpenEvent(open);
- }
-
- }
- /**
- * 初始化 根据配置的流程切换对应的3d界面逻辑
- */
- const objTypeViewEventInit = () => {
-
- // @ts-ignore 记录该对象,全局使用
- courseChapter3dShow().show.objTypeViewEvent = objTypeViewEvent;
- // @ts-ignore
- objTypeViewEvent.BABYLON = threeWorld().obj.newIframe.objIframe.BABYLON;
- // @ts-ignore
- objTypeViewEvent.ChengGuangYuanJing = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing;
- // @ts-ignore
- objTypeViewEvent.objIframe = threeWorld().obj.newIframe.objIframe;
- objTypeViewEvent.objHighlightLayerEvent = objHighlightLayerEvent;
- // 设置回调方法
- objTypeViewEvent.tipsBtnsUpOpenEventCallback = function(open : Boolean) {
- tipsBtnsUpOpenEvent(open);
- }
- objTypeViewEvent.tipsBtnsDownOpenEventCallback = function(open : Boolean) {
- tipsBtnsDownOpenEvent(open);
- }
-
- objTypeViewEvent.musicConfig = {
- "请走到工作区域" : {
- // 进入流程播放如何完成任务的声音
- // "start" : new URL("./../../assets/music/demo.mp3", import.meta.url).href,
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startgongzuoquyu.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startgongzuoquyu.mp3", import.meta.url).href,
- // 完成任务播放的声音
- // "end" : new URL("./../../assets/music/demo2.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endgongzuoquyu.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endgongzuoquyu.mp3", import.meta.url).href,
- },
- "请点击人物进行穿搭衣服" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startgongzuofu.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endgongzuofu.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startgongzuofu.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endgongzuofu.mp3", import.meta.url).href,
- },
- "将四个安全桩放置到正确的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startanquanzhuang.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endanquanzhuang.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startanquanzhuang.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endanquanzhuang.mp3", import.meta.url).href,
- },
- "将盒子拆开把设备拿出来" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startxiangzi.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endxiangzi.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startxiangzi.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endxiangzi.mp3", import.meta.url).href,
- },
- "将盒子拆开把设备放置在安全的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startxiangzi.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endxiangzi.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startxiangzi.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endxiangzi.mp3", import.meta.url).href,
- },
- "将检测机器人6寸轮子安装到正确位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startsixlunzi.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endsixlunzi.mp3.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startsixlunzi.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endsixlunzi.mp3", import.meta.url).href,
- },
- "将检测机器人的轮子安装到正确的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/starttenlunzi.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/enttenlunzi.mp3.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/starttenlunzi.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/enttenlunzi.mp3", import.meta.url).href,
- },
- "将检测机器人6寸右侧轮子安装到正确位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio_1/startSixChunLunZiYouChe.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio_1/endSixChunLunZiYouChe.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startSixChunLunZiYouChe.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endSixChunLunZiYouChe.mp3", import.meta.url).href,
- },
- "将检测机器人6寸左侧轮子安装到正确位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio_1/startSixChunLunZiZuoChe.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio_1/endSixChunLunZiZuoChe.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startSixChunLunZiZuoChe.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endSixChunLunZiZuoChe.mp3", import.meta.url).href,
- },
- "将检测机器人10寸右侧轮子安装到正确位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio_1/startTenChunLunZiYouChe.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio_1/endTenChunLunZiYouChe.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startTenChunLunZiYouChe.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endTenChunLunZiYouChe.mp3", import.meta.url).href,
- },
- "将检测机器人10寸左侧轮子安装到正确位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio_1/startTenChunLunZiZuoChe.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio_1/endTenChunLunZiZuoChe.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startTenChunLunZiZuoChe.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endTenChunLunZiZuoChe.mp3", import.meta.url).href,
- },
-
- "将检测机器人的防撞杆安装到正确的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startfangzhuanggan.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endfangzhuanggan.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startfangzhuanggan.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endfangzhuanggan.mp3", import.meta.url).href,
- },
- "将检测机器人的防撞杆锁安装到正确的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startfangzhuanggansuo.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endfangzhuanggansuo.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startfangzhuanggansuo.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endfangzhuanggansuo.mp3", import.meta.url).href,
- },
- "将检测机器人的镜头架安装到正确的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startxiangji.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endxiangji.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startxiangji.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endxiangji.mp3", import.meta.url).href,
- },
- "将检测机器人的相机安装到正确的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startxiangji.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endxiangji.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startxiangji.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endxiangji.mp3", import.meta.url).href,
- },
- "将绕线车的电源线安装到正确的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startdianyuanxian.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/enddianyuanxian.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startdianyuanxian.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/enddianyuanxian.mp3", import.meta.url).href,
- },
- "将绕线车的纠偏轮安装到正确的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startjiupianlun.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endjiupianlun.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startjiupianlun.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endjiupianlun.mp3", import.meta.url).href,
- },
- "将绕线车的锂电池安装到正确的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startlidianchi.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endlidianchi.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startlidianchi.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endlidianchi.mp3", import.meta.url).href,
- },
- "将绕线车的电脑主机放置到正确的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startdiannaozhuji.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/enddiannaozhuji.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startdiannaozhuji.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/enddiannaozhuji.mp3", import.meta.url).href,
- },
- "将绕线车的手柄安装到正确的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startCaoZuoShouBin.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endCaoZuoShouBin.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startCaoZuoShouBin.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endCaoZuoShouBin.mp3", import.meta.url).href,
- },
- "将绕线车的电缆安装到正确的位置" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startDianLan.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endDianLan.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startDianLan.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endDianLan.mp3", import.meta.url).href,
- },
- "抬升支架降至最低" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startZhiJia.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endZhiJia.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startZhiJia.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endZhiJia.mp3", import.meta.url).href,
- },
- "镜头旋转至正上方" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startXiangJiShang.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endXiangJiShang.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startXiangJiShang.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endXiangJiShang.mp3", import.meta.url).href,
- },
- "镜头归位" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startXiangJiGuiWei.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endXiangJiGuiWei.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startXiangJiGuiWei.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endXiangJiGuiWei.mp3", import.meta.url).href,
- },
- "调节行驶方向正确放置过线滑轮" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startXingShiFangXiang.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endXingShiFangXiang.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startXingShiFangXiang.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endXingShiFangXiang.mp3", import.meta.url).href,
- },
- "打开井盖" : {
- // "start" : new URL("./../../assets/music/threeWorld/tts_audio/startJingGai.mp3", import.meta.url).href,
- // "end" : new URL("./../../assets/music/threeWorld/tts_audio/endJingGai.mp3", import.meta.url).href,
- "start" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/startJingGai.mp3", import.meta.url).href,
- "end" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/endJingGai.mp3", import.meta.url).href,
- },
- "车辆超速" : {
- // "carSpeeding" : new URL("./../../assets/music/threeWorld/tts_audio_1/chaoSuTiXing.mp3", import.meta.url).href,
- "carSpeeding" : new URL("./../../assets/music/threeWorld/tts_audio_04_09/chaoSuTiXing.mp3", import.meta.url).href,
- },
- "爬行器" : {
- "introduce" : new URL("./../../assets/music/audio/paXingQi.mp3", import.meta.url).href,
- },
- "爬行器_LED前灯" : {
- "introduce" : new URL("./../../assets/music/audio/paXingQiLedQianDeng.mp3", import.meta.url).href,
- },
- "爬行器_防撞杆" : {
- "introduce" : new URL("./../../assets/music/audio/paXingQiFangZhuangGan.mp3", import.meta.url).href,
- },
- "爬行器_后置相机" : {
- "introduce" : new URL("./../../assets/music/audio/paXingQiHouZhiXiangJi.mp3", import.meta.url).href,
- },
- "爬行器_检测车身" : {
- "introduce" : new URL("./../../assets/music/audio/paXingQiJianCheCheShen.mp3", import.meta.url).href,
- },
- "爬行器_连接线缆" : {
- "introduce" : new URL("./../../assets/music/audio/paXingQiLianJieXianLan.mp3", import.meta.url).href,
- },
- "爬行器_轮子" : {
- "introduce" : new URL("./../../assets/music/audio/paXingQiLunZi.mp3", import.meta.url).href,
- },
- "爬行器_前置相机" : {
- "introduce" : new URL("./../../assets/music/audio/paXingQiQianZhiXiangJi.mp3", import.meta.url).href,
- },
- "爬行器_升降支架" : {
- "introduce" : new URL("./../../assets/music/audio/paXingQiShengJiangZhiJia.mp3", import.meta.url).href,
- },
- "线缆卷盘" : {
- "introduce" : new URL("./../../assets/music/audio/xianLanJuanPan.mp3", import.meta.url).href,
- },
- "线缆卷盘_电源连线" : {
- "introduce" : new URL("./../../assets/music/audio/xianLanJuanPanDianYuanLianXian.mp3", import.meta.url).href,
- },
- "线缆卷盘_控制手柄" : {
- "introduce" : new URL("./../../assets/music/audio/xianLanJuanPanKongZhiShouBing.mp3", import.meta.url).href,
- },
- "线缆卷盘_控制终端" : {
- "introduce" : new URL("./../../assets/music/audio/xianLanJuanPanKongZhiZhongDuan.mp3", import.meta.url).href,
- },
- "线缆卷盘_锂电池" : {
- "introduce" : new URL("./../../assets/music/audio/xianLanJuanPanLiDianChi.mp3", import.meta.url).href,
- },
- "线缆卷盘_连接线缆" : {
- "introduce" : new URL("./../../assets/music/audio/xianLanJuanPanLianJieXianLan.mp3", import.meta.url).href,
- },
-
- }
-
- }
- /**
- * 初始化 3d渲染帧事件处理
- */
- const objRenderEventInit = () => {
-
- // @ts-ignore
- objRenderEvent.BABYLON = threeWorld().obj.newIframe.objIframe.BABYLON;
- // @ts-ignore
- objRenderEvent.ChengGuangYuanJing = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing;
- // @ts-ignore
- objRenderEvent.objIframe = threeWorld().obj.newIframe.objIframe;
- // 设置回调方法
- objRenderEvent.tipsBtnsUpOpenEventCallback = function(open : Boolean) {
- tipsBtnsUpOpenEvent(open);
- }
- objRenderEvent.tipsBtnsDownOpenEventCallback = function(open : Boolean) {
- tipsBtnsDownOpenEvent(open);
- }
-
- }
- setInterval(function() {
- // 如果没有加载完成,则不触发后面的逻辑
- if (threeWorld().loadSuccess == false) {
- return;
- }
- // 更新时间
- var cur = new Date(); // 创建当前日期对象 cur
- var years = cur.getFullYear(); // 从日期对象cur中取得年数
- var months = cur.getMonth() + 1; // 取得月数
- var days = cur.getDate(); // 取得天数
- var hours = cur.getHours(); // 取得小时数
- var minutes = cur.getMinutes(); // 取得分钟数
- courseChapter3dShow().show.showCarEyeYears = years;
- courseChapter3dShow().show.showCarEyeMonths = months;
- courseChapter3dShow().show.showCarEyeDays = days;
- courseChapter3dShow().show.showCarEyeHours = hours;
- courseChapter3dShow().show.showCarEyeMinutes = minutes;
-
- }, 1000);
- /**
- * 监听是否点击 进入活动,或者是点击屏幕进入3d场景回调
- */
- const goPlayCallbackEventMain = () => {
- if (
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.window["goPlayCallbackEvent"] != null
- // @ts-ignore
- && threeWorld().obj.newIframe.objIframe.window["goPlayCallbackEvent"] != undefined
- ) {
- return;
- }
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.window["goPlayCallbackEvent"] = function(res : any) {
- // console.log(
- // " ========== 监听是否点击 进入活动,或者是点击屏幕进入3d场景 ========== ",
- // res
- // );
- setTimeout(function() {
- initScene();
- }, 200);
- }
- }
- /**
- * 记录点击的时候最后的时间戳
- * 用于后续,点击放开后,是否触发增加点击的值的逻辑
- */
- let clickTime = ref(0);
- /**
- * 控制多少毫秒触发一次逻辑
- */
- let threeEventRenderTime = 0;
- /**
- * 控制多少毫秒触发一次逻辑
- */
- let threeEventRenderTimeTwo = 0;
- /**
- * 控制多少毫秒触发一次逻辑
- */
- let threeEventRenderTimeThree = 0;
- /**
- * 符合条件下,判断鼠标移动到执行的物体后,更换样式
- * 控制多少毫秒执行一次,不要过于频繁,影响性能
- */
- const moveUpdateMouseStyle = () => {
- if (courseChapter3dShow().show.pickResultMoveBool == true) {
- courseChapter3dShow().show.showTxtViewBool = false;
- return;
- }
- // 当前的步骤状态
- let statue = props.config?.threeDimensionalConfig;
-
- if (
- statue == "将四个安全桩放置到正确的位置"
- || statue == "将检测机器人6寸轮子安装到正确位置"
- || statue == "将检测机器人的轮子安装到正确的位置"
- || statue == "将检测机器人6寸右侧轮子安装到正确位置"
- || statue == "将检测机器人6寸左侧轮子安装到正确位置"
- || statue == "将检测机器人10寸右侧轮子安装到正确位置"
- || statue == "将检测机器人10寸左侧轮子安装到正确位置"
- || statue == "将检测机器人的防撞杆安装到正确的位置"
- || statue == "将检测机器人的防撞杆锁安装到正确的位置"
- || statue == "将检测机器人的镜头架安装到正确的位置"
- || statue == "将检测机器人的相机安装到正确的位置"
- || statue == "将绕线车的电源线安装到正确的位置"
- || statue == "将绕线车的纠偏轮安装到正确的位置"
- || statue == "将绕线车的锂电池安装到正确的位置"
- || statue == "将绕线车的电脑主机放置到正确的位置"
- || statue == "将绕线车的手柄安装到正确的位置"
- || statue == "将绕线车的电缆安装到正确的位置"
- || statue == "抬升支架降至最低"
- || statue == "镜头旋转至正上方"
- || statue == "镜头归位"
- || statue == "打开井盖"
- ) {
- // @ts-ignore
- let objScene = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene;
- // 获取选择的对象, 通过测试 scene.pick() 方法是非常消耗性能的
- let pickResultMove = objScene.pick(
- objScene.pointerX,
- objScene.pointerY
- );
- // console.log(
- // " 鼠标移动的坐标位置 moveUpdateMouseStyle = () => { ",
- // objScene.pointerX,
- // objScene.pointerY
- // );
- if (pickResultMove.hit) {
-
- let objMesh = pickResultMove.pickedMesh;
- let thisClickPosition = pickResultMove.pickedPoint;
- // console.log(
- // "符合条件判断是否更新鼠标样式",
- // objMesh.id,
- // thisClickPosition
- // );
-
- // 符合手势的列表
- let meshList = [
- "model_1709892139359安全桩001",
- "model_1709892139359安全桩004",
- "model_1709892139359安全桩003",
- "model_1709892139359安全桩002",
- "exhibition_html_1710385814466_10”后轮左_primitive0",
- "exhibition_html_1710385814466_10”后轮左_primitive1",
- "exhibition_html_1710385814466_10”后轮左_primitive2",
- "exhibition_html_1710385814466_10”前轮左_primitive0",
- "exhibition_html_1710385814466_10”前轮左_primitive1",
- "exhibition_html_1710385814466_10”前轮左_primitive2",
- "exhibition_html_1710385814466_10”后轮右_primitive0",
- "exhibition_html_1710385814466_10”后轮右_primitive1",
- "exhibition_html_1710385814466_10”后轮右_primitive2",
- "exhibition_html_1710385814466_10”前轮右_primitive0",
- "exhibition_html_1710385814466_10”前轮右_primitive1",
- "exhibition_html_1710385814466_10”前轮右_primitive2",
- "exhibition_html_1710385814466_6”后轮左_primitive0",
- "exhibition_html_1710385814466_6”后轮左_primitive1",
- "exhibition_html_1710385814466_6”中轮左_primitive0",
- "exhibition_html_1710385814466_6”中轮左_primitive1",
- "exhibition_html_1710385814466_6”前轮左_primitive0",
- "exhibition_html_1710385814466_6”前轮左_primitive0",
- "exhibition_html_1710385814466_6”后轮右_primitive0",
- "exhibition_html_1710385814466_6”后轮右_primitive0",
- "exhibition_html_1710385814466_6”中轮右_primitive0",
- "exhibition_html_1710385814466_6”中轮右_primitive1",
- "exhibition_html_1710385814466_6”前轮右_primitive0",
- "exhibition_html_1710385814466_6”前轮右_primitive1",
- "exhibition_html_1710385814466_防撞杆_primitive0",
- "exhibition_html_1710385814466_防撞杆_primitive1",
- "exhibition_html_1710385814466_防撞杆锁_primitive0",
- "exhibition_html_1710385814466_防撞杆锁_primitive1",
- "exhibition_html_1710385814466_镜头架_primitive0",
- "exhibition_html_1710385814466_镜头架_primitive1",
- "exhibition_html_1710385814466_镜头架_primitive2",
- "exhibition_html_1710385814466_镜头架_primitive3",
- "exhibition_html_1710385814466_相机_primitive0",
- "exhibition_html_1710385814466_相机_primitive1",
- "exhibition_html_1710385814466_相机_primitive2",
- "exhibition_html_1710385814466_相机_primitive3",
- "exhibition_html_1757573408562_绕线车-电源线",
- "exhibition_html_1710385814466_绕线车-纠偏轮_primitive0",
- "exhibition_html_1710385814466_绕线车-纠偏轮_primitive1",
- "exhibition_html_1710385814466_锂电池_primitive0",
- "exhibition_html_1710385814466_锂电池_primitive1",
- "exhibition_html_1710385814466_锂电池_primitive2",
- "exhibition_html_1710385814466_电脑屏幕_primitive0",
- "exhibition_html_1710385814466_电脑屏幕_primitive1",
- "exhibition_html_1710385814466_电脑屏幕_primitive2",
- "exhibition_html_1710385814466_电脑主机_primitive0",
- "exhibition_html_1710385814466_电脑主机_primitive1",
- "exhibition_html_1710385814466_电脑主机_primitive2",
- "exhibition_html_1710385814466_电脑主机_primitive3",
- "exhibition_html_1710385814466_手柄_primitive0",
- "exhibition_html_1710385814466_手柄_primitive1",
- "exhibition_html_1710385814466_手柄_primitive2",
- "exhibition_html_1710385814466_手柄_primitive3",
- "exhibition_html_1710385814466_电缆01_primitive0",
- "exhibition_html_1710385814466_电缆01_primitive1",
- "exhibition_html_1710385814466_绕线车-电缆",
- "model_1712911455459井盖002",
- "exhibition_html_1710385814466_上机_primitive0",
- "exhibition_html_1710385814466_上机_primitive1",
- "exhibition_html_1710385814466_上机_primitive2",
- "exhibition_html_1710385814466_上机_primitive3",
- "exhibition_html_1710385814466_上机_primitive4",
- "exhibition_html_1710385814466_上机_primitive5",
- ];
- for (let i = 0; i < meshList.length; i++) {
- let thisMeshList = meshList[i];
- if (thisMeshList == objMesh.id) {
- objDragAndDropEvent.iframeCanvasStyle("pointer");
- if (
- // @ts-ignore
- threeWorld().obj.meshEvent[objMesh.id] != null
- // @ts-ignore
- && threeWorld().obj.meshEvent[objMesh.id] != undefined
- ) {
- // @ts-ignore
- let thisMeshEvent = threeWorld().obj.meshEvent[objMesh.id];
- courseChapter3dShow().show.showTxtViewBool = true;
- courseChapter3dShow().show.showTxtContent = thisMeshEvent.txt;
- courseChapter3dShow().show.showTxtViewX = objScene.pointerX + 20;
- courseChapter3dShow().show.showTxtViewY = objScene.pointerY - 20;
-
- }
- return;
- }
- }
- objDragAndDropEvent.iframeCanvasStyle("normal");
- courseChapter3dShow().show.showTxtViewBool = false;
- }
-
- }
-
- }
- /**
- * 设置3d事件
- */
- const threeEvent = () => {
-
- // @ts-ignore
- let objScene = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene;
- /**
- * 可以被追加事件的API【 可以不断追加进来 】
- */
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene.onPointerObservable.add(
- (pointerInfo : any) => {
- // console.log(
- // " ============================== 鼠标事件触发了 ============================== ",
- // pointerInfo.pickInfo,
- // pointerInfo.pickInfo.hit
- // );
- // 当前的步骤状态
- let statue = props.config?.threeDimensionalConfig;
- if (courseChapter3dShow().show.pickResultMoveBool == true) {
- courseChapter3dShow().show.showDirectionViewBool = false;
- courseChapter3dShow().show.showClickRotationViewBool = false;
- // 获取选择的对象, 通过测试 scene.pick() 方法是非常消耗性能的
- let pickResultMove = objScene.pick(
- objScene.pointerX,
- objScene.pointerY
- );
- if (pickResultMove.hit) {
- // console.log(
- // "鼠标移动触发逻辑",
- // "pickResultMove", pickResultMove
- // );
- objDragAndDropEvent.threeWorldPointerMove(pickResultMove, statue);
- objDragAndDropEvent.dragAndDropMove(pickResultMove, statue);
-
-
- }
-
- }
-
- // 如果点击到3d世界里的物体的时候
- if (pointerInfo.pickInfo.hit) {
-
- var pickResult = pointerInfo.pickInfo;
- // console.log(
- // " threeEvent = () => { 鼠标事件 》》》》》》》》》》 ", pickResult
- // );
- // // 获取点击对象的方向【 一定要加上 true,否则载入的获取模型的方向,会有问题 】
- // var getNormal = pickResult.getNormal(true);
- // console.log({
- // '事件' : 'lickType 鼠标事件点击到物体了',
- // '被点击到的物体' : pickResult,
- // '坐标' : pickResult.pickedPoint,
- // '被点击的物体的名字' : pickResult.pickedMesh.name,
- // '被点击物体的材质' : pickResult.pickedMesh.material,
- // '获取点击对象的方向' : getNormal,
- // '得到点击物体的所有点位集合[ 物体都是通过很多点为链接而形成的,可以通过这个方法知道物体的最大尺寸,或者最小尺寸等 ]' : pickResult.pickedMesh._geometry._positions,
- // '得到被点击物体的绝对坐标,后续该坐标例如取中心点垂直就很有用处【3d模型如果错位,说明是3d建模把模型给合并导致的,需要跟对方沟通,让模型单独】' : pickResult.pickedMesh._absolutePosition
- // });
- switch (pointerInfo.type) {
- case BABYLON.PointerEventTypes.POINTERDOWN:
- // console.log("clickType 鼠标按下");
- courseChapter3dShow().show.showDirectionViewBool = false;
- courseChapter3dShow().show.showClickRotationViewBool = false;
- clickTime.value = new Date().getTime();
- objDragAndDropEvent.dragAndDropClick( pickResult, statue );
-
- break;
- case BABYLON.PointerEventTypes.POINTERUP:
- // console.log("clickType 鼠标弹起");
- let thisTime = new Date().getTime();
- // 距离点击的时间
- let distanceTime = thisTime - clickTime.value;
- // console.log(
- // "distanceTime", distanceTime
- // );
- objDragAndDropEvent.dragAndDropPointerup(pickResult, statue);
- /**
- * 低于200毫秒,则为触发增加值的逻辑
- * 否则,就是用户平时旋转3d场景的逻辑
- */
- if (distanceTime <= 200) {
- // console.log(
- // " 鼠标点击弹起了 threeEvent = () => { ", pickResult.pickedMesh
- // );
- objDragAndDropEvent.threeWorldPointerupEvent(pickResult, statue);
- // // 这里的拖拽逻辑,暂时取消
- // gizmoManagerEvent(pickResult.pickedMesh);
- objTypeViewEvent.wearingClothes(pickResult.pickedMesh, statue);
- objTypeViewEvent.openBox(pickResult.pickedMesh, statue);
- objTypeViewEvent.openCable(pickResult.pickedMesh, statue);
- objTypeViewEvent.openSupport(pickResult.pickedMesh, statue);
- objTypeViewEvent.openShotUp(pickResult.pickedMesh, statue);
- objTypeViewEvent.openShotRet(pickResult.pickedMesh, statue);
- objTypeViewEvent.openManholeCover(pickResult.pickedMesh, statue);
-
- }
-
- break;
- case BABYLON.PointerEventTypes.POINTERMOVE:
- // console.log("clickType 鼠标移动中");
-
- break;
- case BABYLON.PointerEventTypes.POINTERWHEEL:
- // console.log("clickType 鼠标滚轮滚动中");
- break;
- case BABYLON.PointerEventTypes.POINTERPICK:
- // console.log("clickType 鼠标指针选中事件");
- break;
- case BABYLON.PointerEventTypes.POINTERTAP:
- // console.log("clickType 当对象被触摸并在没有拖动的情况下释放时,触发指针触发事件。");
- break;
- case BABYLON.PointerEventTypes.POINTERDOUBLETAP:
- // console.log("clickType 鼠标双击");
-
- break;
- }
- }
-
- });
-
- // @ts-ignore 添加帧事件
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene.onBeforeRenderObservable.add(function() {
- // 当前的步骤状态
- let statue = props.config?.threeDimensionalConfig;
- let thisTime = new Date().getTime();
- if (thisTime - threeEventRenderTime >= 1000) {
- threeEventRenderTime = thisTime;
- objRenderEvent.updateCarDb();
- objTypeViewEvent.arcRotateCameraCarPushEvent();
- carStatusEvent();
- objRenderEvent.workEvent(statue);
-
- }
- if (thisTime - threeEventRenderTimeTwo >= 3000) {
- threeEventRenderTimeTwo = thisTime;
- // 自动降挡
- objRenderEvent.carMoveLvEvent('moderate');
- }
- if (thisTime - threeEventRenderTimeThree >= 300) {
- threeEventRenderTimeThree = thisTime;
- moveUpdateMouseStyle();
-
- }
-
- carCameraAlphaAndBetaNew();
- objTypeViewEvent.arcRotateCameraCarEvent();
- objTypeViewEvent.spotLightCameraEvent();
- objDragAndDropEvent.cameraVisualAngleUpdate();
- objHighlightLayerEvent.updateSize();
- // console.log(
- // " 每帧在执行 threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene.onBeforeRenderObservable.add(function() { "
- // );
-
- });
-
- }
- // 是否因为,移动后停止了
- let moveToStop = true;
- // 控制播放超速声音的时间戳,不需要太频繁播放声音
- let speedingMusicPlayTime = 0;
- /**
- * 通过车的不同状态,控制前进还是倒退的逻辑
- */
- const carStatusEvent = () => {
- // console.log(
- // "carStatusEvent = () => {",
- // courseChapter3dShow().show.carStatus,
- // courseChapter3dShow().show.carMoveLv,
- // courseChapter3dShow().show.carMoveSpeed,
- // );
- // 超速提示
- courseChapter3dShow().show.showCarEyeViewBoolSpeeding = courseChapter3dShow().show.carMoveLv >= 8 ? true : false;
- var thisTime = new Date().getTime();
-
- if (
- // 如果超速
- courseChapter3dShow().show.showCarEyeViewBoolSpeeding == true
- && (thisTime - speedingMusicPlayTime) >= 3500
- ) {
-
- speedingMusicPlayTime = thisTime;
- objTypeViewEvent.musicConfigPlay(
- "车辆超速", "carSpeeding"
- );
-
- }
- // 得到最顶部距离的值
- let showCarEyeDistanceMax = (pipelineProblemsArrayEventList.length - 2 - distanceXBoolSum) * 29.94;
- showCarEyeDistanceMax -= (29.94 / 2);
- // 由于多出了个出生点与坐标点的距离差
- showCarEyeDistanceMax += courseChapter3dShow().show.lineDistance;
-
- // console.log(
- // " 得到最顶部距离的值 showCarEyeDistanceMax ",
- // showCarEyeDistanceMax
- // );
- // console.log(
- // "距离判断是否到最顶位置",
- // // pipelineProblemsArrayEventList.length,
- // // showCarEyeDistanceMax,
- // // courseChapter3dShow().show.showCarEyeDistance,
- // // courseChapter3dShow().show.birthPointRecord,
- // // courseChapter3dShow().show.carPointRecord,
- // // courseChapter3dShow().show.birthPointRecord.x,
- // // courseChapter3dShow().show.carPointRecord.x,
- // );
- if (
- // 前视
- courseChapter3dShow().show.lookAfterOrFront == "front"
- // && courseChapter3dShow().show.showCarEyeDistance >= 476
- && courseChapter3dShow().show.showCarEyeDistance >= showCarEyeDistanceMax
- ) {
- courseChapter3dShow().show.showCarEyeViewBoolSpeeding2 = true;
- } else if (
- // 后视
- courseChapter3dShow().show.lookAfterOrFront == "after"
- // && courseChapter3dShow().show.showCarEyeDistance <= 7.3
- && courseChapter3dShow().show.showCarEyeDistance <= 1
- ) {
- courseChapter3dShow().show.showCarEyeViewBoolSpeeding2 = true;
- } else {
- courseChapter3dShow().show.showCarEyeViewBoolSpeeding2 = false;
- }
- // 如果是停止移动了
- if (courseChapter3dShow().show.carStatus == "stopMove") {
- // 此时说明要停止移动了
- if (moveToStop == false) {
- // 触发键盘的停止逻辑
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.EventMoveRole.find().moveState = 0;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolW = false;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolA = false;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolS = false;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolD = false;
- // @ts-ignore 恢复初始的移动速度
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().speed = courseChapter3dShow().show.carMoveSpeed;
-
- moveToStop = true;
- }
- return;
- }
- moveToStop = false;
- // 根据不同的挡位,控制合理的移动速度
- let speed = courseChapter3dShow().show.carMoveSpeed
- * (courseChapter3dShow().show.carMoveLv / courseChapter3dShow().show.carMoveSpeedMultipleMax * 1);
-
- // // @ts-ignore 更新目标角色的参数
- // threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().modelRoleCreateOrUpdate(
- // // @ts-ignore
- // threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().roleCode,
- // {
- // "addMoveSpeed" : courseChapter3dShow().show.carMoveSpeed - speed,
- // "addMoveSpeedSecond" : 3,
- // "addMoveSpeedSecondTimeUpdate" : new Date().getTime()
- // }
- // );
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().speed = speed;
-
- // 前进
- if (courseChapter3dShow().show.carStatus == "forwardMove") {
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.EventMoveRole.find().moveState = 1;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolW = true;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolA = false;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolS = false;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolD = false;
- }
- // 后退
- if (courseChapter3dShow().show.carStatus == "retreatMove") {
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.EventMoveRole.find().moveState = 1;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolS = true;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolA = false;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolW = false;
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolD = false;
- }
- // console.log(
- // " carStatusEvent = () => { 移动速度 ",
- // speed
- // );
-
- }
- /**
- * 通过每帧的方式来控制变化的
- * courseChapter3dShow().show.carCameraAlphaNew
- * courseChapter3dShow().show.carCameraBetaNew
- * …… 左右旋转,上下旋转,镜头放大缩小
- * 等逻辑
- * 跟 车机器人相关的逻辑
- *
- */
- const carCameraAlphaAndBetaNew = () => {
-
- // 可旋转角度
- let mathPiMax = Math.PI / 2;
- let mathPiMax2 = Math.PI / 10;
- // fov每次变化参数
- let fovUpdate = 0.2;
- // fov最大值
- let fovMax = 1.6;
- // fov最小值
- let fovMin = 0.4;
- // 帧数
- let fps = 75;
- // 完成秒数
- let secondFps = fps * 1.5;
- let secondFps2 = fps * 1.5;
- let secondFps3 = fps * 3;
- // y轴支架每次变化的参数
- let yUpdate = 1 / 2;
- // let yUpdate = 1;
- // y轴支架最大值
- let yMax = 1.5;
- // y轴支架最小值
- let yMin = 0;
- // 车速
- // let carMoveLvProportionMax = 100 * 50;
- let carMoveLvProportionMax = 100;
- // 车相机左右旋转
- if (courseChapter3dShow().show.carCameraAlpha != courseChapter3dShow().show.carCameraAlphaNew) {
- let distance = courseChapter3dShow().show.carCameraAlpha - courseChapter3dShow().show.carCameraAlphaNew;
- if (distance > 0) {
- courseChapter3dShow().show.carCameraAlphaNew += mathPiMax / secondFps3;
- if (courseChapter3dShow().show.carCameraAlphaNew >= courseChapter3dShow().show.carCameraAlpha) {
- courseChapter3dShow().show.carCameraAlphaNew = courseChapter3dShow().show.carCameraAlpha;
- }
- } else {
- courseChapter3dShow().show.carCameraAlphaNew -= mathPiMax / secondFps3;
- if (courseChapter3dShow().show.carCameraAlphaNew <= courseChapter3dShow().show.carCameraAlpha) {
- courseChapter3dShow().show.carCameraAlphaNew = courseChapter3dShow().show.carCameraAlpha;
- }
- }
-
- if (courseChapter3dShow().show.carCameraAlphaNew >= mathPiMax) {
- courseChapter3dShow().show.carCameraAlphaNew = mathPiMax;
- }
- if (courseChapter3dShow().show.carCameraAlphaNew <= -mathPiMax) {
- courseChapter3dShow().show.carCameraAlphaNew = -mathPiMax;
- }
- }
- // 车相机上下旋转
- if (courseChapter3dShow().show.carCameraBeta != courseChapter3dShow().show.carCameraBetaNew) {
- let distance = courseChapter3dShow().show.carCameraBeta - courseChapter3dShow().show.carCameraBetaNew;
- if (distance > 0) {
- courseChapter3dShow().show.carCameraBetaNew += mathPiMax / secondFps3;
- if (courseChapter3dShow().show.carCameraBetaNew >= courseChapter3dShow().show.carCameraBeta) {
- courseChapter3dShow().show.carCameraBetaNew = courseChapter3dShow().show.carCameraBeta;
- }
- } else {
- courseChapter3dShow().show.carCameraBetaNew -= mathPiMax / secondFps3;
- if (courseChapter3dShow().show.carCameraBetaNew <= courseChapter3dShow().show.carCameraBeta) {
- courseChapter3dShow().show.carCameraBetaNew = courseChapter3dShow().show.carCameraBeta;
- }
- }
-
- if (courseChapter3dShow().show.carCameraBetaNew >= mathPiMax) {
- courseChapter3dShow().show.carCameraBetaNew = mathPiMax;
- }
- if (courseChapter3dShow().show.carCameraBetaNew <= -mathPiMax) {
- courseChapter3dShow().show.carCameraBetaNew = -mathPiMax;
- }
- }
- // 车左右转弯
- if (courseChapter3dShow().show.carCameraAlphaWheel != courseChapter3dShow().show.carCameraAlphaWheelNew) {
- let distance = courseChapter3dShow().show.carCameraAlphaWheel - courseChapter3dShow().show.carCameraAlphaWheelNew;
- if (distance > 0) {
- courseChapter3dShow().show.carCameraAlphaWheelNew += mathPiMax2 / secondFps2;
- if (courseChapter3dShow().show.carCameraAlphaWheelNew >= courseChapter3dShow().show.carCameraAlphaWheel) {
- courseChapter3dShow().show.carCameraAlphaWheelNew = courseChapter3dShow().show.carCameraAlphaWheel;
- }
- } else {
- courseChapter3dShow().show.carCameraAlphaWheelNew -= mathPiMax2 / secondFps2;
- if (courseChapter3dShow().show.carCameraAlphaWheelNew <= courseChapter3dShow().show.carCameraAlphaWheel) {
- courseChapter3dShow().show.carCameraAlphaWheelNew = courseChapter3dShow().show.carCameraAlphaWheel;
- }
- }
- if (courseChapter3dShow().show.carCameraAlphaWheelNew >= mathPiMax2) {
- courseChapter3dShow().show.carCameraAlphaWheelNew = mathPiMax2;
- }
- if (courseChapter3dShow().show.carCameraAlphaWheelNew <= -mathPiMax2) {
- courseChapter3dShow().show.carCameraAlphaWheelNew = -mathPiMax2;
- }
- }
- // 车相机是否放大
- if (courseChapter3dShow().show.carCameraFov != courseChapter3dShow().show.carCameraFovNew) {
- let distance = courseChapter3dShow().show.carCameraFov - courseChapter3dShow().show.carCameraFovNew;
- if (distance > 0) {
- courseChapter3dShow().show.carCameraFovNew += fovUpdate / secondFps;
- if (courseChapter3dShow().show.carCameraFovNew >= courseChapter3dShow().show.carCameraFov) {
- courseChapter3dShow().show.carCameraFovNew = courseChapter3dShow().show.carCameraFov;
- }
- } else {
- courseChapter3dShow().show.carCameraFovNew -= fovUpdate / secondFps;
- if (courseChapter3dShow().show.carCameraFovNew <= courseChapter3dShow().show.carCameraFov) {
- courseChapter3dShow().show.carCameraFovNew = courseChapter3dShow().show.carCameraFov;
- }
- }
- if (courseChapter3dShow().show.carCameraFovNew >= fovMax) {
- courseChapter3dShow().show.carCameraFovNew = fovMax;
- }
- if (courseChapter3dShow().show.carCameraFovNew <= fovMin) {
- courseChapter3dShow().show.carCameraFovNew = fovMin;
- }
- }
- // 支架上升还是下降
- if (courseChapter3dShow().show.carCameraPositionY != courseChapter3dShow().show.carCameraPositionYNew) {
- let distance = courseChapter3dShow().show.carCameraPositionY - courseChapter3dShow().show.carCameraPositionYNew;
- if (distance > 0) {
- courseChapter3dShow().show.carCameraPositionYNew += yUpdate / secondFps;
- if (courseChapter3dShow().show.carCameraPositionYNew >= courseChapter3dShow().show.carCameraPositionY) {
- courseChapter3dShow().show.carCameraPositionYNew = courseChapter3dShow().show.carCameraPositionY;
- }
- } else {
- courseChapter3dShow().show.carCameraPositionYNew -= yUpdate / secondFps;
- if (courseChapter3dShow().show.carCameraPositionYNew <= courseChapter3dShow().show.carCameraPositionY) {
- courseChapter3dShow().show.carCameraPositionYNew = courseChapter3dShow().show.carCameraPositionY;
- }
- }
- if (courseChapter3dShow().show.carCameraPositionYNew >= yMax) {
- courseChapter3dShow().show.carCameraPositionYNew = yMax;
- }
- if (courseChapter3dShow().show.carCameraPositionYNew <= yMin) {
- courseChapter3dShow().show.carCameraPositionYNew = yMin;
- }
- }
- // 车速变动百分比
- if (courseChapter3dShow().show.carMoveLvProportion != courseChapter3dShow().show.carMoveLvProportionNew) {
- let distance = courseChapter3dShow().show.carMoveLvProportion - courseChapter3dShow().show.carMoveLvProportionNew;
- if (distance > 0) {
- courseChapter3dShow().show.carMoveLvProportionNew += carMoveLvProportionMax / secondFps;
- if (courseChapter3dShow().show.carMoveLvProportionNew >= courseChapter3dShow().show.carMoveLvProportion) {
- courseChapter3dShow().show.carMoveLvProportionNew = courseChapter3dShow().show.carMoveLvProportion;
- }
- } else {
- courseChapter3dShow().show.carMoveLvProportionNew -= carMoveLvProportionMax / secondFps;
- if (courseChapter3dShow().show.carMoveLvProportionNew <= courseChapter3dShow().show.carMoveLvProportion) {
- courseChapter3dShow().show.carMoveLvProportionNew = courseChapter3dShow().show.carMoveLvProportion;
- }
- }
- // if (courseChapter3dShow().show.carMoveLvProportionNew >= 100) {
- // courseChapter3dShow().show.carMoveLvProportionNew = 100;
- // }
- // if (courseChapter3dShow().show.carMoveLvProportionNew <= 0) {
- // courseChapter3dShow().show.carMoveLvProportionNew = 0;
- // }
- if (courseChapter3dShow().show.carMoveLvProportionNew >= 96) {
- courseChapter3dShow().show.carMoveLvProportionNew = 96;
- }
- if (courseChapter3dShow().show.carMoveLvProportionNew <= 3) {
- courseChapter3dShow().show.carMoveLvProportionNew = 3;
- courseChapter3dShow().show.bottomSpeedImgTopSptWidth = '0rem';
- } else {
- // courseChapter3dShow().show.bottomSpeedImgTopSptWidth = '2.6rem';
- courseChapter3dShow().show.bottomSpeedImgTopSptWidth = '2rem';
- }
- // 最大的例子所在位置
- let topRemMax = 6;
- // let topRemMax = 8;
- if (courseChapter3dShow().show.carMoveLvProportionNew <= 50) {
- courseChapter3dShow().show.carMoveLvProportionTopNew = -(topRemMax * courseChapter3dShow().show.carMoveLvProportionNew / 100);
-
- } else {
- courseChapter3dShow().show.carMoveLvProportionTopNew = -(topRemMax * ( 100 - courseChapter3dShow().show.carMoveLvProportionNew) / 100);
- }
-
- }
-
- }
- /**
- * 3d加载完成优先切换到默认的视角
- */
- const initScene = () => {
- // console.log(
- // "initScene = () => {",
- // threeWorld().obj.newIframe,
- // threeWorld().obj.newIframe.getCameraVisualAngleGetList()
- // );
-
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo("检测车");
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(false);
- // 清空3d背景
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene.clearColor = {
- "r" : 0, "g" : 0, "b" : 0, "a" : 0
- };
- groundNoRemove();
- typeEvent(props.config?.threeDimensionalConfig);
- // 触发自动点击逻辑
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().screenClickNumEvent();
- // 默认装的盒子是可以看到的
- objTypeViewEvent.boxLook(true);
- }
- /**
- * 将所有设置为地面的,改为不设置为地面
- */
- const groundNoRemove = () => {
- // // 临时测试用的,后续正式,在注释掉
- // return;
- // console.log(
- // "groundNoRemove = () => {",
- // threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.ModelObjEdit.find().meshListIdToJson
- // );
- // @ts-ignore
- for (const key in threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.ModelObjEdit.find().meshListIdToJson) {
-
- if (
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.ModelObjEdit.find().meshListIdToJson[key]['isGround'] == true
- ) {
- // 通过更新材质的参数,来更新
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.ModelObjEdit.find().objOneMeshListIdToJsonUpdate(
- key,
- {
-
- "isGround" : false,
- }
- );
- }
-
- }
- // @ts-ignore
- for (let i = 0; i < threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene.meshes.length; i++) {
- // @ts-ignore
- let objMesh = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene.meshes[i];
- // console.log(
- // "myIsGround",
- // objMesh["myIsGround"]
- // );
- // if (objMesh["myIsGround"] == true) {
- // delete objMesh["myIsGround"];
- // }
- delete objMesh["myIsGround"];
- }
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().isGroundList = {};
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.ModelObjEdit.find().myIsGroundConfigNum = 0;
- }
- /**
- * 停止所有动画
- */
- const animationAllFpsToZero = () => {
- objTypeViewEvent.animationAllTypeUpdate("stopAll");
- };
- /**
- * 根据不同的类型,切换对应的3d逻辑
- */
- const typeEvent = (type : any) => {
- console.log(
- "根据不同的类型,切换对应的3d逻辑",
- type
- );
- courseChapter3dShow().show.viewType = type;
-
- thisFlowPath = type;
- objDragAndDropEvent.txtBool = false;
- courseChapter3dShow().show.showDirectionViewBool = false;
- // @ts-ignore
- if (threeWorld().obj.showCongratulationsTxtJson[type] != null && threeWorld().obj.showCongratulationsTxtJson[type] != undefined) {
-
- // @ts-ignore
- let showCongratulationsTxtJson = threeWorld().obj.showCongratulationsTxtJson[type];
- courseChapter3dShow().show.showCongratulationsTxt = showCongratulationsTxtJson.txt;
- courseChapter3dShow().show.showEndTxt = showCongratulationsTxtJson.txtEnd;
- if (
- showCongratulationsTxtJson.showDirectionX != null && showCongratulationsTxtJson.showDirectionX != undefined
- && showCongratulationsTxtJson.showDirectionY != null && showCongratulationsTxtJson.showDirectionY != undefined
- ) {
- let tips = props.config?.tips;
- if (tips != null && tips != undefined) {
- // 由于新增了切换视角逻辑,延迟弹出
- setTimeout(function() {
-
- // @ts-ignore
- courseChapter3dShow().show.showDirectionEvent(
- tips,
- null,
- showCongratulationsTxtJson.showDirectionX,
- showCongratulationsTxtJson.showDirectionY,
- function() {}
- );
-
- }, 1500);
- }
-
- }
-
- } else {
- courseChapter3dShow().show.showCongratulationsTxt = "";
- }
- setTimeout(function() {
- // 启动播放声音
- objTypeViewEvent.musicConfigPlay(
- type, "start"
- );
- }, 1500);
- // 控制物体的显示和隐藏以及高亮
- objHighlightLayerEvent.statueMeshLookOrHighlight(type);
- // 重置为空数组
- objDragAndDropEvent.highlightLayerMeshListClick = [];
- objDragAndDropEvent.retVisibility(0, "restore", {});
- objDragAndDropEvent.retVisibility(1, "restore", {});
- switch(type) {
- // 操作帮助
- case 'operationHelp':
- objTypeViewEvent.operationHelpEvent();
- break;
-
- // 设备拆解
- case 'equipmentDisassembly':
- objTypeViewEvent.equipmentDisassemblyEvent();
- // 切换动画
- objTypeViewEvent.animationAllTypeUpdate("stopAll");
- break;
- // 爬行器模块
- case 'crawlerModule':
- objTypeViewEvent.crawlerModuleEvent();
- // 切换动画
- objTypeViewEvent.animationAllTypeUpdate("stopAll");
- objDragAndDropEvent.txtBool = true;
- break;
-
- // 线缆卷盘
- case 'cableReel':
- objTypeViewEvent.cableReelEvent();
- // 切换动画
- objTypeViewEvent.animationAllTypeUpdate("stopAll");
- objDragAndDropEvent.txtBool = true;
- break;
- // 检测实训注意事项
- case 'precautionsForTestingTraining':
- objTypeViewEvent.precautionsForTestingTrainingEvent(props.config?.durationStudyMin);
- // 切换动画
- objTypeViewEvent.animationAllTypeUpdate("stopAll");
- break;
- // 设备下井实验视频
- case 'equipmentDownHoleExperimentVideo':
- objTypeViewEvent.equipmentDownHoleExperimentVideoEvent();
- // 切换动画
- objTypeViewEvent.animationAllTypeUpdate("stopAll");
- break;
-
- case '请走到工作区域':
- objTypeViewEvent.work_1();
- // 切换动画
- objTypeViewEvent.animationAllTypeUpdate("beforeUnboxing");
-
- break;
-
- case '请点击人物进行穿搭衣服':
- objTypeViewEvent.work_2();
- // 切换动画
- objTypeViewEvent.animationAllTypeUpdate("beforeUnboxing");
- break;
-
- case '将四个安全桩放置到正确的位置':
- objTypeViewEvent.work_3();
- // 切换动画
- objTypeViewEvent.animationAllTypeUpdate("beforeUnboxing");
- break;
-
- case '将盒子拆开把设备拿出来':
- objTypeViewEvent.work_4();
- break;
-
- case '将盒子拆开把设备放置在安全的位置':
- objTypeViewEvent.work_5();
- break;
- // 已经不会用到的逻辑了
- case '将检测机器人6寸轮子安装到正确位置':
- objTypeViewEvent.work_6_0();
- break;
-
- // 已经不会用到的逻辑了
- case '将检测机器人的轮子安装到正确的位置':
- objTypeViewEvent.work_6();
- break;
- case '将检测机器人6寸右侧轮子安装到正确位置':
- objTypeViewEvent.work_6_right();
- break;
- case '将检测机器人6寸左侧轮子安装到正确位置':
- objTypeViewEvent.work_6_left();
- break;
- case '将检测机器人10寸右侧轮子安装到正确位置':
- objTypeViewEvent.work_10_right();
- break;
- case '将检测机器人10寸左侧轮子安装到正确位置':
- objTypeViewEvent.work_10_left();
- break;
-
- case '将检测机器人的防撞杆安装到正确的位置':
- objTypeViewEvent.work_7();
- break;
-
- case '将检测机器人的防撞杆锁安装到正确的位置':
- objTypeViewEvent.work_8();
- break;
-
- case '将检测机器人的镜头架安装到正确的位置':
- objTypeViewEvent.work_9();
- break;
-
- case '将检测机器人的相机安装到正确的位置':
- objTypeViewEvent.work_10();
- break;
-
- case '将绕线车的电源线安装到正确的位置':
- objTypeViewEvent.work_11();
- break;
-
- case '将绕线车的纠偏轮安装到正确的位置':
- objTypeViewEvent.work_12();
- break;
-
- case '将绕线车的锂电池安装到正确的位置':
- objTypeViewEvent.work_13();
- break;
-
- case '将绕线车的电脑主机放置到正确的位置':
- objTypeViewEvent.work_14();
- break;
-
- case '将绕线车的手柄安装到正确的位置':
- objTypeViewEvent.work_15();
- break;
-
- case '将绕线车的电缆安装到正确的位置':
- objTypeViewEvent.work_16();
- break;
-
- case '抬升支架降至最低':
- objTypeViewEvent.work_17();
- break;
-
- case '镜头旋转至正上方':
- objTypeViewEvent.work_18();
- break;
-
- case '镜头归位':
- objTypeViewEvent.work_19();
- break;
-
- case '调节行驶方向正确放置过线滑轮':
- objTypeViewEvent.work_20();
- break;
-
- case '打开井盖':
- objTypeViewEvent.work_21();
- break;
-
- case '下井视频':
- objTypeViewEvent.work_22();
- break;
- case '设备回收视频':
- objTypeViewEvent.work_23();
- break;
-
- // 作业前准备工作1
- case 'preparationWorkBeforeHomework1':
- objTypeViewEvent.preparationWorkBeforeHomework1Event();
- break;
- // 作业前准备工作2
- case 'preparationWorkBeforeHomework2':
- objTypeViewEvent.preparationWorkBeforeHomework2Event();
- break;
- // 作业前准备工作3
- case 'preparationWorkBeforeHomework3':
- objTypeViewEvent.preparationWorkBeforeHomework3Event();
- break;
- // 作业前准备工作4
- case 'preparationWorkBeforeHomework4':
- objTypeViewEvent.preparationWorkBeforeHomework4Event();
- break;
- // 设备连接工作1
- case 'deviceConnectionWork1':
- objTypeViewEvent.deviceConnectionWork1Event();
- break;
- // 设备连接工作2
- case 'deviceConnectionWork2':
- objTypeViewEvent.deviceConnectionWork2Event();
- break;
- // 设备调试工作
- case 'equipmentDebuggingWork':
- objTypeViewEvent.equipmentDebuggingWorkEvent();
- break;
- // 录制准备视频
- case 'recordPreparationVideo':
- objTypeViewEvent.recordPreparationVideoEvent();
- break;
- // 设备下井工作1
- case 'equipmentDownHoleWork1':
- objTypeViewEvent.equipmentDownHoleWork1Event();
- break;
- // 设备下井工作2
- case 'equipmentDownHoleWork2':
- objTypeViewEvent.equipmentDownHoleWork2Event();
- break;
- // 设备下井工作3
- case 'equipmentDownHoleWork3':
- objTypeViewEvent.equipmentDownHoleWork3Event();
- break;
- // 设备下井工作4
- case 'equipmentDownHoleWork4':
- objTypeViewEvent.equipmentDownHoleWork4Event();
- break;
- // 设备下井工作5
- case 'equipmentDownHoleWork5':
- objTypeViewEvent.equipmentDownHoleWork5Event();
- break;
- // 设备下井工作6
- case 'equipmentDownHoleWork6':
- objTypeViewEvent.equipmentDownHoleWork6Event();
- break;
- // 设备下井工作7
- case 'equipmentDownHoleWork7':
- objTypeViewEvent.equipmentDownHoleWork7Event();
- break;
- // 下井检测
- case 'downHoleInspection':
- objTypeViewEvent.downHoleInspectionEvent();
- break;
- // 设备归位工作
- case 'equipmentRepositioningWork':
- objTypeViewEvent.equipmentRepositioningWorkEvent();
- break;
- default:
- objTypeViewEvent.viewHide();
- break;
-
- }
- let tips = props.config?.tips;
- if (tips != null && tips != undefined) {
- courseChapter3dShow().show.showTitleTxt = tips;
- }
- }
- // let wearYes = new URL("./../../assets/3dMain/body.webp", import.meta.url).href;
- let wearYes = new URL("./../../assets/3dMain/04_M_Construction_d_2.webp", import.meta.url).href;
- let wearNo = new URL("./../../assets/3dMain/04_M_Construction_d_1.webp", import.meta.url).href;
- let wearTextureNo:any = null;
- let wearTextureYes:any = null;
- // 优先记录好工作人员进行替换的贴图对象
- const workRoleTexture = () => {
-
- let list = [
- "exhibition_html_1709861931375_M_SML_Construction_01_primitive0",
- // "exhibition_html_1709861931375_M_SML_Construction_01_primitive1",
- // "exhibition_html_1709861931375_M_SML_Construction_01_primitive2",
- // "exhibition_html_1709861931375_M_SML_Construction_01_primitive3",
- ];
- for (let i = 0; i < list.length; i++) {
- let objMeshId = list[i];
- // @ts-ignore
- let objMesh = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene.getMeshById(objMeshId);
- if (objMesh != null && objMesh != undefined && objMesh.material != null && objMesh.material != undefined) {
- // console.log(
- // "objMesh.material",
- // objMesh.material
- // );
- if (wearTextureNo == null) {
- if (objMesh.material.albedoTexture != null && objMesh.material.albedoTexture != undefined) {
- wearTextureNo = objMesh.material.albedoTexture.clone();
- }
- }
- }
-
- }
- wearTextureYes = new BABYLON.Texture(
- wearYes,
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene,
- null, false
- );
- objTypeViewEvent.wearTextureNo = wearTextureNo;
- objTypeViewEvent.wearTextureYes = wearTextureYes;
-
- }
- /**
- * 设备连接工作,右侧菜单点击回调
- */
- courseChapter3dShow().show.showToolMenuRightClickCallback = function(res : any) {
-
- console.log(
- "设备连接工作,右侧菜单点击回调", res
- );
- switch (res.name) {
- case "旋转镜头":
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo("镜头归位");
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(false);
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "镜头架", 'start', 1, null, null, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "相机", 'start', 1, null, null, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- break;
- case "移动电源":
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo("电池");
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(false);
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "电池", 'start', 1, null, null, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
-
- break;
- case "主机终端":
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo("检测车组电脑");
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(false);
-
- break;
- case "手柄":
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo("手柄");
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(false);
- break;
- case "绕线车":
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo("绕线车");
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(false);
- break;
- case "爬行器":
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo("检测车组");
- // @ts-ignore
- threeWorld().obj.newIframe.roleShow(false);
- break;
- }
-
- }
- // 管道问题点类型对应布展的物体名字, 每个管段 相差 x = 29.94 的距离,起始坐标 x = -260 [ 端头1 -289.94 ] , y = -13 , z = -30
- let pipelineProblemsJson : any = {
- "管道问题点-支管段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-异物穿入段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-脱节段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-树根段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-起伏段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-破裂段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-密封圈脱落段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-漏水段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-结诟段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-腐蚀段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-浮渣段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-错位段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-残墙段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-障碍物段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-变形段" : {
- "exhibitionCode" : "",
- },
- "管道问题点-端头1" : {
- "exhibitionCode" : "",
- },
- "管道问题点-端头2" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段1" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段2" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段3" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段4" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段5" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段6" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段7" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段8" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段9" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段10" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段11" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段12" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段13" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段14" : {
- "exhibitionCode" : "",
- },
- "管道问题点-标准管段15" : {
- "exhibitionCode" : "",
- },
- };
- /**
- * 记录管道问题点对应的布展的物体
- */
- const pipelineProblemsJsonInitEvent = () => {
-
- // @ts-ignore
- for (let key in threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().exhibitionJson) {
- // @ts-ignore
- let thisExhibitionJson = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().exhibitionJson[key];
- let specialCode = thisExhibitionJson.specialCode;
- let codeId = thisExhibitionJson.codeId;
- if (pipelineProblemsJson[specialCode] != null && pipelineProblemsJson[specialCode] != undefined) {
- pipelineProblemsJson[specialCode]["exhibitionCode"] = codeId;
- }
- // console.log(
- // "thisExhibitionJson", thisExhibitionJson,
- // "specialCode", specialCode,
- // "codeId", codeId
- // );
-
- }
- // console.log(
- // "pipelineProblemsJson", pipelineProblemsJson
- // );
- }
- /**
- * 取随机数
- * min 最小值
- * max 最大值
- */
- const rnd = (min : any, max : any) => {
- return Math.floor(Math.random() * (max - min + 1) + min);
- }
- /**
- * 根据数组demo,来控制管道问题点的排序逻辑
- */
- let pipelineProblemsArrayDemo : any = [
- // { "name" : "管道问题点-标准管段" },
- ];
- /**
- * 随机数组demo
- */
- const getRndArray = () => {
- // 获取可随机定义的数组
- let array = [];
- for (let key in pipelineProblemsJson) {
- array.push({
- "name" : key,
- });
- }
- // 返回得到的随机数组结果
- let arrayNew : any = [];
- // 随机多少个管道问题点
- let runSum = 12;
- for (var i = 0; i < runSum; i++) {
- let rndIndex = rnd(1, array.length) - 1;
- arrayNew.push(array[rndIndex]);
- // 删除数组下标
- array.splice(rndIndex, 1);
- }
- return arrayNew;
- }
- /**
- * 随机个数组案例,来控制管道问题点的排序逻辑
- */
- const getRndArrayDemoEvent = () => {
- // let array = getRndArray();
-
- let array : any = [];
- // 记录当前新增的【 管道问题点-标准管段 】数量
- let addStandardSum = 1;
- /**
- * 临时记录已经出现过的管段
- * 如果已经重复,则不添加
- */
- let addOldNameJson : any = {};
-
- // 固定有个最开始封闭的管道
- array.push({
- "name" : "管道问题点-端头1"
- });
- // // 固定有个最开始封闭的管道
- // array.push({
- // "name" : "管道问题点-标准管段1"
- // });
- // if (
- // props.studentTaskIdList != null
- // && props.studentTaskIdList != undefined
- // && typeof props.studentTaskIdList == 'object'
- // ) {
- // for (var i = 0; i < props.studentTaskIdList.length; i++) {
- // let thisStudentTaskIdList = props.studentTaskIdList[i];
- // console.log(
- // "thisStudentTaskIdList",
- // thisStudentTaskIdList
- // );
-
- // let addJson = {
- // "name" : thisStudentTaskIdList?.pipDefect?.name
- // }
-
- // if (addJson["name"] == null || addJson["name"] == undefined || addJson["name"] == '') {
- // addJson["name"] = '管道问题点-标准管段' + addStandardSum;
- // addStandardSum += 1;
- // }
- // // // // 调试用的,过滤掉一些,来知道哪些管段有问题
- // // // // if (addJson.name == "管道问题点-变形段") {
- // // if (addJson.name !== "管道问题点-变形段") {
- // // continue;
- // // }
- // if (
- // addOldNameJson[addJson["name"]] == null && addOldNameJson[addJson["name"]] == undefined
- // ) {
- // addOldNameJson[addJson["name"]] = addJson["name"];
- // array.push(addJson);
- // }
-
- // }
- // }
- // // 本次要继续随机生成的标准管段数量
- // let standardCreateSum = 15 - (array.length - 2);
- // if (standardCreateSum >= 1) {
- // for (var i = 0; i < standardCreateSum; i++) {
- // let addJson = {
- // "name" : '管道问题点-标准管段' + addStandardSum
- // }
- // addStandardSum += 1;
- // // 随机数
- // let rndIndex = rnd(2, array.length - 2);
- // array.splice(rndIndex, 0, addJson);
- // }
- // }
-
- // console.log(
- // "const getRndArrayDemoEvent = () => {",
- // array,
- // standardCreateSum
- // );
- // ########## 现在修改为根据后端返回的数组下标的点位,进行排序,不在进行随机生成标准管段
- // 优先记录对应数组下标的管段json
- let addIndexJson : any = {};
- if (
- props.studentTaskIdList != null
- && props.studentTaskIdList != undefined
- && typeof props.studentTaskIdList == 'object'
- ) {
- for (var i = 0; i < props.studentTaskIdList.length; i++) {
- let thisStudentTaskIdList = props.studentTaskIdList[i];
- let pipIndex = thisStudentTaskIdList.pipIndex;
- let name = thisStudentTaskIdList?.pipDefect?.name;
- // console.log(
- // "thisStudentTaskIdList",
- // thisStudentTaskIdList
- // );
-
- let addJson = {
- "name" : name
- }
-
- if (addJson["name"] == null || addJson["name"] == undefined || addJson["name"] == '') {
- addJson["name"] = '管道问题点-标准管段' + addStandardSum;
- addStandardSum += 1;
- }
-
- if (
- addOldNameJson[addJson["name"]] == null && addOldNameJson[addJson["name"]] == undefined
- ) {
- addOldNameJson[addJson["name"]] = addJson["name"];
- addIndexJson[pipIndex] = addJson;
- }
-
- }
- }
-
- // 总共是15个管段,15个管段内,根据 addIndexJson 数组下标,替换问题管段
- for (var i = 1; i <= 15; i++) {
- // 如果存在问题管段数据
- if (addIndexJson[i] != null && addIndexJson[i] != undefined) {
- array.push(addIndexJson[i]);
- } else {
- var addJson = {
- "name" : '管道问题点-标准管段' + addStandardSum,
- };
- // 增加为标准管段
- array.push(addJson);
- addStandardSum += 1;
- }
- }
- // 固定有个最尾巴封闭的管道
- array.push({
- "name" : "管道问题点-端头2"
- });
- console.log(
- " 【管道问题点】 const getRndArrayDemoEvent = () => {",
- array,
- pipelineProblemsJson
- );
-
- pipelineProblemsArrayEvent(array);
-
- }
- /**
- * 优先将所有的管道移动到看不到的地方
- */
- const pipelineProblemsJsonMoveEvent = () => {
- for (let key in pipelineProblemsJson) {
- let objPipelineProblemsJson = pipelineProblemsJson[key];
- let exhibitionCode = objPipelineProblemsJson.exhibitionCode;
- // @ts-ignore
- let objMesh = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene.getMeshById(exhibitionCode);
- if (objMesh != null && objMesh != undefined) {
-
- let thisMesh = objMesh;
- // 确认当前可进行移动的主物体
- if (objMesh._parentContainer != null && objMesh._parentContainer != undefined) {
- let _parentContainer = objMesh._parentContainer;
-
- if (_parentContainer.meshes != null && _parentContainer.meshes != undefined) {
- thisMesh = _parentContainer.meshes[0];
- }
-
- }
-
- thisMesh.position.x = 1000;
- }
-
- }
- }
- /**
- * 记录 pipelineProblemsArrayEvent 方法,本次安装的管道列表数据
- */
- let pipelineProblemsArrayEventList : any = [];
- /**
- * 由于一些管段会出现错位的问题,所以要进行,坐标偏移特殊处理
- * 出现的次数
- */
- let distanceXBoolSum = 0;
-
- /**
- * 根据数组,来控制管道问题点的排序逻辑
- * array 数组
- */
- const pipelineProblemsArrayEvent = (array : any) => {
- pipelineProblemsJsonMoveEvent();
- pipelineProblemsArrayEventList = array;
- // console.log(
- // "pipelineProblemsArrayEvent = (array : any) => {",
- // "pipelineProblemsArrayEventList",
- // pipelineProblemsArrayEventList
- // );
-
- // 每个管段 相差 x = 29.94 的距离,起始坐标 x = -260 [ 端头1 -289.94 ] , y = -13 , z = -30
- // let startX = -260;
- // let startX = -289.94;
- let startX = -319.88;
- let distanceX = 29.94;
- /**
- * 由于一些管段会出现错位的问题,所以要进行,坐标偏移特殊处理
- * 出现的次数
- */
- distanceXBoolSum = 0;
-
- // 开始根据数组的排序,来移动对应的管道到合适的位置
- for (let i = 0; i < array.length; i++) {
-
- let thisArray = array[i];
- let name = thisArray.name;
-
- if (pipelineProblemsJson[name] != null && pipelineProblemsJson[name] != undefined) {
- let objPipelineProblemsJson = pipelineProblemsJson[name];
- let exhibitionCode = objPipelineProblemsJson.exhibitionCode;
- // @ts-ignore
- let objMesh = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene.getMeshById(exhibitionCode);
-
- if (objMesh != null && objMesh != undefined) {
-
- let thisMesh = objMesh;
-
- // 确认当前可进行移动的主物体
- if (objMesh._parentContainer != null && objMesh._parentContainer != undefined) {
- let _parentContainer = objMesh._parentContainer;
-
- if (_parentContainer.meshes != null && _parentContainer.meshes != undefined) {
- thisMesh = _parentContainer.meshes[0];
- }
-
- }
- let newX = startX + distanceX * i;
- // // 一些管段特殊处理
- // if (name == "管道问题点-变形段") {
- // // distanceXBoolSum += 1;
- // console.log(
- // name,
- // thisMesh.id
- // );
- // }
- // 触发整体偏移逻辑
- newX = newX - (distanceX * distanceXBoolSum);
- thisMesh.position.x = newX;
-
- }
- }
-
- }
-
- }
- </script>
- <template>
- <!-- 3d课程配置:{{ props.config }} -->
- <img v-if="courseChapter3dShow().show.threeWorldMask == true" class="threeWorldMask" src="../../assets/student/mask.webp" />
- <CourseChapter3dMain
- :iframeId="'newIframe'"
- :url="threeWorldUrl"
- @callbackLoadPercentage="callbackLoadPercentageEvent"
- @callbackLoadEnd="callbackLoadEndEvent"
- @callbackDistanceYes="callbackDistanceYesEvent"
- @callbackDistanceNo="callbackDistanceNoEvent"
- @callbackCameraVisualAngleJsonToLook="callbackCameraVisualAngleJsonToLookEvent"
- ></CourseChapter3dMain>
- </template>
- <style scoped>
- .threeWorldMask {
- position: fixed;
- z-index: 1;
- width: 100%;
- height: 100%;
- top: 0px;
- left: 0px;
- pointer-events: none;
- }
- </style>
|