Code Monkey home page Code Monkey logo

egret-game-library's Issues

socket.io无法获取到query

io("http://localhost:4000",{query:{'authorization': a }});

我用socket.io官网下载的js,socket.handshake.query.authorization是有值的;

但是我用socket.io.ts,socket.handshake.query里没有authorization,但是socket.request._query里有authorization

白鹭引擎使用jszip库在浏览器下会报错

throw new Error(b ? "Can't find end of central directory : is this a zip file ? If it is, see http://stuk.github.io/jszip.json ... howto/read_zip.html" : "Corrupted zip : can't find end of central directory");

用白鹭内置的调试器可以运行成功。但是在使用浏览器的情况下就会报错。我咨询过白鹭的技术人员。那边给出来的是jszip库内部的问题。

白鹭论坛帖子地址:http://bbs.egret.com/thread-30764-1-1.html

TiledMap如何在渲染区域滚动

刚使用上TileMap库,没有找到移动地图的API,
我按照例子已经初始化出来地图并显示了

            var data: any = egret.XML.parse(e.currentTarget.response);

            this._tileMap = new tiled.TMXTilemap(400, 600, data, this._url);

            this._tileMap.render();
            this.addChild(this._tileMap);

设定的渲染区域为400x600。我没有找到移动地图的方法,请问如果要移动地图该使用什么方法,在哪个类下呢?(移动x,y,会把渲染区域也跟着移动)

读了下Tiled.js,没有找到offset的方法,draw方法都是x0, y0开始画的

PS: 如果把render width & render height设成图片的大小,那么渲染区域都变很大了,需求只想在比如 200 x 200的区域渲染

tile图块截取时,间距和边距的应用有明显错误,导致地图拼接时无法吻合

tile.js 第2833行
if (this.images.length > 1) {
_spritesheet = spritesheets[tile.gid - this.firstgid];
var rect = new egret.Rectangle(0 * (this.tilewidth + this._spacing) + this._spacing, 0 * (this.tileheight + this._margin) + this._margin, this.tilewidth, this.tileheight);
}
else {
_spritesheet = spritesheets[0];
var rect = new egret.Rectangle((id % this.horizontalTileCount) * (this.tilewidth + this._spacing) + this._spacing, (Math.floor(id / this.horizontalTileCount)) * (this.tileheight + this._margin) + this._margin, this.tilewidth, this.tileheight);
}
可以看到你算rect的x位置时,代码用的是编号x间距+间距,y位置时则是编号x边距+边距
但实际上无论x还是y,都应该是编号x间距+边距(间距是两个图块直接的距离,边距是所有图块和纹理集边缘的距离),否则除非边距和间距相等,否则排版一定出现问题(结果是拼接出的地图到处都是黑线,无法互相贴合)
应该改成
if (this.images.length > 1) {
_spritesheet = spritesheets[tile.gid - this.firstgid];
var rect = new egret.Rectangle(0 * (this.tilewidth + this._spacing) + this._margin, 0 * (this.tileheight + this._spacing) + this._margin, this.tilewidth, this.tileheight);
}
else {
_spritesheet = spritesheets[0];
var rect = new egret.Rectangle((id % this.horizontalTileCount) * (this.tilewidth + this._spacing) + this._margin, (Math.floor(id / this.horizontalTileCount)) * (this.tileheight + this._spacing) + this._margin, this.tilewidth, this.tileheight);
}

引擎最新5.1.5,粒子库使用报错了

Uncaught TypeError: this.$invalidateContentBounds is not a function at (c:\Users******\Documents\EgretProjects\egretnoeui\libs\modules\particle\particle.js:267:18)

这里是报错信息,粒子库看了github是5.0.14 是需要版本配对使用吗,暂时没有找到最新粒子库

导入libsrc包后 build 出错

libs/modules/tiled/tiled.d.ts(18,18): error TS1005: 应为“=”。这个错误是怎么回事? typescript版本不对吗?

粒子系统在5.2.10版本Android端无法停止

官方demo中加入如下代码

        this.btn3 = new egret.TextField();
        this.btn3.text = "停止";
        this.addChild(this.btn3);

        this.btn3.x = 180;
        this.btn3.y = 100;
        this.btn3.width = 100;
        this.btn3.height = 50;
        this.btn3.touchEnabled = true;
        this.btn3.addEventListener(egret.TouchEvent.TOUCH_TAP, function () {
            this.system.stop()
            egret.log('need stop')
        }, this);

在网页端可以正常运行,在Android项目中无法停止。
在5.1.x版本可正常运行。

TMXImageLayer的构造函数存在bug

以下两句会将_opacity和visible的默认值设置错误, 分别为NaN, false
this._opacity = (typeof +data.attributes.opacity !== "undefined") ? +data.attributes.opacity : 1;
this.visible = (typeof +data.attributes.visible !== "undefined") ? Boolean(+data.attributes.visible) : true;
应改为和TMXLayer一样
this._opacity = (typeof data.attributes.opacity !== "undefined") ? parseFloat(data.attributes.opacity) : 1;
this.visible = (typeof data.attributes.visible !== "undefined") ? Boolean(+data.attributes.visible) : true;

引擎问题.TextFeild 不支持 '\n' 自动换行.

从源码从 看到 TextField 的multiline属性只支持 TextFieldType.INPUT.
但是非 输入模式, 单步跟踪 也没有发现 处理 \n 换行符的处理.
而是使用了 textField 的 width 来强制断行.
不知道是我使用的不对, 还是引擎设计的时候 就是如此?
望大佬指教!谢谢

tileset spacing、margin属性不能有值,会报错

地图片段

<tileset firstgid="3" name="bigMap" tilewidth="188" tileheight="100" tilecount="30" columns="5" spacing="2">
  <image source="bigMap.png" trans="f9fdff" width="948" height="610"/>
 </tileset>

会报如下错误

tiled.js:2847 Uncaught Error: no matching tileset found for gid 29

粒子系统的getValue函数问题

GravityParticleSystem里的getValue函数用于取得base-var之间的随机值。
但是为什么是取正负var值? 是什么意图?
正确的应该是在base上叠加0至var之间的随机值吧?
否则如果lifespan = 1000, lifespanVar = 2000,那么粒子的生命最终值会是1000至-1000之间浮动。
小于0生命的粒子还有意义吗?生产了立即就被删除了。
这个是BUG还是你们本意就是这样?

tiled.js 升级到 3.0.3后使用图像图层报错

Uncaught TypeError: Cannot set property 'texture' of undefined

       /**
         * 加载图片
         * @param $url 图片地址
         * @version Egret 3.0.3
         */
        p.loadImage = function (url) {
            if (url == null || url == "")
                return;
            RES.getResByUrl(url, function (texture) {
                if (texture) {
                    // 此行报错
                    this._sourcebitmap.texture = texture;
                    this._texture = texture;
                    this.dispatchEvent(new tiled.TMXImageLoadEvent(tiled.TMXImageLoadEvent.IMAGE_COMPLETE, texture));
                }
            }, this, RES.ResourceItem.TYPE_IMAGE);
        };

使用脏区域时不渲染

在使用脏区域时,粒子不被渲染,因为要查脏区域的代码太复杂所以没有查具体问题所在,但是可以肯定的是只要开了脏区域,不管当前粒子发射位置在不在渲染区域内,都不会被显示。

添加监听后不能取消

`kb.once(KeyBoard,onkeydown, (e)=>{}, this);

超过等待响应后不能取消监听

kb.removeEventListener(KeyBoard.onkeydown,(e)=>{},this)

无效用
`

运行 tiled demo 出错

egret wing版本.3.0.5

[log] VillageExample
(anonymous function) at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\index.html:130:17)
[log] Uncaught TypeError: Cannot set property 'texture' of undefined
(anonymous function) at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\tiled\tiled.js:800:48)
p.onResourceItemComp at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\res\res.js:3171:31)
p.onItemComplete at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\res\res.js:720:31)
p.onLoadFinish at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\res\res.js:1323:22)
p.$notifyListener at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\egret\egret.js:550:35)
p.dispatchEvent at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\egret\egret.js:529:25)
p.dispatchEventWith at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\egret\egret.js:588:35)
(anonymous function) at (c:\Users\User\Desktop\egret-game-library-master\tiled\demo\libs\modules\egret\egret.web.js:2056:26)

/**
* 加载图片
* @param $url 图片地址
* @Version Egret 3.0.3
*/
p.loadImage = function (url) {
if (url == null || url == "")
return;
RES.getResByUrl(url, function (texture) {
if (texture) {
this._sourcebitmap.texture = texture;
this._texture = texture;
this.dispatchEvent(new tiled.TMXImageLoadEvent(tiled.TMXImageLoadEvent.IMAGE_COMPLETE, texture));
}
}, this, RES.ResourceItem.TYPE_IMAGE);
};

/**
* 加载图片
* @param $url 图片地址
* @Version Egret 3.0.3
*/
p.loadImage = function (url) {
if (url == null || url == "")
return;
RES.getResByUrl(url, function (texture) {
if (texture) {
this._sourcebitmap.texture = texture;
this._texture = texture;
this.dispatchEvent(new tiled.TMXImageLoadEvent(tiled.TMXImageLoadEvent.IMAGE_COMPLETE, texture));
}
}, this, RES.ResourceItem.TYPE_IMAGE);
};

2

3

tiled : TMXHexagonalRenderer 根据px获取网格坐标的方法计算错误

TMXHexagonalRenderer 对象属性如下:

_hexsidelength:0
_rowheight:25
_sidelengthx:0
_sidelengthy:0
_sideoffsetx:47
_sideoffsety:25
_staggeraxis:"y"
_staggerindex:"odd"
animationTiles:Array[0]
cols:92
rows:45
tileheight:50
tilewidth:94

在调用TMXHexagonalRenderer.pixelToTileCoords()方法返回的结果和实际tiled 地图中的坐标有偏差

能否提供地图瓦片异步加载的方式?

问题描述:tiled.js中加载地图的方式(如下图)为地图tmx文件中所有地图瓦片资源加载完毕后,才进行render,这种逻辑在交互上就会出现,一开始地图为空,过了一段时间(资源加载完毕后)地图跳出。交互有些不够友好。
期望目标:地图分块加载,一块瓦片地图资源加载完毕后渲染到地图上。
egret开发者论坛上问题链接

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.