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

dev commit

parent f1337dc5
......@@ -270,6 +270,7 @@ export class Cartoon {
let element = new Label()
element.text = text;
if(fontName){
console.log(fontName)
element.fontName = fontName;
}
if(fontColor){
......
......@@ -224,6 +224,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initCamera();
this.initCards();
this.m_enableAutoRunFocus = true;
console.log("Init auto")
this.autoRunFocus()
this.initShowCard();
this.g_cartoon.playAudio("sm-run", false ,null, true, (audio)=>{
......@@ -302,6 +303,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.subscribeMapDownEvent(element.id, ()=>{
if(this.m_enableCamera){
console.log("Enable camera -> 1 false")
this.m_enableCamera = false;
this.g_cartoon.stopAudio("sm-run")
clearTimeout(this.m_autoFocusID)
......@@ -354,11 +356,6 @@ export class PlayComponent implements OnInit, OnDestroy {
})
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)
element.ref.addChild(cardContent.ref)
......@@ -379,8 +376,32 @@ export class PlayComponent implements OnInit, OnDestroy {
})
element.ref.addChild(cardImage)
}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 {
}
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){
this.g_cartoon.getCartoonElement(this.m_allCardIds[current]).hideHighlight()
}
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()
})
this.m_currentFocusCard = next;
......@@ -503,6 +531,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if(this.m_enableAutoRunFocus){
this.m_autoFocusID = setTimeout(()=>{
if(this.m_enableAutoRunFocus){
console.log("Set timeout auto")
this.autoRunFocus()
}
},3000)
......@@ -536,7 +565,7 @@ export class PlayComponent implements OnInit, OnDestroy {
clickTarget.ref.alpha = 0;
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 sx = 165 / w;
let sy = 165 / h;
......@@ -571,8 +600,31 @@ export class PlayComponent implements OnInit, OnDestroy {
})
element.ref.addChild(element.imageContent)
}else{
element.textContent = this.g_cartoon.createLabel(data.text, null, null, 20)
element.ref.addChild(element.textContent)
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.textContent = textContainer
element.ref.addChild(textContainer)
}
if(data.audio_url){
element.audio_url = data.audio_url
......@@ -593,6 +645,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_enableAutoRunFocus = true;
element.audio_url = null;
this.g_cartoon.stopAudio(element.audio_url)
console.log("Close auto")
this.autoRunFocus()
tweenChange(element.ref, {scaleX: 0, scaleY: 0}, 0.3, ()=>{
element.ref.visible = false;
......@@ -620,9 +673,10 @@ export class PlayComponent implements OnInit, OnDestroy {
this.subscribeMapDownEvent(closeBntton.id, ()=>{
this.g_cartoon.playAudio("sm-camera")
console.log("Enable camera -> 4 true")
this.m_enableCamera = true;
element.hide(()=>{
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