diff --git a/src/jlmap3d/lesson3d/lesson3dplayer.js b/src/jlmap3d/lesson3d/lesson3dplayer.js index 3f9f98815..64fce7345 100644 --- a/src/jlmap3d/lesson3d/lesson3dplayer.js +++ b/src/jlmap3d/lesson3d/lesson3dplayer.js @@ -30,8 +30,8 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) { let scope = this; this.dom = dom; - //定义相机 - + //定义当前课程角色 + let nowRole = ""; //定义场景(渲染容器) scene = new THREE.Scene(); @@ -53,7 +53,6 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) { animateManager.initAnimation(assetModelManager); controlManager.init(animateManager.actions); - console.log(lessonData.lessonProgress[lessonIndex]); if(lessonData.lessonProgress[lessonIndex].action.length>0){ controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,assetModelManager.lessonTriggerList); } @@ -75,12 +74,27 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) { this.changeIndex = function(nowIndex){ lessonIndex = nowIndex; controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action); + + if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){ + controlManager.initRoleMode(true); + }else{ + controlManager.initRoleMode(false); + } + } this.changeCameraPos = function(pos){ controlManager.updatePos(pos); } + this.initNowRole = function(role){ + nowRole = role; + if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){ + controlManager.initRoleMode(true); + }else{ + controlManager.initRoleMode(false); + } + }; //循环渲染函数 function animate() { diff --git a/src/jlmap3d/lesson3d/manager/animatemanager.js b/src/jlmap3d/lesson3d/manager/animatemanager.js index 405129832..1f933a610 100644 --- a/src/jlmap3d/lesson3d/manager/animatemanager.js +++ b/src/jlmap3d/lesson3d/manager/animatemanager.js @@ -13,12 +13,10 @@ export function AnimateManager() { for(let k in assetModelManager.staticAsset){ if(assetModelManager.staticAsset[k].mesh.animations.length > 0){ - console.log(assetModelManager.staticAsset[k].mesh.name); let animations = assetModelManager.staticAsset[k].mesh.animations; let mixer = new THREE.AnimationMixer( assetModelManager.staticAsset[k].mesh ); let actionName = assetModelManager.staticAsset[k].mesh.name; - console.log(actionName); scope.actions[actionName] = { status:"01", action:mixer.clipAction( assetModelManager.staticAsset[k].mesh.animations[ 0 ]) @@ -38,7 +36,6 @@ export function AnimateManager() { for(let i=mixers.length-1;i>=0;i--){ if(mixers[i]._actions[0].isRunning()){ - // console.log(scope.mixers[i]._actions[0].isRunning()); mixers[i].update( mixerUpdateDelta ); } } diff --git a/src/jlmap3d/lesson3d/manager/assetmodelmanager.js b/src/jlmap3d/lesson3d/manager/assetmodelmanager.js index 948c9e5b2..0e46ad277 100644 --- a/src/jlmap3d/lesson3d/manager/assetmodelmanager.js +++ b/src/jlmap3d/lesson3d/manager/assetmodelmanager.js @@ -198,7 +198,6 @@ export function AssetModelManager(scene) { function fbxpromise(asset){ return new Promise(function(resolve, reject){ var loader = new THREE.FBXLoader(); - console.log(asset); if(asset.assetType == "static"){ loader.load( asset.url, function ( object ) { object.name = asset.modelId; @@ -210,7 +209,6 @@ export function AssetModelManager(scene) { loader.load( BASE_ASSET_API+asset.url, function ( object ) { asset.mesh = object; if(asset.assetType == "default"){ - console.log(object); // scene.add(object); }else if(asset.assetType == 'loadModel'){ diff --git a/src/jlmap3d/lesson3d/manager/controlmanager.js b/src/jlmap3d/lesson3d/manager/controlmanager.js index accb75ef6..fbbaa29a0 100644 --- a/src/jlmap3d/lesson3d/manager/controlmanager.js +++ b/src/jlmap3d/lesson3d/manager/controlmanager.js @@ -14,6 +14,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) { this.nowCamera = null; this.eventHitMode = false; + let roleMode = false; let eventBoxs = []; let raycasterBoxs = []; let actionList = []; @@ -110,6 +111,9 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) { } ); + this.initRoleMode = function(rMode){ + roleMode = rMode; + }; const worldOctree = new Octree(); @@ -138,6 +142,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) { const keyStates = {}; let clock = new THREE.Clock(); + this.updateOrbitControl = function(){ oribitControl.update(); }; @@ -151,7 +156,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) { updateSpheres( deltaTime ); - if(scope.eventHitMode == true){ + if(scope.eventHitMode == true && roleMode){ if(eventBoxs.length>0){ attachBox.position.copy(fpsCamera.position); for(let i=0;i0){ + if(raycasterBoxs.length>0 && roleMode){ var mouse = new THREE.Vector2(); var raycaster = new THREE.Raycaster(); @@ -479,7 +484,6 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) { if(actions[i].actionMode == "play"){ for(let j=0;j + + + + + + + @@ -295,6 +306,16 @@ ], jobDataList:[], value:'', + explainPaneTypes:[ + { + name:"无", + value:"null", + }, + { + name:"跳转", + value:"jump", + } + ], } }, computed: { diff --git a/src/views/jlmap3d/lesson3dedit/lesson3dedit.vue b/src/views/jlmap3d/lesson3dedit/lesson3dedit.vue index a589785f5..2fb5f8526 100644 --- a/src/views/jlmap3d/lesson3dedit/lesson3dedit.vue +++ b/src/views/jlmap3d/lesson3dedit/lesson3dedit.vue @@ -7,6 +7,34 @@ :lessonTools='lessonTools' > +
+
课程内容设置
+ + + + + + + + + {{role.name}} + + + + + + 修改完成 + 关闭 + + +
+ +
- 当前课程信息 @@ -118,6 +145,9 @@ data() { return { jl3d: null, + showSetup:false, + examMode:false, + checkedRole:[], netData:{ name:'', type:'', @@ -186,9 +216,10 @@ if(data.data.data){ loadData = JSON.parse(data.data.data); - + console.log(loadData); + this.checkedRole = loadData.setup.checkedRole; + this.examMode = loadData.setup.examMode; this.jobPaneData.dataList = loadData.toolJobPane; - console.log(this.jobPaneData.dataList); this.$refs.jobpane.initJobList(this.jobPaneData.dataList); this.lessonTools = loadData.lessonTools; @@ -197,8 +228,7 @@ this.lessonData.initLessonProgress(); this.$refs.jobpane.initJobList(this.jobPaneData.dataList); } - console.log("loaddata----------------"); - console.log(loadData); + this.jl3d = new Lesson3dEditor(dom,loadData); }).catch(() => { }); @@ -212,13 +242,15 @@ let assetModelData = this.jl3d.saveAssetModel(); saveData.assetList = assetModelData.assetList; saveData.modelList = assetModelData.modelList; - + saveData.setup.examMode = this.examMode; + saveData.setup.checkedRole = this.checkedRole; this.netData.data = JSON.stringify(saveData); // console.log(); updateLesson3dData(this.$route.query.lessonId,this.netData).then(data => { - console.log(data); - }).catch(() => { + this.$message('保存成功'); + }).catch(() => { + this.$message('保存失败'); }); }, addProgress(){ @@ -245,6 +277,7 @@ }, setupclick(){ + this.showSetup = true; }, createModel(assetData,mousePos){ this.jl3d.createModelTrigger(assetData,mousePos); @@ -258,6 +291,13 @@ this.$router.push({ path: '/design/jlmap3d/lesson3dplayer', query: {lessonId: this.$route.query.lessonId} }); }, + + onSubmit() { + this.showSetup = false; + }, + unSubmit(){ + this.showSetup = false; + }, }, } @@ -318,4 +358,25 @@ .el-tabs__content{ position: absolute; } + + .lessonsetupdiv { + position: absolute; + width: 30%; + height: 40%; + top:30%; + left:35%; + background-color: #fff; + border-radius: 18px; + border:solid 2px #000; + z-index: 5; + } + + .nextbuttondiv{ + width:30px; + height:30px; + background-size: 100%; + position: absolute; + right:0; + bottom:0; + } diff --git a/src/views/jlmap3d/lesson3dedit/tools/explainpane.vue b/src/views/jlmap3d/lesson3dedit/tools/explainpane.vue index e24bb0413..db4fd16b4 100644 --- a/src/views/jlmap3d/lesson3dedit/tools/explainpane.vue +++ b/src/views/jlmap3d/lesson3dedit/tools/explainpane.vue @@ -9,6 +9,11 @@
{{lessonData.lessonData.lessonProgress[lessonEditIndex].explainPane.text}}
+ +
+