Commit f81caf51 authored by 李维's avatar 李维

dev commit

parent cea8eb1e
......@@ -121,6 +121,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// ------------ 游戏逻辑数据 ------------
m_currentSelectedCard = ""
m_allUpCards = []
m_fishes = []
// ------------------------------------
......@@ -195,9 +196,13 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initCard_up();
this.initCard_down();
this.initCutter()
this.initHand()
this.initBlackMask()
}
cleanGameVar(){
this.g_enableMapDown = true;
this.stopEndPatal()
this.m_currentSelectedCard = ""
this.m_allUpCards = []
}
......@@ -212,7 +217,11 @@ export class PlayComponent implements OnInit, OnDestroy {
}
endGame(){
this.g_cartoon.getCartoonElement("mask-layer").in(()=>{
this.g_enableMapDown = false;
this.showEndPatal()
this.clapHand()
})
}
......@@ -736,18 +745,14 @@ export class PlayComponent implements OnInit, OnDestroy {
card.ref.dot = dot;
// 链接关系
card.lineTo = this.g_formData.textUp[index].lineTo
card.lineTo = JSON.parse(JSON.stringify(this.g_formData.textUp[index].lineTo))
card.complete = false
card.checkLink = (id)=>{
this.log(id, card.lineTo)
let index = Number(id.split("-")[2])
this.log(index)
let z = card.lineTo.indexOf(index)
if(z==-1){
this.log("不正确")
return false
}else{
this.log("正确")
card.lineTo.splice(z, 1)
if(card.lineTo.length==0){
card.complete = true;
......@@ -1250,10 +1255,128 @@ checkEndGame(){
return result
}
initHand(){
let basePos = {
x: this.g_canvasWidth / 2,
y: this.g_canvasHeight / 2
}
let elementLeft = this.g_cartoon.createCartoonElementImage("hand-left", "bg_hand1", 391, 254, basePos.x, basePos.y, true)
elementLeft.pos_1 = {
x: basePos.x,
y: basePos.y
}
elementLeft.pos_2 = {
x: basePos.x - 50*this.g_mapScale,
y: basePos.y
}
elementLeft.ref.setScaleXY(0)
let elementRight = this.g_cartoon.createCartoonElementImage("hand-right", "bg_hand2", 392, 392, basePos.x, basePos.y, true)
elementRight.pos_1 = {
x: basePos.x,
y: basePos.y
}
elementRight.pos_2 = {
x: basePos.x + 50*this.g_mapScale,
y: basePos.y
}
elementRight.ref.setScaleXY(0)
let fishPos = [
{x: this.g_canvasWidth/2 + 280*this.g_mapScale, y: this.g_canvasHeight/2 - 150*this.g_mapScale, w: 107, h:91},
{x: this.g_canvasWidth/2 + 150*this.g_mapScale, y: this.g_canvasHeight/2 - 250*this.g_mapScale, w: 48, h:69},
{x: this.g_canvasWidth/2 + 50*this.g_mapScale, y: this.g_canvasHeight/2 - 220*this.g_mapScale, w: 64, h:70}
]
for(let index=0; index<3; index++){
let item = this.g_cartoon.createCartoonElementImage("hand-fish-" + index, "icon_yu"+(index+1), fishPos[index].w, fishPos[index].h, fishPos[index].x, fishPos[index].y, true)
elementRight.pos_1 = {
x: basePos.x,
y: basePos.y
}
item.ref.setScaleXY(0)
item.show = ()=>{
tweenChange(item.ref, {scaleX:item.initScaleX, scaleY:item.initScaleY}, 0.2, ()=>{})
}
item.rote = (callback?)=>{
setTimeout(() => {
this.m_setIntervalIDs.push(setInterval(()=>{
tweenChange(item.ref, {rotation:360}, 0.2, ()=>{
item.ref.rotation = 0
callback && callback
})
}, 410))
}, 505);
}
this.m_fishes.push(item)
}
elementRight.pos_2 = {
x: basePos.x + 50*this.g_mapScale,
y: basePos.y
}
elementRight.ref.setScaleXY(0)
elementLeft.clap = (callback?)=>{
tweenChange(elementLeft.ref, {scaleX:elementLeft.initScaleX, scaleY:elementLeft.initScaleY}, 0.2, ()=>{
this.m_setIntervalIDs.push(setInterval(()=>{
tweenChange(elementLeft.ref, elementLeft.pos_2, 0.2, ()=>{
tweenChange(elementLeft.ref, elementLeft.pos_1, 0.2)
})
}, 410))
})
}
elementRight.clap = (callback?)=>{
tweenChange(elementRight.ref, {scaleX:elementRight.initScaleX, scaleY:elementRight.initScaleY}, 0.2, ()=>{
this.m_setIntervalIDs.push(setInterval(()=>{
tweenChange(elementRight.ref, elementRight.pos_2, 0.2, ()=>{
tweenChange(elementRight.ref, elementRight.pos_1, 0.2)
})
}, 410))
})
}
this.m_fishes.forEach(item=>{
this.render(item.ref, 9995)
})
this.render(elementLeft.ref, 9999)
this.render(elementRight.ref, 9990)
}
clapHand(callback?){
this.m_fishes.forEach(item=>{
item.show()
item.rote()
})
this.g_cartoon.getCartoonElement("hand-left").clap()
this.g_cartoon.getCartoonElement("hand-right").clap()
}
initBlackMask(callback?){
let element = this.g_cartoon.createCartoonElementImage("mask-layer", "_mask_layer_1280_720", this.g_canvasWidth, this.g_canvasHeight, this.g_canvasWidth/2, this.g_canvasHeight/2)
element.ref.visible = false;
element.in = (callback?)=>{
element.ref.visible = true;
tweenChange(element.ref, {alpha:1}, 0.1, ()=>{
callback && callback()
})
}
element.out = (callback?)=>{
tweenChange(element.ref, {alpha:0}, 0.1, ()=>{
element.ref.visible = false;
callback && callback()
})
}
this.render(element.ref, 998)
}
......
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