三维课程增加场景id显示,修改提示窗下一步功能区分,修改事件驱动条件

This commit is contained in:
sunzhenyu 2021-05-21 15:30:50 +08:00
parent f3c9bfdcb6
commit 351d268e52
7 changed files with 2900 additions and 2877 deletions

View File

@ -53,9 +53,7 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
animateManager.initAnimation(assetModelManager);
controlManager.init(animateManager.actions,assetModelManager);
if(lessonData.lessonProgress[lessonIndex].action.length>0){
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,true,assetModelManager.lessonTriggerList);
}
startLesson();
animate();
@ -104,10 +102,14 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
this.initNowRole = function(role){
nowRole = role;
controlManager.initControlMode(lessonIndex);
let roleMode = false;
if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){
controlManager.initRoleMode(true);
}else{
controlManager.initRoleMode(false);
roleMode = true;
}
controlManager.initRoleMode(roleMode);
if(lessonData.lessonProgress[lessonIndex].action.length>0){
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,roleMode,assetModelManager.lessonTriggerList);
}
};
//循环渲染函数

View File

@ -229,7 +229,9 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
document.addEventListener( 'mousedown', (event) => {
fpsMouseStatus = true;
// document.body.requestPointerLock();
console.log("mousedown-----------------------");
console.log(raycasterBoxs);
console.log(roleMode);
if(raycasterBoxs.length>0 && roleMode){
var mouse = new THREE.Vector2();
@ -240,21 +242,26 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
mouse.y = - ( event.clientY / dom.offsetHeight ) * 2 + 1;
raycaster.setFromCamera(mouse,scope.nowCamera) // 也可以给构造函数传参的形式写
console.log(raycasterBoxs);
for(let i=0;i<raycasterBoxs.length;i++){
var intersects = raycaster.intersectObject( raycasterBoxs[i].mesh);
var intersects = raycaster.intersectObject( raycasterBoxs[i].mesh,true);
if(intersects.length>0){
console.log(raycasterBoxs[i]);
if(raycasterBoxs[i].type == "switch"){
if(raycasterBoxs[i].action.status == "01"){
raycasterBoxs[i].action.status = "02";
raycasterBoxs[i].action.action.play();
}else if(raycasterBoxs[i].action.status == "02"){
raycasterBoxs[i].action.status = "01";
raycasterBoxs[i].action.action.stop();
if(raycasterBoxs[i].actionMode == "jump"){
actionEvent("remove",raycasterBoxs[i],raycasterBoxs[i].mesh);
jumpEvent("action",raycasterBoxs[i]);
}else{
if(raycasterBoxs[i].action.status == "01"){
raycasterBoxs[i].action.status = "02";
raycasterBoxs[i].action.action.play();
}else if(raycasterBoxs[i].action.status == "02"){
raycasterBoxs[i].action.status = "01";
raycasterBoxs[i].action.action.stop();
}
}
}
if(raycasterBoxs[i].type == "urgeSwitch"){
}else if(raycasterBoxs[i].type == "urgeSwitch"){
if(raycasterBoxs[i].action.status == "02"){
raycasterBoxs[i].action.status = "01";
raycasterBoxs[i].action.action.stop();
@ -502,6 +509,8 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
// eventBoxs = newEventBoxs;
raycasterBoxs = [];
roleMode = rMode;
console.log("changeIndex-----------------");
console.log(actions);
console.log(roleMode);
if(actions.length>0 && roleMode){
for(let i=0;i<actions.length;i++){
@ -528,7 +537,6 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
eventTestBox.mesh = eventTrigger[j];
eventTestBox.action = actions[i];
eventBoxs.push(eventTestBox);
console.log("changeindex");
actionEvent("changeIndex",eventBoxs[i].action,eventTestBox.mesh);
}
}
@ -542,8 +550,12 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
mesh:eventTrigger[j],
action:actionList[eventTrigger[j].actionName],
type:actions[i].actionType,
actionMode:actions[i].actionMode,
jumpNode:actions[i].jumpNode,
};
raycasterBoxs.push(eventRaycaster);
actionEvent("changeIndex",actions[i],eventTrigger[j]);
}
}
}

View File

@ -9,7 +9,9 @@
<el-input v-model="lessonData.lessonData.lessonProgress[lessonEditIndex].progressName" placeholder="请输入内容"></el-input>
</el-form-item>
<el-form-item label="场景id:" >
<el-input v-model="lessonData.lessonData.lessonProgress[lessonEditIndex].id" placeholder="请输入内容"></el-input>
</el-form-item>
<el-form-item label="三维场景设置:">
<el-select v-model="lessonData.lessonData.lessonProgress[lessonEditIndex].progressScene" placeholder="请选择场景">
@ -165,6 +167,10 @@
</el-select>
</el-form-item>
<el-form-item label="课程场景id:" v-if="selected.sceneId" >
<el-input v-model="selected.sceneId" ></el-input>
</el-form-item>
<el-form-item label="内容:" v-if="selected.text">
<el-input v-model="selected.text" ></el-input>
</el-form-item>

View File

@ -81,6 +81,10 @@
<el-row>
当前课程信息
</el-row>
<el-row>
<el-button @click="saveLesson3dData">保存当前课程</el-button>
</el-row>
<el-row>
<el-button @click="setupclick">课程设置</el-button>
</el-row>
@ -88,8 +92,9 @@
<el-button @click="jumpPlayer">预览课程</el-button>
</el-row>
<el-row>
<el-button @click="saveLesson3dData">保存当前课程</el-button>
<el-button @click="back">退出编辑器</el-button>
</el-row>
</div>
<Pro-Perty
@ -298,6 +303,9 @@
unSubmit(){
this.showSetup = false;
},
back(){
history.go(-1);
},
},
}

View File

@ -193,7 +193,6 @@
for(let i=0;i<this.jobPaneData.dataList.length;i++){
if(job == this.jobPaneData.dataList[i].name){
this.nowRole = this.jobPaneData.dataList[i].value;
console.log(this.nowRole);
this.jl3d.initNowRole(this.nowRole);
}
}

View File

@ -14,7 +14,7 @@
</div>
<div class="nextbuttondiv"
:style="{'background-image': 'url('+staticImg+'/lesson3d/nextbutton.png)'}"
v-if="lessonData.lessonData.lessonProgress[lessonPlayIndex].explainPane.explainPaneType=='jump'|| (lessonData.lessonData.lessonProgress[lessonPlayIndex].explainPane.explainPaneType == 'limitjump' && lessonData.lessonData.lessonProgress[lessonPlayIndex].value == nowRole) "
v-if="lessonData.lessonData.lessonProgress[lessonPlayIndex].explainPane.explainPaneType=='jump'|| (lessonData.lessonData.lessonProgress[lessonPlayIndex].explainPane.explainPaneType == 'limitjump' && !(lessonData.lessonData.lessonProgress[lessonPlayIndex].roleName == nowRole)) "
@click="explainJump"></div>
</div>
</template>
@ -54,6 +54,7 @@
// lesson3dSelect('toolproperty','explainpane');
// },
explainJump(){
if(this.lessonData.lessonData.lessonProgress[this.lessonPlayIndex].explainPane.explainPaneType == "jump" || (this.lessonData.lessonData.lessonProgress[this.lessonPlayIndex].explainPane.explainPaneType == "limitjump")){
this.$emit('jumpEvent','jump',this.lessonData.lessonData.lessonProgress[this.lessonPlayIndex].explainPane);
}

File diff suppressed because it is too large Load Diff