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

dev commit

parent f81caf51
......@@ -29,7 +29,7 @@
<textarea type="text" nz-input placeholder="" [(ngModel)]="item.contentObj.mainQuestion.text" (blur)="saveItem()" ></textarea>
</div>
<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>
......@@ -42,7 +42,7 @@
<span>短音频</span><span> :</span>
</div>
<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 style="flex:8"></div>
</div>
......@@ -90,7 +90,7 @@
</div>
<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>
新建卡片
</button>
......@@ -135,7 +135,7 @@
</div>
<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>
新建卡片
</button>
......
......@@ -890,6 +890,7 @@ export class MyAnimation extends MySprite {
restartFlag = false;
reverseFlag = false;
firstPlay = true
addFrameByImg(img) {
const spr = new MySprite(this.ctx);
spr.init(img);
......@@ -926,8 +927,16 @@ export class MyAnimation extends MySprite {
}
play() {
if(this.firstPlay){
this.firstPlay = false
this.playFlag = true;
this.lastDateTime = new Date().getTime();
}else{
this.restartFlag = true;
this.firstPlay = false
this.playFlag = true;
this.lastDateTime = new Date().getTime();
}
}
stop() {
......
......@@ -135,7 +135,6 @@ export class PlayComponent implements OnInit, OnDestroy {
g_ForceChangeDefaultRole = false // 强制当前角色为默认角色
g_EnableTestSendEvent = false // 发送模拟Web数据
g_EnableLeftCornerTest= false // 测试左上角图标
g_enableConsoleLog = true;
// ------------------------------------
......@@ -205,6 +204,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.stopEndPatal()
this.m_currentSelectedCard = ""
this.m_allUpCards = []
this.m_fishes = []
}
startGame(){
......@@ -530,7 +530,6 @@ export class PlayComponent implements OnInit, OnDestroy {
}
let _time = parseInt(longAudio.audio.currentTime)
this.log(_time, _time/60, _time%60)
let m = parseInt(_time/60 + "")
let s = parseInt(_time%60 + "")
longAudio.currentTimeString.ref.text = `${m<9?"0"+m:m}:${s<9?"0"+s:s}`
......@@ -649,27 +648,19 @@ export class PlayComponent implements OnInit, OnDestroy {
let spaceing = 10 * this.g_mapScale;
let totalWidth = 0
let totalNum = cardAll.length
cardAll.forEach((element, index) => {
if(index==0 || index==(totalNum-1)){
totalWidth += (element.width/2) + spaceing
}else{
totalWidth += (element.width) + spaceing
}
let bd = element.getBoundingBox()
totalWidth += (bd.width) + spaceing
});
let baseFontsize = 50
let fontSize = 50;
let adjustSX = 1
if(totalWidth > 1214){
fontSize = baseFontsize * (1214 / (totalWidth * 1.65))
if(totalWidth > 1920){
fontSize = 50 * (1920 / (totalWidth)) * 0.7
}
cardAll.forEach((card, index)=>{
card.fontSize = fontSize
card.refreshSize()
})
let lastWidth = 0
let cardX = xuanzhuanTai.ref.x - (xuanzhuanTai.ref.width*this.g_mapScale)/2 + 100 * this.g_mapScale
let A1 = []
let A2 = []
......@@ -697,19 +688,19 @@ export class PlayComponent implements OnInit, OnDestroy {
A4.push(temp.e4)
A5.push(temp.e5)
})
let movedDis =this.alignCenter(A1)
A2.forEach(item=>{
item.x = item.x + movedDis
})
A3.forEach(item=>{
item.x = item.x + movedDis
})
A4.forEach(item=>{
item.x = item.x + movedDis
})
A5.forEach(item=>{
item.x = item.x + movedDis
})
// let movedDis =this.alignCenter(A1)
// A2.forEach(item=>{
// item.x = item.x + movedDis
// })
// A3.forEach(item=>{
// item.x = item.x + movedDis
// })
// A4.forEach(item=>{
// item.x = item.x + movedDis
// })
// A5.forEach(item=>{
// item.x = item.x + movedDis
// })
}
createCardUp(index, label, pos){
......@@ -788,18 +779,16 @@ export class PlayComponent implements OnInit, OnDestroy {
card.lined = false;
card.startAni = this.g_cartoon.createAnimation("bg_star", 11, 500)
card.startAni.visible = false
card.startAni = null;
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.y = card.ref.y
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()
}
......@@ -817,10 +806,12 @@ export class PlayComponent implements OnInit, OnDestroy {
}else{
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){
this.g_cartoon.getCartoonElement(this.m_currentSelectedCard).showHideDoc(false)
card.showHideDoc(false)
}else{
card.showStar()
}
this.m_currentSelectedCard = null
this.g_enableMapDown = true;
......@@ -863,20 +854,13 @@ export class PlayComponent implements OnInit, OnDestroy {
let spaceing = 10 * this.g_mapScale;
let totalWidth = 0
let totalNum = cardAll.length
cardAll.forEach((element, index) => {
if(index==0 || index==(totalNum-1)){
totalWidth += (element.width/2) + spaceing
}else{
totalWidth += (element.width) + spaceing
}
let bd = element.getBoundingBox()
totalWidth += (bd.width) + spaceing
});
let baseFontsize = 50
let fontSize = 50;
let adjustSX = 1
if(totalWidth > 1700){
fontSize = baseFontsize * (1720 / (totalWidth * 2.2))
if(totalWidth > 1920){
fontSize = 50 * (1920 / (totalWidth)) * 0.7
}
cardAll.forEach((card, index)=>{
card.fontSize = fontSize
......@@ -1010,11 +994,14 @@ export class PlayComponent implements OnInit, OnDestroy {
}else{
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){
this.g_cartoon.getCartoonElement(this.m_currentSelectedCard).showHideDoc(false)
card.showHideDoc(false)
}else{
this.g_cartoon.getCartoonElement(this.m_currentSelectedCard).showStar()
}
this.m_currentSelectedCard = null
this.g_enableMapDown = true;
if(this.checkEndGame()){
......@@ -1051,22 +1038,22 @@ export class PlayComponent implements OnInit, OnDestroy {
let last = null
let length = elementArray.length
if(length > 0){
first = elementArray[0]
first = elementArray[0].getBoundingBox()
}
if(length==1){
last = first
}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 moveDis = avDis - (first.x- first.width/2)
let avDis = ((this.g_canvasWidth - (last.x + last.width)) + first.x) / 2
let moveDis = avDis - first.x
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?){
......@@ -1504,7 +1491,6 @@ initBlackMask(callback?){
}
this.initDefaultData();
this.log(this.g_formData)
this.initAudio();
this.initImg();
......@@ -1901,14 +1887,6 @@ initBlackMask(callback?){
this.canvas.nativeElement.height = this.g_canvasHeight;
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.update();
......@@ -1922,10 +1900,10 @@ initBlackMask(callback?){
this.g_cartoon.stageHeight= bgHeight*this.g_mapScale;
const imageColor = this.g_cartoon.createCartoonElement("background-color", "ShapeRect").ref;
this.log( "stageWidth: " + this.g_cartoon.stageWidth + " stageHeight" + this.g_cartoon.stageHeight)
this.log( "clientWidth: " + this.g_cartoon.clientWidth + " clientHeight" + this.g_cartoon.clientHeight)
this.log( "canvasWidth: " + this.g_canvasWidth + " canvasHeight" + this.g_canvasHeight)
this.log( "mapScale: " + this.g_mapScale )
// console.log( "stageWidth: " + this.g_cartoon.stageWidth + " stageHeight" + this.g_cartoon.stageHeight)
// console.log( "clientWidth: " + this.g_cartoon.clientWidth + " clientHeight" + this.g_cartoon.clientHeight)
// console.log( "canvasWidth: " + this.g_canvasWidth + " canvasHeight" + this.g_canvasHeight)
// console.log( "mapScale: " + this.g_mapScale )
imageColor.x = this.g_cartoon.clientWidth / 2 ;
imageColor.y = this.g_cartoon.clientHeight / 2 ;
imageColor.setSize(this.g_cartoon.clientWidth, this.g_cartoon.clientHeight);
......@@ -2094,20 +2072,6 @@ initBlackMask(callback?){
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 {
"version": "1.0",
key: "DataKey_PU03",
mainQuestion:{
type: "Image",
type: "Text",
text: "It's really a fantastic magic movie which talks about love and friendship.",
image_url: "default_Image",
shortAudio_url: "default_short_audio",
longAudio_url: "default_long_audio"
image_url: "",
shortAudio_url: "",
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:[
{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:"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]}
{text:"make friends", lineTo:[0,1] },{text:"lound", lineTo:[2] },{text:"we eat ice cream", lineTo:[4] },{text:"very happy", lineTo:[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:[
{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