[]3d特效克隆时,在手机会现卡顿情况,特效资源已经提前在加载
特效资源已经提前在加载,但克隆出现卡顿(手机浏览器),代码如下 求解
/**
* 是否需要分组。
* 分组资源在地图变化时自动销毁
* **/
public function Load(url:String,isGroup:Boolean):void {
_path = UrlConfig.EFFECT_PATH_3D+url;
var itemComplete:Sprite3D = Laya.loader.getRes(_path);
if(itemComplete == null || itemComplete.loaded == false){
var groupName:String = null;
if(isGroup == true){
groupName = url;
}
Laya.loader.create(_path, Handler.create(this,OnComplete,null),null,null,null,1,true,groupName);
}else{
var item:Sprite3D = Pool.getItem(_path);
if(item != null){
//直接用缓存的
Instantiate(item);
}else{
OnComplete();
}
}
}
public function DelayDestroy(delay:int):void {
this.timerOnce(delay,this,destroy);
}
public function OnComplete():void {
var item:Sprite3D = Laya.loader.getRes(_path) as Sprite3D;
if(item != null){
item = item.getChildAt(0).clone();
Instantiate(item);
}
}
private function Instantiate(item:Sprite3D):void {
effect3D = item;
//effect3D.active = true;
this.addChild(effect3D);
//console.hylog("_path:",_path);
SetUVEffect(effect3D);
}
/**
* 是否需要分组。
* 分组资源在地图变化时自动销毁
* **/
public function Load(url:String,isGroup:Boolean):void {
_path = UrlConfig.EFFECT_PATH_3D+url;
var itemComplete:Sprite3D = Laya.loader.getRes(_path);
if(itemComplete == null || itemComplete.loaded == false){
var groupName:String = null;
if(isGroup == true){
groupName = url;
}
Laya.loader.create(_path, Handler.create(this,OnComplete,null),null,null,null,1,true,groupName);
}else{
var item:Sprite3D = Pool.getItem(_path);
if(item != null){
//直接用缓存的
Instantiate(item);
}else{
OnComplete();
}
}
}
public function DelayDestroy(delay:int):void {
this.timerOnce(delay,this,destroy);
}
public function OnComplete():void {
var item:Sprite3D = Laya.loader.getRes(_path) as Sprite3D;
if(item != null){
item = item.getChildAt(0).clone();
Instantiate(item);
}
}
private function Instantiate(item:Sprite3D):void {
effect3D = item;
//effect3D.active = true;
this.addChild(effect3D);
//console.hylog("_path:",_path);
SetUVEffect(effect3D);
}
没有找到相关结果
已邀请:
要回复问题请先登录
2 个回复
Aar0n
赞同来自:
诗韵生swinsun
赞同来自: