Commit 20c67dab authored by 李维's avatar 李维

dev commit

parent f81caf51
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<textarea type="text" nz-input placeholder="" [(ngModel)]="item.contentObj.mainQuestion.text" (blur)="saveItem()" ></textarea> <textarea type="text" nz-input placeholder="" [(ngModel)]="item.contentObj.mainQuestion.text" (blur)="saveItem()" ></textarea>
</div> </div>
<div *ngIf="item.contentObj.mainQuestion.type=='LongAudio'"> <div *ngIf="item.contentObj.mainQuestion.type=='LongAudio'">
<app-audio-recorder [audioUrl]="item.contentObj.mainQuestion.longAudio_url" (audioUploaded)="onAudioUploadSuccessByItem($event, item)" ></app-audio-recorder> <app-audio-recorder [audioUrl]="item.contentObj.mainQuestion.longAudio_url" (audioUploaded)="onAudioUploadSuccessByItem($event, item, 'longAudio_url')" ></app-audio-recorder>
</div> </div>
</div> </div>
</div> </div>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<span>短音频</span><span> :</span> <span>短音频</span><span> :</span>
</div> </div>
<div style="flex:3"> <div style="flex:3">
<app-audio-recorder [audioUrl]="item.contentObj.mainQuestion.longAudio_url" (audioUploaded)="onAudioUploadSuccessByItem($event, item)" ></app-audio-recorder> <app-audio-recorder [audioUrl]="item.contentObj.mainQuestion.shortAudio_url" (audioUploaded)="onAudioUploadSuccessByItem($event, item, 'shortAudio_url')" ></app-audio-recorder>
</div> </div>
<div style="flex:8"></div> <div style="flex:8"></div>
</div> </div>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</div> </div>
<div class="card-item" style="padding: 0.5vw; text-align: right;" > <div class="card-item" style="padding: 0.5vw; text-align: right;" >
<button nz-button nzType="primary" (click)="addItem(item.contentObj.textUp)"> <button nz-button nzType="primary" (click)="addItem(item.contentObj.textUp, 'card')">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i> <i nz-icon nzType="plus-circle" nzTheme="outline"></i>
新建卡片 新建卡片
</button> </button>
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
</div> </div>
<div class="card-item" style="padding: 0.5vw; text-align: right;" > <div class="card-item" style="padding: 0.5vw; text-align: right;" >
<button nz-button nzType="primary" (click)="addItem(item.contentObj.textDown)"> <button nz-button nzType="primary" (click)="addItem(item.contentObj.textDown, 'card')">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i> <i nz-icon nzType="plus-circle" nzTheme="outline"></i>
新建卡片 新建卡片
</button> </button>
......
...@@ -890,6 +890,7 @@ export class MyAnimation extends MySprite { ...@@ -890,6 +890,7 @@ export class MyAnimation extends MySprite {
restartFlag = false; restartFlag = false;
reverseFlag = false; reverseFlag = false;
firstPlay = true
addFrameByImg(img) { addFrameByImg(img) {
const spr = new MySprite(this.ctx); const spr = new MySprite(this.ctx);
spr.init(img); spr.init(img);
...@@ -926,8 +927,16 @@ export class MyAnimation extends MySprite { ...@@ -926,8 +927,16 @@ export class MyAnimation extends MySprite {
} }
play() { play() {
if(this.firstPlay){
this.firstPlay = false
this.playFlag = true; this.playFlag = true;
this.lastDateTime = new Date().getTime(); this.lastDateTime = new Date().getTime();
}else{
this.restartFlag = true;
this.firstPlay = false
this.playFlag = true;
this.lastDateTime = new Date().getTime();
}
} }
stop() { stop() {
......
...@@ -135,7 +135,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -135,7 +135,6 @@ export class PlayComponent implements OnInit, OnDestroy {
g_ForceChangeDefaultRole = false // 强制当前角色为默认角色 g_ForceChangeDefaultRole = false // 强制当前角色为默认角色
g_EnableTestSendEvent = false // 发送模拟Web数据 g_EnableTestSendEvent = false // 发送模拟Web数据
g_EnableLeftCornerTest= false // 测试左上角图标 g_EnableLeftCornerTest= false // 测试左上角图标
g_enableConsoleLog = true;
// ------------------------------------ // ------------------------------------
...@@ -205,6 +204,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -205,6 +204,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.stopEndPatal() this.stopEndPatal()
this.m_currentSelectedCard = "" this.m_currentSelectedCard = ""
this.m_allUpCards = [] this.m_allUpCards = []
this.m_fishes = []
} }
startGame(){ startGame(){
...@@ -530,7 +530,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -530,7 +530,6 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
let _time = parseInt(longAudio.audio.currentTime) let _time = parseInt(longAudio.audio.currentTime)
this.log(_time, _time/60, _time%60)
let m = parseInt(_time/60 + "") let m = parseInt(_time/60 + "")
let s = parseInt(_time%60 + "") let s = parseInt(_time%60 + "")
longAudio.currentTimeString.ref.text = `${m<9?"0"+m:m}:${s<9?"0"+s:s}` longAudio.currentTimeString.ref.text = `${m<9?"0"+m:m}:${s<9?"0"+s:s}`
...@@ -649,27 +648,19 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -649,27 +648,19 @@ export class PlayComponent implements OnInit, OnDestroy {
let spaceing = 10 * this.g_mapScale; let spaceing = 10 * this.g_mapScale;
let totalWidth = 0 let totalWidth = 0
let totalNum = cardAll.length
cardAll.forEach((element, index) => { cardAll.forEach((element, index) => {
if(index==0 || index==(totalNum-1)){ let bd = element.getBoundingBox()
totalWidth += (element.width/2) + spaceing totalWidth += (bd.width) + spaceing
}else{
totalWidth += (element.width) + spaceing
}
}); });
let baseFontsize = 50
let fontSize = 50; let fontSize = 50;
let adjustSX = 1 if(totalWidth > 1920){
if(totalWidth > 1214){ fontSize = 50 * (1920 / (totalWidth)) * 0.7
fontSize = baseFontsize * (1214 / (totalWidth * 1.65))
} }
cardAll.forEach((card, index)=>{ cardAll.forEach((card, index)=>{
card.fontSize = fontSize card.fontSize = fontSize
card.refreshSize() card.refreshSize()
}) })
let lastWidth = 0
let cardX = xuanzhuanTai.ref.x - (xuanzhuanTai.ref.width*this.g_mapScale)/2 + 100 * this.g_mapScale let cardX = xuanzhuanTai.ref.x - (xuanzhuanTai.ref.width*this.g_mapScale)/2 + 100 * this.g_mapScale
let A1 = [] let A1 = []
let A2 = [] let A2 = []
...@@ -697,19 +688,19 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -697,19 +688,19 @@ export class PlayComponent implements OnInit, OnDestroy {
A4.push(temp.e4) A4.push(temp.e4)
A5.push(temp.e5) A5.push(temp.e5)
}) })
let movedDis =this.alignCenter(A1) // let movedDis =this.alignCenter(A1)
A2.forEach(item=>{ // A2.forEach(item=>{
item.x = item.x + movedDis // item.x = item.x + movedDis
}) // })
A3.forEach(item=>{ // A3.forEach(item=>{
item.x = item.x + movedDis // item.x = item.x + movedDis
}) // })
A4.forEach(item=>{ // A4.forEach(item=>{
item.x = item.x + movedDis // item.x = item.x + movedDis
}) // })
A5.forEach(item=>{ // A5.forEach(item=>{
item.x = item.x + movedDis // item.x = item.x + movedDis
}) // })
} }
createCardUp(index, label, pos){ createCardUp(index, label, pos){
...@@ -788,18 +779,16 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -788,18 +779,16 @@ export class PlayComponent implements OnInit, OnDestroy {
card.lined = false; card.lined = false;
card.startAni = this.g_cartoon.createAnimation("bg_star", 11, 500) card.startAni = null;
card.startAni.visible = false card.showStar = (callback?)=>{
card.startAni = this.g_cartoon.createAnimation("bg_star", 11, 500, ()=>{
card.startAni.visible = false;
this.deleteElementInRender(card.startAni.id)
callback && callback()
})
card.startAni.x = card.ref.x card.startAni.x = card.ref.x
card.startAni.y = card.ref.y card.startAni.y = card.ref.y
this.render(card.startAni, zIndexMap.animation) this.render(card.startAni, zIndexMap.animation)
card.showStart = (callback?)=>{
card.startAni.visible = true
card.startAni.playEndFunc = ()=>{
card.startAni.visible = false;
callback && callback()
}
card.startAni.play() card.startAni.play()
} }
...@@ -817,10 +806,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -817,10 +806,12 @@ export class PlayComponent implements OnInit, OnDestroy {
}else{ }else{
result = this.g_cartoon.getCartoonElement(card.id).checkLink(this.m_currentSelectedCard) result = this.g_cartoon.getCartoonElement(card.id).checkLink(this.m_currentSelectedCard)
} }
this.lineTo(this.m_currentSelectedCard, card.id, result, ()=>{ this.lineTo(card.id, this.m_currentSelectedCard, result, ()=>{
if(!result){ if(!result){
this.g_cartoon.getCartoonElement(this.m_currentSelectedCard).showHideDoc(false) this.g_cartoon.getCartoonElement(this.m_currentSelectedCard).showHideDoc(false)
card.showHideDoc(false) card.showHideDoc(false)
}else{
card.showStar()
} }
this.m_currentSelectedCard = null this.m_currentSelectedCard = null
this.g_enableMapDown = true; this.g_enableMapDown = true;
...@@ -863,20 +854,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -863,20 +854,13 @@ export class PlayComponent implements OnInit, OnDestroy {
let spaceing = 10 * this.g_mapScale; let spaceing = 10 * this.g_mapScale;
let totalWidth = 0 let totalWidth = 0
let totalNum = cardAll.length
cardAll.forEach((element, index) => { cardAll.forEach((element, index) => {
if(index==0 || index==(totalNum-1)){ let bd = element.getBoundingBox()
totalWidth += (element.width/2) + spaceing totalWidth += (bd.width) + spaceing
}else{
totalWidth += (element.width) + spaceing
}
}); });
let baseFontsize = 50
let fontSize = 50; let fontSize = 50;
let adjustSX = 1 if(totalWidth > 1920){
if(totalWidth > 1700){ fontSize = 50 * (1920 / (totalWidth)) * 0.7
fontSize = baseFontsize * (1720 / (totalWidth * 2.2))
} }
cardAll.forEach((card, index)=>{ cardAll.forEach((card, index)=>{
card.fontSize = fontSize card.fontSize = fontSize
...@@ -1010,11 +994,14 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1010,11 +994,14 @@ export class PlayComponent implements OnInit, OnDestroy {
}else{ }else{
result = this.g_cartoon.getCartoonElement(card.id).checkLink(this.m_currentSelectedCard) result = this.g_cartoon.getCartoonElement(card.id).checkLink(this.m_currentSelectedCard)
} }
this.lineTo(this.m_currentSelectedCard, card.id, result, ()=>{ this.lineTo(card.id, this.m_currentSelectedCard, result, ()=>{
if(!result){ if(!result){
this.g_cartoon.getCartoonElement(this.m_currentSelectedCard).showHideDoc(false) this.g_cartoon.getCartoonElement(this.m_currentSelectedCard).showHideDoc(false)
card.showHideDoc(false) card.showHideDoc(false)
}else{
this.g_cartoon.getCartoonElement(this.m_currentSelectedCard).showStar()
} }
this.m_currentSelectedCard = null this.m_currentSelectedCard = null
this.g_enableMapDown = true; this.g_enableMapDown = true;
if(this.checkEndGame()){ if(this.checkEndGame()){
...@@ -1051,22 +1038,22 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1051,22 +1038,22 @@ export class PlayComponent implements OnInit, OnDestroy {
let last = null let last = null
let length = elementArray.length let length = elementArray.length
if(length > 0){ if(length > 0){
first = elementArray[0] first = elementArray[0].getBoundingBox()
} }
if(length==1){ if(length==1){
last = first last = first
}else{ }else{
last = elementArray[length-1] last = elementArray[length-1].getBoundingBox()
} }
let avDis = ((this.g_canvasWidth - (last.x + last.width/2)) + first.x - first.width/2 ) / 2 let avDis = ((this.g_canvasWidth - (last.x + last.width)) + first.x) / 2
let moveDis = avDis - (first.x- first.width/2) let moveDis = avDis - first.x
elementArray.forEach(element => { elementArray.forEach(element => {
element.x = element.x + moveDis * this.g_mapScale element.x = element.x + moveDis
}); });
return moveDis * this.g_mapScale return moveDis
} }
lineTo(T1, T2, isCorrect, callback?){ lineTo(T1, T2, isCorrect, callback?){
...@@ -1504,7 +1491,6 @@ initBlackMask(callback?){ ...@@ -1504,7 +1491,6 @@ initBlackMask(callback?){
} }
this.initDefaultData(); this.initDefaultData();
this.log(this.g_formData)
this.initAudio(); this.initAudio();
this.initImg(); this.initImg();
...@@ -1901,14 +1887,6 @@ initBlackMask(callback?){ ...@@ -1901,14 +1887,6 @@ initBlackMask(callback?){
this.canvas.nativeElement.height = this.g_canvasHeight; this.canvas.nativeElement.height = this.g_canvasHeight;
window["curCtx"] = this.g_ctx; window["curCtx"] = this.g_ctx;
if(window.location.href.indexOf("localhost")==-1){
this.g_enableConsoleLog = false;
}else{
if(this.g_enableConsoleLog){
this.log("== log enable ==")
}
}
// 初始化舞台 // 初始化舞台
this.initStage(); this.initStage();
this.update(); this.update();
...@@ -1922,10 +1900,10 @@ initBlackMask(callback?){ ...@@ -1922,10 +1900,10 @@ initBlackMask(callback?){
this.g_cartoon.stageHeight= bgHeight*this.g_mapScale; this.g_cartoon.stageHeight= bgHeight*this.g_mapScale;
const imageColor = this.g_cartoon.createCartoonElement("background-color", "ShapeRect").ref; const imageColor = this.g_cartoon.createCartoonElement("background-color", "ShapeRect").ref;
this.log( "stageWidth: " + this.g_cartoon.stageWidth + " stageHeight" + this.g_cartoon.stageHeight) // console.log( "stageWidth: " + this.g_cartoon.stageWidth + " stageHeight" + this.g_cartoon.stageHeight)
this.log( "clientWidth: " + this.g_cartoon.clientWidth + " clientHeight" + this.g_cartoon.clientHeight) // console.log( "clientWidth: " + this.g_cartoon.clientWidth + " clientHeight" + this.g_cartoon.clientHeight)
this.log( "canvasWidth: " + this.g_canvasWidth + " canvasHeight" + this.g_canvasHeight) // console.log( "canvasWidth: " + this.g_canvasWidth + " canvasHeight" + this.g_canvasHeight)
this.log( "mapScale: " + this.g_mapScale ) // console.log( "mapScale: " + this.g_mapScale )
imageColor.x = this.g_cartoon.clientWidth / 2 ; imageColor.x = this.g_cartoon.clientWidth / 2 ;
imageColor.y = this.g_cartoon.clientHeight / 2 ; imageColor.y = this.g_cartoon.clientHeight / 2 ;
imageColor.setSize(this.g_cartoon.clientWidth, this.g_cartoon.clientHeight); imageColor.setSize(this.g_cartoon.clientWidth, this.g_cartoon.clientHeight);
...@@ -2094,20 +2072,6 @@ initBlackMask(callback?){ ...@@ -2094,20 +2072,6 @@ initBlackMask(callback?){
this.render(bgRect, 9999); this.render(bgRect, 9999);
} }
log(message?: any, ...optionalParams: any[]){
let type = "log"
if(this.g_enableConsoleLog){
switch(type){
case "log": console.log(...arguments); break;
case "info": console.log(...arguments); break;
case "warn": console.log(...arguments); break;
case "error": console.log(...arguments); break;
default: console.log(...arguments); break;
}
}
}
......
...@@ -2,28 +2,16 @@ export default { ...@@ -2,28 +2,16 @@ export default {
"version": "1.0", "version": "1.0",
key: "DataKey_PU03", key: "DataKey_PU03",
mainQuestion:{ mainQuestion:{
type: "Image", type: "Text",
text: "It's really a fantastic magic movie which talks about love and friendship.", text: "It's really a fantastic magic movie which talks about love and friendship.",
image_url: "default_Image", image_url: "",
shortAudio_url: "default_short_audio", shortAudio_url: "",
longAudio_url: "default_long_audio" longAudio_url: ""
}, },
// textUp:[
// {text:"make friends", lineTo:""},{text:"lound", lineTo:""},{text:"we eat ice cream", lineTo:""},{text:"very happy", lineTo:""},
// {text:"make friends", lineTo:""},{text:"lound", lineTo:""},{text:"we eat ice cream", lineTo:""},{text:"very happy", lineTo:""},
// {text:"make friends", lineTo:""}
// ],
textUp:[ textUp:[
{text:"ABCD", lineTo:[1,2,3]},{text:"ABCDEFG", lineTo:[1,2,3]},{text:"ABCDEF", lineTo:[1,2,3]},{text:"ABCD EFG", lineTo:[1,2,3]}, {text:"make friends", lineTo:[0,1] },{text:"lound", lineTo:[2] },{text:"we eat ice cream", lineTo:[4] },{text:"very happy", lineTo:[3] },
{text:"ABCD", lineTo:[1,2,3]},{text:"ABCD", lineTo:[1,2,3]},{text:"ABCD", lineTo:[1,2,3]},{text:"ABCD", lineTo:[1,2,3]},
{text:"ABCD", lineTo:[1,2,3]}
], ],
// textDown:[
// {text:"it's so much fun", lineTo:""},{text:"lound", lineTo:""},{text:"very happy", lineTo:""},{text:"sun", lineTo:""},{text:"at the park", lineTo:""},
// {text:"it's so much fun", lineTo:""},{text:"lound", lineTo:""},{text:"very happy", lineTo:""},{text:"sun", lineTo:""},{text:"at the park", lineTo:""},
// {text:"it's so much fun", lineTo:""}
// ]
textDown:[ textDown:[
{text:"it's so much fun", lineTo:""},{text:"lound", lineTo:""},{text:"very happy", lineTo:""},{text:"sun", lineTo:""} {text:"it's so much fun", lineTo:[] },{text:"lound", lineTo:[] },{text:"very happy", lineTo:[] },{text:"sun", lineTo:[] },{text:"at the park", lineTo:[] },
] ]
} }
\ 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