You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
4.5 KiB
133 lines
4.5 KiB
|
|
interface CNodeUtilsEx {
|
|
//#region 节点查找
|
|
getNodeEx(target: cc.Node | cc.Component, name: string, active: boolean);
|
|
/**根据节点路径 寻找节点 */
|
|
getNode(target: cc.Node | cc.Component, ...url: any[]);
|
|
//#endregion
|
|
|
|
//#region 节点组件查询
|
|
/**获取组件 不存在那么就添加 */
|
|
getOrAddComponent<T extends cc.Component>(node: cc.Node | cc.Component, cla);
|
|
//#endregion
|
|
|
|
//#region 节点组件属性设置
|
|
|
|
/**设置节点透明度 */
|
|
setOpacity(node: cc.Node | cc.Component, Opacity: number);
|
|
|
|
/**设置节点缩放 */
|
|
setScale(target: cc.Node | cc.Component, scale: number);
|
|
|
|
/**设置节点显示 */
|
|
setActive(target: cc.Node | cc.Component, active: boolean, ADFlag?: number);
|
|
|
|
/**设置按钮是否禁用 */
|
|
setBtnInteractable(btn: cc.Button, _interactable: boolean);
|
|
|
|
/**缓动图片范围 */
|
|
TweenSpriteRange(node: cc.Node | cc.cc.Sprite, fillRange: number, time: number);
|
|
|
|
/**设置数组节点 全部是否置灰 */
|
|
setAllGray(node: cc.Node[], isGray: boolean, exclude: cc.Node[] = []);
|
|
|
|
/**设置节点以及子节点 全部是否置灰 */
|
|
setChiladAllGray(node: cc.Node | cc.Sprite, isGray: boolean, exclude: cc.Node[] = []);
|
|
|
|
/**设置节点是否置灰 */
|
|
setGray(node: cc.Node | cc.Sprite, isGray: boolean);
|
|
|
|
/**
|
|
* 更新label文字
|
|
* **/
|
|
switchText(node: cc.Node | cc.Label, str: any, forceUpdate = false, isNum = false);
|
|
switchTextByQuality(node: Node | Label, str: any, quality: number, forceUpdate = false, isNum = false);
|
|
|
|
/**
|
|
* 更新RichText文字
|
|
* **/
|
|
switchRichText(node: Node | RichText, str: any, forceUpdate = false, isNum = false);
|
|
|
|
TweenNumText(target: cc.Node | cc.Label, toNum: number,isConvert?:boolean);
|
|
|
|
|
|
addBtnLister(node: cc.Node, callback: Function, target?: any, audio: ESounds = ESounds.So_click);
|
|
|
|
addEventHandler<T extends cc.EventHandler>(node: cc.Node, calssname = '', callFunc = '', customData = '');
|
|
|
|
/**
|
|
* 添加button事件
|
|
* @param node
|
|
* @param callback
|
|
* @param target
|
|
* @param isAudio
|
|
*/
|
|
addBtnComponent(node: cc.Node, callback: Function, target?: any, isAudio: ESounds = ESounds.So_click);
|
|
addNoScaleBtnComponent(node: cc.Node, callback: Function, target?: any, isAudio?: ESounds);
|
|
ClearBtnCommontEffect(node: cc.Node);
|
|
|
|
/**添加按钮长按 */
|
|
addBtnLongpress(node: cc.Node | Button, downCallBack: Function, upCallback: Function);
|
|
|
|
|
|
/**
|
|
*
|
|
* @param node
|
|
* @param callback
|
|
* @param target
|
|
*/
|
|
addMoveComponent(node: cc.Node, callback: Function, target?: any, TiggerFuntion?: Function);
|
|
|
|
/**富文本处理 列表*/
|
|
ContainRichtTextByList(value: string, list: RichTextTypeData[]): string;
|
|
|
|
/**富文本处理 */
|
|
ContainRichtText(value: string, data: RichTextTypeData): string;
|
|
|
|
/**添加富文本点击事件 */
|
|
AddRichTextClick(tagetNode: cc.Node | RichText, CallBack: Function, functionName?: string);
|
|
|
|
|
|
SwitchSpine( node: cc.Node | sp.Skeleton,file:string, bundleName: string = EBundleName.resources, animation: string | string[] = 'idle', isLoop: boolean = true, skin: string = 'default', back: Function = null)
|
|
|
|
SwitchTexture(file: string, node: cc.Node | cc.Sprite, bundleName: string = EBundleName.resources, width: number = 0, back: Function = null)
|
|
|
|
SwitchTextureByAutoAtlas(file: string, atlas: string, node: cc.Node | cc.Sprite, bundleName: string = EBundleName.resources, width: number = 0, back: Function = null)
|
|
|
|
SwitchTextureByData(node: cc.Node | cc.Sprite, data: IData, width: number = 0, back: Function = null)
|
|
/**加载远程图片 */
|
|
SwitchRomateTexture(file: string, node: cc.Node | Sprite, width: number = 0, back: Function = null)
|
|
|
|
scaleNode(node: cc.Node, width, height = 0);
|
|
|
|
scaleNodeW(node: cc.Node, width);
|
|
|
|
scaleNodeH(node: cc.Node, height);
|
|
|
|
/**
|
|
* 二阶贝塞尔曲线 运动
|
|
* @param target
|
|
* @param {number} duration
|
|
* @param {} c1 起点坐标
|
|
* @param {} c2 控制点
|
|
* @param {Vec3} to 终点坐标
|
|
* @param opts
|
|
* @returns {any}
|
|
*/
|
|
bezierTo(target: cc.Node, duration: number, c1: Vec2, c2: Vec2, to: Vec3, opts: any, Callback?: Function);
|
|
|
|
|
|
addNodeTounch(node: cc.Node, onMouseUp: Function, target?: any, onMouseEnter?: Function, onMouseMove?: Function, onMouseLeave?: Function, OnMoveDir?: Function);
|
|
clearNodeTounch(node: cc.Node);
|
|
//#endregion
|
|
|
|
setADWaitShow(btn_Reward: cc.Node | cc.Component);
|
|
|
|
GetPosRange(pos: Vec3, org: cc.Node, Traget: cc.Node, offset: IVec2Like);
|
|
|
|
GetNodeInScreenRect(node: cc.Node): { left: number, top: number, width: number, height: number };
|
|
|
|
}
|
|
|
|
/** 节点辅助工具 */
|
|
declare const CNodeUtils: CNodeUtilsEx;
|