Commit abf65db8 authored by Tt's avatar Tt

更换图片 动态适配

parent a193b254
This diff is collapsed.
...@@ -47,6 +47,16 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -47,6 +47,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
question.id = id; question.id = id;
return question; return question;
}); });
// 处理两侧的信息
let isWidth = cc.winSize.width / cc.winSize.height - 1920 / 1080;
if (isWidth > 0) {
this.layout_battery_left.getComponent(cc.Widget).left = 65;
this.layout_battery_right.getComponent(cc.Widget).right = 65;
} else {
this.layout_battery_left.getComponent(cc.Widget).left = 0;
this.layout_battery_right.getComponent(cc.Widget).right = 0;
}
console.log(isWidth);
} }
// 当前数据 // 当前数据
get currentQuestion() { return this.questions[this.current] } get currentQuestion() { return this.questions[this.current] }
...@@ -171,7 +181,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -171,7 +181,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 右侧 // 右侧
let sid = (i + 1 - lineNum) % 2 + 5 let sid = (i + 1 - lineNum) % 2 + 5
pg.view.visible(pg.view.find(item, 'bg/img_battery' + sid), true) pg.view.visible(pg.view.find(item, 'bg/img_battery' + sid), true)
item_text.x = 20 item_text.x = 10
item.x = 400; item.x = 400;
if (this.current == 0) { if (this.current == 0) {
cc.tween(item).delay(delayTime).to(0.5, { x: 0 }).start(); cc.tween(item).delay(delayTime).to(0.5, { x: 0 }).start();
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 286, "width": 232,
"height": 232, "height": 189,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"img_battery001_dg18_tianci": { "img_battery001_dg18_tianci": {
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 286, "width": 232,
"height": 232, "height": 189,
"rawWidth": 286, "rawWidth": 232,
"rawHeight": 232, "rawHeight": 189,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 281, "width": 249,
"height": 140, "height": 114,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"img_battery1_dg18_tianci": { "img_battery1_dg18_tianci": {
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 281, "width": 249,
"height": 140, "height": 114,
"rawWidth": 281, "rawWidth": 249,
"rawHeight": 140, "rawHeight": 114,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 281, "width": 249,
"height": 140, "height": 113,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"img_battery2_dg18_tianci": { "img_battery2_dg18_tianci": {
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 281, "width": 249,
"height": 140, "height": 113,
"rawWidth": 281, "rawWidth": 249,
"rawHeight": 140, "rawHeight": 113,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 281, "width": 249,
"height": 140, "height": 113,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"img_battery3_dg18_tianci": { "img_battery3_dg18_tianci": {
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 281, "width": 249,
"height": 140, "height": 113,
"rawWidth": 281, "rawWidth": 249,
"rawHeight": 140, "rawHeight": 113,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 281, "width": 249,
"height": 140, "height": 113,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"img_battery4_dg18_tianci": { "img_battery4_dg18_tianci": {
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 281, "width": 249,
"height": 140, "height": 113,
"rawWidth": 281, "rawWidth": 249,
"rawHeight": 140, "rawHeight": 113,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 281, "width": 249,
"height": 140, "height": 113,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"img_battery5_dg18_tianci": { "img_battery5_dg18_tianci": {
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 281, "width": 249,
"height": 140, "height": 113,
"rawWidth": 281, "rawWidth": 249,
"rawHeight": 140, "rawHeight": 113,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 281, "width": 249,
"height": 140, "height": 113,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"img_battery6_dg18_tianci": { "img_battery6_dg18_tianci": {
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 281, "width": 249,
"height": 140, "height": 113,
"rawWidth": 281, "rawWidth": 249,
"rawHeight": 140, "rawHeight": 113,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
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