Commit 009042e8 authored by 李维's avatar 李维

dev commit

parent d5b32c74
......@@ -55,6 +55,7 @@ const zIndexMap = {
Curtain_E: 110,
startButton: 120,
drum: 30,
hand: 35,
answerCard: 45,
questionCard: 50,
mainQuestionImage: 35,
......@@ -133,7 +134,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// ------------ 游戏逻辑数据 ------------
m_startGame = false;
// ------------------------------------
......@@ -212,11 +213,11 @@ export class PlayComponent implements OnInit, OnDestroy {
}
cleanGameVar(){
this.m_startGame = false;
}
startGame(){
this.m_startGame = true;
}
restartGame(){
......@@ -288,7 +289,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.render(element.ref, zIndexMap.boy)
element.ref.visible = true
element.play = this.g_cartoon.createAnimation("boy", 30, 500)
// 准备动画
element.play = this.g_cartoon.createAnimation("boy", 30, 1000)
element.play.x = element.ref.x;
element.play.y = element.ref.y;
element.play.scaleX = element.ref.scaleX
......@@ -299,6 +301,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.render(element.play, zIndexMap.boy)
element.startReadyAni = ()=>{
console.log("Start ready ani")
element.play.play()
element.ref.visible = false
element.play.visible = true
......@@ -306,19 +309,90 @@ export class PlayComponent implements OnInit, OnDestroy {
}
element.endReadyAni = ()=>{
console.log("End ready ani")
element.play.stop()
element.ref.visible = true
element.play.visible = false
element.isPlay = false;
}
// 手
element.leftHand = this.g_cartoon.createCartoonElementImageFunc("boy-leftHand", "hand2", (w ,h)=>{
return {
sx: 180 * this.g_mapScale / w,
sy: 100 * this.g_mapScale / h
}
}, (w, h)=>{
return {
x: this.g_canvasWidth / 2 - 160 * this.g_mapScale,
y: this.g_canvasHeight / 2 + 75 * this.g_mapScale
}
})
this.render(element.leftHand.ref, zIndexMap.hand)
element.leftHand.ref.visible = false
element.rightHand = this.g_cartoon.createCartoonElementImageFunc("boy-rightHand", "hand", (w ,h)=>{
return {
sx: 180 * this.g_mapScale / w,
sy: 100 * this.g_mapScale / h
}
}, (w, h)=>{
return {
x: this.g_canvasWidth / 2 + 160 * this.g_mapScale,
y: this.g_canvasHeight / 2 + 75 * this.g_mapScale
}
})
this.render(element.rightHand.ref, zIndexMap.hand)
element.rightHand.ref.visible = false
element.firstClick = true;
// 敲打动画
element.beat = (side, callback?) =>{
if(element.firstClick){
element.endReadyAni()
element.leftHand.ref.visible = true
element.rightHand.ref.visible = true
element.firstClick = false;
}
element.beatAnimate = this.g_cartoon.createAnimation(`beat_${side}`, 30, 1000, ()=>{
callback && callback()
})
if(side=="left"){
element.beatAnimate.x = element.leftHand.ref.x
element.beatAnimate.y = element.leftHand.ref.y
}else{
element.beatAnimate.x = element.rightHand.ref.x
element.beatAnimate.y = element.rightHand.ref.y
}
if(side == "left"){
element.leftHand.ref.visible = false
}else{
element.rightHand.ref.visible = false
}
// element.beatAnimate.setScaleXY(this.g_mapScale * 1.2)
this.render(element.beatAnimate, zIndexMap.animation)
element.beatAnimate.play()
}
element.beatReset = (side, callback) => {
element.beatAnimate.visible = false;
this.deleteElementInRender(element.beatAnimate.id)
if(side == "left"){
element.leftHand.ref.visible = true
}else{
element.rightHand.ref.visible = true
}
callback && callback()
}
}
initCurtain(){
let A = this.g_cartoon.createCartoonElementImageFunc("Curtain-A", "lianzir", (w ,h)=>{
return {
sx: 357 * this.g_mapScale / w,
sy: 720 * this.g_mapScale / h
sy: this.g_canvasHeight / h
}
}, (w, h)=>{
return {
......@@ -342,7 +416,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let B = this.g_cartoon.createCartoonElementImageFunc("Curtain-B", "lianzil", (w ,h)=>{
return {
sx: 357 * this.g_mapScale / w,
sy: 720 * this.g_mapScale / h
sy: this.g_canvasHeight / h
}
}, (w, h)=>{
return {
......@@ -365,7 +439,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let C = this.g_cartoon.createCartoonElementImageFunc("Curtain-C", "lianzi4", (w ,h)=>{
return {
sx: this.g_canvasWidth / 2 / w,
sy: 720 * this.g_mapScale / h
sy: this.g_canvasHeight / h
}
}, (w, h)=>{
return {
......@@ -384,7 +458,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let D = this.g_cartoon.createCartoonElementImageFunc("Curtain-D", "lianzi3", (w ,h)=>{
return {
sx: this.g_canvasWidth / 2 / w,
sy: 720 * this.g_mapScale / h
sy: this.g_canvasHeight / h
}
}, (w, h)=>{
return {
......@@ -449,13 +523,13 @@ export class PlayComponent implements OnInit, OnDestroy {
this.showJellyAnimation(element.id, ()=>{
tweenChange(element.ref, {x: this.g_canvasWidth + 331 * this.g_mapScale}, 0.5)
})
this.g_cartoon.getCartoonElement("boy").startReadyAni()
this.startGame()
this.curtainContral(true, ()=>{
this.g_enableMapDown = true;
})
})
return true;
}, 100)
}
initRestartButton(){
......@@ -518,7 +592,7 @@ export class PlayComponent implements OnInit, OnDestroy {
createDrum(index, data, baseX){
let color = ["red", "blue", "yellow", "green"]
let element = this.g_cartoon.createCartoonElementImageFunc(`drum=${index}`, color[index], (w ,h)=>{
let element = this.g_cartoon.createCartoonElementImageFunc(`drum-${index}`, color[index], (w ,h)=>{
return {
sx: 317 * this.g_mapScale / w,
sy: 312 * this.g_mapScale / h
......@@ -530,6 +604,46 @@ export class PlayComponent implements OnInit, OnDestroy {
}
})
element.light = this.g_cartoon.createCartoonElementImageFunc(`drum-${index}-light`, "drum_highlight", (w ,h)=>{
return {
sx: 464 * 0.9 / w,
sy: 454 * 0.9 / h
}
}, (w, h)=>{
return {
x: 0,
y: 0
}
})
element.ref.addChild(element.light.ref)
element.light.ref.visible = false;
element.highlight = () => {
this.m_setTimeoutIDs.push(setTimeout(() => {
this.g_cartoon.getCartoonElement("boy").beatReset("left")
tweenChange(element.ref, {scaleX: element.initScaleX, scaleY: element.initScaleY}, 0.2, ()=>{
element.light.ref.visible = false;
this.setRenderZIndex(element.ref, zIndexMap.drum)
this.g_enableMapDown = true;
})
}, 2000))
}
this.subscribeMapDownEvent(element.id, ()=>{
if(!this.m_startGame){
this.g_enableMapDown = true;
return
}
this.setRenderZIndex(element.ref, zIndexMap.drum + 1)
tweenChange(element.ref, {scaleX: element.initScaleX * 1.2, scaleY: element.initScaleY * 1.2}, 0.2, ()=>{
element.light.ref.visible = true;
this.g_cartoon.getCartoonElement("boy").beat("left", ()=>{
element.highlight()
})
})
})
return element
}
......
......@@ -34,6 +34,7 @@ const localImages = {
'card_bg': 'assets/play/card_bg.png',
'creatJsonProfile': 'assets/play/creatJsonProfile.py',
'dengqiu1': 'assets/play/dengqiu1.png',
'drum_highlight': 'assets/play/drum_highlight.png',
'filename': 'assets/play/filename.txt',
'green': 'assets/play/green.png',
'hand': 'assets/play/hand.png',
......@@ -53,9 +54,70 @@ const localImages = {
'red': 'assets/play/red.png',
'resizeImg': 'assets/play/resizeImg.py',
'restart': 'assets/play/restart.png',
'reversalImg': 'assets/play/reversalImg.py',
'star': 'assets/play/star.png',
'yellow': 'assets/play/yellow.png',
'beat_left (1)': 'assets/play/frame/beat_left (1).png',
'beat_left (10)': 'assets/play/frame/beat_left (10).png',
'beat_left (11)': 'assets/play/frame/beat_left (11).png',
'beat_left (12)': 'assets/play/frame/beat_left (12).png',
'beat_left (13)': 'assets/play/frame/beat_left (13).png',
'beat_left (14)': 'assets/play/frame/beat_left (14).png',
'beat_left (15)': 'assets/play/frame/beat_left (15).png',
'beat_left (16)': 'assets/play/frame/beat_left (16).png',
'beat_left (17)': 'assets/play/frame/beat_left (17).png',
'beat_left (18)': 'assets/play/frame/beat_left (18).png',
'beat_left (19)': 'assets/play/frame/beat_left (19).png',
'beat_left (2)': 'assets/play/frame/beat_left (2).png',
'beat_left (20)': 'assets/play/frame/beat_left (20).png',
'beat_left (21)': 'assets/play/frame/beat_left (21).png',
'beat_left (22)': 'assets/play/frame/beat_left (22).png',
'beat_left (23)': 'assets/play/frame/beat_left (23).png',
'beat_left (24)': 'assets/play/frame/beat_left (24).png',
'beat_left (25)': 'assets/play/frame/beat_left (25).png',
'beat_left (26)': 'assets/play/frame/beat_left (26).png',
'beat_left (27)': 'assets/play/frame/beat_left (27).png',
'beat_left (28)': 'assets/play/frame/beat_left (28).png',
'beat_left (29)': 'assets/play/frame/beat_left (29).png',
'beat_left (3)': 'assets/play/frame/beat_left (3).png',
'beat_left (30)': 'assets/play/frame/beat_left (30).png',
'beat_left (4)': 'assets/play/frame/beat_left (4).png',
'beat_left (5)': 'assets/play/frame/beat_left (5).png',
'beat_left (6)': 'assets/play/frame/beat_left (6).png',
'beat_left (7)': 'assets/play/frame/beat_left (7).png',
'beat_left (8)': 'assets/play/frame/beat_left (8).png',
'beat_left (9)': 'assets/play/frame/beat_left (9).png',
'beat_right (1)': 'assets/play/frame/beat_right (1).PNG',
'beat_right (10)': 'assets/play/frame/beat_right (10).PNG',
'beat_right (11)': 'assets/play/frame/beat_right (11).PNG',
'beat_right (12)': 'assets/play/frame/beat_right (12).PNG',
'beat_right (13)': 'assets/play/frame/beat_right (13).PNG',
'beat_right (14)': 'assets/play/frame/beat_right (14).PNG',
'beat_right (15)': 'assets/play/frame/beat_right (15).PNG',
'beat_right (16)': 'assets/play/frame/beat_right (16).PNG',
'beat_right (17)': 'assets/play/frame/beat_right (17).PNG',
'beat_right (18)': 'assets/play/frame/beat_right (18).PNG',
'beat_right (19)': 'assets/play/frame/beat_right (19).PNG',
'beat_right (2)': 'assets/play/frame/beat_right (2).PNG',
'beat_right (20)': 'assets/play/frame/beat_right (20).PNG',
'beat_right (21)': 'assets/play/frame/beat_right (21).PNG',
'beat_right (22)': 'assets/play/frame/beat_right (22).PNG',
'beat_right (23)': 'assets/play/frame/beat_right (23).PNG',
'beat_right (24)': 'assets/play/frame/beat_right (24).PNG',
'beat_right (25)': 'assets/play/frame/beat_right (25).PNG',
'beat_right (26)': 'assets/play/frame/beat_right (26).PNG',
'beat_right (27)': 'assets/play/frame/beat_right (27).PNG',
'beat_right (28)': 'assets/play/frame/beat_right (28).PNG',
'beat_right (29)': 'assets/play/frame/beat_right (29).PNG',
'beat_right (3)': 'assets/play/frame/beat_right (3).PNG',
'beat_right (4)': 'assets/play/frame/beat_right (4).PNG',
'beat_right (5)': 'assets/play/frame/beat_right (5).PNG',
'beat_right (6)': 'assets/play/frame/beat_right (6).PNG',
'beat_right (7)': 'assets/play/frame/beat_right (7).PNG',
'beat_right (8)': 'assets/play/frame/beat_right (8).PNG',
'beat_right (9)': 'assets/play/frame/beat_right (9).PNG',
'beat_right (30)': 'assets/play/frame/beat_right (30).PNG',
'boy (1)': 'assets/play/frame/boy (1).png',
'boy (10)': 'assets/play/frame/boy (10).png',
'boy (11)': 'assets/play/frame/boy (11).png',
......
......@@ -5,6 +5,7 @@
'card_bg': 'assets/play/card_bg.png',
'creatJsonProfile': 'assets/play/creatJsonProfile.py',
'dengqiu1': 'assets/play/dengqiu1.png',
'drum_highlight': 'assets/play/drum_highlight.png',
'filename': 'assets/play/filename.txt',
'green': 'assets/play/green.png',
'hand': 'assets/play/hand.png',
......@@ -24,9 +25,69 @@
'red': 'assets/play/red.png',
'resizeImg': 'assets/play/resizeImg.py',
'restart': 'assets/play/restart.png',
'reversalImg': 'assets/play/reversalImg.py',
'star': 'assets/play/star.png',
'yellow': 'assets/play/yellow.png',
'beat_left (1)': 'assets/play/frame/beat_left (1).png',
'beat_left (10)': 'assets/play/frame/beat_left (10).png',
'beat_left (11)': 'assets/play/frame/beat_left (11).png',
'beat_left (12)': 'assets/play/frame/beat_left (12).png',
'beat_left (13)': 'assets/play/frame/beat_left (13).png',
'beat_left (14)': 'assets/play/frame/beat_left (14).png',
'beat_left (15)': 'assets/play/frame/beat_left (15).png',
'beat_left (16)': 'assets/play/frame/beat_left (16).png',
'beat_left (17)': 'assets/play/frame/beat_left (17).png',
'beat_left (18)': 'assets/play/frame/beat_left (18).png',
'beat_left (19)': 'assets/play/frame/beat_left (19).png',
'beat_left (2)': 'assets/play/frame/beat_left (2).png',
'beat_left (20)': 'assets/play/frame/beat_left (20).png',
'beat_left (21)': 'assets/play/frame/beat_left (21).png',
'beat_left (22)': 'assets/play/frame/beat_left (22).png',
'beat_left (23)': 'assets/play/frame/beat_left (23).png',
'beat_left (24)': 'assets/play/frame/beat_left (24).png',
'beat_left (25)': 'assets/play/frame/beat_left (25).png',
'beat_left (26)': 'assets/play/frame/beat_left (26).png',
'beat_left (27)': 'assets/play/frame/beat_left (27).png',
'beat_left (28)': 'assets/play/frame/beat_left (28).png',
'beat_left (29)': 'assets/play/frame/beat_left (29).png',
'beat_left (3)': 'assets/play/frame/beat_left (3).png',
'beat_left (30)': 'assets/play/frame/beat_left (30).png',
'beat_left (4)': 'assets/play/frame/beat_left (4).png',
'beat_left (5)': 'assets/play/frame/beat_left (5).png',
'beat_left (6)': 'assets/play/frame/beat_left (6).png',
'beat_left (7)': 'assets/play/frame/beat_left (7).png',
'beat_left (8)': 'assets/play/frame/beat_left (8).png',
'beat_left (9)': 'assets/play/frame/beat_left (9).png',
'beat_right (1)': 'assets/play/frame/beat_right (1).PNG',
'beat_right (10)': 'assets/play/frame/beat_right (10).PNG',
'beat_right (11)': 'assets/play/frame/beat_right (11).PNG',
'beat_right (12)': 'assets/play/frame/beat_right (12).PNG',
'beat_right (13)': 'assets/play/frame/beat_right (13).PNG',
'beat_right (14)': 'assets/play/frame/beat_right (14).PNG',
'beat_right (15)': 'assets/play/frame/beat_right (15).PNG',
'beat_right (16)': 'assets/play/frame/beat_right (16).PNG',
'beat_right (17)': 'assets/play/frame/beat_right (17).PNG',
'beat_right (18)': 'assets/play/frame/beat_right (18).PNG',
'beat_right (19)': 'assets/play/frame/beat_right (19).PNG',
'beat_right (2)': 'assets/play/frame/beat_right (2).PNG',
'beat_right (20)': 'assets/play/frame/beat_right (20).PNG',
'beat_right (21)': 'assets/play/frame/beat_right (21).PNG',
'beat_right (22)': 'assets/play/frame/beat_right (22).PNG',
'beat_right (23)': 'assets/play/frame/beat_right (23).PNG',
'beat_right (24)': 'assets/play/frame/beat_right (24).PNG',
'beat_right (25)': 'assets/play/frame/beat_right (25).PNG',
'beat_right (26)': 'assets/play/frame/beat_right (26).PNG',
'beat_right (27)': 'assets/play/frame/beat_right (27).PNG',
'beat_right (28)': 'assets/play/frame/beat_right (28).PNG',
'beat_right (29)': 'assets/play/frame/beat_right (29).PNG',
'beat_right (3)': 'assets/play/frame/beat_right (3).PNG',
'beat_right (4)': 'assets/play/frame/beat_right (4).PNG',
'beat_right (5)': 'assets/play/frame/beat_right (5).PNG',
'beat_right (6)': 'assets/play/frame/beat_right (6).PNG',
'beat_right (7)': 'assets/play/frame/beat_right (7).PNG',
'beat_right (8)': 'assets/play/frame/beat_right (8).PNG',
'beat_right (9)': 'assets/play/frame/beat_right (9).PNG',
'boy (1)': 'assets/play/frame/boy (1).png',
'boy (10)': 'assets/play/frame/boy (10).png',
'boy (11)': 'assets/play/frame/boy (11).png',
......
src/assets/play/hand.png

4.02 KB | W: | H:

src/assets/play/hand.png

14.9 KB | W: | H:

src/assets/play/hand.png
src/assets/play/hand.png
src/assets/play/hand.png
src/assets/play/hand.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/hand2.png

4.13 KB | W: | H:

src/assets/play/hand2.png

15.5 KB | W: | H:

src/assets/play/hand2.png
src/assets/play/hand2.png
src/assets/play/hand2.png
src/assets/play/hand2.png
  • 2-up
  • Swipe
  • Onion skin
import os
import shutil
from PIL import Image
imageName = input("图片名:")
number = int(input("数量:"))
newImageName = input("新图片名:")
if os.path.exists('./' + imageName + '/'):
shutil.rmtree('./' + imageName + '/')
os.mkdir('./' + newImageName + '/')
for index in range(1, number):
pic = Image.open('./beat_left (' + str(index) + ').PNG')
newpic = pic.transpose(Image.FLIP_LEFT_RIGHT)
newpic.save('./' + newImageName + '/' + newImageName + ' (' + str(index) + ').PNG')
\ No newline at end of file
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