Full screen adaptation start of the game interface

Functional effects show

 

Operating Environment

Win7,Win8,Win10

Reworld version trial version

vc_redist.x64 operating environment

 

For zero-based supplementary readers

Download and install the corresponding version Reworld

Reworld official website link : http://www.reworlder.com/

Creator of Reworld 'Forum: http://bbs.reworlder.com

After you install after downloading registered account open air map

Download and install vc_redist.x64.rar operating environment

redist.x64 download link

 

Ideas analysis

Adaptive significance of making full-screen UI that allows the PC to edit the game to achieve the best display effect running on different proportions of mobile phone screen, this post is less a practice full-screen UI adaptive, and by clicking on "Start "button to close the full-screen UI to display the game scene.

Because of 2D plane UI can only exist on the client, so as long as the event by clicking on the UI indicate that the attribute change "false" uncheck it.

 

Function building

UI interface to build process

1. initialize and add the next 2D container interface and name it "menu." High and wide anchor base attribute parameter adjustment, the range of "menu" screen is covered at this time with the UI interface screen will automatically zoom ratio. As shown below:

2. Add an Image control in the "menu" as the background, adjusting the basic properties and the "menu" as covered screen, color burn, reduce transparency, add the appropriate image to make the game according to the needs at the time. As shown below:

3. Add to the menu button control , like the need to add a few a few, select a button to start the game as, rename it to "Start", and then add a text control under the button, the text will be changed to start the game. As shown below:

4. Finally add a button control in client script to turn off the "" is displayed. As shown below:

编写客户端脚本如下:

local start = script.Parent --定义脚本文件的父级(开始按钮)为start

start.OnClick:Connect(function() --点击按钮触发事件

    GameUI.菜单.IsVisable = false --将“主菜单”界面是否显示取消勾选

end) --通过点击(OnClick)事件修改UI界面的IsVisable属性,实现UI界面的关闭。

 

补充说明

1.什么是界面初始化?

存放客户端界面,不放置在此服务下的界面需要自行设置显示到客户端。服务对象。 

用于管理和设置默认角色的属性。

不可创建。  

不能用RWObject.Create()函数创建此对象。

不可删除。 

不能用Destroy()函数删除此对象。

不可复制。 

不能用Clone()函数复制此对象。

 

2.什么是2D容器界面?

   2D容器界面是显示在玩家屏幕上的2DUI对象的主要存储对象。UI对象若要显示在编辑器中,必须作为容器控件的子级。

游戏运行后,存放在界面初始化下的界面会复制到玩家界面下,只有在玩家界面下的界面才能在游戏中显示。

 

3.什么是按钮控件?

按钮控件用于响应来自用户的事件,经常用于启动或者确认某项操作使用。

 

4.什么是客户端脚本?

只会在客户端执行的脚本,执行的逻辑和表现也只会在本地客户端展现;可在以下几个文件目录下自动执行,客户端脚本在工作区下不会自动执行,需要放在以下对象里面: 

1. 客户端最先加载 。
2. 工作区中的角色模型玩家初始化中的角色初始化脚本,在运行后会自动移动到角色模型下。 
3. 玩家列表中的玩家玩家初始化中的玩家初始化脚本,在运行后会自动移动到玩家下 
4. 玩家玩家界面界面初始化的脚本,在运行后会自动移动到玩家界面下。 
5. 玩家的背包,例如工具里面的。

 

5.为什么要使用客户端脚本?

 2D平面UI是只在客户端存在并加载的,在服务器是没有2D平面UI的实体对象的,所以只能客户端脚本来对2D平面UI的信息进行更新修改。其他这种只在客户端存在的实体对象还有摄像机、鼠标、键盘等。

 

好了,接下来我们开始游戏,点击开始游戏按钮,就能关闭全屏UI啦。如果有什么问题或者有更好的实现方式,大家可以在下方积极交流讨论,我们也会参与进来和大家一起分享经验,期望能和大家共同进步~~

发布了35 篇原创文章 · 获赞 2 · 访问量 5813

Guess you like

Origin blog.csdn.net/weixin_41987154/article/details/103308625