Commit 58afe92c authored by 李维's avatar 李维

dev commit

parent 3c232eb1
......@@ -1288,7 +1288,7 @@ export function removeItemFromArr(arr, item) {
if (index != -1) {
arr.splice(index, 1);
}else{
console.warn("[removeItemFromArr] Can not delete item", item )
// console.warn("[removeItemFromArr] Can not delete item", item )
}
}
......
......@@ -30,68 +30,7 @@
font-size: 64px;
}
@font-face
{
font-family: 'BRLNSDB';
src: url("../../assets/font/BRLNSDB.TTF") ;
}
@font-face
{
font-family: 'RoundedBold';
src: url("../../assets/font/ArialRoundedBold.otf") ;
}
@font-face{
font-family: 'BRLNSB_1';
src: url("../../assets/font/BerlinSansFB/BRLNSB_1.TTF") ;
}
@font-face{
font-family: 'BerlinSansFBDemi-Bold';
src: url("../../assets/font/BerlinSansFB/BRLNSDB_1.TTF") ;
}
@font-face{
font-family: 'BRLNSR_1';
src: url("../../assets/font/BerlinSansFB/BRLNSR_1.TTF") ;
}
@font-face{
font-family: 'GOTHIC_1';
src: url("../../assets/font/CenturyGothic/GOTHIC_1.TTF") ;
}
@font-face{
font-family: 'GOTHICB_1';
src: url("../../assets/font/CenturyGothic/GOTHICB_1.TTF") ;
}
@font-face{
font-family: 'GOTHICBI_1';
src: url("../../assets/font/CenturyGothic/GOTHICBI_1.TTF") ;
}
@font-face{
font-family: 'GOTHICI_1';
src: url("../../assets/font/CenturyGothic/GOTHICI_1.TTF") ;
}
@font-face{
font-family: 'MMTextBook';
src: url("../../assets/font/MMTextBook/MMTextBook.otf") ;
}
@font-face{
font-family: 'MMTextBook-Bold';
src: url("../../assets/font/MMTextBook/MMTextBook-Bold.otf") ;
}
@font-face{
font-family: 'MMTextBook-BoldItalic';
src: url("../../assets/font/MMTextBook/MMTextBook-BoldItalic.otf") ;
}
@font-face{
font-family: 'MMTextBook-Italic';
src: url("../../assets/font/MMTextBook/MMTextBook-Italic.otf") ;
}
......@@ -44,7 +44,7 @@ const defauleFormData = {
bgmusic: "",
dataArray:[
{
audio_url:"sm-choice-timeup-3",
audio_url:"",
options: [
{type:"Text", image_url:"default-image", text:"Demo_1", audio_url:"", isCorrect:true},
{type:"Image", image_url:"default-image", text:"", audio_url:"", isCorrect:false},
......@@ -225,7 +225,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initMilestoneBoardTotal();
this.initQuestionCards()
this.initSpeaker()
this.initQuestionIndexBoard()
this.initQuestionIndexBoard();
}
cleanGameVar(){
......@@ -238,7 +238,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.g_cartoon.getCartoonElement(`question-index-board`).resetIndex()
this.g_cartoon.getCartoonElement("play-audio").in()
this.g_cartoon.getCartoonElement("skier").ready(()=>{
this.g_cartoon.getCartoonElement("play-audio").play()
// this.g_cartoon.getCartoonElement("play-audio").play()
})
}
......@@ -575,7 +575,7 @@ export class PlayComponent implements OnInit, OnDestroy {
element.animationCard = this.g_cartoon.createAnimation("card-frame", 29, 50)
element.animationCard.setScaleXY(0.3)
element.ref.addChild(element.animationCard)
tweenChange(element.animationSnow, {scaleY:0}, 0.05)
// tweenChange(element.animationSnow, {scaleY:0}, 0.05)
tweenChange(element.imageContent, {scaleX: 0, scaleY: 0}, 0.05)
tweenChange(element.textContent, {scaleX: 0, scaleY: 0}, 0.05)
element.animationCard.play()
......@@ -584,6 +584,20 @@ export class PlayComponent implements OnInit, OnDestroy {
}, 500))
}
element.shake = (callback?)=>{
tweenChange(element.ref, {rotation:3}, 0.1, ()=>{
tweenChange(element.ref, {rotation:-3}, 0.1, ()=>{
tweenChange(element.ref, {rotation:3}, 0.1, ()=>{
tweenChange(element.ref, {rotation:-3}, 0.1, ()=>{
tweenChange(element.ref, {rotation:0}, 0.05, ()=>{
callback && callback()
})
})
})
})
})
}
element.setContent = (data)=>{
if(data.type == "Image"){
if(element.imageContent){
......@@ -667,17 +681,16 @@ export class PlayComponent implements OnInit, OnDestroy {
removeItemFromArr(element.ref.children, element.animationSnow)
removeItemFromArr(element.ref.children, element.animationCard)
this.g_cartoon.getCartoonElement("question-index-board").setIndex(this.m_currentQuestion+1)
tweenChange(element.ref, {y: element.initY}, 0.5, ()=>{
this.m_setTimeoutIDs.push(setTimeout(()=>element.snowBoom(),50))
tweenChange(element.ref, {y: element.initY}, 0.8, ()=>{
setTimeout(()=>element.snowBoom())
})
}
element.snowBoom = ()=>{
element.animationSnow = this.g_cartoon.createAnimation("snow", 5, 50)
element.animationSnow.x = -7
element.animationSnow.y = 170
element.animationSnow.setScaleXY(0.5)
element.animationSnow.setScaleXY(0.4)
element.ref.addChild(element.animationSnow)
element.animationSnow.play()
......@@ -722,6 +735,68 @@ export class PlayComponent implements OnInit, OnDestroy {
element.ref.scaleX = element.initScaleX * 1.2
element.ref.scaleY = element.initScaleY * 1.2
let header = this.g_cartoon.createCartoonElementImageFunc(`header`, "header", (w,h)=>{
return {
sx: 98 / w,
sy: 97 / h
}
}, (w,h)=>{
return{
x: 0,
y: 50
}
})
header.ref.x = header.ref.x+500
header.ref.y = header.ref.y+500
header.ref.scaleX = header.ref.scaleX * 1.5
header.ref.scaleY = header.ref.scaleY * 1.5
header.ref.visible = false;
element.ref.addChild(header.ref)
element.cruiseIntervalID = null;
element.cruiseSetTimeoutID = null
element.firstClick = true
element.cruise = (callback?)=>{
header.ref.visible = true;
tweenChange(header.ref, {
x: header.initX,
y: header.initY,
scaleX: header.initScaleX,
scaleY: header.initScaleY
}, 0.8, ()=>{
if(element.firstClick){
element.cruiseSetTimeoutID = setTimeout(() => {
let dir = false;
let step = 10 * this.g_mapScale
element.cruiseIntervalID = setInterval(()=>{
if(dir){
element.ref.x += step
}else{
element.ref.x -= step
}
if(element.ref.x>this.g_canvasWidth-300*this.g_mapScale || element.ref.x<300*this.g_mapScale){
dir = !dir
}
}, 30)
this.m_setIntervalIDs.push(element.cruiseIntervalID)
callback && callback()
}, 500)
this.m_setTimeoutIDs.push(element.cruiseSetTimeoutID)
}
})
}
element.stopCruise = ()=>{
header.ref.visible = false;
if(element.cruiseIntervalID){
clearInterval(element.cruiseIntervalID)
}
if(element.cruiseSetTimeoutID){
clearTimeout(element.cruiseSetTimeoutID)
}
element.firstClick = false;
}
element.in =(callback?)=>{
tweenChange(element.ref, {x: element.initX, y: element.initY, scaleX: element.initScaleX, scaleY: element.initScaleY}, 0.8, ()=>{
callback && callback()
......@@ -734,10 +809,19 @@ export class PlayComponent implements OnInit, OnDestroy {
})
}
element.firstReady = true;
element.ready =(callback?)=>{
tweenChange(element.ref, {x: element.initX, y: element.initY, scaleX: element.initScaleX, scaleY: element.initScaleY}, 0.2, ()=>{
this.g_enableMapDown = true
callback && callback()
if(element.firstReady){
element.firstReady = false;
element.cruise(()=>{
callback && callback()
})
}else{
callback && callback()
}
})
}
......@@ -760,6 +844,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.subscribeMapDownEvent(element.id, ()=>{
if(!this.g_cartoon.getCartoonElementRef("mask-layer").visible && !element.enableDrag){
element.enableDrag = true
element.stopCruise()
let disX = element.ref.x - this.g_clickX
let disY = element.ref.y - this.g_clickY
this.g_cartoon.playAudio("skier", false, null, true)
......@@ -783,13 +868,16 @@ export class PlayComponent implements OnInit, OnDestroy {
this.nextQuestion(()=>{
this.loadQuestion()
element.ready(()=>{
this.g_cartoon.getCartoonElement("play-audio").play()
// this.g_cartoon.getCartoonElement("play-audio").play()
})
})
})
}else{
this.g_cartoon.playAudio("sm-choice-error")
element.ready()
this.g_cartoon.getCartoonElement(`question-card-${element.targetRunWay}`).shake(()=>{
element.ready()
})
element.targetRunWay = -1;
}
})
......@@ -862,18 +950,75 @@ export class PlayComponent implements OnInit, OnDestroy {
this.endGame()
}else{
this.m_currentQuestion++
this.g_cartoon.getCartoonElement("mask-layer").in(()=>{
this.showMMilestoneBoardTotal(this.m_currentQuestion, ()=>{
this.g_cartoon.getCartoonElement("mask-layer").out(()=>{
callback && callback()
})
})
})
// this.g_cartoon.getCartoonElement("mask-layer").in(()=>{
// this.showMMilestoneBoardTotal(this.m_currentQuestion, ()=>{
// this.g_cartoon.getCartoonElement("mask-layer").out(()=>{
// callback && callback()
// })
// })
// })
for(let index=0; index<4; index++){
this.g_cartoon.getCartoonElement(`question-card-${index}`).ref.visible = false;
}
this.showEndPatal()
// this.g_cartoon.playAudio("win")
this.m_setTimeoutIDs.push(setTimeout(() => {
this.stopEndPatal()
callback && callback()
}, 3000))
}
}, 1000))
}
// 小手
initHeader(){
let element = this.g_cartoon.createCartoonElementImageFunc(`header`, "header", (w,h)=>{
return {
sx: 98*this.g_mapScale / w,
sy: 97*this.g_mapScale / h
}
}, (w,h)=>{
return{
x: this.g_canvasWidth/2,
y: this.g_canvasHeight/2
}
})
element.ref.visible = false;;
element.move = ()=>{
let y = this.g_cartoon.getCartoonElement("skier").ref.y + 50*this.g_mapScale
tweenChange(element.ref, {x: fakePoint[currentIndex], y:y}, 0.5)
currentIndex++;
if(currentIndex==9){
currentIndex = 0;
}
}
element.in = (callback?)=>{
element.ref.x = this.g_canvasWidth + 100*this.g_mapScale
element.ref.y = this.g_canvasHeight + 100*this.g_mapScale
let dis = {
x: this.g_cartoon.getCartoonElement("camera").ref.x + 55*this.g_mapScale,
y: this.g_cartoon.getCartoonElement("camera").ref.y + 55*this.g_mapScale
}
tweenChange(element.ref, dis, 0.5, ()=>{
callback && callback()
})
element.ref.visible = true;
}
element.out = ()=>{
element.ref.visible = false;
}
let currentIndex = 0;
let fakePoint = [ 735,1040,468,1288,196,1040,1288,735,196 ]
this.render(element.ref)
}
......
......@@ -38,16 +38,13 @@ const localImages = {
'question_bg': 'assets/play/question_bg.png',
'restart': 'assets/play/restart.png',
'skier': 'assets/play/skier.png',
'snow- (1)': 'assets/play/snow-0.png',
'snow- (2)': 'assets/play/snow-1.png',
'snow- (3)': 'assets/play/snow-2.png',
'snow- (4)': 'assets/play/snow-3.png',
'snow- (5)': 'assets/play/snow-4.png',
'stage_number_bg': 'assets/play/stage_number_bg.png',
'start_btn': 'assets/play/start_btn.png',
'text_container': 'assets/play/text_container.png',
'score_bg': 'assets/play/score_bg.png',
'question-container': 'assets/play/question-container.png',
'header': 'assets/play/header.png',
'card-frame- (1)': 'assets/play/frame/card-frame- (1).png',
'card-frame- (10)': 'assets/play/frame/card-frame- (10).png',
'card-frame- (11)': 'assets/play/frame/card-frame- (11).png',
......@@ -71,43 +68,23 @@ const localImages = {
'card-frame- (28)': 'assets/play/frame/card-frame- (28).png',
'card-frame- (29)': 'assets/play/frame/card-frame- (29).png',
'card-frame- (3)': 'assets/play/frame/card-frame- (3).png',
'card-frame- (30)': 'assets/play/frame/card-frame- (30).png',
'card-frame- (31)': 'assets/play/frame/card-frame- (31).png',
'card-frame- (32)': 'assets/play/frame/card-frame- (32).png',
'card-frame- (33)': 'assets/play/frame/card-frame- (33).png',
'card-frame- (34)': 'assets/play/frame/card-frame- (34).png',
'card-frame- (4)': 'assets/play/frame/card-frame- (4).png',
'card-frame- (5)': 'assets/play/frame/card-frame- (5).png',
'card-frame- (6)': 'assets/play/frame/card-frame- (6).png',
'card-frame- (7)': 'assets/play/frame/card-frame- (7).png',
'card-frame- (8)': 'assets/play/frame/card-frame- (8).png',
'card-frame- (9)': 'assets/play/frame/card-frame- (9).png',
'card-frame- (35)': 'assets/play/frame/card-frame- (35).png',
'question-container': 'assets/play/question-container.png',
'snow- (1)': 'assets/play/frame/snow- (1).png',
'snow- (2)': 'assets/play/frame/snow- (2).png',
'snow- (3)': 'assets/play/frame/snow- (3).png',
'snow- (4)': 'assets/play/frame/snow- (4).png',
'snow- (5)': 'assets/play/frame/snow- (5).png',
};
const localAudios = {
'sm-back': "assets/default/audio/sm-back.mp3",
'sm-display': "assets/default/audio/sm-display.mp3",
'sm-wrong': "assets/default/audio/sm-wrong.mp3",
'sm-win': "assets/default/audio/sm-win.mp3",
'sm-in': "assets/default/audio/sm-in.mp3",
'sm-out': "assets/default/audio/sm-out.mp3",
'sm-click': "assets/default/audio/sm-click.mp3",
'sm-start': "assets/default/audio/sm-start.mp3",
'sm-correct': 'assets/default/audio/sm-correct.mp3',
'sm-star': "assets/default/audio/sm-star.mp3",
'sm-choice-complete': 'assets/default/audio/sm-choice-complete.mp3',
'sm-choice-correct': 'assets/default/audio/sm-choice-correct.mp3',
'sm-choice-error': 'assets/default/audio/sm-choice-error.mp3',
'sm-choice-in': 'assets/default/audio/sm-choice-in.mp3',
'sm-choice-show-answer': 'assets/default/audio/sm-choice-show-answer.mp3',
'sm-choice-timeup-0': 'assets/default/audio/sm-choice-timeup-0.mp3',
'sm-choice-timeup-3': 'assets/default/audio/sm-choice-timeup-3.mp3',
'sm-go': 'assets/default/audio/sm-go.mp3',
'sm-ready': 'assets/default/audio/sm-ready.mp3',
'skier': 'assets/audio/skier.mp3',
'win': 'assets/audio/win.mp3',
......
src/assets/play/arrow.png

6.62 KB | W: | H:

src/assets/play/arrow.png

4.92 KB | W: | H:

src/assets/play/arrow.png
src/assets/play/arrow.png
src/assets/play/arrow.png
src/assets/play/arrow.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/background.png

198 KB | W: | H:

src/assets/play/background.png

530 KB | W: | H:

src/assets/play/background.png
src/assets/play/background.png
src/assets/play/background.png
src/assets/play/background.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -21,14 +21,15 @@
'card-frame- (28)': 'assets/play/frame/card-frame- (28).png',
'card-frame- (29)': 'assets/play/frame/card-frame- (29).png',
'card-frame- (3)': 'assets/play/frame/card-frame- (3).png',
'card-frame- (30)': 'assets/play/frame/card-frame- (30).png',
'card-frame- (31)': 'assets/play/frame/card-frame- (31).png',
'card-frame- (32)': 'assets/play/frame/card-frame- (32).png',
'card-frame- (33)': 'assets/play/frame/card-frame- (33).png',
'card-frame- (34)': 'assets/play/frame/card-frame- (34).png',
'card-frame- (4)': 'assets/play/frame/card-frame- (4).png',
'card-frame- (5)': 'assets/play/frame/card-frame- (5).png',
'card-frame- (6)': 'assets/play/frame/card-frame- (6).png',
'card-frame- (7)': 'assets/play/frame/card-frame- (7).png',
'card-frame- (8)': 'assets/play/frame/card-frame- (8).png',
'card-frame- (9)': 'assets/play/frame/card-frame- (9).png',
'filename': 'assets/play/frame/filename.txt',
'snow- (1)': 'assets/play/frame/snow- (1).png',
'snow- (2)': 'assets/play/frame/snow- (2).png',
'snow- (3)': 'assets/play/frame/snow- (3).png',
'snow- (4)': 'assets/play/frame/snow- (4).png',
'snow- (5)': 'assets/play/frame/snow- (5).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