Commit dd991b1e authored by 李维's avatar 李维

dev commit

parent a65352ba
...@@ -738,10 +738,10 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges { ...@@ -738,10 +738,10 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
const currentY = hotZoneItem['rect'].y const currentY = hotZoneItem['rect'].y
hotZoneItem['media'] = {} hotZoneItem['media'] = {}
hotZoneItem['scale'] = this.scale hotZoneItem['scale'] = this.scale
hotZoneItem['rect'].x = (Math.round((currentX - bgItem['rect'].x) * 100) / 100) * this.scale; hotZoneItem['rect'].x = (Math.round((currentX - bgItem['rect'].x) * 1000) / 1000) * this.scale;
hotZoneItem['rect'].y = (Math.round((currentY - bgItem['rect'].y) * 100) / 100) * this.scale; hotZoneItem['rect'].y = (Math.round((currentY - bgItem['rect'].y) * 1000) / 1000) * this.scale;
hotZoneItem['rect'].width = (Math.round((hotZoneItem['rect'].width) * 100) / 100) * this.scale; hotZoneItem['rect'].width = (Math.round((hotZoneItem['rect'].width) * 1000) / 1000) * this.scale;
hotZoneItem['rect'].height = (Math.round((hotZoneItem['rect'].height) * 100) / 100) * this.scale; hotZoneItem['rect'].height = (Math.round((hotZoneItem['rect'].height) * 1000) / 1000) * this.scale;
hotZoneItem['media'].image_url = hotZoneArr[i].image_url hotZoneItem['media'].image_url = hotZoneArr[i].image_url
hotZoneItem['media'].text = hotZoneArr[i].text hotZoneItem['media'].text = hotZoneArr[i].text
hotZoneItem['media'].type = hotZoneArr[i].type hotZoneItem['media'].type = hotZoneArr[i].type
......
...@@ -40,7 +40,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -40,7 +40,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.item = {}; this.item = {};
} }
if ( !this.item.contentObj ) { if ( !this.item.contentObj ) {
this.item.contentObj = {}; this.item.contentObj = {
"version": "1.0",
"dataKey": "DataKey_YM4-11",
};
} }
this.init(); this.init();
this.refresh(); this.refresh();
......
...@@ -323,6 +323,8 @@ export class Cartoon { ...@@ -323,6 +323,8 @@ export class Cartoon {
element.ref.fontSize = fontSize element.ref.fontSize = fontSize
element.ref.x = initX element.ref.x = initX
element.ref.y = initY element.ref.y = initY
element.initX = initX
element.initY = initY
element.ref.textAlign = "center" element.ref.textAlign = "center"
element.ref.refreshSize(); element.ref.refreshSize();
......
...@@ -48,18 +48,9 @@ import { element } from 'protractor'; ...@@ -48,18 +48,9 @@ import { element } from 'protractor';
const zIndexMap = { const zIndexMap = {
mainBackground: 0, mainBackground: 0,
hotZoo: 20, hotZooContainer: 100,
answerCardsContainer: 10, hotZoo: 110,
audioICO: 10,
answerCardPannel: 40,
liewen: 41,
answerCard: 45,
questionCard: 50,
mainQuestionImage: 35,
imageContainer:35,
imageBackground: 36,
shortAudio: 40,
animation: 80
} }
@Component({ @Component({
...@@ -163,17 +154,22 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -163,17 +154,22 @@ export class PlayComponent implements OnInit, OnDestroy {
// 屏幕尺寸变化后执行 // 屏幕尺寸变化后执行
handleScreenResize(){ handleScreenResize(){
this.initSystem();
this.cleanSystemVar() this.cleanSystemVar()
this.cleanGameVar(); this.cleanGameVar();
this.setLeftCornerTest() this.setLeftCornerTest();
this.disableMoveAsstant();
this.initSystem();
this.initGame() this.initGame()
} }
// 映射预加载图片[网路]资源 返回包含图片路径的数组 // 映射预加载图片[网路]资源 返回包含图片路径的数组
mapToImageArray(contentObj){ mapToImageArray(contentObj){
let array = [] let array = []
array.push(contentObj.bgItem.url)
contentObj.hotZoneItemArr.forEach(element => {
array.push(element.media.image_url)
});
console.log(array)
return array return array
} }
...@@ -196,7 +192,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -196,7 +192,10 @@ export class PlayComponent implements OnInit, OnDestroy {
initGame(){ initGame(){
console.log(this.g_formData); console.log(this.g_formData);
this.initSelectPannel();
this.initMainWindow();
this.initLeftPart();
this.initRightPart();
} }
cleanGameVar(){ cleanGameVar(){
...@@ -216,10 +215,164 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -216,10 +215,164 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
initSelectPannel() {
let element = this.g_cartoon.createCartoonElementImageFunc("select-background", "select-bg", (w, h)=>{
return {
sx: 1065 * this.g_mapScale / w,
sy: 188 * this.g_mapScale / h
}
}, (w, h)=>{
return {
x: this.g_canvasWidth / 2,
y: this.g_cartoon.getOrigin().y + (114 + 168 / 2) * this.g_mapScale
}
})
this.render(element.ref)
}
initMainWindow(){
let element = this.g_cartoon.createCartoonElementImageFunc("select-container", "defalut_container", (w, h)=>{
return {
sx: 960 * this.g_mapScale / w,
sy: 155 * this.g_mapScale / h
}
}, (w, h)=>{
return {
x: this.g_canvasWidth / 2,
y: this.g_cartoon.getOrigin().y + (114 + 168 / 2) * this.g_mapScale
}
})
element.originX = element.ref.x - 960 * this.g_mapScale / 2
element.originY = element.ref.y - 155 * this.g_mapScale / 2
let element_t = this.g_cartoon.createCartoonElement("window-image-container", "MySprite")
element_t.ref.init(this.g_cartoon.images.get(this.g_formData.bgItem.url))
element.ref.addChild(element_t.ref)
this.render(element.ref)
this.initHotZooes(element)
}
initHotZooes(parent) {
let hotZoneItemArr = this.g_formData.hotZoneItemArr
hotZoneItemArr.forEach( (item,index) => {
let element = null
element = this.g_cartoon.createCartoonElement("image-puzzle-"+index, "MySprite")
element.ref.init(this.g_cartoon.images.get(item.media.image_url))
element.ref.scaleX = (item.rect.width / element.ref.width) * parent.ref.scaleX
element.ref.scaleY = (item.rect.height / element.ref.height) * parent.ref.scaleY
element.ref.rotation = item.rect.rotation
element.ref.x = parent.originX + (item.rect.x + item.rect.width / 2) * parent.ref.scaleX * 1.05
element.ref.y = parent.originY + (item.rect.y + item.rect.height / 2) * parent.ref.scaleY * 1.05
element.initX = element.ref.x;
element.initY = element.ref.y
element.margin = 0
let elementDrag = null
elementDrag = this.g_cartoon.createCartoonElementLabel("text-puzzle-"+index, " " + item.media.text + " ", "MMTextBook-Bold", "#000", 48 * this.g_mapScale, -500, -500)
console.log(elementDrag.ref.x + " - " + elementDrag.ref.y)
this.render(element.ref)
this.render(elementDrag.ref)
this.subscribeMapDragEvent(element.id, ()=>{
element.ref.alpha = 0.5;
}, ()=>{
elementDrag.ref.x = this.g_clickX,
elementDrag.ref.y = this.g_clickY
}, ()=>{
element.ref.alpha = 1;
elementDrag.ref.x = elementDrag.initX,
elementDrag.ref.y = elementDrag.initY
this.g_enableMapUp = true;
this.g_enableMapDown = true;
})
});
}
initLeftPart() {
if(!this.g_formData.bgItem.wordLeft_text) {
return;
}
let element = this.g_cartoon.createCartoonElementImageFunc("left-part-container", "oval-copy", (w, h)=>{
return {
sx: 100 * this.g_mapScale / w,
sy: 100 * this.g_mapScale / h
}
}, (w, h)=>{
return {
x: this.g_cartoon.getOrigin().x + (108 + 96 / 2) * this.g_mapScale,
y: this.g_cartoon.getOrigin().y + (150 + 96 / 2) * this.g_mapScale
}
})
let text = null
text = this.g_cartoon.createCartoonElementLabel("text-puzzle-left", " " + this.g_formData.bgItem.wordLeft_text + " ", "MMTextBook-Bold", "#FFF", 48)
element.ref.addChild(text.ref)
let textDrag = null
textDrag = this.g_cartoon.createCartoonElementLabel("text-puzzle-left-drag", " " + this.g_formData.bgItem.wordLeft_text + " ", "MMTextBook-Bold", "#000", 48 * this.g_mapScale, -500, -500)
this.render(textDrag.ref)
this.render(element.ref)
this.subscribeMapDragEvent(element.id, ()=>{
text.ref.alpha = 0.5;
}, ()=>{
textDrag.ref.x = this.g_clickX,
textDrag.ref.y = this.g_clickY
}, ()=>{
text.ref.alpha = 1;
textDrag.ref.x = textDrag.initX,
textDrag.ref.y = textDrag.initY
this.g_enableMapUp = true;
this.g_enableMapDown = true;
})
}
initRightPart() {
if(!this.g_formData.bgItem.wordRight_text) {
return;
}
let element = this.g_cartoon.createCartoonElementImageFunc("right-part-container", "oval-copy", (w, h)=>{
return {
sx: 100 * this.g_mapScale / w,
sy: 100 * this.g_mapScale / h
}
}, (w, h)=>{
return {
x: this.g_cartoon.getOrigin().x + (1087 + 96 / 2) * this.g_mapScale,
y: this.g_cartoon.getOrigin().y + (150 + 96 / 2) * this.g_mapScale
}
})
let text = null
text = this.g_cartoon.createCartoonElementLabel("text-puzzle-right", " " + this.g_formData.bgItem.wordRight_text + " ", "MMTextBook-Bold", "#FFF", 48)
element.ref.addChild(text.ref)
let textDrag = null
textDrag = this.g_cartoon.createCartoonElementLabel("text-puzzle-right-drag", " " + this.g_formData.bgItem.wordRight_text + " ", "MMTextBook-Bold", "#000", 48 * this.g_mapScale, -500, -500)
this.render(textDrag.ref)
this.render(element.ref)
this.subscribeMapDragEvent(element.id, ()=>{
text.ref.alpha = 0.5;
}, ()=>{
textDrag.ref.x = this.g_clickX,
textDrag.ref.y = this.g_clickY
}, ()=>{
text.ref.alpha = 1;
textDrag.ref.x = textDrag.initX,
textDrag.ref.y = textDrag.initY
this.g_enableMapUp = true;
this.g_enableMapDown = true;
})
}
...@@ -323,6 +476,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -323,6 +476,7 @@ export class PlayComponent implements OnInit, OnDestroy {
initDefaultData() { initDefaultData() {
if ( Object.keys(this.g_formData).length===0 || this.g_formData.version != defauleFormData.version ) { if ( Object.keys(this.g_formData).length===0 || this.g_formData.version != defauleFormData.version ) {
this.g_formData = defauleFormData; this.g_formData = defauleFormData;
console.log("Use default data.")
} }
} }
...@@ -750,6 +904,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -750,6 +904,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.g_stage = image this.g_stage = image
this.subscribeMapUpEvent("g-ackground-color", ()=>{ this.subscribeMapUpEvent("g-ackground-color", ()=>{
console.log("FEEFEFEFEFEF")
if(this.g_currentDragElementID){ if(this.g_currentDragElementID){
// let dragElement = this.g_cartoon.getCartoonElement(this.g_currentDragElementID) // let dragElement = this.g_cartoon.getCartoonElement(this.g_currentDragElementID)
this.releaseDragElement() this.releaseDragElement()
...@@ -892,6 +1047,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -892,6 +1047,9 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_mapUpQueue = {} this.m_mapUpQueue = {}
this.m_mapUpArray = [] this.m_mapUpArray = []
this.m_mapUpObject = [] this.m_mapUpObject = []
this.m_mapDragQueue = []
this.m_mapDragArray = []
this.m_mapDragObject = []
this.stopAllInterval(); this.stopAllInterval();
this.stopAllTimeout() this.stopAllTimeout()
this.g_cartoon.stopAllAudio() this.g_cartoon.stopAllAudio()
......
...@@ -27,6 +27,20 @@ const localImages = { ...@@ -27,6 +27,20 @@ const localImages = {
'_bubble': 'assets/default/images/bubble.png', '_bubble': 'assets/default/images/bubble.png',
'_image_none': 'assets/default/images/image_none.png', '_image_none': 'assets/default/images/image_none.png',
"defalut_container": "assets/play/hotZooCard/defalut_bg.png",
'bg_70_40': 'assets/play/bg_70_40.png',
'line': 'assets/play/line.png',
'num-1': 'assets/play/num-1.png',
'num-2': 'assets/play/num-2.png',
'num-3': 'assets/play/num-3.png',
'num-4': 'assets/play/num-4.png',
'num-5': 'assets/play/num-5.png',
'num-6': 'assets/play/num-6.png',
'num-7': 'assets/play/num-7.png',
'num-8': 'assets/play/num-8.png',
'oval-copy': 'assets/play/oval-copy.png',
'select-bg': 'assets/play/select-bg.png',
}; };
......
export default { export default {
version: "1.1", "version": "1.0",
displayType:"A", "dataKey": "DataKey_YM4-11",
dataKey: "DataKey_YM_L3_35", "dataArray": [
listeningRecordingAll_url:"",
title: {
partText: "C",
mainText: "Listen, number write and read",
fontSize: "40",
fontFamily: "FUTURAB",
color: "#000000",
audio_url: ""
},
groupingTextLeft:{
text: "",
audio_url: ""
},
groupingTextRight:{
text: "",
audio_url: ""
},
indexAudio: [
"","","","","","","",""
], ],
recordingIndex:["1","2","3","4","5","6","7","8"], "hotZoneItemArr": [
wordArray: [
{ ],
textAll:"", "bgItem": {
setting:[], "url": "assets/play/hotZooCard/defalut_bg.png",
audio_url: "" "questions": [
},
{ ],
textAll:"", "wordLeft_text": "",
setting:[], "rect": {
audio_url: "" "x": 0,
}, "y": 0,
{ "width": 1315,
textAll:"", "height": 212.31770833333334
setting:[], }
audio_url: ""
},
{
textAll:"",
setting:[],
audio_url: ""
},
{
textAll:"",
setting:[],
audio_url: ""
},
{
textAll:"",
setting:[],
audio_url: ""
},
{
textAll:"",
setting:[],
audio_url: ""
},
{
textAll:"",
setting:[],
audio_url: ""
} }
]
} }
\ No newline at end of file
'bg_70_40': 'assets/play/bg_70_40.png', 'bg_70_40': 'assets/play/bg_70_40.png',
'creatJsonProfile': 'assets/play/creatJsonProfile.py', 'creatJsonProfile': 'assets/play/creatJsonProfile.py',
'filename': 'assets/play/filename.txt', 'filename': 'assets/play/filename.txt',
'line': 'assets/play/line.png',
'num-1': 'assets/play/num-1.png',
'num-2': 'assets/play/num-2.png',
'num-3': 'assets/play/num-3.png',
'num-4': 'assets/play/num-4.png',
'num-5': 'assets/play/num-5.png',
'num-6': 'assets/play/num-6.png',
'num-7': 'assets/play/num-7.png',
'num-8': 'assets/play/num-8.png',
'oval-copy': 'assets/play/oval-copy.png',
'question-bg': 'assets/play/question-bg.png',
'resizeImg': 'assets/play/resizeImg.py', 'resizeImg': 'assets/play/resizeImg.py',
'1': 'assets/play/sound/1.mp3', '1': 'assets/play/sound/1.mp3',
......
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