Commit 0a0c19de authored by 李维's avatar 李维

dev commit

parent f1337dc5
...@@ -270,6 +270,7 @@ export class Cartoon { ...@@ -270,6 +270,7 @@ export class Cartoon {
let element = new Label() let element = new Label()
element.text = text; element.text = text;
if(fontName){ if(fontName){
console.log(fontName)
element.fontName = fontName; element.fontName = fontName;
} }
if(fontColor){ if(fontColor){
......
...@@ -224,6 +224,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -224,6 +224,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initCamera(); this.initCamera();
this.initCards(); this.initCards();
this.m_enableAutoRunFocus = true; this.m_enableAutoRunFocus = true;
console.log("Init auto")
this.autoRunFocus() this.autoRunFocus()
this.initShowCard(); this.initShowCard();
this.g_cartoon.playAudio("sm-run", false ,null, true, (audio)=>{ this.g_cartoon.playAudio("sm-run", false ,null, true, (audio)=>{
...@@ -302,6 +303,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -302,6 +303,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.subscribeMapDownEvent(element.id, ()=>{ this.subscribeMapDownEvent(element.id, ()=>{
if(this.m_enableCamera){ if(this.m_enableCamera){
console.log("Enable camera -> 1 false")
this.m_enableCamera = false; this.m_enableCamera = false;
this.g_cartoon.stopAudio("sm-run") this.g_cartoon.stopAudio("sm-run")
clearTimeout(this.m_autoFocusID) clearTimeout(this.m_autoFocusID)
...@@ -353,11 +355,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -353,11 +355,6 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
}) })
element.content = null; element.content = null;
let Text = new Label()
Text.text = "" + index
Text.textAlign = "center"
element.ref.addChild(Text)
// 内容 // 内容
let cardContent = this.g_cartoon.createCartoonElementImage(`card-content-${index}`, "Image-05", 210, 210, 0, 0) let cardContent = this.g_cartoon.createCartoonElementImage(`card-content-${index}`, "Image-05", 210, 210, 0, 0)
...@@ -379,8 +376,32 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -379,8 +376,32 @@ export class PlayComponent implements OnInit, OnDestroy {
}) })
element.ref.addChild(cardImage) element.ref.addChild(cardImage)
}else{ }else{
let cardText = this.g_cartoon.createLabel(data.text, null, null, 20)
element.ref.addChild(cardText)
let textContainer = this.g_cartoon.createImage("Image-05", (w,h)=>{
return {
sx: 165 / w,
sy: 165 / h
}
}, (w,h)=>{
return {
x: 0,
y:0
}
})
textContainer.alpha = 0
let text = this.g_cartoon.createLabel(data.text, "BerlinSansFBDemi-Bold", null, 50)
let lineNum = data.text.split(" ").length
console.log(lineNum)
text.maxSingalLineWidth = 165
text.fontColor = "#e05e14";
if(lineNum>1){
textContainer.y = -(lineNum * 50) / 2 + 50
}
textContainer.addChild(text)
element.ref.addChild(textContainer)
} }
// 高亮 // 高亮
...@@ -477,11 +498,18 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -477,11 +498,18 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
if(this.g_cartoon.getCartoonElement(this.m_allCardIds[next]).ref.x>=this.g_canvasWidth-300*this.g_mapScale){ if(this.g_cartoon.getCartoonElement(this.m_allCardIds[next]).ref.x>=this.g_canvasWidth-300*this.g_mapScale){
this.cardRunControl(500*this.g_mapScale, ()=>{ console.log("Enable camera -> 2 false")
this.m_enableCamera = false;
this.g_enableMapDown = false;
let distance = this.g_cartoon.getCartoonElement(this.m_allCardIds[current]).ref.x / 2
this.cardRunControl(distance, ()=>{
if(current != -1){ if(current != -1){
this.g_cartoon.getCartoonElement(this.m_allCardIds[current]).hideHighlight() this.g_cartoon.getCartoonElement(this.m_allCardIds[current]).hideHighlight()
} }
this.g_cartoon.getCartoonElement(this.m_allCardIds[next]).showHighlight(()=>{ this.g_cartoon.getCartoonElement(this.m_allCardIds[next]).showHighlight(()=>{
console.log("Enable camera -> 3 true")
this.m_enableCamera = true;
this.g_enableMapDown = true;
callback && callback() callback && callback()
}) })
this.m_currentFocusCard = next; this.m_currentFocusCard = next;
...@@ -503,6 +531,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -503,6 +531,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if(this.m_enableAutoRunFocus){ if(this.m_enableAutoRunFocus){
this.m_autoFocusID = setTimeout(()=>{ this.m_autoFocusID = setTimeout(()=>{
if(this.m_enableAutoRunFocus){ if(this.m_enableAutoRunFocus){
console.log("Set timeout auto")
this.autoRunFocus() this.autoRunFocus()
} }
},3000) },3000)
...@@ -536,7 +565,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -536,7 +565,7 @@ export class PlayComponent implements OnInit, OnDestroy {
clickTarget.ref.alpha = 0; clickTarget.ref.alpha = 0;
element.ref.addChild(clickTarget.ref) element.ref.addChild(clickTarget.ref)
let textContent = this.g_cartoon.createLabel("", null, null, 20) let textContent = this.g_cartoon.createLabel("", "BerlinSansFBDemi-Bold", null, 50)
let imageContent = this.g_cartoon.createImage("Image-05", (w,h)=>{ let imageContent = this.g_cartoon.createImage("Image-05", (w,h)=>{
let sx = 165 / w; let sx = 165 / w;
let sy = 165 / h; let sy = 165 / h;
...@@ -571,8 +600,31 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -571,8 +600,31 @@ export class PlayComponent implements OnInit, OnDestroy {
}) })
element.ref.addChild(element.imageContent) element.ref.addChild(element.imageContent)
}else{ }else{
element.textContent = this.g_cartoon.createLabel(data.text, null, null, 20) let textContainer = this.g_cartoon.createImage("Image-05", (w,h)=>{
element.ref.addChild(element.textContent) return {
sx: 165 / w,
sy: 165 / h
}
}, (w,h)=>{
return {
x: 0,
y:0
}
})
textContainer.alpha = 0
let text = this.g_cartoon.createLabel(data.text, "BerlinSansFBDemi-Bold", null, 50)
let lineNum = data.text.split(" ").length
console.log(lineNum)
text.maxSingalLineWidth = 165
text.fontColor = "#e05e14";
if(lineNum>1){
textContainer.y = -(lineNum * 50) / 2 + 50
}
textContainer.addChild(text)
element.textContent = textContainer
element.ref.addChild(textContainer)
} }
if(data.audio_url){ if(data.audio_url){
element.audio_url = data.audio_url element.audio_url = data.audio_url
...@@ -593,6 +645,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -593,6 +645,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_enableAutoRunFocus = true; this.m_enableAutoRunFocus = true;
element.audio_url = null; element.audio_url = null;
this.g_cartoon.stopAudio(element.audio_url) this.g_cartoon.stopAudio(element.audio_url)
console.log("Close auto")
this.autoRunFocus() this.autoRunFocus()
tweenChange(element.ref, {scaleX: 0, scaleY: 0}, 0.3, ()=>{ tweenChange(element.ref, {scaleX: 0, scaleY: 0}, 0.3, ()=>{
element.ref.visible = false; element.ref.visible = false;
...@@ -620,9 +673,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -620,9 +673,10 @@ export class PlayComponent implements OnInit, OnDestroy {
this.subscribeMapDownEvent(closeBntton.id, ()=>{ this.subscribeMapDownEvent(closeBntton.id, ()=>{
this.g_cartoon.playAudio("sm-camera") this.g_cartoon.playAudio("sm-camera")
console.log("Enable camera -> 4 true")
this.m_enableCamera = true;
element.hide(()=>{ element.hide(()=>{
this.g_enableMapDown = true this.g_enableMapDown = true
this.m_enableCamera = true;
}) })
}) })
......
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