Micro-channel Laya game, open field project

 

 

Release micro-letter game project

When you create a project, check the micro-channel / bin directory Baidu games quick commissioning

 

 

When publish projects selected micro-channel publishing platform for small game

 

Open the release / wxgame micro letter Developer Tools, this is the micro-channel game project, and very convenient

 

 

to sum up:

Egret release micro-letter games and Laya release micro-letter game almost

 

 4M package with dynamic resource restrictions

Because 4m bag limit, it is generally small game project is divided into the main package + remote resources.

Now I create a remote directory, the directory resource is not released to the next micro-channel games directory, but the server remotely loaded.

 

 

When released, the hook line is extracted local package

 

 

Remote Resource Directory remote does not need to check

 

 

Which was released out of the project has two folders, which wxgame conventional project, wxgame_pack project without remote folder

 

I can not really see wxgame_pack contain remote folder

 

 So when we submit micro letter, only you need to submit the main package wxgame_pack on the line. The remote server resources into dynamically loaded.

 

We usually use remote picture is this. Load remote.atlas Atlas, and display the test1.jpg

Laya.loader.load("res/atlas/remote.atlas", Laya.Handler.create(this, ()=>{
     let sp:Laya.Sprite = new Laya.Sprite();
     sp.texture = Laya.loader.getRes("remote/test1.jpg");
     this.addChild(sp);
}));

  

Now resources on a remote server. Load address becomes http: //xxxxx/res/atlas/remote.atlas, the address is determined according to your actual server address.

Laya.loader.load("http://127.0.0.1:8011/wxgame/res/atlas/remote.atlas", Laya.Handler.create(this, ()=>{
    let sp:Laya.Sprite = new Laya.Sprite();
    sp.texture = Laya.loader.getRes("remote/test1.jpg");
    this.addChild(sp);
}));

  

Laya forum there is a solution. It is to set Url.basePath. Each such load path automatically add basePath. While MiniAdpter.nativefiles whitelist resources will only be loaded from a local.

But the real test did not use eggs. The white list and will not take effect. View source bin / libs / laya.core.js, ctrl + F search to find the class loader loads the class, and found no place to use the nativefiles the white list.

Laya.URL.basePath = "http://127.0.0.1:8011/wxgame/";

Laya["MiniAdpter"].nativefiles = [
      "wxlocal",
      "res/atlas/comp.atlas"
]

 

to sum up:

Egret publish local and remote resources, divided into two resource files, local and remote default.res.json remote.res.json, local resources are not prefixed, remote resources will add http://xxxxx.com/ prefix. In this way we can solve this problem of local and remote packet problem.

Laya publish local and remote resources, it did not find any good way to temporarily.

 

Guess you like

Origin www.cnblogs.com/gamedaybyday/p/11512155.html