Commit 2c339eb6 authored by 李维's avatar 李维

dev done

parent b3a0e8a9
...@@ -148,7 +148,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -148,7 +148,7 @@ export class PlayComponent implements OnInit, OnDestroy {
m_enableRunway = false; m_enableRunway = false;
m_currentFocusCard = 0; m_currentFocusCard = 0;
m_autoFocusID = null; m_autoFocusID = null;
m_enableCamera = true; m_enableCamera = false;
m_nextCardLock = false; m_nextCardLock = false;
// ------------------------------------ // ------------------------------------
...@@ -224,10 +224,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -224,10 +224,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initCamera(); this.initCamera();
this.initCards(); this.initCards();
this.initShowCard(); this.initShowCard();
this.g_cartoon.playAudio("sm-run", false ,null, true, (audio)=>{ this.initStartButton()
audio.volume = 0.3
})
this.autoRollRun()
} }
cleanGameVar(){ cleanGameVar(){
...@@ -243,7 +240,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -243,7 +240,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_requestID = null; this.m_requestID = null;
this.m_enableRunway = false; this.m_enableRunway = false;
this.m_currentFocusCard = 0; this.m_currentFocusCard = 0;
this.m_autoFocusID = null this.m_autoFocusID = null;
this.m_enableCamera = false;
this.m_nextCardLock = false; this.m_nextCardLock = false;
} }
...@@ -251,11 +249,48 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -251,11 +249,48 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
startGame(){
this.m_enableCamera = true;
this.autoRollRun();
this.g_cartoon.playAudio("sm-run", false ,null, true, (audio)=>{
audio.volume = 0.3
})
}
initBackground(){ initBackground(){
let element = this.g_cartoon.createCartoonElementImage("background-main", "main-bg", this.g_canvasWidth, this.g_canvasHeight, this.g_canvasWidth/2, this.g_canvasHeight/2); let element = this.g_cartoon.createCartoonElementImage("background-main", "main-bg", this.g_canvasWidth, this.g_canvasHeight, this.g_canvasWidth/2, this.g_canvasHeight/2);
this.render(element.ref) this.render(element.ref)
} }
initStartButton(){
let element = this.g_cartoon.createCartoonElementImage("start-button", "button_start", 434, 92, this.g_canvasWidth/2, this.g_canvasHeight/2, true);
let element_black = this.g_cartoon.createCartoonElementImage("background-black-main", "_bg_1280_720", this.g_canvasWidth, this.g_canvasHeight, this.g_canvasWidth/2, this.g_canvasHeight/2);
element.out = (callback?)=>{
tweenChange(element.ref, {x:this.g_canvasWidth + 500*this.g_mapScale}, 0.3, ()=>{
tweenChange(element_black.ref, {alpha:0}, 0.1, ()=>{
element.ref.visible = false;
element_black.ref.visible = false;
element_black.ref.x = this.g_canvasWidth + 500*this.g_mapScale
callback && callback()
})
element.ref.visible = false;
callback && callback()
})
}
this.subscribeMapDownEvent(element.id, ()=>{
this.g_cartoon.playAudio("sm-click-start")
element.out(()=>{
this.startGame();
this.g_enableMapDown = true;
})
})
this.render(element.ref,999)
this.render(element_black.ref,998)
}
initRoll(){ initRoll(){
let element = this.g_cartoon.createCartoonElementImageFunc("Camera-Roll", "Image-02", (w,h)=>{ let element = this.g_cartoon.createCartoonElementImageFunc("Camera-Roll", "Image-02", (w,h)=>{
return { return {
...@@ -299,8 +334,25 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -299,8 +334,25 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
}); });
let element_highlight = this.g_cartoon.createCartoonElementImage("Camera-highlight", "camera_highlight",150, 148, 0, 0);
element_highlight.ref.alpha = 0;
element.hightlight = (status, callback?)=>{
if(status){
tweenChange(element_highlight.ref, {alpha:1}, 0.1, ()=>{
callback && callback()
})
}else{
tweenChange(element_highlight.ref, {alpha:0}, 0.1, ()=>{
callback && callback()
})
}
}
element.ref.addChild(element_highlight.ref)
this.subscribeMapDownEvent(element.id, ()=>{ this.subscribeMapDownEvent(element.id, ()=>{
if(this.m_enableCamera){ if(this.m_enableCamera){
element.hightlight(true)
this.m_enableCamera = false; this.m_enableCamera = false;
this.m_enableRunway = false; this.m_enableRunway = false;
this.g_cartoon.stopAudio("sm-run") this.g_cartoon.stopAudio("sm-run")
...@@ -646,6 +698,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -646,6 +698,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.g_cartoon.stopAudio(element.audio_url) this.g_cartoon.stopAudio(element.audio_url)
this.m_enableCamera = true; this.m_enableCamera = true;
element.hide(()=>{ element.hide(()=>{
this.g_cartoon.getCartoonElement("Camera").hightlight(false)
this.m_enableRunway = true; this.m_enableRunway = true;
this.g_enableMapDown = true this.g_enableMapDown = true
}) })
......
const localImages = { const localImages = {
'_bg_1280_720_Ruler': 'assets/default/images/1280_720_Ruler.png', '_bg_1280_720_Ruler': 'assets/default/images/1280_720_Ruler.png',
'_bg_1280_720': 'assets/default/images/bg_1280_720.png',
'_scrap-pic-1': 'assets/default/images/scrap-pic-1.png', '_scrap-pic-1': 'assets/default/images/scrap-pic-1.png',
'_scrap-pic-2': 'assets/default/images/scrap-pic-2.png', '_scrap-pic-2': 'assets/default/images/scrap-pic-2.png',
'_scrap-pic-3': 'assets/default/images/scrap-pic-3.png', '_scrap-pic-3': 'assets/default/images/scrap-pic-3.png',
...@@ -20,13 +21,16 @@ const localImages = { ...@@ -20,13 +21,16 @@ const localImages = {
'light-off': 'assets/play/light-off.png', 'light-off': 'assets/play/light-off.png',
'light-on': 'assets/play/light-on.png', 'light-on': 'assets/play/light-on.png',
'main-bg': 'assets/play/main-bg.png', 'main-bg': 'assets/play/main-bg.png',
'default_image': 'assets/play/default_image.png' 'default_image': 'assets/play/default_image.png',
'camera_highlight': 'assets/play/camera_highlight.png',
'button_start': 'assets/play/button_start.png'
}; };
const localAudios = { const localAudios = {
'sm-camera': 'assets/audio/sm-camera.mp3', 'sm-camera': 'assets/audio/sm-camera.mp3',
'sm-run': 'assets/audio/sm-run.mp3' 'sm-run': 'assets/audio/sm-run.mp3',
'sm-click-start': 'assets/audio/sm-click-start.mp3'
}; };
export {localImages, localAudios}; export {localImages, localAudios};
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