当前位置:网站首页>白鹭egret添加新页面教程,如何添加新页面
白鹭egret添加新页面教程,如何添加新页面
2022-08-05 05:25:00 【花花省】
上一个教程中讲解了如何引入图片,如果图片作为一个按钮,点开一个跳转页面,怎么处理
1.首先打开需要引入的页面的ts文件定义一个按钮,比如我们定义为private btnXxl:eui.Button;
免费的egret视频学习资料
关注技术公众号【清兮科技】回复【egret】免费获取
2.写点击动作,打开下面的onTouchTap方法,加入点击事件,这里我们作为打开和主页面一样的界面的方式来实现,这里称之为切换游戏场景,使用SceneManager.instance.runScene(HuhuScene);方法切换游戏场景
3.新建ts文件,她继承于scenebase
4.新建exml文件 ,这里的模板自己写好(可自定义拖拽布局)
5.添加好了模板以后还需要再添加几个引入,首先是exml.e.d.ts
然后是打开manifest.json
然后再打开default.thm.json,添加一行代码,引入exml文件
在游戏项目根目录下添加引入js文件,因为项目执行debug的时候会生成相应的js
引入完成这些一个新的页面就可以打开了,如果需要打开一个弹出框,跟上面步骤几乎一样,
只是引入的ts文件最好是放在/src/layer/panel目录下
引入的exml模板文件放在resource/eui_skins/layer/panel目录下
然后使用UIManager.instance.popPanel打开弹出层!!!
边栏推荐
- 人人AI(吴恩达系列)
- 七种让盒子水平垂直居中的方法
- The size of the screen adaptation
- wc, grep, tar, vi/vim
- Autoware--Beike Tianhui rfans lidar uses the camera & lidar joint calibration file to verify the fusion effect of point cloud images
- Detailed explanation of ten solutions across domains (summary)
- 云计算基础-学习笔记
- GetEnumerator method and MoveNext and Reset methods in Unity
- The method of using ROS1 bag under ROS2
- 单片机原理与应用复习
猜你喜欢
随机推荐
Passing parameters in multiple threads
Collection of error records (write down when you encounter them)
通过反射获取Class对象的四种方式
Does flink cdc currently support Gauss database sources?
前置++和后置++的区别
滚动条问题,未解决
LaTeX 图片加标题 文本分栏自动换行
DevOps process demo (practical record)
数组&的运算
多用户商城多商户B2B2C拼团砍价秒杀支持小程序H5+APP全开源
Vim tutorial: vimtutor
ROS2下使用ROS1 bag的方法
Complete mysql offline installation in 5 minutes
Teach you simple steps to achieve industrial raspberries pie properly installed RS232 USB drive
BIO,NIO,AIO实践学习笔记(便于理解理论)
Difference between link and @improt
单片机原理与应用复习
The use of three parameters of ref, out, and Params in Unity3D
BIO, NIO, AIO practical study notes (easy to understand theory)
[问题已处理]-jenkins流水线checkout超时









