zoukankan      html  css  js  c++  java
  • egret升级经验记录

    1、StageDelegate.setDesignSize ;

    直接去掉,在3.x里是直接在index.html里设置如:

    data-content-width="960"
    data-content-height="640"

    2、_getFrameLabelForFrame

    用frameLabels[i],注意判断i的范围

    3、Cannot invoke an expression whose type lacks a call signature

    不是函数,错把数组当函数用了

    4、锚点问题

    用sublime text的正则替换,并使用AnchorUtil

    先替换后再把文件放入

    a、先替换 anchorX = anchorY的

    ([w.]+).anchorX.*anchorY.*=s([w.()]+)
    AnchorUtil.setAnchor($1,$2)
     
    b、再替换单独的 anchorX  anchorY
    ([w.]+).anchorX.*=s([d.]+)
    AnchorUtil.setAnchorX($1,$2)
     
    ([w.]+).anchorY.*=s([d.]+)
    AnchorUtil.setAnchorY($1,$2)
     
    ([w.]+).anchor([XY]).*=s([w.()]+)
    AnchorUtil.setAnchor$2($1,$3)
     
    c、创建游戏场景前调用AnchorUtil.init();
     
    5、声音问题
    之前是sound.play()
    但是2.5以后改成了
    play(startTime?: number, loops?: number): SoundChannel;
    要修改play()的参数。play返回SoundChannel,用SoundChannel修改音量和停止播放

    var sound_bg: egret.Sound =RES.getRes(name);
    sound_bg.type = egret.Sound.MUSIC;

    var loop_cnt = loop ? 0 : 1;
    sound_ch= sound_bg.play(0,loop_cnt);

    sound_ch.volume = value;
    sound_ch.stop();
  • 相关阅读:
    jQuery的选择器
    01-jQuery的介绍
    client、offset、scroll系列
    BOM
    定时器
    js中的面向对象
    javascript小练手
    DOM介绍
    关于DOM的事件操作
    伪数组 arguments
  • 原文地址:https://www.cnblogs.com/xdao/p/egret_upgrade.html
Copyright © 2011-2022 走看看