Commit d8d2dc15 authored by 李维's avatar 李维

dev commit

parent 3b8ffabe
......@@ -4,7 +4,7 @@
<div class="card-item-content border">
<div class="card-item-content">
<div class="title" >
糖果 -<strong>{{ i + 1 }}</strong>-
卡片 -<strong>{{ i + 1 }}</strong>-
</div>
<div class="section" >
<div class="section-content">
......
......@@ -46,6 +46,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
this.init();
this.refresh();
this.save()
}, this.KEY);
}
ngOnChanges() {
......
......@@ -131,7 +131,8 @@ export class PlayComponent implements OnInit, OnDestroy {
// ------------ 游戏逻辑数据 ------------
m_startGame = false;
m_allDrums = [];
m_dataArrayNew = []
m_dataArrayNew = [];
m_restartGameFlag: boolean = false;
// ------------------------------------
......@@ -181,7 +182,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let array = []
this.g_formData.dataArray.forEach(element => {
if(element.image_url){
if(element.audio_url){
array.push(element.audio_url)
}
});
......@@ -226,7 +227,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
endGame(){
this.showEndPatal()
this.showEndPatal(3000)
this.g_enableMapDown = false;
this.g_cartoon.getCartoonElement("restart-button").in()
}
......@@ -506,9 +507,9 @@ export class PlayComponent implements OnInit, OnDestroy {
}
element.backToReady = () => {
element.ref.x = standPos[this.g_formData.dataArray.length][0].x
element.currentPosition = 0;
element.updateHandPos();
// element.ref.x = standPos[this.g_formData.dataArray.length][0].x
// element.currentPosition = 0;
// element.updateHandPos();
}
element.beatReset = (callback) => {
......@@ -542,10 +543,10 @@ export class PlayComponent implements OnInit, OnDestroy {
y: this.g_canvasHeight / 2
}
})
A.open = ()=>{
A.open = (time=7)=>{
this.m_setTimeoutIDs.push(setTimeout(() => {
tweenChange(A.ref, {x: (-357 / 2 + 100) * this.g_mapScale}, 3)
}, 3000))
tweenChange(A.ref, {x: (-357 / 2 + 100) * this.g_mapScale}, time/2)
}, time * 500))
}
A.close = ()=>{
......@@ -565,10 +566,10 @@ export class PlayComponent implements OnInit, OnDestroy {
y: this.g_canvasHeight / 2
}
})
B.open = ()=>{
B.open = (time = 7)=>{
this.m_setTimeoutIDs.push(setTimeout(() => {
tweenChange(B.ref, {x: this.g_canvasWidth + (357 / 2 - 100) * this.g_mapScale}, 3)
}, 3000))
tweenChange(B.ref, {x: this.g_canvasWidth + (357 / 2 - 100) * this.g_mapScale}, time / 2)
}, time * 500))
}
B.close = ()=>{
this.m_setTimeoutIDs.push(setTimeout(() => {
......@@ -587,11 +588,11 @@ export class PlayComponent implements OnInit, OnDestroy {
y: this.g_canvasHeight / 2
}
})
C.open = ()=>{
tweenChange(C.ref, {x: -this.g_canvasWidth / 4}, 7)
C.open = (time = 7)=>{
tweenChange(C.ref, {x: -this.g_canvasWidth / 4}, time)
}
C.close = ()=>{
tweenChange(C.ref, {x: C.initX}, 4)
C.close = (time = 4)=>{
tweenChange(C.ref, {x: C.initX}, time)
}
let D = this.g_cartoon.createCartoonElementImageFunc("Curtain-D", "lianzi3", (w ,h)=>{
......@@ -605,11 +606,11 @@ export class PlayComponent implements OnInit, OnDestroy {
y: this.g_canvasHeight / 2
}
})
D.open = ()=>{
tweenChange(D.ref, {x: this.g_canvasWidth + this.g_canvasWidth / 4}, 7)
D.open = (time = 7)=>{
tweenChange(D.ref, {x: this.g_canvasWidth + this.g_canvasWidth / 4}, time)
}
D.close = ()=>{
tweenChange(D.ref, {x: D.initX}, 4)
D.close = (time = 4)=>{
tweenChange(D.ref, {x: D.initX}, time)
}
let E = this.g_cartoon.createCartoonElementImageFunc("Curtain-E", "lianzi0", (w ,h)=>{
......@@ -639,17 +640,18 @@ export class PlayComponent implements OnInit, OnDestroy {
this.g_cartoon.playAudio("gusheng_kaitou")
}, 2000))
if(status){
let openTime = this.m_restartGameFlag?3:7
all.forEach(item=>{
_this.g_cartoon.getCartoonElement(item).open()
_this.g_cartoon.getCartoonElement(item).open(openTime)
})
this.m_setTimeoutIDs.push(setTimeout(()=>{
this.m_allDrums.forEach(function(item,index){
_this.g_cartoon.getCartoonElement(item).show(index)
})
}, 4000))
}, openTime * 500))
this.m_setTimeoutIDs.push(setTimeout(()=>{
callback && callback()
}, 7000))
}, openTime * 1000))
}else{
all.forEach(item=>{
_this.g_cartoon.getCartoonElement(item).close()
......@@ -723,6 +725,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_setTimeoutIDs.push(setTimeout(() => {
this.g_cartoon.playAudio("guzhang")
}, 1000))
this.m_restartGameFlag = true;
this.curtainContral(false, ()=>{
this.g_cartoon.getCartoonElement("boy").reset()
this.g_cartoon.getCartoonElement("boy").startReadyAni()
......@@ -816,8 +819,8 @@ export class PlayComponent implements OnInit, OnDestroy {
element.content = element.imageContainer
element.image = this.g_cartoon.createImage(contentData.image_url, (w, h)=>{
let sx = 261 / w
let sy = 178 / w
let sx = 261 * 0.85 / w
let sy = 178 * 0.85 / h
let s = Math.min(sx, sy)
return {
sx: s,
......@@ -871,26 +874,37 @@ export class PlayComponent implements OnInit, OnDestroy {
this.g_cartoon.getCartoonElement("boy").backToReady()
this.g_enableMapDown = true;
})
}, 2000))
}, 500))
}
element.isOpen = false;
this.subscribeMapDownEvent(element.id, ()=>{
if(!this.m_startGame || element.isOpen){
if(element.isOpen){
if(data.audio_url){
this.g_cartoon.playAudio(data.audio_url)
}
this.g_cartoon.stopAllAudio();
this.g_cartoon.playAudio(`gusheng_${index+1}`, false, ()=>{
if(data.audio_url){
this.g_cartoon.playAudio(data.audio_url)
}
})
this.g_cartoon.getCartoonElement("boy").beat(index, ()=>{
this.g_cartoon.getCartoonElement("boy").beatReset()
this.g_enableMapDown = true;
})
}else{
this.g_enableMapDown = true;
}
this.g_enableMapDown = true;
return
}
this.g_cartoon.playAudio(`gusheng_${index+1}`)
this.setRenderZIndex(element.ref, zIndexMap.drum + 1)
tweenChange(element.ref, {scaleX: element.initScaleX * 1.1, scaleY: element.initScaleY * 1.1}, 0.2, ()=>{
this.g_cartoon.stopAllAudio();
this.g_cartoon.playAudio(`gusheng_${index+1}`, false, ()=>{
if(data.audio_url){
this.g_cartoon.playAudio(data.audio_url)
}
})
this.setRenderZIndex(element.ref, zIndexMap.drum + 1)
tweenChange(element.ref, {scaleX: element.initScaleX * 1.1, scaleY: element.initScaleY * 1.1}, 0.2, ()=>{
if(element.content){
element.content.visible = true;
tweenChange(element.content, {scaleX: element.content.initScaleX, scaleY: element.content.initScaleY}, 0.2)
......@@ -1895,10 +1909,10 @@ export class PlayComponent implements OnInit, OnDestroy {
// 结束动画花瓣飘落
showEndPatal() {
showEndPatal(totalTimes?) {
this.m_endPageArr = [];
this.m_showPetalFlag = true;
this.addPetal();
this.addPetal(totalTimes);
}
stopEndPatal() {
......@@ -1906,7 +1920,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_showPetalFlag = false;
}
addPetal() {
addPetal(totalTimes?) {
if (!this.m_showPetalFlag) {
return;
}
......@@ -1922,9 +1936,12 @@ export class PlayComponent implements OnInit, OnDestroy {
}
);
rotateItem(petal, petal["tr"], petal["time"]);
setTimeout(() => {
this.addPetal();
}, 100);
totalTimes -= 100
if(totalTimes>=0){
setTimeout(() => {
this.addPetal(totalTimes);
}, 100);
}
}
getPetal() {
......
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