//********************* // create by 流云 // 插件自动生成的节点脚本 // 请勿修改(自动生成会覆盖) // 请通过子类继承使用 // 如何生成可直接调用的UI节点和组件? // 1.在场景节点树中选中要生成的UI根节点 // 2.点击菜单"tool"->“生成UI脚本” 或者使用快捷键(快捷键:Ctrl+Shift+C) // 3.点击后会在script/ui/目录中生成一个以选中节点命名的文件夹,文件夹中会生成两个脚本文件,“Auto_”开头的就是本文件,不可修改,另一个是“UI”+选中节点名称命名的脚本文件,可修改,是需要挂载到选中节点的脚本文件,给用户使用的写逻辑的脚本,只会生成一次 // 4.找到第3步描述的“UI”+选中节点名称命名的脚本文件,将其挂载到选中节点上(第一生成需要挂载,后续修改场景,重复生成的时候,该脚本不会再生成,不用担心会覆盖逻辑脚本) // 下面是类型示例 // 1.按钮,节点名以“btn_”或者“Btn_”开头或者节点添加了Button组件, 例:btn_Close,会生成btn_Close节点和click_btn_Close()方法 // 2.标签,节点名以“lb_”开头, 例:lb_title,会生成lb_title的Label组件 // 3.输入框,节点名以“eb_”开头, 例:eb_input,会生成eb_input的EditBox组件 // 4.滚动视图,节点名以“sv_”开头, 例:sv_list,会生成sv_list的ScrollView组件 // 5.图片,节点名以“img_”或者sp_“”开头, 例:img_Icon,会生成img_Icon的Sprite组件 // 6.普通节点,节点名以“ui_”或者“Ui_”或者“UI_”开头, 例:ui_Content,会生成ui_Content的Node节点 //********************* import { _decorator, Component, Node, find, Sprite, Label, Button, ScrollView, EditBox, RichText } from 'cc'; import { UIBase } from '../../../mx/module/ui/UIBase'; const { ccclass } = _decorator; @ccclass('Auto_PanelHome') export class Auto_PanelHome extends UIBase { ui_bg:Node; ui_diffbg_2:Node; ui_bottomCloud:Node; ui_center:Node; ui_power:Node; lb_combatPower:Label; ui_levelSelect:Node; ui_chapterNode:Node; ui_lockStatus:Node; ui_finishStatus:Node; ui_title:Node; ui_titlebg:Node; lb_chapter:Label; lb_chapterName:Label; ui_Box:Node; sp_progress:Sprite; ui_boxBtns:Node; btnBox1:Node; btnBox2:Node; btnBox3:Node; ui_rewardLayer:Node; ui_ItemReward:Node; ItemGrid:Node; btnOutLine:Node; ui_task:Node; ui_btns:Node; lb_status:Label; btnStart:Node; ui_tilitag:Node; lb_needVigour:Label; lb_tilifree:Label; btnLeft:Node; btnRight:Node; btnBack:Node; ui_leftBtns:Node; ui_leftTopBtns:Node; btnSetting:Node; btnSignIn:Node; btnEntrance:Node; btnMoreGame:Node; ui_leftMidBtns:Node; btnFirstBag:Node; btnfund:Node; btnValueGift:Node; ui_RightBtns:Node; ui_RightTopBtns:Node; btnTask:Node; btnLevel:Node; btnRank:Node; btnNotice:Node; btnSupergift:Node; ui_RightMidBtns:Node; btnMonthlyCard:Node; btnDayGift:Node; btnInvite:Node; ui_topBtns:Node; btnFeedback:Node; btnAddDesk:Node; onLoad(){ super.onLoad(); this.ui_bg = find("ui_bg",this.node); this.ui_diffbg_2 = find("ui_bg/ui_diffbg_2",this.node); this.ui_bottomCloud = find("ui_bg/ui_bottomCloud",this.node); this.ui_center = find("ui_center",this.node); this.ui_power = find("ui_center/ui_power",this.node); this.lb_combatPower = find("ui_center/ui_power/lb_combatPower",this.node)?.getComponent(Label); this.ui_levelSelect = find("ui_center/ui_levelSelect",this.node); this.ui_chapterNode = find("ui_center/ui_levelSelect/ui_chapterNode",this.node); this.ui_lockStatus = find("ui_center/ui_levelSelect/ui_lockStatus",this.node); this.ui_finishStatus = find("ui_center/ui_levelSelect/ui_finishStatus",this.node); this.ui_title = find("ui_center/ui_title",this.node); this.ui_titlebg = find("ui_center/ui_title/ui_titlebg",this.node); this.lb_chapter = find("ui_center/ui_title/lb_chapter",this.node)?.getComponent(Label); this.lb_chapterName = find("ui_center/ui_title/lb_chapterName",this.node)?.getComponent(Label); this.ui_Box = find("ui_center/ui_Box",this.node); this.sp_progress = find("ui_center/ui_Box/sp_progress",this.node)?.getComponent(Sprite); this.ui_boxBtns = find("ui_center/ui_Box/ui_boxBtns",this.node); this.btnBox1 = find("ui_center/ui_Box/ui_boxBtns/btnBox1",this.node); this.btnBox2 = find("ui_center/ui_Box/ui_boxBtns/btnBox2",this.node); this.btnBox3 = find("ui_center/ui_Box/ui_boxBtns/btnBox3",this.node); this.ui_rewardLayer = find("ui_center/ui_rewardLayer",this.node); this.ui_ItemReward = find("ui_center/ui_rewardLayer/ui_ItemReward",this.node); this.ItemGrid = find("ui_center/ui_rewardLayer/ui_ItemReward/ItemGrid",this.node); this.btnOutLine = find("ui_center/btnOutLine",this.node); this.bindDynamicHomeNodes(); } /** 动态挂载 ui_task / ui_btns / ui_leftBtns / ui_RightBtns / ui_topBtns 后重新绑定节点引用 */ bindDynamicHomeNodes() { this.ui_task = find("ui_center/ui_task",this.node); this.ui_btns = find("ui_center/ui_btns",this.node); this.lb_status = find("ui_center/ui_btns/lb_status",this.node)?.getComponent(Label); this.btnStart = find("ui_center/ui_btns/btnStart",this.node); this.ui_tilitag = find("ui_center/ui_btns/btnStart/按钮体力框/ui_tilitag",this.node); this.lb_needVigour = find("ui_center/ui_btns/btnStart/按钮体力框/lb_needVigour",this.node)?.getComponent(Label); this.lb_tilifree = find("ui_center/ui_btns/btnStart/按钮体力框/lb_tilifree",this.node)?.getComponent(Label); this.btnLeft = find("ui_center/ui_btns/btnLeft",this.node); this.btnRight = find("ui_center/ui_btns/btnRight",this.node); this.btnBack = find("ui_center/ui_btns/btnBack",this.node); this.ui_leftBtns = find("ui_center/ui_leftBtns",this.node); this.ui_leftTopBtns = find("ui_center/ui_leftBtns/ui_leftTopBtns",this.node); this.btnSetting = find("ui_center/ui_leftBtns/ui_leftTopBtns/btnSetting",this.node); this.btnSignIn = find("ui_center/ui_leftBtns/ui_leftTopBtns/btnSignIn",this.node); this.btnEntrance = find("ui_center/ui_leftBtns/ui_leftTopBtns/btnEntrance",this.node); this.btnMoreGame = find("ui_center/ui_leftBtns/ui_leftTopBtns/btnMoreGame",this.node); this.ui_leftMidBtns = find("ui_center/ui_leftBtns/ui_leftMidBtns",this.node); this.btnFirstBag = find("ui_center/ui_leftBtns/ui_leftMidBtns/btnFirstBag",this.node); this.btnfund = find("ui_center/ui_leftBtns/ui_leftMidBtns/btnfund",this.node); this.btnValueGift = find("ui_center/ui_leftBtns/ui_leftMidBtns/btnValueGift",this.node); this.ui_RightBtns = find("ui_center/ui_RightBtns",this.node); this.ui_RightTopBtns = find("ui_center/ui_RightBtns/ui_RightTopBtns",this.node); this.btnTask = find("ui_center/ui_RightBtns/ui_RightTopBtns/btnTask",this.node); this.btnLevel = find("ui_center/ui_RightBtns/ui_RightTopBtns/btnLevel",this.node); this.btnRank = find("ui_center/ui_RightBtns/ui_RightTopBtns/btnRank",this.node); this.btnNotice = find("ui_center/ui_RightBtns/ui_RightTopBtns/btnNotice",this.node); this.btnSupergift = find("ui_center/ui_RightBtns/ui_RightTopBtns/btnSupergift",this.node); this.ui_RightMidBtns = find("ui_center/ui_RightBtns/ui_RightMidBtns",this.node); this.btnMonthlyCard = find("ui_center/ui_RightBtns/ui_RightMidBtns/btnMonthlyCard",this.node); this.btnDayGift = find("ui_center/ui_RightBtns/ui_RightMidBtns/btnDayGift",this.node); this.btnInvite = find("ui_center/ui_RightBtns/ui_RightMidBtns/btnInvite",this.node); this.ui_topBtns = find("ui_center/ui_topBtns",this.node); this.btnFeedback = find("ui_center/ui_topBtns/btnFeedback",this.node); this.btnAddDesk = find("ui_center/ui_topBtns/btnAddDesk",this.node); } onEnable() { this.btnBox1?.on(Node.EventType.TOUCH_END, this.click_btnBox1, this); this.btnBox2?.on(Node.EventType.TOUCH_END, this.click_btnBox2, this); this.btnBox3?.on(Node.EventType.TOUCH_END, this.click_btnBox3, this); this.ItemGrid?.on(Node.EventType.TOUCH_END, this.click_ItemGrid, this); this.btnOutLine?.on(Node.EventType.TOUCH_END, this.click_btnOutLine, this); this.bindDynamicHomeEvents(true); } onDisable() { this.btnBox1?.off(Node.EventType.TOUCH_END, this.click_btnBox1, this); this.btnBox2?.off(Node.EventType.TOUCH_END, this.click_btnBox2, this); this.btnBox3?.off(Node.EventType.TOUCH_END, this.click_btnBox3, this); this.ItemGrid?.off(Node.EventType.TOUCH_END, this.click_ItemGrid, this); this.btnOutLine?.off(Node.EventType.TOUCH_END, this.click_btnOutLine, this); this.bindDynamicHomeEvents(false); } /** 动态子预制上的按钮事件(节点未创建时安全跳过) */ bindDynamicHomeEvents(bind: boolean) { const op = bind ? 'on' : 'off'; this.btnStart?.[op](Node.EventType.TOUCH_END, this.click_btnStart, this); this.btnLeft?.[op](Node.EventType.TOUCH_END, this.click_btnLeft, this); this.btnRight?.[op](Node.EventType.TOUCH_END, this.click_btnRight, this); this.btnBack?.[op](Node.EventType.TOUCH_END, this.click_btnBack, this); this.btnSetting?.[op](Node.EventType.TOUCH_END, this.click_btnSetting, this); this.btnSignIn?.[op](Node.EventType.TOUCH_END, this.click_btnSignIn, this); this.btnEntrance?.[op](Node.EventType.TOUCH_END, this.click_btnEntrance, this); this.btnMoreGame?.[op](Node.EventType.TOUCH_END, this.click_btnMoreGame, this); this.btnFirstBag?.[op](Node.EventType.TOUCH_END, this.click_btnFirstBag, this); this.btnfund?.[op](Node.EventType.TOUCH_END, this.click_btnfund, this); this.btnValueGift?.[op](Node.EventType.TOUCH_END, this.click_btnValueGift, this); this.btnTask?.[op](Node.EventType.TOUCH_END, this.click_btnTask, this); this.btnLevel?.[op](Node.EventType.TOUCH_END, this.click_btnLevel, this); this.btnRank?.[op](Node.EventType.TOUCH_END, this.click_btnRank, this); this.btnNotice?.[op](Node.EventType.TOUCH_END, this.click_btnNotice, this); this.btnSupergift?.[op](Node.EventType.TOUCH_END, this.click_btnSupergift, this); this.btnMonthlyCard?.[op](Node.EventType.TOUCH_END, this.click_btnMonthlyCard, this); this.btnDayGift?.[op](Node.EventType.TOUCH_END, this.click_btnDayGift, this); this.btnInvite?.[op](Node.EventType.TOUCH_END, this.click_btnInvite, this); // btnFeedback / btnAddDesk 由 ui_topBtns 上的 topNode 自行绑定 } click_btnBox1() {} click_btnBox2() {} click_btnBox3() {} click_ItemGrid() {} click_btnOutLine() {} click_btnStart() {} click_btnLeft() {} click_btnRight() {} click_btnBack() {} click_btnSetting() {} click_btnSignIn() {} click_btnEntrance() {} click_btnMoreGame() {} click_btnFirstBag() {} click_btnfund() {} click_btnValueGift() {} click_btnTask() {} click_btnLevel() {} click_btnRank() {} click_btnNotice() {} click_btnSupergift() {} click_btnMonthlyCard() {} click_btnDayGift() {} click_btnInvite() {} }