给一个图片的runtime设置 “game/ImageRunTime.ts”
如果这个图片没有取名,就是var属性为空, 运行起来是OK的,runtime也生效了, 如果 给它取名了, 比如:
就成这样了~
用2.0的beta 3版本的, 之前 想自定义组件,发现不行,小明给我说那个编译库不兼容。暂时不能自定义,让我用runtime, runtime也够折腾的, 也没搞成, 我现在不知道是我的问题,还是程序 的问题?
我试着把runtime脚本中的类单独导出, 或者写在模块里导出, 各种办法都试了,就是不行?
能不能麻烦老大在这个版本测试一下, 如果能搞成给我个demo行吗, 折腾好久了
4 个回复
三五七
赞同来自:
三五七
赞同来自:
这两种形式都试了效果是一样的!
Aar0n
赞同来自:
import View=Laya.View;
import Dialog=Laya.Dialog;
import Scene=Laya.Scene;
export module ui {
export class BGPageUI extends View {
constructor(){ super()}
createChildren():void {
super.createChildren();
this.loadScene("BGPage");
}
}
export class MonkeyPageUI extends View {
constructor(){ super()}
createChildren():void {
super.createChildren();
this.loadScene("MonkeyPage");
}
}
}
===============================
/*GameConfig.ts *This class is automatically generated by LayaAirIDE, please do not make any modifications. */
import ImageRunTime from "./game/ImageRunTime"
/*
* 游戏初始化配置;
*/
export default class GameConfig{
static width:number=640;
static height:number=1136;
static scaleMode:string="fixedwidth";
static screenMode:string="none";
static alignV:string="top";
static alignH:string="left";
static startScene:any="mainscene.scene";
static sceneRoot:string="";
static debug:boolean=false;
static stat:boolean=false;
static physicsDebug:boolean=false;
static exportSceneToJson:boolean=false;
constructor(){}
static init(){
var reg: Function = Laya.ClassUtils.regClass;
reg("game/ImageRunTime.ts",ImageRunTime);
}
}
GameConfig.init();
Aar0n
赞同来自: