Commit 8b4ced49 authored by 李维's avatar 李维

dev commit

parent db81def0
......@@ -272,7 +272,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_questionCard_All.push(this.createQuestionCardText(2, {}))
this.m_questionCard_All.push(this.createQuestionCardText(3, {}))
this.alignCenter(this.m_questionCard_All, 0, true)
this.alignCenter(this.m_questionCard_All, 20*this.g_mapScale, true)
}
createQuestionCardText(index, data){
......@@ -299,7 +299,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_questionCard_All.push(this.createQuestionCardImage(2, {}))
this.m_questionCard_All.push(this.createQuestionCardImage(3, {}))
this.alignCenter(this.m_questionCard_All, 40, true)
this.alignCenter(this.m_questionCard_All, 20*this.g_mapScale, true)
}
createQuestionCardImage(index, data){
......@@ -405,7 +405,7 @@ export class PlayComponent implements OnInit, OnDestroy {
element.startPos = { x:element.initX, y:element.initY }
element.backTo = (pos?, callback?)=>{
if(pos){
tweenChange(element.ref, pos, 0.3, ()=>{
tweenChange(element.ref, pos, 0.1, ()=>{
callback && callback()
})
}else{
......@@ -415,17 +415,22 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
element.release = ()=>{
element.disable = false;
element.release = (pos, callback?)=>{
this.m_enableCardMove = false;
this.m_currentSelectedCardID = null;
border_H.ref.visible = false;
borderRight_H.ref.visible = false;
borderLeft_H.ref.visible = false;
this.disableMoveAsstant()
element.backTo()
element.backTo(pos, callback)
}
this.subscribeMapDownEvent(element.id, ()=>{
if(element.disable){
this.g_enableMapDown = true;
return
}
this.m_enableCardMove = true;
this.m_currentSelectedCardID = element.id
border_H.ref.visible = true;
......@@ -444,6 +449,10 @@ export class PlayComponent implements OnInit, OnDestroy {
})
this.subscribeMapUpEvent(element.id, ()=>{
if(element.disable){
this.g_enableMapUp = true;
return
}
element.release()
this.g_enableMapUp = true;
})
......@@ -460,7 +469,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_answerCard_All.push(this.createAnswerCardText(2, {}))
this.m_answerCard_All.push(this.createAnswerCardText(3, {}))
this.alignCenter(this.m_answerCard_All, 0, true)
this.alignCenter(this.m_answerCard_All, 20*this.g_mapScale, true)
}
createAnswerCardText(index, data){
......@@ -487,7 +496,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_answerCard_All.push(this.createAnswerCardImage(2, {}))
this.m_answerCard_All.push(this.createAnswerCardImage(3, {}))
this.alignCenter(this.m_answerCard_All, 0, true)
this.alignCenter(this.m_answerCard_All, 20*this.g_mapScale, true)
}
createAnswerCardImage(index, data){
......@@ -503,6 +512,24 @@ export class PlayComponent implements OnInit, OnDestroy {
}
})
this.subscribeMapUpEvent(element.id, ()=>{
if(this.m_currentSelectedCardID && this.m_enableCardMove){
let selectedCard = this.g_cartoon.getCartoonElement(this.m_currentSelectedCardID)
selectedCard.ref.x = element.ref.x
selectedCard.ref.y = element.ref.y
selectedCard.release({x:element.ref.x, y:element.ref.y - 6 * this.g_mapScale}, ()=>{
this.alignCenter(this.m_answerCard_All, 30*this.g_mapScale, true)
})
selectedCard.disable = true;
let index = this.m_answerCard_All.indexOf(element)
this.m_answerCard_All.splice(index, 1, selectedCard)
this.deleteElementInRender(element.id)
this.topOfRenderArray(this.g_cartoon.getCartoonElement("background-main-xia").ref)
}
this.g_enableMapUp = true;
return true
}, 100)
this.render(element.ref, zIndexMap.answerCard)
return element
}
......@@ -665,7 +692,6 @@ export class PlayComponent implements OnInit, OnDestroy {
this.g_enableMapDown = true;
return;
}
console.log(slider.enableSlider)
if(!slider.enableSlider){
slider.enableSlider= true;
this.enableMoveAsstant(()=>{
......@@ -1337,7 +1363,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.g_cartoon.setOrigin( image.x-(bgWidth/2*this.g_mapScale), image.y-(bgHeight/2*this.g_mapScale) )
this.g_cartoon.setRelativeOrigin( -bgWidth/2, -bgHeight/2)
image.setScaleXY(this.g_mapScale);
this.render(image, -999999)
this.render(image, 50)
this.g_stage = image
}
......@@ -1490,30 +1516,43 @@ export class PlayComponent implements OnInit, OnDestroy {
this.render(bgRect, 9999);
}
alignCenter(elementArray, spacing, withAni?){
alignCenter(elementArray, spacing, withAni?, callback?){
let totlaWidth = 0
elementArray.forEach(element => {
let bd = element.ref.getBoundingBox()
totlaWidth += bd.width
});
totlaWidth += (elementArray.length-1) * spacing
let laseX = this.g_canvasWidth / 2 - totlaWidth/2;
elementArray.forEach(element => {
let bd = element.ref.getBoundingBox()
if(withAni){
tweenChange(element.ref, {x: laseX + bd.width / 2}, 0.2, ()=>{
this.g_cartoon.saveSize(element.id)
callback && callback()
})
}else{
element.ref.x = laseX + bd.width / 2
this.g_cartoon.saveSize(element.id)
callback && callback()
}
laseX = (laseX + bd.width + spacing)
});
}
createTestLine(x, y, color?){
var colorAll = ['#ff0000','#eb4310','#f6941d','#fbb417','#ffff00','#cdd541','#99cc33','#3f9337','#219167','#239676','#24998d','#1f9baa','#0080ff','#3366cc','#333399','#003366','#800080','#a1488e','#c71585','#bd2158'];
color = color ? color : colorAll[Math.floor(Math.random()*20)]
this.render(this.g_cartoon.createRectangula({
width: 5,
height: 100,
x: x,
y: y,
fillColor: color
}), 9999)
}
......
......@@ -30,7 +30,7 @@ const localImages = {
'bg_bg': 'assets/play/bg_bg.png',
'bg_bottom': 'assets/play/bg_bottom.png',
'bg_change': 'assets/play/bg_change.png',
'bg_change2': 'assets/play/bg_change2.png',
'bg_change2': 'assets/play/bg_change2-1.png',
'bg_kuang1': 'assets/play/bg_kuang1.png',
'bg_kuang2': 'assets/play/bg_kuang2.png',
'bg_laba': 'assets/play/bg_laba.png',
......
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