修改homeScene适配 GameScene适配
修改冰冻道具使用时间+20秒
This commit is contained in:
parent
7066f2720b
commit
8eaf8b9f7a
|
|
@ -39529,7 +39529,7 @@
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 1080,
|
"width": 2000,
|
||||||
"height": 2600
|
"height": 2600
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
|
|
|
||||||
|
|
@ -401,7 +401,7 @@ export default class JiaZai extends cc.Component {
|
||||||
let top = this.node.getChildByName("Load").getChildByName("Top");
|
let top = this.node.getChildByName("Load").getChildByName("Top");
|
||||||
top.getChildByName("hammer").active = false;
|
top.getChildByName("hammer").active = false;
|
||||||
}
|
}
|
||||||
|
this.setAdaptation();
|
||||||
// 加载广告
|
// 加载广告
|
||||||
// cc.fx.GameTool.preloadRewardedVideoAd().then((success) => {
|
// cc.fx.GameTool.preloadRewardedVideoAd().then((success) => {
|
||||||
// if (success) {
|
// if (success) {
|
||||||
|
|
@ -412,6 +412,78 @@ export default class JiaZai extends cc.Component {
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 适配pad
|
||||||
|
setAdaptation() {
|
||||||
|
const hmScale = cc.fx.GameTool.adaptation()
|
||||||
|
if (hmScale == 1) return;
|
||||||
|
|
||||||
|
const loadNode = this.node.getChildByName("Load");
|
||||||
|
if (loadNode) {
|
||||||
|
const designSize = cc.view.getDesignResolutionSize();
|
||||||
|
const frameSize = cc.view.getFrameSize();
|
||||||
|
const scaleX = frameSize.width / designSize.width;
|
||||||
|
const scaleY = frameSize.height / designSize.height;
|
||||||
|
const scale = Math.min(scaleX, scaleY);
|
||||||
|
let barWidth = 0;
|
||||||
|
if (scaleX > scaleY) {
|
||||||
|
barWidth = (frameSize.width - designSize.width * scale) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadNode.scale = hmScale;
|
||||||
|
|
||||||
|
// 适配右边的元素,保持与右边框距离不变
|
||||||
|
const rightElements = [
|
||||||
|
"tiaodik",
|
||||||
|
"shezhiBtn",
|
||||||
|
"popRank",
|
||||||
|
"Pause",
|
||||||
|
"rank",
|
||||||
|
"day",
|
||||||
|
"hammer",
|
||||||
|
"Coin"
|
||||||
|
];
|
||||||
|
const rightElements2 = [
|
||||||
|
"shop",
|
||||||
|
"yicon",
|
||||||
|
"xinshou",
|
||||||
|
"avatar",
|
||||||
|
"kuang"
|
||||||
|
]
|
||||||
|
rightElements.forEach(elementName => {
|
||||||
|
let element;
|
||||||
|
if (elementName === "Pause") {
|
||||||
|
element = this.node.getChildByName(elementName);
|
||||||
|
} else if (elementName === "popRank") {
|
||||||
|
element = this.node.getChildByName("rank");
|
||||||
|
} else if (elementName === "tiaodik" || elementName === "shezhiBtn") {
|
||||||
|
element = loadNode.getChildByName(elementName);
|
||||||
|
} else {
|
||||||
|
element = loadNode.getChildByName("Top").getChildByName(elementName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element) {
|
||||||
|
if (!element.originalRightOffset) {
|
||||||
|
element.originalRightOffset = designSize.width / 2 - element.x;
|
||||||
|
}
|
||||||
|
element.x = designSize.width / 2 - element.originalRightOffset + barWidth / scale;
|
||||||
|
element.scale = hmScale;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
rightElements2.forEach(elementName => {
|
||||||
|
let element;
|
||||||
|
element = loadNode.getChildByName("Top").getChildByName(elementName);
|
||||||
|
|
||||||
|
if (element) {
|
||||||
|
if (!element.originalLeftOffset) {
|
||||||
|
element.originalLeftOffset = element.x + designSize.width / 2;
|
||||||
|
}
|
||||||
|
element.x = -designSize.width / 2 + element.originalLeftOffset - barWidth / scale;
|
||||||
|
element.scale = hmScale;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
checkDailyQuests() {
|
checkDailyQuests() {
|
||||||
cc.fx.GameTool.getDailyQuestsInfo((data) => {
|
cc.fx.GameTool.getDailyQuestsInfo((data) => {
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -2641,6 +2641,9 @@ export default class MapConroler extends cc.Component {
|
||||||
})
|
})
|
||||||
|
|
||||||
cc.fx.GameConfig.GM_INFO.freezeAmount -= 1;
|
cc.fx.GameConfig.GM_INFO.freezeAmount -= 1;
|
||||||
|
// 倒计时加20秒
|
||||||
|
this.timeNumber += 20;
|
||||||
|
NumberToImage.getTimeMargin(this.timeNumber, 50, "time_", this.timeLabel)
|
||||||
if (cc.fx.GameConfig.GM_INFO.freezeAmount < 0)
|
if (cc.fx.GameConfig.GM_INFO.freezeAmount < 0)
|
||||||
cc.fx.GameConfig.GM_INFO.freezeAmount = 0;
|
cc.fx.GameConfig.GM_INFO.freezeAmount = 0;
|
||||||
this.setPropNum();
|
this.setPropNum();
|
||||||
|
|
@ -3475,11 +3478,30 @@ export default class MapConroler extends cc.Component {
|
||||||
this.node.scale = 1;
|
this.node.scale = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.node.scale = 1;
|
const gmScale = cc.fx.GameTool.adaptation()
|
||||||
|
this.node.scale = this.node.scale * gmScale;
|
||||||
cc.fx.GameConfig.GM_INFO.scale = this.node.scale;
|
cc.fx.GameConfig.GM_INFO.scale = this.node.scale;
|
||||||
// this.node.scale = 0.5;
|
|
||||||
// console.log(this.node.scale);
|
const topNode = this.node.parent.getChildByName("Top");
|
||||||
// this.node.scale = 1;
|
// topNode.scale = gmScale;
|
||||||
|
if (topNode) {
|
||||||
|
if (gmScale == 0.7) {
|
||||||
|
// 修改Widget的top属性
|
||||||
|
const widget = topNode.getComponent(cc.Widget);
|
||||||
|
if (widget) {
|
||||||
|
widget.top -= 80; // 减去偏移量使节点向上移动
|
||||||
|
widget.updateAlignment(); // 强制更新对齐
|
||||||
|
}
|
||||||
|
this.node.y = this.node.y + 40;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.node.parent.parent.getChildByName("Win").scale = gmScale;
|
||||||
|
this.node.parent.parent.getChildByName("Lose").scale = gmScale;
|
||||||
|
this.node.parent.parent.getChildByName("propWindow").scale = gmScale;
|
||||||
|
this.node.parent.parent.getChildByName("guidet").scale = gmScale;
|
||||||
|
this.node.parent.parent.parent.getChildByName("Pause").scale = gmScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建门的粒子特效
|
//创建门的粒子特效
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user