mirror of
https://github.com/zhitaocai/CocosCreator-Multi-resolution-Adapter.git
synced 2026-06-04 01:30:14 +08:00
加入内容适配方面内容
This commit is contained in:
@@ -47,8 +47,8 @@ export default class ContentAdapter extends cc.Component {
|
||||
this.node.width = this.node.width * (cc.view.getCanvasSize().width / realWidth);
|
||||
this.node.height = this.node.height * (cc.view.getCanvasSize().height / realHeight);
|
||||
|
||||
// 3. 因为本节点的宽高发生了改变,所以要手动更新剩下子节点的宽高
|
||||
this._updateAllChildNodeWidget(this.node);
|
||||
// // 3. 因为本节点的宽高发生了改变,所以要手动更新剩下子节点的宽高
|
||||
// this._updateAllChildNodeWidget(this.node);
|
||||
|
||||
// if (CC_DEBUG) {
|
||||
// cc.log(`节点在SHOW_ALL模式下展示的宽高: ${realWidth} x ${realHeight}`);
|
||||
@@ -61,19 +61,19 @@ export default class ContentAdapter extends cc.Component {
|
||||
// }
|
||||
}
|
||||
|
||||
private _updateAllChildNodeWidget(parentNode: cc.Node) {
|
||||
if (parentNode == null) {
|
||||
return;
|
||||
}
|
||||
let widget = parentNode.getComponent(cc.Widget);
|
||||
if (widget != null) {
|
||||
widget.updateAlignment();
|
||||
}
|
||||
if (parentNode.childrenCount == 0) {
|
||||
return;
|
||||
}
|
||||
parentNode.children.forEach((childNode: cc.Node) => {
|
||||
this._updateAllChildNodeWidget(childNode);
|
||||
});
|
||||
}
|
||||
// private _updateAllChildNodeWidget(parentNode: cc.Node) {
|
||||
// if (parentNode == null) {
|
||||
// return;
|
||||
// }
|
||||
// let widget = parentNode.getComponent(cc.Widget);
|
||||
// if (widget != null) {
|
||||
// widget.updateAlignment();
|
||||
// }
|
||||
// if (parentNode.childrenCount == 0) {
|
||||
// return;
|
||||
// }
|
||||
// parentNode.children.forEach((childNode: cc.Node) => {
|
||||
// this._updateAllChildNodeWidget(childNode);
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
/**
|
||||
* 未完成
|
||||
*/
|
||||
@ccclass
|
||||
export default class MultiResolutionCompat extends cc.Component {
|
||||
static DEFAULT_RESOLUTION_WIDTH = 720;
|
||||
|
||||
Reference in New Issue
Block a user