Adapter.ts 556 B

12345678910111213141516171819202122
  1. const {ccclass, property} = cc._decorator;
  2. /**
  3. * 适配器
  4. */
  5. @ccclass
  6. export default class Adapter extends cc.Component {
  7. onLoad(){
  8. let widget = this.node.getComponent(cc.Widget);
  9. if(widget){
  10. widget.target = cc.Canvas.instance.node;
  11. // if(widget.isAlignTop){
  12. // let winsize = cc.winSize;
  13. // let dt = winsize.height / winsize.width;
  14. // if(dt >= 2.16){//刘海屏
  15. // widget.top += 50;
  16. // }
  17. // }
  18. }
  19. }
  20. }