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

dev commit

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