Commit 240de8dc authored by 李维's avatar 李维

dev commit

parent 3f27e6d2
......@@ -52,7 +52,11 @@ const defauleFormData = {
{type:"Text", text:"Apple", audio_url:"apple-demo"},
{type:"Image", image_url:"bee-demo", audio_url:"bee-demo"},
{type:"Text", text:"Apple", audio_url:"apple-demo"}
]
],
cardContainerSetting: {
type: "D",
image_url: "dish"
}
}
const zIndexMap = {
......@@ -323,15 +327,48 @@ export class PlayComponent implements OnInit, OnDestroy {
// 卡片容器(盘子 桌布)
initCardContainer(){
let element = this.g_cartoon.createCartoonElementImageFunc('card-container', "dish", (w,h)=>{
let pos = {
image:"",x:0, y:0, sx:0, sy:0
}
switch(this.g_formData.cardContainerSetting.type){
case "A":
pos.image = "dish";
pos.x = this.g_canvasWidth/2;
pos.y = 481*this.g_mapScale;
pos.sx = 658*this.g_mapScale;
pos.sy = 228*this.g_mapScale;
break;
case "B":
pos.image = "box";
pos.x = this.g_canvasWidth/2;
pos.y = 440*this.g_mapScale;
pos.sx = 771*this.g_mapScale*0.8;
pos.sy = 282*this.g_mapScale*0.8;
break;
case "C":
pos.image = "tablecloth";
pos.x = this.g_canvasWidth/2;
pos.y = 490*this.g_mapScale;
pos.sx = 918*this.g_mapScale;
pos.sy = 228*this.g_mapScale;
break;
default:
pos.image = this.g_formData.cardContainerSetting.image_url?this.g_formData.cardContainerSetting.image_url:"dish";
pos.x = this.g_canvasWidth/2;
pos.y = 481*this.g_mapScale;
pos.sx = 658*this.g_mapScale;
pos.sy = 228*this.g_mapScale;
break;
}
let element = this.g_cartoon.createCartoonElementImageFunc('card-container', pos.image, (w,h)=>{
return {
sx: 658*this.g_mapScale/w,
sy: 228*this.g_mapScale/h
sx: pos.sx/w,
sy: pos.sy/h
}
}, (w,h)=>{
return {
x: this.g_canvasWidth/2,
y: this.g_cartoon.getOrigin().y+ (h/2)*this.g_mapScale + 481*this.g_mapScale
x: pos.x,
y: this.g_cartoon.getOrigin().y+ (h/2)*this.g_mapScale + pos.y
}
})
this.render(element.ref)
......@@ -500,7 +537,7 @@ export class PlayComponent implements OnInit, OnDestroy {
cardContent.ref.addChild(textContent)
}else{
let imageContent = new MySprite()
imageContent.init(this.g_cartoon.images.get(data.image_url?data.image_url:"apple-demp"))
imageContent.init(this.g_cartoon.images.get(data.image_url?data.image_url:"_noImage"))
imageContent.setScaleXY(Math.min( 120/imageContent.width, 120/imageContent.height ))
cardContent.ref.addChild(imageContent)
}
......@@ -692,6 +729,13 @@ export class PlayComponent implements OnInit, OnDestroy {
// 已选择卡片放置点
initSelectedCardArea(){
let totalLightCount = Math.floor(this.g_canvasWidth / (190*this.g_mapScale))-1
let baseLine = null;
switch(this.g_formData.cardContainerSetting.type){
case "A": baseLine = 165*this.g_mapScale; break;
case "B": baseLine = 125*this.g_mapScale; break;
case "C": baseLine = 165*this.g_mapScale; break;
default: baseLine = 165*this.g_mapScale;
}
let element = this.g_cartoon.createCartoonElementImageFunc(`selected-card-hotzone`, "bg_1280_180", (w,h)=>{
return {
sx: 1,//this.g_canvasWidth/w,
......@@ -700,7 +744,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}, (w,h)=>{
return {
x: this.g_canvasWidth/2,
y: this.g_canvasHeight/2 + 165*this.g_mapScale
y: this.g_canvasHeight/2 + baseLine
}
})
element.ref.alpha = 0;
......
......@@ -24,6 +24,7 @@ const localImages = {
'_sm-pic-4': 'assets/default/images/sm-pic-4.png',
'_star': 'assets/default/images/star.png',
'_bubble': 'assets/default/images/bubble.png',
'_image_none': 'assets/default/images/image_none.png',
'bg-background': 'assets/play/bg-background.png',
'box': 'assets/play/box.png',
......@@ -42,7 +43,8 @@ const localImages = {
'text_container': 'assets/play/text_container-1.png',
'bg_selected_card': 'assets/play/bg_selected_card.png',
'bg_1280_180': 'assets/play/bg_1280_180_1.png',
'bee-demo': 'assets/play/bee-demo.jpg'
'bee-demo': 'assets/play/bee-demo.jpg',
'tablecloth': 'assets/play/tablecloth.png'
};
......
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