1475 lines
25 KiB
TypeScript
1475 lines
25 KiB
TypeScript
/**
|
|
* NX框架接口提示
|
|
*/
|
|
namespace nx {
|
|
/***
|
|
* 调试日志
|
|
*/
|
|
export function debug( key: String, ...args: any ): void;
|
|
|
|
/***
|
|
* 普通日志
|
|
*/
|
|
export function info( key: String, ...args: any ): void;
|
|
|
|
/***
|
|
* 警告日志
|
|
*/
|
|
export function warn( key: String, ...args: any ): void;
|
|
|
|
/***
|
|
* 错误日志
|
|
*/
|
|
export function error( key: String, ...args: any ): void;
|
|
|
|
/***
|
|
* 新建警告框
|
|
*/
|
|
export function alert( __text: String, _key: String, _cb: Function ): void;
|
|
|
|
/***
|
|
* 新建消息框
|
|
*/
|
|
export function mbox(
|
|
_text: String,
|
|
_keys: Array,
|
|
_cb: Function,
|
|
_tag: String
|
|
): void;
|
|
|
|
/***
|
|
* 新建轻态提示框
|
|
*/
|
|
export function tbox( _text: String, _tag: String ): void;
|
|
|
|
/***
|
|
* 生成一个错误
|
|
*/
|
|
export function genError( _code: Number, _desc: String, _log: Boolean ): void;
|
|
|
|
/***
|
|
* 文本化错误
|
|
*/
|
|
export function fmtError( _error: Object ): String;
|
|
|
|
/***
|
|
* 错误轻态提示
|
|
*/
|
|
export function tipError( _error: Object ): void;
|
|
|
|
/***
|
|
* 错误弹窗提示
|
|
*/
|
|
export function boxError( _error: Object ): void;
|
|
|
|
/***
|
|
* 全局等待开启
|
|
*/
|
|
export function showWait( _from: String, _tip: String, _args: Object ): void;
|
|
|
|
/***
|
|
* 全局等待关闭
|
|
*/
|
|
export function closeWait( _from: String ): void;
|
|
|
|
/***
|
|
* 全局等待提示更新
|
|
*/
|
|
export function updWait( _from: String, _tip: String ): void;
|
|
|
|
/**
|
|
* 预加载窗口
|
|
*/
|
|
export function preloadWindow( _wid: String, _cb: Function ): void;
|
|
|
|
/**
|
|
* 新建窗口
|
|
*/
|
|
export function createWindow( _wid: String, _cb: Function, _args: any ): void;
|
|
|
|
/**
|
|
* 查找窗口
|
|
*/
|
|
export function findWindow( _wid: String, _cmpname: String ): Object;
|
|
|
|
/**
|
|
* 关闭窗口
|
|
*/
|
|
export function closeWindow( _wid: String ): void;
|
|
|
|
/**
|
|
* 关闭全部窗口
|
|
*/
|
|
export function closeWindowAll(): void;
|
|
|
|
/**
|
|
* 预加载场景
|
|
*/
|
|
export function preloadScene( _sceneId: String, _cb: Function ): void;
|
|
|
|
/**
|
|
* 新建场景
|
|
*/
|
|
export function createScene(
|
|
_sceneId: String,
|
|
_cb: Function,
|
|
_args: any
|
|
): void;
|
|
|
|
/**
|
|
* 查找场景
|
|
*/
|
|
export function getScene(): Object;
|
|
|
|
/**
|
|
* 关闭场景
|
|
*/
|
|
export function closeScene(): void;
|
|
|
|
/***
|
|
* 获取当前系统语言
|
|
*/
|
|
export function getLocLanguage(): String;
|
|
|
|
/***
|
|
* 设置当前系统语言
|
|
*/
|
|
export function setLocLanguage( _lcode: String ): void;
|
|
|
|
/***
|
|
* 获取当前方言
|
|
*/
|
|
export function getLocVoice(): number;
|
|
|
|
/***
|
|
* 设置当前方言
|
|
*/
|
|
export function setLocVoice( _vt: number ): void;
|
|
|
|
/***
|
|
* 游戏退出
|
|
*/
|
|
export function appQuit(): void;
|
|
|
|
/***
|
|
* 游戏重启
|
|
*/
|
|
export function restart(): void;
|
|
|
|
/***
|
|
* 提示重启
|
|
*/
|
|
export function tipRestart( _msg: String ): void;
|
|
|
|
/***
|
|
* 编号大类拆解
|
|
*/
|
|
export function idType( _id: Number ): number;
|
|
|
|
/***
|
|
* 获取ID对应配置
|
|
*/
|
|
export function queryID( _id: Number ): Object;
|
|
|
|
/***
|
|
* GUI代理
|
|
*/
|
|
export class gui {
|
|
/**
|
|
* 子节点查找
|
|
* _names为cc.find参数格式 若_names空,则为_refnode
|
|
*/
|
|
static find( _refnode: cc.Node | cc.Component, _names?: String ): cc.Node;
|
|
|
|
/**
|
|
* 获取子节点组件
|
|
*/
|
|
static getComponent(
|
|
_refNode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_cmpName: String,
|
|
_create: Boolean
|
|
): cc.Component;
|
|
static getComponent<T extends cc.Component>(
|
|
_refNode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_cmpName: { prototype: T },
|
|
_create: Boolean
|
|
): T;
|
|
|
|
/**
|
|
* 节点有效
|
|
*/
|
|
static setActive(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_active: boolean | any
|
|
): cc.Node;
|
|
|
|
/**
|
|
* 节点透明度
|
|
*/
|
|
static setOpacity(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_opacity: number
|
|
): cc.Node;
|
|
|
|
/**
|
|
* 设置是否有效
|
|
*/
|
|
static setEnable(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_enable: Boolean
|
|
): cc.Node;
|
|
|
|
/**
|
|
* 设置文本
|
|
*/
|
|
static setString(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_text: String
|
|
): cc.Label;
|
|
|
|
/**
|
|
* 设置富文本
|
|
*/
|
|
static setStringRich(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_text: String
|
|
): cc.RichText;
|
|
|
|
/**
|
|
* 设置颜色
|
|
*/
|
|
static setColor(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_text: cc.Color
|
|
): cc.Node;
|
|
|
|
/**
|
|
* 设置样式
|
|
*/
|
|
static setCSS(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_cssKey: String
|
|
): cc.Node;
|
|
|
|
/**
|
|
* 设置描边色
|
|
*/
|
|
static setOutlineColor(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_text: cc.Color
|
|
): cc.LabelOutline;
|
|
|
|
/**
|
|
* 精灵褪色
|
|
*/
|
|
static fadeSpriteColor(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_isfade: Boolean
|
|
): cc.Sprite;
|
|
|
|
/**
|
|
* 设置节点全色
|
|
*/
|
|
static setColorDeep(
|
|
_node: cc.Node | cc.Component,
|
|
_names: String,
|
|
_text: cc.Color
|
|
): void;
|
|
|
|
/**
|
|
* 设置WEB图片
|
|
*/
|
|
static setWebImage(
|
|
_refnode: cc.Node | cc.Component,
|
|
_url: String | String
|
|
): cc.Sprite;
|
|
|
|
/**
|
|
* 设置精灵
|
|
*/
|
|
static setSpriteFrame(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_sfkey: cc.SpriteFrame | String,
|
|
_cb: Function
|
|
): cc.Sprite;
|
|
|
|
/**
|
|
* 设置图集里的精灵
|
|
*/
|
|
static setAtlasFrame(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_sfkey: cc.SpriteFrame | String,
|
|
_opacity: Boolean
|
|
): cc.Sprite;
|
|
|
|
/**
|
|
* 设置本地化图片
|
|
*/
|
|
static setLocAtlas(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_text: String
|
|
): cc.Component;
|
|
|
|
/**
|
|
* 设置本地文字
|
|
*/
|
|
static setLocText(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_text: String
|
|
): cc.Component;
|
|
|
|
/**
|
|
* 按钮锁&解锁
|
|
*/
|
|
static setLocked(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_locked: Boolean
|
|
): cc.Component;
|
|
|
|
/**
|
|
* 隐藏所有子物体
|
|
*/
|
|
static hideAllChildren(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names?: String
|
|
): cc.Node;
|
|
|
|
/**
|
|
* 保证子物体的个数足够
|
|
* _prefab 如果不指定则为指定父级的第一个子节点
|
|
*/
|
|
static gocChildren(
|
|
_refNode: cc.Node | cc.Component,
|
|
_names,
|
|
_count: number,
|
|
_prefab?: cc.Node | cc.Prefab
|
|
): cc.Node;
|
|
|
|
/**
|
|
* 设置对齐方式
|
|
* _key center, lt, ld, rt, rd
|
|
*/
|
|
static gocChildren(
|
|
_refNode: cc.Node | cc.Component,
|
|
_names,
|
|
_key: String,
|
|
_p1: Number,
|
|
_p2: Number
|
|
): cc.Component;
|
|
|
|
/**
|
|
* 视图绑定-文本
|
|
*/
|
|
static vbindText(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_target: Object,
|
|
_key: String,
|
|
_fmt: String
|
|
): cc.Component;
|
|
|
|
/**
|
|
* 视图绑定-富文本
|
|
*/
|
|
static vbindRichText(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_target: Object,
|
|
_key: String,
|
|
_fmt: String
|
|
): cc.Component;
|
|
|
|
/**
|
|
* 视图绑定-图片
|
|
*/
|
|
static vbindImage(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_target: Object,
|
|
_key: String
|
|
): cc.Component;
|
|
|
|
/**
|
|
* 视图绑定-进度条
|
|
*/
|
|
static vbindProgress(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_target: Object,
|
|
_key1: String,
|
|
_key2: String
|
|
): cc.Component;
|
|
|
|
/**
|
|
* 视图绑定-显示控制
|
|
*/
|
|
static vbindVisible(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_target: Object,
|
|
_key: String
|
|
): cc.Component;
|
|
|
|
/**
|
|
* 设置合图精灵
|
|
*/
|
|
static setAtlasFrame(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_sfkey: String | cc.SpriteFrame
|
|
): cc.Component;
|
|
|
|
/**
|
|
* 设置帧动画
|
|
*/
|
|
static setFrameAnimation(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_rkey: String,
|
|
_cb: Function,
|
|
_loop: Boolean,
|
|
_speed: Number
|
|
): cc.Component;
|
|
|
|
/**
|
|
* 播放DragonBones骨骼动画
|
|
*/
|
|
static playDragonDones(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_rkey: String,
|
|
_action: String,
|
|
_cb: Function,
|
|
_loop: Boolean,
|
|
_speed: Number
|
|
): cc.Component;
|
|
|
|
/**
|
|
* 播放Spine骨骼动画
|
|
*/
|
|
static playSpine(
|
|
_refnode: cc.Node | cc.Component,
|
|
_names: String,
|
|
_rkey: String,
|
|
_action: String,
|
|
_cb: Function,
|
|
_loop: Boolean,
|
|
_speed: Number
|
|
): cc.Component;
|
|
}
|
|
|
|
/***
|
|
* 资源代理
|
|
*/
|
|
export class res {
|
|
/**
|
|
* 资源通配路径格式化
|
|
* */
|
|
static fmtPath( _fmt: String ): String;
|
|
|
|
/**
|
|
* 包名通配格式化
|
|
* */
|
|
static fmtBundleName( _fmt: String ): String;
|
|
|
|
/**
|
|
* 是否语言相关
|
|
* */
|
|
static isBindLang( _fmt: String ): Boolean;
|
|
|
|
/**
|
|
* 资源键组合
|
|
* */
|
|
static encodeRK( _path: String, _bdname: String ): String;
|
|
|
|
/**
|
|
* 资源键拆分
|
|
* */
|
|
static decodeRK( _key: String ): Object;
|
|
|
|
/**
|
|
* 读取包
|
|
* */
|
|
static loadBundle( _bdname: String, _cb: Function ): void;
|
|
|
|
/**
|
|
* 卸载包
|
|
* */
|
|
static removeBundle( _bdname: String ): void;
|
|
|
|
/**
|
|
* 预加载
|
|
* */
|
|
static preload(
|
|
_rkey: String,
|
|
_type: any,
|
|
_cb: ( _error: Object, _items: Array ) => void
|
|
): void;
|
|
|
|
/**
|
|
* 读取JSON
|
|
* */
|
|
static loadJson(
|
|
_rkey: String,
|
|
_cb: ( _error: Object, _data: any ) => void
|
|
): void;
|
|
|
|
/**
|
|
* 读取字体
|
|
* */
|
|
static loadFont(
|
|
_rkey: String,
|
|
_cb: ( _error: Object, _data: any ) => void
|
|
): void;
|
|
|
|
/**
|
|
* 读取纹理
|
|
* */
|
|
static loadSpriteFrame(
|
|
_rkey: String,
|
|
_cb: ( _error: Object, _data: any ) => void
|
|
): void;
|
|
|
|
/**
|
|
* 读取图集
|
|
* */
|
|
static loadSpriteAtlas(
|
|
_rkey: String,
|
|
_cb: ( _error: Object, _data: any ) => void
|
|
): void;
|
|
|
|
/**
|
|
* 读取图集子图
|
|
* */
|
|
static loadAtlasFrame(
|
|
_rkey: String,
|
|
_cb: ( _error: Object, _data: any ) => void
|
|
): void;
|
|
|
|
/**
|
|
* 读取SPINE
|
|
* */
|
|
static loadSpine(
|
|
_rkey: String,
|
|
_cb: ( _error: Object, _data: any ) => void
|
|
): void;
|
|
|
|
/**
|
|
* 加载Prefab
|
|
* */
|
|
static loadPrefab(
|
|
_rkey: String,
|
|
_cb: ( _error: Object, _data: any ) => void
|
|
): void;
|
|
|
|
/**
|
|
* 加载资源目录
|
|
* */
|
|
static loadResDir(
|
|
_rkey: String,
|
|
_cb: ( _error: Object, _data: any ) => void
|
|
): void;
|
|
|
|
/**
|
|
* 远程加载资源
|
|
* */
|
|
static loadRemote(
|
|
_url: String,
|
|
_cb: ( _error: Object, _asset: any ) => void
|
|
): void;
|
|
}
|
|
|
|
/***
|
|
* 资源代理
|
|
*/
|
|
export class assets {
|
|
/**
|
|
* 资产查询
|
|
* */
|
|
static queryAsset( _uid: String ): cc.Asset;
|
|
|
|
/**
|
|
* 资产缓存
|
|
* */
|
|
static cacheAsset( _asset: cc.Asset, _customId: String ): void;
|
|
|
|
/**
|
|
* 资产释放
|
|
* */
|
|
static uncacheAsset( _assetOrUid: cc.Asset | String ): void;
|
|
|
|
/**
|
|
* 资源全释放
|
|
* */
|
|
static uncacheAssets(): void;
|
|
|
|
/**
|
|
* 缓存打印
|
|
* */
|
|
static dumpAssets(): void;
|
|
}
|
|
|
|
/***
|
|
* 数据类型辅助
|
|
*/
|
|
export class dt {
|
|
/**
|
|
* 判断:数字
|
|
* */
|
|
static numGood( _n: any ): boolean;
|
|
|
|
/**
|
|
* 判断:正数
|
|
* */
|
|
static numPositive( _n: any, _inZero?: boolean ): boolean;
|
|
|
|
/**
|
|
* 判断:等于X的数
|
|
* */
|
|
static numEqual( _n: any, _t: number ): boolean;
|
|
|
|
/**
|
|
* 判断:大于X的数
|
|
* */
|
|
static numGreater( _n: any, _t: number ): boolean;
|
|
|
|
/**
|
|
* 判断:小于X的数
|
|
* */
|
|
static numLess( _n: any, _t: number ): boolean;
|
|
|
|
/**
|
|
* 判断:范围内的数
|
|
* */
|
|
static numInRange( _n: any, _t: Array ): boolean;
|
|
|
|
/**
|
|
* 数字修正
|
|
* */
|
|
static numFix( _num: Number, _def: Number ): Number;
|
|
|
|
/**
|
|
* 判断:浮点精确度
|
|
* */
|
|
static toFixedDecimal( _n: number ): number;
|
|
|
|
/**
|
|
* 判断:布尔
|
|
* */
|
|
static isBool( _n: any ): boolean;
|
|
|
|
/**
|
|
* 判断:有效方法
|
|
* */
|
|
static fnGood( _f: any ): boolean;
|
|
|
|
/**
|
|
* 判断:空方法
|
|
* */
|
|
static fnEmpty(): void;
|
|
|
|
/**
|
|
* 判断:空方法报错
|
|
* */
|
|
static fnEmptyError( _fn: Function ): void;
|
|
|
|
/**
|
|
* 安全回调
|
|
* */
|
|
static fnInvoke( _cb: Function | any ): void;
|
|
|
|
/**
|
|
* 判断:字符串
|
|
* */
|
|
static strGood( _s: any ): boolean;
|
|
|
|
/**
|
|
* 判断:空字符串
|
|
* */
|
|
static strEmpty( _s: any ): boolean;
|
|
|
|
/**
|
|
* 判断:非空字符串
|
|
* */
|
|
static strNEmpty( _s: any ): boolean;
|
|
|
|
/**
|
|
* 字符串去空格
|
|
* */
|
|
static strTrim( _s: String ): String;
|
|
|
|
/**
|
|
* 判断:获取字节长度
|
|
* */
|
|
static strBytes( _s: String ): number;
|
|
|
|
/**
|
|
* 判断:字符串省略截取
|
|
* */
|
|
static strCut( _s: String, _l: number ): String;
|
|
|
|
/**
|
|
* 判断:字符串省略截取(逆向)
|
|
* */
|
|
static strCutR( _s: String, _l: number ): String;
|
|
|
|
/**
|
|
* key#value属性串转数组
|
|
* */
|
|
static pairSplit( _sp: String ): Array;
|
|
|
|
/**
|
|
* [key#value属性串转数组]
|
|
* */
|
|
static arrPairSplit( _arr: Array ): Array;
|
|
|
|
/**
|
|
* 补零
|
|
* */
|
|
static prefixZero( num: number, _n: number ): String;
|
|
|
|
/**
|
|
* 字符串替换
|
|
* */
|
|
static replace( _str: String, _old: String, _new: String ): String;
|
|
|
|
/**
|
|
* 判断:数组
|
|
* */
|
|
static arrGood( _n: any ): boolean;
|
|
|
|
/**
|
|
* 判断:空数组
|
|
* */
|
|
static arrEmpty( _n: any ): boolean;
|
|
|
|
/**
|
|
* 判断:非空数组
|
|
* */
|
|
static arrNEmpty( _n: any ): boolean;
|
|
|
|
/**
|
|
* 判断:是不是数组成员
|
|
* */
|
|
static arrMember( _a: any, _m: Array ): boolean;
|
|
|
|
/**
|
|
* 判断:从数组中删除
|
|
* */
|
|
static arrDelete( _a: Array, _f: Function, _once: boolean ): Array;
|
|
|
|
/***
|
|
* 创建一个UUID(运行时唯一)
|
|
*/
|
|
static newUUID( _key: String ): String;
|
|
|
|
/***
|
|
* 创建永不重复的Tag
|
|
*/
|
|
static newTag( _key: String ): String;
|
|
|
|
/**
|
|
* 判断:对象
|
|
* */
|
|
static objGood( _n: any ): boolean;
|
|
|
|
/**
|
|
* 判断:非空对象
|
|
* */
|
|
static objNEmpty( _n: any ): boolean;
|
|
|
|
/**
|
|
* 判断:空对象
|
|
* */
|
|
static objEmpty( _n: any ): boolean;
|
|
|
|
/**
|
|
* 对象合并
|
|
* */
|
|
static objConcat( _dic1: Object, _dic2: Object ): Object;
|
|
|
|
/**
|
|
* 获取对象成员数量
|
|
* */
|
|
static objLen( _dic: Object ): Number;
|
|
|
|
/**
|
|
* 深复制
|
|
* */
|
|
static objClone( _obj: any ): object;
|
|
|
|
/**
|
|
* 复制属性到对象
|
|
* */
|
|
static copyProperties(
|
|
_obj: Object,
|
|
_dic: Object,
|
|
_log: Boolean
|
|
): object;
|
|
|
|
/**
|
|
* 范围随机数
|
|
* */
|
|
static randomRange( _min: number, _max: number ): number;
|
|
|
|
/**
|
|
* 秒级时间戳
|
|
* */
|
|
static timeStamp( _ms: Boolean ): String;
|
|
|
|
/**
|
|
* 判断:格式化日期
|
|
* */
|
|
static fmtDate( _date: Date, _year: Boolean ): String;
|
|
|
|
/**
|
|
* 判断:格式化日期
|
|
* */
|
|
static fmtDateLoc( _date: Date, _year: Boolean ): String;
|
|
|
|
/**
|
|
* 判断:格式化时间
|
|
* */
|
|
static fmtTime( _date: Date ): String;
|
|
|
|
/**
|
|
* 判断:格式化时间
|
|
* */
|
|
static fmtTimeFromSecs( _secs: number ): String;
|
|
|
|
/**
|
|
* 计算剩余天数(向上取整)
|
|
* _ts: 秒级时间戳
|
|
* */
|
|
static getDaysFromNow( _ts: Number ): Number;
|
|
|
|
/**
|
|
* 判断:货币化数字
|
|
* */
|
|
static fmtCount( _money: number, _n: number ): String;
|
|
|
|
/**
|
|
* 数量简化
|
|
* */
|
|
static shortCount(
|
|
_money: number,
|
|
_add: boolean,
|
|
_trimZero?: boolean
|
|
): String;
|
|
|
|
/**
|
|
* 判断:经纬度距离计算(M)
|
|
* */
|
|
static earthDistance(
|
|
_lon1: number,
|
|
_lat1: number,
|
|
_lon2: number,
|
|
_lat2: number
|
|
): number;
|
|
|
|
/**
|
|
* 判断:格式化距离
|
|
* */
|
|
static formatDistance( _meters: number ): String;
|
|
|
|
/**
|
|
* 随机字符串生成
|
|
* */
|
|
static randomStr( _min: number, _max: number, _s: String ): String;
|
|
|
|
/***
|
|
* 获取URL网址参数
|
|
*/
|
|
static parseURLArgs( _key: String ): Object;
|
|
|
|
/***
|
|
* 针对URL不正规的参数解析
|
|
*/
|
|
static queryURLArg( _key: String ): String;
|
|
|
|
/***
|
|
* 安全执行(异常捕获)
|
|
*/
|
|
static trycatch( _dosth: Function, _error: Function ): void;
|
|
|
|
/***
|
|
* 格式化JSON(异常捕获)
|
|
*/
|
|
static enjson( _object: Object ): String;
|
|
|
|
/***
|
|
* 解析JSON(异常捕获)
|
|
*/
|
|
static dejson( _str: String ): Object;
|
|
}
|
|
|
|
/**
|
|
* 事件管理器
|
|
*/
|
|
export class event {
|
|
/***
|
|
* 监听
|
|
*/
|
|
static bind( _binder: any, _lst: object ): boolean;
|
|
|
|
/***
|
|
* 解除
|
|
*/
|
|
static unbind( _binder: any ): boolean;
|
|
|
|
/***
|
|
* 发送
|
|
*/
|
|
static send( id: String, args: object ): boolean;
|
|
|
|
/***
|
|
* 清理
|
|
*/
|
|
static clear(): void;
|
|
}
|
|
|
|
/**
|
|
* 计时管理器
|
|
*/
|
|
export class timers {
|
|
/***
|
|
* 查询计时器
|
|
*/
|
|
static findTimer( _uuname: String, _notify: boolean ): object;
|
|
|
|
/***
|
|
* 新建计时器
|
|
*/
|
|
static newTimer(
|
|
_uuname: String,
|
|
_interval: number,
|
|
_times: number,
|
|
_cb: Function
|
|
): boolean;
|
|
|
|
/***
|
|
* 删除计时器
|
|
*/
|
|
static delTimer( _uuname: String ): boolean;
|
|
|
|
/***
|
|
* 清理
|
|
*/
|
|
static clean(): void;
|
|
}
|
|
|
|
/**
|
|
* 对象工厂
|
|
*/
|
|
export class factory {
|
|
/***
|
|
* 创建
|
|
*/
|
|
static create( _jsfile: String, _args: object ): object;
|
|
|
|
/***
|
|
* 删除
|
|
*/
|
|
static remove( _object: object ): void;
|
|
|
|
/***
|
|
* 获取对象的UUID
|
|
*/
|
|
static getUUID( _binder: String | object, _create: boolean ): String;
|
|
}
|
|
|
|
/**
|
|
* 缓存管理器
|
|
*/
|
|
export class storage {
|
|
|
|
/***
|
|
* 取值
|
|
*/
|
|
static get( key: String, def: String, _pri: boolean ): String;
|
|
|
|
/***
|
|
* 取数
|
|
*/
|
|
static getNumber( key: String, def: number, _pri: boolean ): Number;
|
|
|
|
/***
|
|
* 取对象
|
|
*/
|
|
static getObject( key: String, _pri: boolean ): Object;
|
|
|
|
/***
|
|
* 设值
|
|
*/
|
|
static set( key: String, value: any, _pri: boolean ): void;
|
|
|
|
/***
|
|
* 设对象
|
|
*/
|
|
static setObject( key: String, value: any, _pri: boolean ): void;
|
|
|
|
/***
|
|
* 删值
|
|
*/
|
|
static del( key: String, _pri: boolean ): void;
|
|
}
|
|
|
|
/**
|
|
* 文本管理器
|
|
*/
|
|
export class text {
|
|
/***
|
|
* 获取
|
|
*/
|
|
static getKey( _txtkey: String ): String;
|
|
|
|
/***
|
|
* 本文库取值后格式化输出
|
|
*/
|
|
static format( _key: String, ...args: any[] ): String;
|
|
|
|
/***
|
|
* 直接格式化输出
|
|
*/
|
|
static formatS( _fmt: String, ...args: any[] ): String;
|
|
|
|
/***
|
|
* 格式化错误码
|
|
*/
|
|
static formatError( _eid: String | number, ...args: any[] ): String;
|
|
}
|
|
|
|
/**
|
|
* 命令管理器
|
|
*/
|
|
export class cmd {
|
|
/***
|
|
* 命令注册
|
|
*/
|
|
static regCmd( _key: String, _fn: Function, _desc: String ): void;
|
|
|
|
/***
|
|
* 命令注销
|
|
*/
|
|
static unregCmd( _key: String ): void;
|
|
|
|
/***
|
|
* 执行命令
|
|
*/
|
|
static do( _cmd: String, _cb: Function ): void;
|
|
|
|
/***
|
|
* 批量执行命令
|
|
*/
|
|
static doBatch( _cmds: Array, _cb: Function ): void;
|
|
|
|
/***
|
|
* 全命令输出
|
|
*/
|
|
static dump(): void;
|
|
}
|
|
|
|
/***
|
|
* 资源代理
|
|
*/
|
|
export class views {
|
|
/***
|
|
* 模型注册
|
|
*/
|
|
static regModel( _key: String, _model: Object, _single: Boolean ): Boolean;
|
|
|
|
/***
|
|
* 模型注销
|
|
*/
|
|
static unregModel( _key: String ): Boolean;
|
|
|
|
/***
|
|
* 查询模型
|
|
*/
|
|
static queryModel( _key: String, _warn: Boolean ): Object;
|
|
|
|
/***
|
|
* 获取合并模板结果
|
|
*/
|
|
static combineModel( _modName: String, _modEx: Object ): Object;
|
|
|
|
/***
|
|
* 获取视图
|
|
*/
|
|
static queryView( _vid: String, _warn: Boolean ): Object;
|
|
|
|
/***
|
|
* 创建视图
|
|
*/
|
|
static buildView( _modName: String, _vmodel: Object ): String;
|
|
|
|
/***
|
|
* 视图重置
|
|
*/
|
|
static resetView( _vid: String, _vmodel: Object, _clean: Boolean ): Boolean;
|
|
|
|
/***
|
|
* 视图删除
|
|
*/
|
|
static delView( _vid: String ): Boolean;
|
|
|
|
/***
|
|
* 监听绑定
|
|
*/
|
|
static bindView( _vid: String, _bindername: String, _lst: Array ): Boolean;
|
|
|
|
/***
|
|
* 监听解除
|
|
*/
|
|
static unbindView( _vid: String, _bindername: String ): Boolean;
|
|
|
|
/***
|
|
* 直接获取视图数据
|
|
*/
|
|
static getData( _vid: String, _vk: String, _def: any ): any;
|
|
|
|
/***
|
|
* 直接设置视图数据
|
|
*/
|
|
static setData( _vid: String, _vk: String, _value: any, _notify: Boolean ): Boolean;
|
|
|
|
/***
|
|
* 是不是唯一视图
|
|
*/
|
|
static isSingleView( _modName: String ): Boolean;
|
|
|
|
/***
|
|
* (自定义)VBD视图可绑定对象 --- 注册
|
|
*/
|
|
static regBindTarget( _key: String, _target: Object ): void;
|
|
|
|
/***
|
|
* (自定义)VBD视图可绑定对象 --- 注销
|
|
*/
|
|
static unregBindTarget( _key: String ): void;
|
|
|
|
/***
|
|
* (自定义)VBD视图可绑定对象 --- 查找
|
|
*/
|
|
static queryBindTarget( _key: String ): void;
|
|
|
|
/***
|
|
* (自定义)VBD视图可绑定对象 --- 清理
|
|
*/
|
|
static cleanBindTargets(): void;
|
|
}
|
|
|
|
/**
|
|
* 功能服务
|
|
*/
|
|
export class func {
|
|
/***
|
|
* 获取指定功能
|
|
*/
|
|
static queryFunc( _fid: Number ): Object;
|
|
|
|
/***
|
|
* 添加功能
|
|
*/
|
|
static addFunc( _cfgs: Object ): Object;
|
|
|
|
/***
|
|
* 删除功能
|
|
*/
|
|
static delFunc( _fid: Number ): void;
|
|
|
|
/***
|
|
* 功能条件判断
|
|
*/
|
|
static checkFunc( _fid: Number ): Object;
|
|
|
|
/***
|
|
* 功能开关监听
|
|
*/
|
|
static bindFunc( _fid: Number, _cb: Function, _tar: Object ): void;
|
|
|
|
/***
|
|
* 删除功能开关监听
|
|
*/
|
|
static unbindFunc( _fid: Number, _cb: Function, _tar: Object ): void;
|
|
|
|
/***
|
|
* 监听更新通告
|
|
*/
|
|
static updateAndNotifyBinders( _fid: Number ): void;
|
|
|
|
/***
|
|
* 添加条件
|
|
*/
|
|
static addCondition( _key: String, _handle: Function ): Boolean;
|
|
|
|
/***
|
|
* 删除条件
|
|
*/
|
|
static delCondition( _key: String ): void;
|
|
|
|
/***
|
|
* 条件检测
|
|
*/
|
|
static checkCodition( _key: String, _param1: any, _param2: any ): Object;
|
|
}
|
|
|
|
/**
|
|
* 插件管理器
|
|
*/
|
|
export class plugin {
|
|
/***
|
|
* 添加插件
|
|
*/
|
|
static add( _inst: Object, _keys: Array ): Boolean;
|
|
|
|
/***
|
|
* 删除插件
|
|
*/
|
|
static remove( _inst: Object ): Boolean;
|
|
}
|
|
|
|
/**
|
|
* Tween动作序列包
|
|
*/
|
|
export class tween {
|
|
/***
|
|
* 淡进
|
|
*/
|
|
static fadeIn(
|
|
_refnode: Object,
|
|
_names: String,
|
|
_secs: Number,
|
|
_cb: Function,
|
|
_to: Number,
|
|
_from: Number
|
|
): void;
|
|
|
|
/***
|
|
* 淡出
|
|
*/
|
|
static fadeOut(
|
|
_refnode: Object,
|
|
_names: String,
|
|
_secs: Number,
|
|
_cb: Function,
|
|
_to: Number,
|
|
_from: Number
|
|
): void;
|
|
|
|
/***
|
|
* 延迟淡进
|
|
*/
|
|
static delayFadeIn(
|
|
_refnode: Object,
|
|
_names: String,
|
|
_delay: Number,
|
|
_secs: Number,
|
|
_cb: Function,
|
|
_to: Number,
|
|
_from: Number
|
|
): void;
|
|
|
|
/***
|
|
* 贝塞尔位移淡出
|
|
*/
|
|
static fadeOutBezier(
|
|
_refnode: Object,
|
|
_names: String,
|
|
_secs: Number,
|
|
_cb: Function,
|
|
_to: cc.Vec2,
|
|
_from: cc.Vec2,
|
|
_scale: Number,
|
|
_opacity: Number,
|
|
_h: Number
|
|
): void;
|
|
|
|
/***
|
|
* 无限旋转
|
|
*/
|
|
static rotateForever( _refnode: Object, _names: String, _speed: Number ): void;
|
|
|
|
/***
|
|
* 移动
|
|
*/
|
|
static moveTo( _refnode: Object, _names: String, _secs: Number, _pos: cc.Vec2, _cb: Function ): void;
|
|
}
|
|
|
|
/**
|
|
* 桥接对象池管理器
|
|
*/
|
|
export class mTrace {
|
|
|
|
/** 埋点 */
|
|
static trace( _type: Number, _p1: String, _p2: String, _cb: Function, _reset: Boolean ): void;
|
|
}
|
|
|
|
/**
|
|
* 桥接对象池管理器
|
|
*/
|
|
export class pools {
|
|
/***
|
|
* 获取单池
|
|
* @key:全局唯一名字
|
|
* @node:对象实例模板(cc.Node)
|
|
* @initCount:初始大小
|
|
*/
|
|
static getPool( _key: String, _node: cc.Node, _initCount: Number ): cc.Node;
|
|
|
|
/***
|
|
* 对象回收
|
|
*/
|
|
static put( _node: cc.Node ): void;
|
|
|
|
/***
|
|
* 全子节点回收
|
|
*/
|
|
static putChildren( _node: cc.Node ): void;
|
|
}
|
|
|
|
/**
|
|
* 合图快捷读取
|
|
*/
|
|
export class atlas {
|
|
/***
|
|
* 是否可缓存
|
|
*/
|
|
static canCache( _path: String ): Boolean;
|
|
|
|
/***
|
|
* 获取缓存
|
|
*/
|
|
static getCache( _path: String ): any;
|
|
|
|
/***
|
|
* 设置缓存
|
|
*/
|
|
static addCache( _path: String, _res: any ): void;
|
|
|
|
/***
|
|
* 全清理
|
|
*/
|
|
static clean(): void;
|
|
}
|
|
|
|
/**
|
|
* 老项目桥接
|
|
*/
|
|
export namespace bridge {
|
|
|
|
/**
|
|
* 设置图标
|
|
*/
|
|
export function checkConditions( _conds: Array ): Object;
|
|
|
|
/**
|
|
* 设置图标
|
|
*/
|
|
export function setIcon( _refnode: cc.Node | cc.Component, _names: String, _iconId: Number ): void;
|
|
|
|
/**
|
|
* 设置小图标
|
|
*/
|
|
export function setIconS( _refnode: cc.Node | cc.Component, _names: String, _iconId: Number ): void;
|
|
|
|
/**
|
|
* 快速设置头像(face_id)
|
|
*/
|
|
export function setAvatarByFaceId( _refnode: cc.Node | cc.Component, _names: String, _faceId: Number ): void;
|
|
|
|
/**
|
|
* 快速设置头像框(avatar_base_id)
|
|
*/
|
|
export function setAvatarFrame( _refnode: cc.Node | cc.Component, _names: String, _fid: Number ): void;
|
|
|
|
/**
|
|
* 快速设置聊天泡泡(bubble_bid)
|
|
*/
|
|
export function setChatBubble( _refnode: cc.Node | cc.Component, _names: String, _bid: Number ): void;
|
|
|
|
/**
|
|
* 获取子节点上的BridgeWindow组件
|
|
*/
|
|
export function getBridgeWindow( _refnode: cc.Node | cc.Component, _names: String ): cc.Component;
|
|
|
|
/**
|
|
* 创建界面
|
|
*/
|
|
export function createPanel( _wname: String, _params: any ): void;
|
|
|
|
/**
|
|
* 关闭界面
|
|
*/
|
|
export function closePanel( _wname: String ): void;
|
|
|
|
/**
|
|
* 添加单等待
|
|
*/
|
|
export function addWaiting( _key: String ): void;
|
|
|
|
/**
|
|
* 删除单等待
|
|
*/
|
|
export function delWaiting( _key: String ): void;
|
|
|
|
/**
|
|
* 清空等待
|
|
*/
|
|
export function cleanWaitings(): void;
|
|
|
|
/**
|
|
* 跳转支持
|
|
*/
|
|
export class jumper {
|
|
|
|
/**
|
|
* 来源条件检查
|
|
*/
|
|
static checkSource( _sourceId: Number ): Object;
|
|
|
|
/**
|
|
* 来源UI跳转
|
|
*/
|
|
static jump2Window( _sourceId: Number, _args: any ): boolean;
|
|
|
|
/**
|
|
* 来源UI跳转
|
|
*/
|
|
static jump2WindowByKey( _sourceKey: String, _args: any ): boolean;
|
|
|
|
/**
|
|
* 资产类获取
|
|
*/
|
|
static jump2GetAsset( _key: String ): boolean;
|
|
|
|
/**
|
|
* 道具获取跳转
|
|
*/
|
|
static jumpGetItem( _itemId: Number ): boolean;
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
interface Function {
|
|
_super: () => any;
|
|
}
|