Commit 92d9ce0a authored by 范雪寒's avatar 范雪寒

feat: 分辨率适配

parent 529bfd11
......@@ -3762,10 +3762,10 @@
"node": {
"__id__": 7
},
"_enabled": true,
"_enabled": false,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_alignFlags": 18,
"_left": 0,
"_right": 0,
"_top": 0,
......@@ -3778,8 +3778,8 @@
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_originalWidth": 1280,
"_originalHeight": 720,
"_id": "1bqJ4tHIpFjZymhKtOdYgN"
},
{
......
......@@ -80,6 +80,7 @@ cc.Class({
start() {
initAir(this);
this.reWriteAir();
this.updateScale();
window.courseware.getEngineInfo((dataStr) => {
const engineInfo = JSON.parse(dataStr);
......@@ -397,6 +398,7 @@ cc.Class({
console.log("sceneName = " + conf.sceneName);
const canvas = cc.find("Canvas");
const middleLayer = cc.find("middleLayer");
middleLayer.getComponent("middleLayer").updateWidgets();
this.hideWaitingLetters();
callback && callback();
});
......@@ -405,6 +407,23 @@ cc.Class({
);
},
updateWidgets() {
this.updateScale();
this.node.getComponentsInChildren(cc.Widget).forEach((widget) => {
widget.updateAlignment();
});
},
updateScale() {
const canvas = cc.find("Canvas");
const size = cc.view.getCanvasSize();
this.node.width = size.width;
this.node.height = size.height;
this.node.scale = canvas.width / size.width;
this.node.getComponent(cc.Widget).updateAlignment();
},
loadBundleByConf(conf, callback) {
if (cc.sys.isNative && cc.sys.os == cc.sys.OS_IOS) {
this.loadBundle(conf.ios, callback);
......
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