Commit cc76e42c authored by 李维's avatar 李维

Bug fix

parent c458b230
......@@ -66,7 +66,7 @@ export class PlayComponent implements OnInit, OnDestroy {
g_topElementContainer; // 用于装载装饰元素 气球 星星等
g_stage; //中心舞台
// g_background_color = "#rgb(0,0,0,0)"
g_background_color = "#FFFFFF"
g_background_color = "#f0f5f8"
g_enableMapDown = true; // 触摸使能
g_enableMapUp = true; // 抬起使能
g_enableMapMove = true; // 移动ss使能
......@@ -206,7 +206,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
cleanGameVar(){
this.m_currentQuestionIndex = -1;
}
startGame(){
......@@ -322,8 +322,8 @@ export class PlayComponent implements OnInit, OnDestroy {
let sliderBG = this.g_cartoon.createCartoonElementImageFunc("slider-background", "bgSlider", (w, h)=>{
return {
sx: 14 * this.g_mapScale / w,
sy: 552* this.g_mapScale / h,
sx: 14 / w,
sy: 552 / h,
}
}, (w, h)=>{
return {
......@@ -387,7 +387,6 @@ export class PlayComponent implements OnInit, OnDestroy {
return true;
}
}
sliderBG.ref.addChild(sliderTop.ref)
let sliderBody = this.g_cartoon.createCartoonElementImageFunc("slider-body", "slider_body", (w, h)=>{
return {
......@@ -419,9 +418,6 @@ export class PlayComponent implements OnInit, OnDestroy {
sliderBottom.update();
}
sliderBG.ref.addChild(sliderBody.ref)
let sliderBottom = this.g_cartoon.createCartoonElementImageFunc("slider-bottom", "slider_bottom", (w, h)=>{
return {
sx: 8 / w,
......@@ -446,7 +442,9 @@ export class PlayComponent implements OnInit, OnDestroy {
return true;
}
}
sliderBG.ref.addChild(sliderBody.ref)
sliderBG.ref.addChild(sliderBottom.ref)
sliderBG.ref.addChild(sliderTop.ref)
this.render(sliderBG.ref, zIndexMap.sliderBG)
let clickSY = 0
......@@ -481,13 +479,14 @@ export class PlayComponent implements OnInit, OnDestroy {
}
initScrollPannel() {
let pannel = this.g_cartoon.createCartoonElementShapeRect("scroll-pannel", this.g_canvasWidth, this.g_canvasHeight - 78 * this.g_mapScale, "#f0f5f8")
let pannel = this.g_cartoon.createCartoonElementShapeRect("scroll-pannel", this.g_canvasWidth - 180 * this.g_mapScale, this.g_canvasHeight - 78 * this.g_mapScale, "#f0f5f8")
pannel.ref.y = 78 * this.g_mapScale
this.render(pannel.ref, 10);
pannel.lastInserType = "Q"
pannel.windowHeight = this.g_canvasHeight - 78 * this.g_mapScale
pannel.currentY = 0;
pannel.currentQuestionIndex = -1;
pannel.topY = 78 * this.g_mapScale
pannel.insertQuestion = (text, nextQuestion = false) => {
if(nextQuestion) {
pannel.currentQuestionIndex++;
......@@ -512,14 +511,15 @@ export class PlayComponent implements OnInit, OnDestroy {
lineText.show()
pannel.currentY = label.ref.y + 64 * this.g_mapScale;
if(pannel.windowHeight < pannel.currentY) {
pannel.ref.setSize(this.g_canvasWidth, pannel.currentY)
pannel.ref.setSize(this.g_canvasWidth - 180 * this.g_mapScale, pannel.currentY)
this.g_cartoon.getCartoonElement("slider-background").initSlider(pannel.windowHeight, pannel.currentY, 1)
this.g_cartoon.getCartoonElement("slider-background").show()
}
pannel.ref.addChild(label.ref);
pannel.lastInserType = "Q";
}
pannel.canScroll = false;
pannel.firstInstert = true;
pannel.insertAnswer = (text) => {
let line = this.creatAnswerTextLine(pannel.currentQuestionIndex, text, 42 * this.g_mapScale * 2, pannel.currentY, pannel.ref)
......@@ -537,14 +537,68 @@ export class PlayComponent implements OnInit, OnDestroy {
line.show()
if(pannel.windowHeight < pannel.currentY) {
pannel.ref.setSize(this.g_canvasWidth, pannel.currentY)
pannel.ref.setSize(this.g_canvasWidth - 180 * this.g_mapScale, pannel.currentY)
this.g_cartoon.getCartoonElement("slider-background").initSlider(pannel.windowHeight, pannel.currentY, 1)
this.g_cartoon.getCartoonElement("slider-background").show()
this.g_cartoon.getCartoonElement("slider-background").show();
pannel.canScroll = true;
}
pannel.ref.addChild(label.ref);
pannel.lastInserType = "A"
}
let clickSY = null;
let baseY = null;
this.subscribeMapDragEvent(pannel.id, ()=>{
if(!pannel.canScroll) {
this.g_enableMapUp = true;
this.g_enableMapDown = true;
return;
}
clickSY = this.g_clickY;
baseY = pannel.ref.y
console.log("baseY", baseY)
}, ()=>{
let dis = clickSY - this.g_clickY;
let _t = pannel.topY - (pannel.currentY - pannel.windowHeight)
if(pannel.topY <= (baseY - dis)) {
pannel.ref.y = pannel.topY
} else {
if((baseY - dis) <= _t) {
pannel.ref.y = _t
} else {
pannel.ref.y = baseY - dis
}
}
let total = pannel.topY - _t;
let current = pannel.topY - pannel.ref.y
let progress = Math.floor(current / total * 100) / 100;
if(progress<0.05) {
progress = 0.05
}
if(progress>1) {
progress = 1
}
console.log(progress)
this.g_cartoon.getCartoonElement("slider-background").initSlider(pannel.windowHeight, pannel.currentY, progress)
// let crTop = sliderTop.update()
// let crBottom = sliderBottom.update()
// if(!crTop) {
// sliderBody.toTop()
// sliderTop.update();
// sliderBottom.update();
// }
// if(!crBottom) {
// sliderBody.toEnd();
// sliderTop.update();
// sliderBottom.update();
// }
// scrollPannel.ref.y = 78 * this.g_mapScale - (scrollPannel.currentY - (this.g_canvasHeight - 78 * this.g_mapScale)) * sliderBG.getCurrentProgress()
}, ()=>{
this.g_enableMapUp = true;
this.g_enableMapDown = true;
})
}
initButtions() {
......@@ -637,7 +691,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}, 900*index);
}
})
})
}, 100)
this.subscribeMapDownEvent(btnAnswer.id, ()=>{
let text = this.g_formData.dataArray[this.m_currentQuestionIndex].answerText?this.g_formData.dataArray[this.m_currentQuestionIndex].answerText:""
......@@ -664,7 +718,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}, 900*index);
})
})
}, 100)
this.render(btnQuestion.ref, zIndexMap.buttons);
this.render(btnAnswer.ref, zIndexMap.buttons);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment