Commit d8d2dc15 authored by 李维's avatar 李维

dev commit

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