Code Monkey home page Code Monkey logo

adapters's People

Contributors

bofeng-song avatar caryliu1999 avatar cocos-robot avatar finscn avatar holycanvas avatar jareguo avatar knoxhuang avatar linyunmo avatar pppro avatar xianyinchen avatar yyycggg avatar zhefengzhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

adapters's Issues

适配微信 iPad 屏幕方向

大城小胖在微信那边确认 iPad 设备上返回的 screenHeight screenWidth 应该跟屏幕方向无关,
微信底层应该在 安卓和 iOS 上做了一些特殊处理,使上层接口对齐到屏幕方向上的宽高,实际上底层查到的原始数据应该就是竖屏的数据

在 iPad 上就没有这个特殊处理,所以 iPad 上 screenHeight screenWidth 应该跟屏幕方向无关

关于解决 安卓手机 文本帖图丢失的 方法.

经过和 微信团队沟通, 最新解决方案是:


cc.game.on(cc.game.EVENT_HIDE, function () {
    const gl = cc.game._renderContext;
    if (gl && gl.finish) {
        gl.finish();
    }
    if (gl && gl.submit) {
        gl.submit();
    }
});

cc.game.on(cc.game.EVENT_SHOW, function () {
    const gl = cc.game._renderContext;
    if (gl && gl.finish) {
        gl.finish();
    }
    if (gl && gl.submit) {
        gl.submit();
    }
});

这个 submit 是微信专有的. 加上这个就好了. (finish那个也要有)
建议整合到 adapter里.

XMLHttpRequest#getResponseHeader should be case insensitive

The search for the header name is case-insensitive.

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getResponseHeader

当前的实现没有忽略大小写:

return _responseHeader.get(this)[header]

这意味着如果 server 返回的是 Content-Type: application/json,而代码中使用 xhr.getResponseHeader('content-type') 拿到的会是 undefined。比如我们用的 superagent 就是这么用的: https://github.com/visionmedia/superagent/blob/aa43b3d27594d231afee9009ae740ce1b44a6f62/src/client.js#L351

请考虑在实现 getResponseHeader 时忽略 key 的大小写。感谢支持。

关于cocos 在小游戏平台获取 窗口尺寸 和 safeArea 有时不准确的问题.

现象:

同一台手机 同样的微信, 同一个小游戏的同一个版本, 每次打开 有一定概率无法获得准确的 窗口尺寸或 safeArea.
经过和微信同学的交流. 目前大家比较一致的看法是 安卓系统正确获取 safeArea 的时机 无法做到百分百一致.
有时候要延迟一会儿去获取 才准确.

但是 cocos的 adapter 里 总是会在 初始化时 立刻获取 systemInfo, 并且 缓存起来 .
后面 每次过去safeArea 总是用这个缓存起来的值.

如果第一次获取 systemInfo 时, 里面的 safeArea是错误的, 那么后面就一直错误了.

要解决这个问题, 有两个方案, 就是 cc的 getSafeArea 方法里 每次都去通过 wx.getSystemInfoSync 去获得最新的数据.
但是缺点是 可能会破坏一丝丝性能.

还有个思路是, 引擎稳定运行一段时间之后 (比如5秒钟) , 就不再"每次都去通过 wx.getSystemInfoSync 去获得最新的数据"了.
也就是说加个计时.

不管怎么说现在的做法都不太稳定.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.