• 【cocos2d-js官方文档】二十一、v3相对于v2版本的api变动


    CCAudio.js

    SimpleAudioEngine.js改名为CCAudio.js

    AudioEngine中删除了以下几个方法:

    1.  
      preloadMusic
    2.  
      preloadEffect
    3.  
      isFormatSupported
    4.  
      preloadSound

    cc.AudioEngine.end被移到了实例中,而不是作为类的静态方法。

    cc.textureCache

    删除了以下的几个api:

    1.  
      cc.loadImg
    2.  
      cc.loadImage.handler
    3.  
      cc.computeImageFormatType

    addImageAsync方法被合并到了addImage中去了。

    CCTGAlib.js

    移除了cc.tgaLoad

    cc.Texture2D

    改动:

    1.  
      cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888 --> cc.Texture2D.PIXEL_FORMAT_RGBA8888
    2.  
      cc.TEXTURE_2D_PIXEL_FORMAT_RGB888 --> cc.Texture2D.PIXEL_FORMAT_RGB888
    3.  
      cc.TEXTURE_2D_PIXEL_FORMAT_RGB565 --> cc.Texture2D.PIXEL_FORMAT_RGB565
    4.  
      cc.TEXTURE_2D_PIXEL_FORMAT_A8 --> cc.Texture2D.PIXEL_FORMAT_A8
    5.  
      cc.TEXTURE_2D_PIXEL_FORMAT_I8 --> cc.Texture2D.PIXEL_FORMAT_I8
    6.  
      cc.TEXTURE_2D_PIXEL_FORMAT_AI88 --> cc.Texture2D.PIXEL_FORMAT_AI88
    7.  
      cc.TEXTURE_2D_PIXEL_FORMAT_RGBA4444 --> cc.Texture2D.PIXEL_FORMAT_RGBA4444
    8.  
      cc.TEXTURE_2D_PIXEL_FORMAT_RGB5A1 --> cc.Texture2D.PIXEL_FORMAT_RGB5A1
    9.  
      cc.TEXTURE_2D_PIXEL_FORMAT_PVRTC4 --> cc.Texture2D.PIXEL_FORMAT_PVRTC4
    10.  
      cc.TEXTURE_2D_PIXEL_FORMAT_PVRTC2 --> cc.Texture2D.PIXEL_FORMAT_PVRTC2
    11.  
      cc.TEXTURE_2D_PIXEL_FORMAT_DEFAULT --> cc.Texture2D.PIXEL_FORMAT_DEFAULT
    12.  
      cc.Texture2D.setDefaultAlphaPixelFormat(format) --> cc.Texture2D.defaultPixelFormat = format
    13.  
      cc.Texture2D.getDefaultAlphaPixelFormat() --> cc.Texture2D.defaultPixelFormat
    14.  
      cc.Texture2D.defaultAlphaPixelFormat() --> cc.Texture2D.defaultPixelFormat

    cc.Scheduler

    cc.PRIORITY_SYSTEM改为cc.Scheduler.PRIORITY_SYSTEM

    数组操作函数

    这些函数有些将名字开头改为小写,有些废弃了直接用Array的函数进行操作。

    1.  
      cc.ArrayVerifyType --> cc.arrayVerifyType
    2.  
      cc.ArrayRemoveObject --> cc.arrayRemoveObject
    3.  
      cc.ArrayRemoveArray ---> cc.arrayRemoveArray
    4.  
      cc.ArrayAppendObjectsToIndex --> cc.arrayAppendObjectsToIndex
    5.  
       
    6.  
      cc.ArrayRemoveObjectAtIndex(arr, index) --> arr.splice(index, 1)
    7.  
      cc.ArrayGetIndexOfValue(arr, value) --> arr.indexOf(value)
    8.  
      cc.ArrayAppendObject(arr, addObj) --> arr.push(addObj)
    9.  
      cc.ArrayAppendObjectToIndex(arr, addObj, index) --> arr.splice(index, 0, addObj)
    10.  
      cc.ArrayGetIndexOfObject(arr, findObj) --> arr.indexOf(findObj)
    11.  
      cc.ArrayContainsObject(arr, findObj) --> arr.indexOf(findObj) != -1
    12.  
       
    13.  
      remove cc.HASH_FIND_INT

    共有方法或对象变成私有方法或对象:

    1.  
      cc.setup --> cc._setup
    2.  
      cc.initDebugSetting --> cc._initDebugSetting
    3.  
      cc.canvas --> cc._canvas
    4.  
      cc.drawingUtil --> cc._drawingUtil
    5.  
      cc.renderContext --> cc._renderContext
    6.  
      cc.gameDiv --> cc._gameDiv
    7.  
      cc.setContextMenuEnable --> cc._setContextMenuEnable
    8.  
      cc.renderContextType --> cc._renderType
    9.  
      cc.CANVAS --> cc._RENDER_TYPE_CANVAS
    10.  
      cc.WEBGL --> cc._RENDER_TYPE_CANVAS
    11.  
      cc.mainRenderContextBackup --> cc._mainRenderContextBackup
    12.  
      cc.RectFromString --> cc.spriteFrameCache._rectFromString
    13.  
      cc.PointFromString --> cc.spriteFrameCache._pointFromString
    14.  
      cc.SizeFromString --> cc.spriteFrameCache._sizeFromString

    常量

    删除:

    1.  
      cc.IS_SHOW_DEBUG_ON_PAGE
    2.  
      cc.COCOS2D_DEBUG

    其他

    修改

    1.  
      cc.dumpConfig ---> cc.sys.dump
    2.  
       

    删除:

    1.  
      cc.isAddedHiddenEvent
    2.  
      cc.originalCanvasSize

    新增:

    cc.BuilderReader.registerController
    
    

    转载自:https://blog.csdn.net/qinning199/article/details/42009801

  • 相关阅读:
    hdu 5352 匈牙利(多重匹配)
    hdu 2112 最短路+stl
    hdu 1811 拓扑排序+并查集+细心
    hdu5407 CRB and Candies
    hdu1018 Big Number
    hdu5410 CRB and His Birthday
    hdu1023 Train Problem II
    hdu4812 D Tree
    hdu1085 Holding Bin-Laden Captive!
    hdu4810 Wall Painting
  • 原文地址:https://www.cnblogs.com/wodehao0808/p/11929642.html
Copyright © 2020-2023  润新知