Merge pull request #33 from BeamMP/gitlocalize-29842

Updated zh_Hans translations
This commit is contained in:
Starystars67 2024-06-08 21:28:54 +01:00 committed by GitHub
commit a85b3475e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 201 additions and 0 deletions

162
docs/zh/beamng/snippets.md Normal file
View File

@ -0,0 +1,162 @@
!!!警告“该网站正在建设当中!“
```
该网站仍在积极开发中。
觉得你能帮上忙?点击页面右侧的铅笔即可!
这也可以在任何页面上完成。
```
# BeamNG.drive代码片段
## Lua代码片段
### 绘制标记和车辆检测
在地图中绘制标记可能是向用户表明他们可以在那里进行某种形式的交互的最佳方式之一。
绘制标记相当容易。以下是如何绘制公交车路线标记的示例:
```Lua
local function createBusMarker(markerName)
local marker = createObject('TSStatic')
marker:setField('shapeName', 0, "art/shapes/interface/position_marker.dae")
marker:setPosition(vec3(0, 0, 0))
marker.scale = vec3(1, 1, 1)
marker:setField('rotation', 0, '1 0 0 0')
marker.useInstanceRenderData = true
marker:setField('instanceColor', 0, '1 1 1 0')
marker:setField('collisionType', 0, "Collision Mesh")
marker:setField('decalType', 0, "Collision Mesh")
marker:setField('playAmbient', 0, "1")
marker:setField('allowPlayerStep', 0, "1")
marker:setField('canSave', 0, "0")
marker:setField('canSaveDynamicFields', 0, "1")
marker:setField('renderNormals', 0, "0")
marker:setField('meshCulling', 0, "0")
marker:setField('originSort', 0, "0")
marker:setField('forceDetail', 0, "-1")
marker.canSave = false
marker:registerObject(markerName)
scenetree.MissionGroup:addObject(marker)
return marker
end
-- this can then be called in a loop to setup your markers.
-- NOTE: You should only do this once as part of your setup and not called on each frame.
if #markers == 0 then
for k,v in pairs(nameMarkers) do
local mk = scenetree.findObject(v)
if mk == nil then
log('I', logTag,'Creating marker '..tostring(v))
mk = createBusMarker(v)
ScenarioObjectsGroup:addObject(mk.obj)
end
table.insert(markers, mk)
end
end
```
以下是来自[BeamNG-FuelStations](https://github.com/BeamMP/BeamNG-FuelStations/tree/master)的自定义标记示例:
```Lua
local stations = [
{ "location": [ -778.813, 485.973, 23.46 ], "type":"gas" },
{ "location": [ 617.164, -192.107, 53.2 ], "type":"ev" },
]
local function IsEntityInsideArea(pos1, pos2, radius)
return pos1:distance(pos2) < radius
end
local onUpdate = function (dt)
for k, spot in pairs(stations) do -- loop through all spots on the current map
local bottomPos = vec3(spot.location[1], spot.location[2], spot.location[3])
local topPos = bottomPos + vec3(0,0,2) -- offset vec to get top position (2m tall)
local spotInRange = false -- is this spot in range? used for color
local spotCompatible = false -- is this spot compatible?
if activeVeh then -- we have a car and its ours (if in mp)
local vehPos = activeVeh:getPosition()
spotInRange = IsEntityInsideArea(vec3(vehPos.x, vehPos.y,vehPos.z), bottomPos, 1.5)
spotCompatible = activeFuelType == "any" or spot.type == "any" or activeFuelType == spot.type
end
local spotColor = (spotInRange and spotCompatible) and activeColorMap[spot.type] or inactiveColorMap[spot.type] or ColorF(1,1,1,0.5)
debugDrawer:drawCylinder(bottomPos:toPoint3F(), topPos:toPoint3F(), 1, spotColor) --bottom, top, radius, color
end
end
```
### guihooks示例
#### Toast通知位于屏幕右上角
![图像](https://github.com/StanleyDudek/Docs/assets/49531350/c8a87842-b95a-4eca-84dc-93072ecc9158)
```lua
--guihooks.trigger('toastrMsg', {type, title, msg, config = {timeOut}})
guihooks.trigger('toastrMsg', {type = "info", title = "Info Message:", msg = "Info Message Text Here", config = {timeOut = 5000}})
guihooks.trigger('toastrMsg', {type = "warning", title = "Warning Message:", msg = "Warning Message Text Here", config = {timeOut = 5000}})
guihooks.trigger('toastrMsg', {type = "error", title = "Error Message:", msg = "Error Message Text Here", config = {timeOut = 5000}})
```
#### 消息通知,消息应用程序中默认位于屏幕左上角
![图像](https://github.com/StanleyDudek/Docs/assets/49531350/6baef813-50cb-43c3-9c59-0de550b014b6)
```lua
--guihooks.trigger('Message', {msg, ttl, category, icon}) --requires Messages app
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "arrow_upward", icon = "arrow_upward"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "arrow_downward", icon = "arrow_downward"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "flag", icon = "flag"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "check", icon = "check"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "check_circle", icon = "check_circle"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "warning", icon = "warning"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "error", icon = "error"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "directions_car", icon = "directions_car"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "star", icon = "star"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "timeline", icon = "timeline"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "save", icon = "save"})
guihooks.trigger('Message', {msg = "Message Text Here", ttl = 5.0, category = "settings", icon = "settings"})
```
#### 位于中心,大,小型短暂显示
![图像](https://github.com/StanleyDudek/Docs/assets/49531350/d0cf754f-83f8-4d15-9159-27350da127de)![图像](https://github.com/StanleyDudek/Docs/assets/49531350/1df6fc9b-756f-484e-b8d9-5df346dc4c26)
```lua
--guihooks.trigger('ScenarioFlashMessage', {{msg, ttl, sound, big}} ) -- requires RaceCountdown ui app
guihooks.trigger('ScenarioFlashMessage', {{"Message", 5.0, 0, true}} )
guihooks.trigger('ScenarioFlashMessage', {{"Message Text Here", 5.0, 0, false}} )
--countdown example, when all executed at once, the items are queued and will follow eachother after the previous ttl expires
guihooks.trigger('ScenarioFlashMessage', {{"3", 1.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_Countdown1')", true}})
guihooks.trigger('ScenarioFlashMessage', {{"2", 1.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_Countdown2')", true}})
guihooks.trigger('ScenarioFlashMessage', {{"1", 1.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_Countdown3')", true}})
guihooks.trigger('ScenarioFlashMessage', {{"GO!", 3.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_CountdownGo')", true}})
--another sound example
guihooks.trigger('ScenarioFlashMessage', {{"Teleported!", 3.0, "Engine.Audio.playOnce('AudioGui', 'event:UI_Checkpoint')", false}})
```
#### 位于中心,中型持续显示
![图像](https://github.com/StanleyDudek/Docs/assets/49531350/6290e018-6b3d-4674-98f2-34282a723258)
```lua
--guihooks.trigger('ScenarioRealtimeDisplay', {msg = msg} ) -- requires Race Realtime Display ui app
guihooks.trigger('ScenarioRealtimeDisplay', {msg = "Message Text Here"} )
--these messages persist, clear with a blank string
--if you are running live data, this is a good one to update rapidly (think timers, distance calcs, et cetera)
guihooks.trigger('ScenarioRealtimeDisplay', {msg = ""} )
```
## IMGUI代码片段
## CEF UI代码片段

View File

@ -0,0 +1,39 @@
# 入门
---
## **开始之前**
BeamMP仅与Steam正版的游戏版本兼容。不支持”盗版“版本。
---
## **安装**
BeamMP目前仅与Windows系统原生兼容。
### **Windows安装**
1. 访问[beammp.com](https://beammp.com/)并点击“Download Client”按钮。
2. 解压`BeamMP_Installer.zip`
3. 运行`BeamMP_Installer.exe`并按照说明进行操作。
4. BeamMP启动器图标应将出现在您的桌面上。如果没有只需在Windows搜索栏中搜索“BeamMP”即可。
5. 启动器运行后,您应该会看到一个终端窗口,随即 BeamNG.drive将自动运行。**请勿**关闭终端窗口。
6. BeamNG启动后在主菜单中点击`联机模式`即可开始多人游戏。
7. 系统将提示您登录或以访客身份游玩(并非所有服务器都允许访客)。您可以在我们的[论坛](https://forum.beammp.com)上创建一个帐户然后使用相同的凭据登录BeamMP。
8. 选择您感兴趣的任何服务器,然后点击`连接` 。尽情享受吧!
注意:*当您加载到已有多辆载具的地图时,加入可能需要比预期更长的时间。*
## **Linux安装**
BeamMP应该可以用`wine`来使用,但(还)没有官方支持。
---
## **已知问题**
- 如果您未看到”联机模式“按钮。确保BeamMP模组已在“模组管理器”中激活然后尝试按下CTRL+L。
- 另外请确保BeamMP是“模组管理器”中**唯一**激活的模组,否则可能会导致问题。
如果您需要更多安装帮助,欢迎您在我们的[论坛](https://forum.beammp.com)上发帖或在我们的[Discord服务器](https://discord.gg/beammp)上提问(仅英文)。