Commit cc76e42c authored by 李维's avatar 李维

Bug fix

parent c458b230
...@@ -66,7 +66,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -66,7 +66,7 @@ export class PlayComponent implements OnInit, OnDestroy {
g_topElementContainer; // 用于装载装饰元素 气球 星星等 g_topElementContainer; // 用于装载装饰元素 气球 星星等
g_stage; //中心舞台 g_stage; //中心舞台
// g_background_color = "#rgb(0,0,0,0)" // g_background_color = "#rgb(0,0,0,0)"
g_background_color = "#FFFFFF" g_background_color = "#f0f5f8"
g_enableMapDown = true; // 触摸使能 g_enableMapDown = true; // 触摸使能
g_enableMapUp = true; // 抬起使能 g_enableMapUp = true; // 抬起使能
g_enableMapMove = true; // 移动ss使能 g_enableMapMove = true; // 移动ss使能
...@@ -206,7 +206,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -206,7 +206,7 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
cleanGameVar(){ cleanGameVar(){
this.m_currentQuestionIndex = -1;
} }
startGame(){ startGame(){
...@@ -322,8 +322,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -322,8 +322,8 @@ export class PlayComponent implements OnInit, OnDestroy {
let sliderBG = this.g_cartoon.createCartoonElementImageFunc("slider-background", "bgSlider", (w, h)=>{ let sliderBG = this.g_cartoon.createCartoonElementImageFunc("slider-background", "bgSlider", (w, h)=>{
return { return {
sx: 14 * this.g_mapScale / w, sx: 14 / w,
sy: 552* this.g_mapScale / h, sy: 552 / h,
} }
}, (w, h)=>{ }, (w, h)=>{
return { return {
...@@ -387,7 +387,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -387,7 +387,6 @@ export class PlayComponent implements OnInit, OnDestroy {
return true; return true;
} }
} }
sliderBG.ref.addChild(sliderTop.ref)
let sliderBody = this.g_cartoon.createCartoonElementImageFunc("slider-body", "slider_body", (w, h)=>{ let sliderBody = this.g_cartoon.createCartoonElementImageFunc("slider-body", "slider_body", (w, h)=>{
return { return {
...@@ -419,9 +418,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -419,9 +418,6 @@ export class PlayComponent implements OnInit, OnDestroy {
sliderBottom.update(); sliderBottom.update();
} }
sliderBG.ref.addChild(sliderBody.ref)
let sliderBottom = this.g_cartoon.createCartoonElementImageFunc("slider-bottom", "slider_bottom", (w, h)=>{ let sliderBottom = this.g_cartoon.createCartoonElementImageFunc("slider-bottom", "slider_bottom", (w, h)=>{
return { return {
sx: 8 / w, sx: 8 / w,
...@@ -446,7 +442,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -446,7 +442,9 @@ export class PlayComponent implements OnInit, OnDestroy {
return true; return true;
} }
} }
sliderBG.ref.addChild(sliderBody.ref)
sliderBG.ref.addChild(sliderBottom.ref) sliderBG.ref.addChild(sliderBottom.ref)
sliderBG.ref.addChild(sliderTop.ref)
this.render(sliderBG.ref, zIndexMap.sliderBG) this.render(sliderBG.ref, zIndexMap.sliderBG)
let clickSY = 0 let clickSY = 0
...@@ -481,13 +479,14 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -481,13 +479,14 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
initScrollPannel() { 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 pannel.ref.y = 78 * this.g_mapScale
this.render(pannel.ref, 10); this.render(pannel.ref, 10);
pannel.lastInserType = "Q" pannel.lastInserType = "Q"
pannel.windowHeight = this.g_canvasHeight - 78 * this.g_mapScale pannel.windowHeight = this.g_canvasHeight - 78 * this.g_mapScale
pannel.currentY = 0; pannel.currentY = 0;
pannel.currentQuestionIndex = -1; pannel.currentQuestionIndex = -1;
pannel.topY = 78 * this.g_mapScale
pannel.insertQuestion = (text, nextQuestion = false) => { pannel.insertQuestion = (text, nextQuestion = false) => {
if(nextQuestion) { if(nextQuestion) {
pannel.currentQuestionIndex++; pannel.currentQuestionIndex++;
...@@ -512,7 +511,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -512,7 +511,7 @@ export class PlayComponent implements OnInit, OnDestroy {
lineText.show() lineText.show()
pannel.currentY = label.ref.y + 64 * this.g_mapScale; pannel.currentY = label.ref.y + 64 * this.g_mapScale;
if(pannel.windowHeight < pannel.currentY) { 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").initSlider(pannel.windowHeight, pannel.currentY, 1)
this.g_cartoon.getCartoonElement("slider-background").show() this.g_cartoon.getCartoonElement("slider-background").show()
} }
...@@ -520,6 +519,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -520,6 +519,7 @@ export class PlayComponent implements OnInit, OnDestroy {
pannel.lastInserType = "Q"; pannel.lastInserType = "Q";
} }
pannel.canScroll = false;
pannel.firstInstert = true; pannel.firstInstert = true;
pannel.insertAnswer = (text) => { pannel.insertAnswer = (text) => {
let line = this.creatAnswerTextLine(pannel.currentQuestionIndex, text, 42 * this.g_mapScale * 2, pannel.currentY, pannel.ref) 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 { ...@@ -537,14 +537,68 @@ export class PlayComponent implements OnInit, OnDestroy {
line.show() line.show()
if(pannel.windowHeight < pannel.currentY) { 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").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.ref.addChild(label.ref);
pannel.lastInserType = "A" 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() { initButtions() {
...@@ -637,7 +691,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -637,7 +691,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}, 900*index); }, 900*index);
} }
}) })
}) }, 100)
this.subscribeMapDownEvent(btnAnswer.id, ()=>{ this.subscribeMapDownEvent(btnAnswer.id, ()=>{
let text = this.g_formData.dataArray[this.m_currentQuestionIndex].answerText?this.g_formData.dataArray[this.m_currentQuestionIndex].answerText:"" 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 { ...@@ -664,7 +718,7 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
}, 900*index); }, 900*index);
}) })
}) }, 100)
this.render(btnQuestion.ref, zIndexMap.buttons); this.render(btnQuestion.ref, zIndexMap.buttons);
this.render(btnAnswer.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