├── dependencies
└── client
│ ├── MenuAPI.dll
│ └── Newtonsoft.Json.dll
├── EnhancedCamera
├── dist
│ ├── __resource.lua
│ └── config.ini
├── Language.cs
├── Properties
│ └── AssemblyInfo.cs
├── EnhancedCamera.csproj
├── langs
│ ├── zh_CN.cs
│ ├── zh_TW.cs
│ └── en_US.cs
├── MainMenu.cs
└── menus
│ ├── DroneCam.cs
│ └── CustomCam.cs
├── LICENSE
├── EnhancedCamera.sln
├── README.md
└── .gitignore
/dependencies/client/MenuAPI.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shrimpey/FiveM-Enhanced-Camera/HEAD/dependencies/client/MenuAPI.dll
--------------------------------------------------------------------------------
/dependencies/client/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shrimpey/FiveM-Enhanced-Camera/HEAD/dependencies/client/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/EnhancedCamera/dist/__resource.lua:
--------------------------------------------------------------------------------
1 | resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5'
2 |
3 | files {
4 | 'MenuAPI.dll',
5 | 'config.ini'
6 | }
7 |
8 | client_script {
9 | 'enhancedcamera.net.dll',
10 | 'Newtonsoft.Json.dll'
11 | }
--------------------------------------------------------------------------------
/EnhancedCamera/dist/config.ini:
--------------------------------------------------------------------------------
1 | #The Control to toggle the Menu (default is 344=F11) list at https://wiki.fivem.net/wiki/Controls
2 | toggleMenu=344
3 | #Should chase camera be enabled for users to select? (1 - yes, 0 - no)
4 | chaseCameraEnabled=1
5 | #Should drone camera be enabled for users to select? (1 - yes, 0 - no)
6 | droneCameraEnabled=1
--------------------------------------------------------------------------------
/EnhancedCamera/Language.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using CitizenFX.Core;
8 | using static CitizenFX.Core.Native.API;
9 | using CustomCamera.langs;
10 |
11 | namespace CustomCamera {
12 | class Language {
13 | public static string get(string key) {
14 | if (MainMenu.langData != null) {
15 | if (MainMenu.langData.ContainsKey(key)) {
16 | return (string)MainMenu.langData[key];
17 | }
18 | }
19 | return key;
20 | }
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/EnhancedCamera/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle("Enhanced Camera")]
5 | [assembly: AssemblyDescription("Custom camera options")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("")]
8 | [assembly: AssemblyProduct("Enhanced Camera")]
9 | [assembly: AssemblyCopyright("Copyright © 2019")]
10 | [assembly: AssemblyTrademark("")]
11 | [assembly: AssemblyCulture("")]
12 |
13 | [assembly: ComVisible(false)]
14 |
15 | [assembly: Guid("09ebf4dd-b196-4eb4-a1fe-b4aaad0b4023")]
16 |
17 | [assembly: AssemblyVersion("1.0.0.0")]
18 | [assembly: AssemblyFileVersion("1.0.0.0")]
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Luke Kabat
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/EnhancedCamera.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26430.16
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnhancedCamera", "EnhancedCamera\EnhancedCamera.csproj", "{09EBF4DD-B196-4EB4-A1FE-B4AAAD0B4023}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {09EBF4DD-B196-4EB4-A1FE-B4AAAD0B4023}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {09EBF4DD-B196-4EB4-A1FE-B4AAAD0B4023}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {09EBF4DD-B196-4EB4-A1FE-B4AAAD0B4023}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {09EBF4DD-B196-4EB4-A1FE-B4AAAD0B4023}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {63101A63-FCD6-4BAF-A917-6641850D413D}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Enhanced Camera
2 |
3 | ## Overview of the menu
4 | This menu recreates vehicle camera from scratch and introduces a number of customizable parameters for user to tune. On top of that there is a drone camera with a few modes to simulate drone flight.
5 |
6 |
7 |
8 |
9 |
10 | Main features of this menu:
11 | - **Lead camera** - main camera, rotates around car dependant on angular velocity of the vehicle
12 | - **Chase camera** - focuses on closest vehicle and points towards it
13 | - **Drone camera** - simulates drone physics, allows choice between different modes (race, zero-G, spectator, homing)
14 | - **Customizable parameters** - FOV, XYZ position offsets, interpolation values and more
15 | - **Saving/loading** - save and load camera parameters or choose from default presets
16 |
17 | ## Installation
18 |
19 | Go to [releases](https://github.com/Shrimpey/EnhancedCamera/releases) and download latest zipped release. Unzip and place ``enhancedcamera`` folder inside your server's ``resources`` folder, then edit your server.cfg to include line ``start enhancedcamera``.
20 |
21 | ## Parameters overview
22 |
23 | It's best to just experiment with parameters to see how they affect camera handling (for lead/chase camera you can start by spawning a preset from submenu).
24 | #### Lead and chase camera parameters:
25 | - **Lock position offset** - determines whether camera changes position compared to vehicle (or just rotates)
26 | - **Linear position offset** - experimental feature, camera changes position along the line drawn behind vehicle instead of doing circular motion around the car
27 | - **Lock rotation to camera plane** - changes the way that camera rotates around car (mostly visible on uneven ground)
28 | - **Modifier** - this modifier * angular velocity = target rotation. Higher values make camera move further from lock. (-1,1)
29 | - **Yaw interpolation** - lower values - smoother movement along yaw axis (0,1)
30 | - **Roll interpolation** - lower values - smoother movement along roll axis (0,1)
31 | - **Pitch interpolation** - lower values - smoother movement along pitch axis (0,1)
32 | - **Camera offset** - offsets chase camera target towards its velocity vector. (0,5)
33 | - **Position interpolation** - lower values - smoother movement, higher delay. (0,1)
34 | - **FOV** - changes field of view, may affect performance with higher values (20,120)
35 | - **X/Y/Z Offset** - static position offset in XYZ direction
36 | - **Max angle to lock** - for chase camera only, max angle from velocity vector to keep the lock on, if angle exceeds this limit, camera switches back to normal. (25,360)
37 |
38 | ## Examples/showcase
39 |
40 | [](https://youtu.be/JL7sxyNec_g)
41 |
42 | ## Credits
43 | - [Tom Grobbe](https://github.com/TomGrobbe) - [MenuAPI](https://github.com/TomGrobbe/MenuAPI) used for GUI, code snippets from [vMenu](https://github.com/TomGrobbe/vMenu) used for saving/loading camera parameters
44 | - [QuadrupleTurbo](https://github.com/QuadrupleTurbo) - providing new ideas for features, massive help with playtesting
45 | - [No Name Drift](https://nonamedrift.com/) and [Velocity](http://www.velocitydrift.com/) servers - playtesting and feedback
46 |
--------------------------------------------------------------------------------
/EnhancedCamera/EnhancedCamera.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {09EBF4DD-B196-4EB4-A1FE-B4AAAD0B4023}
8 | Library
9 | Properties
10 | enhancedcamera
11 | enhancedcamera.net
12 | v4.5.2
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 | False
36 | F:\Fivem\FiveM.app\citizen\clr2\lib\mono\4.5\CitizenFX.Core.dll
37 |
38 |
39 | F:\Fivem\FiveM.app\citizen\clr2\lib\mono\4.5\CitizenFX.Core.Client.dll
40 |
41 |
42 | False
43 | ..\dependencies\client\MenuAPI.dll
44 |
45 |
46 | ..\..\..\vStancer+sl_sh\fivem-vstancer\VStancer.Client\Newtonsoft.Json.dll
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | copy /y "$(TargetPath)" "D:\FiveM\ServerData\resources\enhancedcamera"
64 | copy /y "$(SolutionDir)EnhancedCamera\dist\__resource.lua" "D:\FiveM\ServerData\resources\enhancedcamera\__resource.lua"
65 | copy /y "$(SolutionDir)EnhancedCamera\dist\config.ini" "D:\FiveM\ServerData\resources\enhancedcamera\config.ini"
66 | copy /y "$(SolutionDir)dependencies\client\MenuAPI.dll" "D:\FiveM\ServerData\resources\enhancedcamera\MenuAPI.dll"
67 | copy /y "$(SolutionDir)dependencies\client\Newtonsoft.Json.dll" "D:\FiveM\ServerData\resources\enhancedcamera\Newtonsoft.Json.dll"
68 |
69 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015/2017 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # Visual Studio 2017 auto generated files
33 | Generated\ Files/
34 |
35 | # MSTest test Results
36 | [Tt]est[Rr]esult*/
37 | [Bb]uild[Ll]og.*
38 |
39 | # NUNIT
40 | *.VisualState.xml
41 | TestResult.xml
42 |
43 | # Build Results of an ATL Project
44 | [Dd]ebugPS/
45 | [Rr]eleasePS/
46 | dlldata.c
47 |
48 | # Benchmark Results
49 | BenchmarkDotNet.Artifacts/
50 |
51 | # .NET Core
52 | project.lock.json
53 | project.fragment.lock.json
54 | artifacts/
55 | **/Properties/launchSettings.json
56 |
57 | # StyleCop
58 | StyleCopReport.xml
59 |
60 | # Files built by Visual Studio
61 | *_i.c
62 | *_p.c
63 | *_i.h
64 | *.ilk
65 | *.meta
66 | *.obj
67 | *.iobj
68 | *.pch
69 | *.pdb
70 | *.ipdb
71 | *.pgc
72 | *.pgd
73 | *.rsp
74 | *.sbr
75 | *.tlb
76 | *.tli
77 | *.tlh
78 | *.tmp
79 | *.tmp_proj
80 | *.log
81 | *.vspscc
82 | *.vssscc
83 | .builds
84 | *.pidb
85 | *.svclog
86 | *.scc
87 |
88 | # Chutzpah Test files
89 | _Chutzpah*
90 |
91 | # Visual C++ cache files
92 | ipch/
93 | *.aps
94 | *.ncb
95 | *.opendb
96 | *.opensdf
97 | *.sdf
98 | *.cachefile
99 | *.VC.db
100 | *.VC.VC.opendb
101 |
102 | # Visual Studio profiler
103 | *.psess
104 | *.vsp
105 | *.vspx
106 | *.sap
107 |
108 | # Visual Studio Trace Files
109 | *.e2e
110 |
111 | # TFS 2012 Local Workspace
112 | $tf/
113 |
114 | # Guidance Automation Toolkit
115 | *.gpState
116 |
117 | # ReSharper is a .NET coding add-in
118 | _ReSharper*/
119 | *.[Rr]e[Ss]harper
120 | *.DotSettings.user
121 |
122 | # JustCode is a .NET coding add-in
123 | .JustCode
124 |
125 | # TeamCity is a build add-in
126 | _TeamCity*
127 |
128 | # DotCover is a Code Coverage Tool
129 | *.dotCover
130 |
131 | # AxoCover is a Code Coverage Tool
132 | .axoCover/*
133 | !.axoCover/settings.json
134 |
135 | # Visual Studio code coverage results
136 | *.coverage
137 | *.coveragexml
138 |
139 | # NCrunch
140 | _NCrunch_*
141 | .*crunch*.local.xml
142 | nCrunchTemp_*
143 |
144 | # MightyMoose
145 | *.mm.*
146 | AutoTest.Net/
147 |
148 | # Web workbench (sass)
149 | .sass-cache/
150 |
151 | # Installshield output folder
152 | [Ee]xpress/
153 |
154 | # DocProject is a documentation generator add-in
155 | DocProject/buildhelp/
156 | DocProject/Help/*.HxT
157 | DocProject/Help/*.HxC
158 | DocProject/Help/*.hhc
159 | DocProject/Help/*.hhk
160 | DocProject/Help/*.hhp
161 | DocProject/Help/Html2
162 | DocProject/Help/html
163 |
164 | # Click-Once directory
165 | publish/
166 |
167 | # Publish Web Output
168 | *.[Pp]ublish.xml
169 | *.azurePubxml
170 | # Note: Comment the next line if you want to checkin your web deploy settings,
171 | # but database connection strings (with potential passwords) will be unencrypted
172 | *.pubxml
173 | *.publishproj
174 |
175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
176 | # checkin your Azure Web App publish settings, but sensitive information contained
177 | # in these scripts will be unencrypted
178 | PublishScripts/
179 |
180 | # NuGet Packages
181 | *.nupkg
182 | # The packages folder can be ignored because of Package Restore
183 | **/[Pp]ackages/*
184 | # except build/, which is used as an MSBuild target.
185 | !**/[Pp]ackages/build/
186 | # Uncomment if necessary however generally it will be regenerated when needed
187 | #!**/[Pp]ackages/repositories.config
188 | # NuGet v3's project.json files produces more ignorable files
189 | *.nuget.props
190 | *.nuget.targets
191 |
192 | # Microsoft Azure Build Output
193 | csx/
194 | *.build.csdef
195 |
196 | # Microsoft Azure Emulator
197 | ecf/
198 | rcf/
199 |
200 | # Windows Store app package directories and files
201 | AppPackages/
202 | BundleArtifacts/
203 | Package.StoreAssociation.xml
204 | _pkginfo.txt
205 | *.appx
206 |
207 | # Visual Studio cache files
208 | # files ending in .cache can be ignored
209 | *.[Cc]ache
210 | # but keep track of directories ending in .cache
211 | !*.[Cc]ache/
212 |
213 | # Others
214 | ClientBin/
215 | ~$*
216 | *~
217 | *.dbmdl
218 | *.dbproj.schemaview
219 | *.jfm
220 | *.pfx
221 | *.publishsettings
222 | orleans.codegen.cs
223 |
224 | # Including strong name files can present a security risk
225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
226 | #*.snk
227 |
228 | # Since there are multiple workflows, uncomment next line to ignore bower_components
229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
230 | #bower_components/
231 |
232 | # RIA/Silverlight projects
233 | Generated_Code/
234 |
235 | # Backup & report files from converting an old project file
236 | # to a newer Visual Studio version. Backup files are not needed,
237 | # because we have git ;-)
238 | _UpgradeReport_Files/
239 | Backup*/
240 | UpgradeLog*.XML
241 | UpgradeLog*.htm
242 | ServiceFabricBackup/
243 | *.rptproj.bak
244 |
245 | # SQL Server files
246 | *.mdf
247 | *.ldf
248 | *.ndf
249 |
250 | # Business Intelligence projects
251 | *.rdl.data
252 | *.bim.layout
253 | *.bim_*.settings
254 | *.rptproj.rsuser
255 |
256 | # Microsoft Fakes
257 | FakesAssemblies/
258 |
259 | # GhostDoc plugin setting file
260 | *.GhostDoc.xml
261 |
262 | # Node.js Tools for Visual Studio
263 | .ntvs_analysis.dat
264 | node_modules/
265 |
266 | # Visual Studio 6 build log
267 | *.plg
268 |
269 | # Visual Studio 6 workspace options file
270 | *.opt
271 |
272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
273 | *.vbw
274 |
275 | # Visual Studio LightSwitch build output
276 | **/*.HTMLClient/GeneratedArtifacts
277 | **/*.DesktopClient/GeneratedArtifacts
278 | **/*.DesktopClient/ModelManifest.xml
279 | **/*.Server/GeneratedArtifacts
280 | **/*.Server/ModelManifest.xml
281 | _Pvt_Extensions
282 |
283 | # Paket dependency manager
284 | .paket/paket.exe
285 | paket-files/
286 |
287 | # FAKE - F# Make
288 | .fake/
289 |
290 | # JetBrains Rider
291 | .idea/
292 | *.sln.iml
293 |
294 | # CodeRush
295 | .cr/
296 |
297 | # Python Tools for Visual Studio (PTVS)
298 | __pycache__/
299 | *.pyc
300 |
301 | # Cake - Uncomment if you are using it
302 | # tools/**
303 | # !tools/packages.config
304 |
305 | # Tabs Studio
306 | *.tss
307 |
308 | # Telerik's JustMock configuration file
309 | *.jmconfig
310 |
311 | # BizTalk build output
312 | *.btp.cs
313 | *.btm.cs
314 | *.odx.cs
315 | *.xsd.cs
316 |
317 | # OpenCover UI analysis results
318 | OpenCover/
319 |
320 | # Azure Stream Analytics local run output
321 | ASALocalRun/
322 |
323 | # MSBuild Binary and Structured Log
324 | *.binlog
325 |
326 | # NVidia Nsight GPU debugger configuration file
327 | *.nvuser
328 |
329 | # MFractors (Xamarin productivity tool) working folder
330 | .mfractor/
331 |
--------------------------------------------------------------------------------
/EnhancedCamera/langs/zh_CN.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace CustomCamera.langs {
9 | class zh_CN {
10 | public Hashtable data() {
11 |
12 | Hashtable ht = new Hashtable();
13 |
14 | // Main Menu
15 | ht.Add("MAIN_MENU_TITLE", "增强型游戏镜头");
16 | ht.Add("MAIN_MENU_DESC", "高级镜头和无人机镜头设置");
17 | ht.Add("MAIN_MENU_ENABLE_LEAD", "启用漂移镜头");
18 | ht.Add("MAIN_MENU_ENABLE_CHASE", "启用追踪镜头");
19 | ht.Add("MAIN_MENU_ENABLE_DRONE", "启用无人机镜头");
20 | ht.Add("MAIN_MENU_ENABLE_LEAD_DESC", "主镜头,行为取决于汽车的漂移角度和速度");
21 | ht.Add("MAIN_MENU_ENABLE_CHASE_DESC", "锁定前方目标,如果目标不在范围内,则切换到普通镜头");
22 | ht.Add("MAIN_MENU_ENABLE_DRONE_DESC", "自由无人机镜头,提供不同的模式,例如穿梭机和无重力飞行");
23 | ht.Add("MAIN_MENU_LEAD_CHASE_CONF", "漂移和追踪镜头设定");
24 | ht.Add("MAIN_MENU_DRONE_CONF", "无人机镜头设定");
25 | ht.Add("MAIN_MENU_LEAD_CHASE_CONF_DESC", "修改漂移或追踪镜头的参数设定");
26 | ht.Add("MAIN_MENU_DRONE_CONF_DESC", "修改无人机镜头的参数设定");
27 | ht.Add("MAIN_MENU_CREDITS", "鸣谢");
28 | ht.Add("MAIN_MENU_CREDITS_DESC", "~g~Shrimp~s~ - 提供想法并实现\n" +
29 | "~g~Tom Grobbe~s~ - MenuAPI 界面库的作者,以及保存和加载设定的代码\n" +
30 | "~g~QuadrupleTurbo~s~ - 提供想法并帮助测试\n" +
31 | "~y~No Name Drift~s~ 和 ~y~Velocity~s~ 漂移服务器进行游戏测试和反馈\n" +
32 | "~y~ZeroDream~s~ 增加多语言支持以及中文翻译\n");
33 |
34 | // Custom Camera
35 | ht.Add("CUSTOM_CAM_MANAGE", "管理镜头");
36 | ht.Add("CUSTOM_CAM_MANAGE_DESC", "管理此已保存的镜头");
37 | ht.Add("CUSTOM_CAM_TITLE", "自定义摄像机");
38 | ht.Add("CUSTOM_CAM_DESC", "漂移和追踪镜头设定");
39 | ht.Add("CUSTOM_CAM_LOCK_POSITION", "锁定位置偏移");
40 | ht.Add("CUSTOM_CAM_LOCK_POSITION_DESC", "锁定镜头的位置,在用于固定镜头和第一人称镜头时非常有用");
41 | ht.Add("CUSTOM_CAM_LINEAR", "线性位置偏移");
42 | ht.Add("CUSTOM_CAM_LINEAR_DESC", "镜头不是围绕车辆做圆周运动,而是沿着汽车的 X 轴移动,适合拍电影");
43 | ht.Add("CUSTOM_CAM_LOCK_ROTATE", "锁定镜头的水平旋转");
44 | ht.Add("CUSTOM_CAM_LOCK_ROTATE_DESC", "修改了镜头围绕车辆旋转的方式");
45 | ht.Add("CUSTOM_CAM_MODIFIER", "修改器");
46 | ht.Add("CUSTOM_CAM_MODIFIER_DESC", "这个修改器 * 角速度 = 旋转目标,数值越高,则相机越偏离锁定值 (-1,1)");
47 | ht.Add("CUSTOM_CAM_YAW", "偏航插值");
48 | ht.Add("CUSTOM_CAM_YAW_DESC", "数值越低,运动更平稳。警告:追踪镜头的设定是相反的,0 为最大值,1 为完全锁定 (0,1)");
49 | ht.Add("CUSTOM_CAM_ROLL", "滚动插值");
50 | ht.Add("CUSTOM_CAM_ROLL_DESC", "数值越低,运动更平稳 (0,1)");
51 | ht.Add("CUSTOM_CAM_PITCH", "俯仰插值");
52 | ht.Add("CUSTOM_CAM_PITCH_DESC", "数值越低,运动更平稳 (0,1)");
53 | ht.Add("CUSTOM_CAM_OFFSET", "镜头偏移量");
54 | ht.Add("CUSTOM_CAM_OFFSET_DESC", "设定追踪镜头向目标移动的速度矢量偏移 (0,5)");
55 | ht.Add("CUSTOM_CAM_POSITION", "位置插值");
56 | ht.Add("CUSTOM_CAM_POSITION_DESC", "数值越低,运动更平稳,但是延迟更高 (0,1)");
57 | ht.Add("CUSTOM_CAM_FOV", "FOV 视场");
58 | ht.Add("CUSTOM_CAM_FOV_DESC", "修改镜头的视场 (20,120)");
59 | ht.Add("CUSTOM_CAM_Y_OFFSET", "Y 偏移");
60 | ht.Add("CUSTOM_CAM_Y_OFFSET_DESC", "修改镜头向前的偏移量 (-8,8)");
61 | ht.Add("CUSTOM_CAM_X_OFFSET", "X 偏移");
62 | ht.Add("CUSTOM_CAM_X_OFFSET_DESC", "修改相机左右的偏移量 (-5,8)");
63 | ht.Add("CUSTOM_CAM_Z_OFFSET", "Z 偏移");
64 | ht.Add("CUSTOM_CAM_Z_OFFSET_DESC", "修改相机上下的偏移量 (-5,8)");
65 | ht.Add("CUSTOM_CAM_MAX_ANGLE", "最大锁定角度");
66 | ht.Add("CUSTOM_CAM_MAX_ANGLE_DESC", "保持锁定的速度矢量最大角度,超过此角度后将会切换回普通镜头");
67 | ht.Add("CUSTOM_CAM_PRESETS", "预设");
68 | ht.Add("CUSTOM_CAM_PRESETS_DESC", "应用镜头预设");
69 | ht.Add("CUSTOM_CAM_PRESETS_TANDEM", "追走镜头 1.0");
70 | ht.Add("CUSTOM_CAM_PRESETS_TANDEM_DESC", "适用于漂移追走时使用的镜头");
71 | ht.Add("CUSTOM_CAM_PRESETS_FPV", "FPV 第一人称");
72 | ht.Add("CUSTOM_CAM_PRESETS_FPV_DESC", "适用于第一人称漂移时使用的镜头");
73 | ht.Add("CUSTOM_CAM_PRESETS_NFS", "NFS 镜头");
74 | ht.Add("CUSTOM_CAM_PRESETS_NFS_DESC", "街机游戏一样的画面体验");
75 | ht.Add("CUSTOM_CAM_PRESETS_MENU", "预设菜单");
76 | ht.Add("CUSTOM_CAM_PRESETS_MENU_DESC", "从这里开始");
77 | ht.Add("CUSTOM_CAM_SAVED", "保存的镜头");
78 | ht.Add("CUSTOM_CAM_SAVED_DESC", "用户创建的镜头");
79 | ht.Add("CUSTOM_CAM_SAVE_CURRENT", "保存当前镜头");
80 | ht.Add("CUSTOM_CAM_SAVE_CURRENT_DESC", "将当前的镜头设定储存为预设");
81 | ht.Add("CUSTOM_CAM_SPAWN", "应用镜头预设");
82 | ht.Add("CUSTOM_CAM_SPAWN_DESC", "应用此保存的镜头预设");
83 | ht.Add("CUSTOM_CAM_RENAME", "重命名预设");
84 | ht.Add("CUSTOM_CAM_RENAME_DESC", "重命名你已保存的镜头预设");
85 | ht.Add("CUSTOM_CAM_DELETE", "~r~删除预设");
86 | ht.Add("CUSTOM_CAM_DELETE_DESC", "~r~这将会删除此预设。警告:这是不可撤销的操作");
87 |
88 | // Drones Menu
89 | ht.Add("DRONE_MANAGE_TITLE", "管理无人机");
90 | ht.Add("DRONE_MANAGE_DESC", "管理已保存的无人机设定");
91 | ht.Add("DRONE_TITLE", "无人机");
92 | ht.Add("DRONE_DESC", "无人机镜头参数设定");
93 | ht.Add("DRONE_RACE", "穿梭机");
94 | ht.Add("DRONE_ZERO_G", "无重力");
95 | ht.Add("DRONE_SPECTATOR", "旁观者");
96 | ht.Add("DRONE_HOMING", "返航无人机");
97 | ht.Add("DRONE_INVERT_PITCH", "反向俯仰");
98 | ht.Add("DRONE_INVERT_PITCH_DESC", "调换俯仰控制的按键");
99 | ht.Add("DRONE_INVERT_ROLL", "反向滚动");
100 | ht.Add("DRONE_INVERT_ROLL_DESC", "调换滚动控制的按键");
101 | ht.Add("DRONE_GRAVITY", "重力倍数");
102 | ht.Add("DRONE_GRAVITY_DESC", "修改重力常数,更高的值会使无人机在自由落体运动中下降得更快");
103 | ht.Add("DRONE_TIMESTEP", "时间倍数");
104 | ht.Add("DRONE_TIMESTEP_DESC", "影响重力和无人机的响应能力");
105 | ht.Add("DRONE_DRAG", "阻力倍数");
106 | ht.Add("DRONE_DRAG_DESC", "设定空气阻力,越高的值会使无人机更快地失去速度");
107 | ht.Add("DRONE_ACCELE", "加速倍数");
108 | ht.Add("DRONE_ACCELE_DESC", "设定无人机的加速性能");
109 | ht.Add("DRONE_PITCH", "俯仰倍数");
110 | ht.Add("DRONE_PITCH_DESC", "设定无人机的俯仰响应速度 (pitch).");
111 | ht.Add("DRONE_ROLL", "滚动倍数");
112 | ht.Add("DRONE_ROLL_DESC", "设定无人机的滚动响应速度 (roll).");
113 | ht.Add("DRONE_YAW", "偏航倍数");
114 | ht.Add("DRONE_YAW_DESC", "设定无人机的偏航响应速度 (yaw).");
115 | ht.Add("DRONE_TILT", "倾斜角度");
116 | ht.Add("DRONE_TILT_DESC", "设定镜头相对于无人机的倾斜角度");
117 | ht.Add("DRONE_FOV", "FOV 视场");
118 | ht.Add("DRONE_FOV_DESC", "设定镜头的视场");
119 | ht.Add("DRONE_MAX_VELOCITY", "最高速度");
120 | ht.Add("DRONE_MAX_VELOCITY_DESC", "设定无人机的最高速度");
121 | ht.Add("DRONE_SAVED", "已保存的无人机");
122 | ht.Add("DRONE_SAVED_DESC", "用户创建的无人机");
123 | ht.Add("DRONE_SAVED_TITLE", "已保存的无人机");
124 | ht.Add("DRONE_SAVE_CURRENT", "保存当前无人机");
125 | ht.Add("DRONE_SAVE_CURRENT_DESC", "保存当前的无人机参数");
126 | ht.Add("DRONE_SPAWN", "应用无人机参数");
127 | ht.Add("DRONE_SPAWN_DESC", "应用此已保存的无人机参数");
128 | ht.Add("DRONE_RENAME", "重命名无人机");
129 | ht.Add("DRONE_RENAME_DESC", "重命名你已保存的无人机");
130 | ht.Add("DRONE_DELETE", "~r~删除无人机");
131 | ht.Add("DRONE_DELETE_DESC", "~r~这将会删除你已保存的无人机。警告:这是不可撤销的操作");
132 | ht.Add("DRONE_MODE", "模式");
133 | ht.Add("DRONE_MODE_DESC", "选择无人机的飞行模式\n" +
134 | "~r~Race 穿梭机~s~ - 普通,带有重力的无人机\n" +
135 | "~g~Zero-G 无重力~s~ - 没有重力的无人机,增加了减速\n" +
136 | "~b~Spectator 旁观者~s~ - 方便操作进行旁观\n" +
137 | "~y~Homing 返航机~s~ - 获取目标并将其作为中心点");
138 | return ht;
139 | }
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/EnhancedCamera/langs/zh_TW.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace CustomCamera.langs {
9 | class zh_TW {
10 | public Hashtable data() {
11 |
12 | Hashtable ht = new Hashtable();
13 |
14 | // Main Menu
15 | ht.Add("MAIN_MENU_TITLE", "增強型遊戲鏡頭");
16 | ht.Add("MAIN_MENU_DESC", "高級鏡頭和無人機鏡頭設置");
17 | ht.Add("MAIN_MENU_ENABLE_LEAD", "啟用漂移鏡頭");
18 | ht.Add("MAIN_MENU_ENABLE_CHASE", "啟用追踪鏡頭");
19 | ht.Add("MAIN_MENU_ENABLE_DRONE", "啟用無人機鏡頭");
20 | ht.Add("MAIN_MENU_ENABLE_LEAD_DESC", "主鏡頭,行為取決於汽車的漂移角度和速度");
21 | ht.Add("MAIN_MENU_ENABLE_CHASE_DESC", "鎖定前方目標,如果目標不在範圍內,則切換到普通鏡頭");
22 | ht.Add("MAIN_MENU_ENABLE_DRONE_DESC", "自由無人機鏡頭,提供不同的模式,例如穿梭機和無重力飛行");
23 | ht.Add("MAIN_MENU_LEAD_CHASE_CONF", "漂移和追踪鏡頭設定");
24 | ht.Add("MAIN_MENU_DRONE_CONF", "無人機鏡頭設定");
25 | ht.Add("MAIN_MENU_LEAD_CHASE_CONF_DESC", "修改漂移或追踪鏡頭的參數設定");
26 | ht.Add("MAIN_MENU_DRONE_CONF_DESC", "修改無人機鏡頭的參數設定");
27 | ht.Add("MAIN_MENU_CREDITS", "鳴謝");
28 | ht.Add("MAIN_MENU_CREDITS_DESC", "~g~Shrimp~s~ - 提供想法並實現\n" +
29 | "~g~Tom Grobbe~s~ - MenuAPI 界面庫的作者,以及保存和加載設定的代碼\n" +
30 | "~g~QuadrupleTurbo~s~ - 提供想法並幫助測試\n" +
31 | "~y~No Name Drift~s~ 和 ~y~Velocity~s~ 漂移服務器進行遊戲測試和反饋\n" +
32 | "~y~ZeroDream~s~ 增加多語言支持以及中文翻譯\n");
33 |
34 | // Custom Camera
35 | ht.Add("CUSTOM_CAM_MANAGE", "管理鏡頭");
36 | ht.Add("CUSTOM_CAM_MANAGE_DESC", "管理此已保存的鏡頭");
37 | ht.Add("CUSTOM_CAM_TITLE", "自定義攝像機");
38 | ht.Add("CUSTOM_CAM_DESC", "漂移和追踪鏡頭設定");
39 | ht.Add("CUSTOM_CAM_LOCK_POSITION", "鎖定位置偏移");
40 | ht.Add("CUSTOM_CAM_LOCK_POSITION_DESC", "鎖定鏡頭的位置,在用於固定鏡頭和第一人稱鏡頭時非常有用");
41 | ht.Add("CUSTOM_CAM_LINEAR", "線性位置偏移");
42 | ht.Add("CUSTOM_CAM_LINEAR_DESC", "鏡頭不是圍繞車輛做圓周運動,而是沿著汽車的 X 軸移動,適合拍電影");
43 | ht.Add("CUSTOM_CAM_LOCK_ROTATE", "鎖定鏡頭的水平旋轉");
44 | ht.Add("CUSTOM_CAM_LOCK_ROTATE_DESC", "修改了鏡頭圍繞車輛旋轉的方式");
45 | ht.Add("CUSTOM_CAM_MODIFIER", "修改器");
46 | ht.Add("CUSTOM_CAM_MODIFIER_DESC", "這個修改器 * 角速度 = 旋轉目標,數值越高,則相機越偏離鎖定值 (-1,1)");
47 | ht.Add("CUSTOM_CAM_YAW", "偏航插值");
48 | ht.Add("CUSTOM_CAM_YAW_DESC", "數值越低,運動更平穩。警告:追踪鏡頭的設定是相反的,0 為最大值,1 為完全鎖定 (0,1)");
49 | ht.Add("CUSTOM_CAM_ROLL", "滾動插值");
50 | ht.Add("CUSTOM_CAM_ROLL_DESC", "數值越低,運動更平穩 (0,1)");
51 | ht.Add("CUSTOM_CAM_PITCH", "俯仰插值");
52 | ht.Add("CUSTOM_CAM_PITCH_DESC", "數值越低,運動更平穩 (0,1)");
53 | ht.Add("CUSTOM_CAM_OFFSET", "鏡頭偏移量");
54 | ht.Add("CUSTOM_CAM_OFFSET_DESC", "設定追踪鏡頭向目標移動的速度矢量偏移 (0,5)");
55 | ht.Add("CUSTOM_CAM_POSITION", "位置插值");
56 | ht.Add("CUSTOM_CAM_POSITION_DESC", "數值越低,運動更平穩,但是延遲更高 (0,1)");
57 | ht.Add("CUSTOM_CAM_FOV", "FOV 視場");
58 | ht.Add("CUSTOM_CAM_FOV_DESC", "修改鏡頭的視場 (20,120)");
59 | ht.Add("CUSTOM_CAM_Y_OFFSET", "Y 偏移");
60 | ht.Add("CUSTOM_CAM_Y_OFFSET_DESC", "修改鏡頭向前的偏移量 (-8,8)");
61 | ht.Add("CUSTOM_CAM_X_OFFSET", "X 偏移");
62 | ht.Add("CUSTOM_CAM_X_OFFSET_DESC", "修改相機左右的偏移量 (-5,8)");
63 | ht.Add("CUSTOM_CAM_Z_OFFSET", "Z 偏移");
64 | ht.Add("CUSTOM_CAM_Z_OFFSET_DESC", "修改相機上下的偏移量 (-5,8)");
65 | ht.Add("CUSTOM_CAM_MAX_ANGLE", "最大鎖定角度");
66 | ht.Add("CUSTOM_CAM_MAX_ANGLE_DESC", "保持鎖定的速度矢量最大角度,超過此角度後將會切換回普通鏡頭");
67 | ht.Add("CUSTOM_CAM_PRESETS", "預設");
68 | ht.Add("CUSTOM_CAM_PRESETS_DESC", "應用鏡頭預設");
69 | ht.Add("CUSTOM_CAM_PRESETS_TANDEM", "追走鏡頭 1.0");
70 | ht.Add("CUSTOM_CAM_PRESETS_TANDEM_DESC", "適用於漂移追走時使用的鏡頭");
71 | ht.Add("CUSTOM_CAM_PRESETS_FPV", "FPV 第一人稱");
72 | ht.Add("CUSTOM_CAM_PRESETS_FPV_DESC", "適用於第一人稱漂移時使用的鏡頭");
73 | ht.Add("CUSTOM_CAM_PRESETS_NFS", "NFS 鏡頭");
74 | ht.Add("CUSTOM_CAM_PRESETS_NFS_DESC", "街機遊戲一樣的畫面體驗");
75 | ht.Add("CUSTOM_CAM_PRESETS_MENU", "預設菜單");
76 | ht.Add("CUSTOM_CAM_PRESETS_MENU_DESC", "從這裡開始");
77 | ht.Add("CUSTOM_CAM_SAVED", "保存的鏡頭");
78 | ht.Add("CUSTOM_CAM_SAVED_DESC", "用戶創建的鏡頭");
79 | ht.Add("CUSTOM_CAM_SAVE_CURRENT", "保存當前鏡頭");
80 | ht.Add("CUSTOM_CAM_SAVE_CURRENT_DESC", "將當前的鏡頭設定儲存為預設");
81 | ht.Add("CUSTOM_CAM_SPAWN", "應用鏡頭預設");
82 | ht.Add("CUSTOM_CAM_SPAWN_DESC", "應用此保存的鏡頭預設");
83 | ht.Add("CUSTOM_CAM_RENAME", "重命名預設");
84 | ht.Add("CUSTOM_CAM_RENAME_DESC", "重命名你已保存的鏡頭預設");
85 | ht.Add("CUSTOM_CAM_DELETE", "~r~刪除預設");
86 | ht.Add("CUSTOM_CAM_DELETE_DESC", "~r~這將會刪除此預設。警告:這是不可撤銷的操作");
87 |
88 | // Drones Menu
89 | ht.Add("DRONE_MANAGE_TITLE", "管理無人機");
90 | ht.Add("DRONE_MANAGE_DESC", "管理已保存的無人機設定");
91 | ht.Add("DRONE_TITLE", "無人機");
92 | ht.Add("DRONE_DESC", "無人機鏡頭參數設定");
93 | ht.Add("DRONE_RACE", "穿梭機");
94 | ht.Add("DRONE_ZERO_G", "無重力");
95 | ht.Add("DRONE_SPECTATOR", "旁觀者");
96 | ht.Add("DRONE_HOMING", "返航無人機");
97 | ht.Add("DRONE_INVERT_PITCH", "反向俯仰");
98 | ht.Add("DRONE_INVERT_PITCH_DESC", "調換俯仰控制的按鍵");
99 | ht.Add("DRONE_INVERT_ROLL", "反向滾動");
100 | ht.Add("DRONE_INVERT_ROLL_DESC", "調換滾動控制的按鍵");
101 | ht.Add("DRONE_GRAVITY", "重力倍數");
102 | ht.Add("DRONE_GRAVITY_DESC", "修改重力常數,更高的值會使無人機在自由落體運動中下降得更快");
103 | ht.Add("DRONE_TIMESTEP", "時間倍數");
104 | ht.Add("DRONE_TIMESTEP_DESC", "影響重力和無人機的響應能力");
105 | ht.Add("DRONE_DRAG", "阻力倍數");
106 | ht.Add("DRONE_DRAG_DESC", "設定空氣阻力,越高的值會使無人機更快地失去速度");
107 | ht.Add("DRONE_ACCELE", "加速倍數");
108 | ht.Add("DRONE_ACCELE_DESC", "設定無人機的加速性能");
109 | ht.Add("DRONE_PITCH", "俯仰倍數");
110 | ht.Add("DRONE_PITCH_DESC", "設定無人機的俯仰響應速度 (pitch).");
111 | ht.Add("DRONE_ROLL", "滾動倍數");
112 | ht.Add("DRONE_ROLL_DESC", "設定無人機的滾動響應速度 (roll).");
113 | ht.Add("DRONE_YAW", "偏航倍數");
114 | ht.Add("DRONE_YAW_DESC", "設定無人機的偏航響應速度 (yaw).");
115 | ht.Add("DRONE_TILT", "傾斜角度");
116 | ht.Add("DRONE_TILT_DESC", "設定鏡頭相對於無人機的傾斜角度");
117 | ht.Add("DRONE_FOV", "FOV 視場");
118 | ht.Add("DRONE_FOV_DESC", "設定鏡頭的視場");
119 | ht.Add("DRONE_MAX_VELOCITY", "最高速度");
120 | ht.Add("DRONE_MAX_VELOCITY_DESC", "設定無人機的最高速度");
121 | ht.Add("DRONE_SAVED", "已保存的無人機");
122 | ht.Add("DRONE_SAVED_DESC", "用戶創建的無人機");
123 | ht.Add("DRONE_SAVED_TITLE", "已保存的無人機");
124 | ht.Add("DRONE_SAVE_CURRENT", "保存當前無人機");
125 | ht.Add("DRONE_SAVE_CURRENT_DESC", "保存當前的無人機參數");
126 | ht.Add("DRONE_SPAWN", "應用無人機參數");
127 | ht.Add("DRONE_SPAWN_DESC", "應用此已保存的無人機參數");
128 | ht.Add("DRONE_RENAME", "重命名無人機");
129 | ht.Add("DRONE_RENAME_DESC", "重命名你已保存的無人機");
130 | ht.Add("DRONE_DELETE", "~r~刪除無人機");
131 | ht.Add("DRONE_DELETE_DESC", "~r~這將會刪除你已保存的無人機。警告:這是不可撤銷的操作");
132 | ht.Add("DRONE_MODE", "模式");
133 | ht.Add("DRONE_MODE_DESC", "選擇無人機的飛行模式\n" +
134 | "~r~Race 穿梭機~s~ - 普通,帶有重力的無人機\n" +
135 | "~g~Zero-G 無重力~s~ - 沒有重力的無人機,增加了減速\n" +
136 | "~b~Spectator 旁觀者~s~ - 方便操作進行旁觀\n" +
137 | "~y~Homing 返航機~s~ - 獲取目標並將其作為中心點");
138 | return ht;
139 | }
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/EnhancedCamera/langs/en_US.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace CustomCamera.langs {
9 | class en_US {
10 | public Hashtable data() {
11 |
12 | Hashtable ht = new Hashtable();
13 |
14 | // Main Menu
15 | ht.Add("MAIN_MENU_TITLE", "Enhanced camera");
16 | ht.Add("MAIN_MENU_DESC", "Lead, chase and drone camera options");
17 | ht.Add("MAIN_MENU_ENABLE_LEAD", "Enable lead camera");
18 | ht.Add("MAIN_MENU_ENABLE_CHASE", "Enable chase camera");
19 | ht.Add("MAIN_MENU_ENABLE_DRONE", "Enable drone camera");
20 | ht.Add("MAIN_MENU_ENABLE_LEAD_DESC", "Main camera, behaviour dependant on angular velocity of the car.");
21 | ht.Add("MAIN_MENU_ENABLE_CHASE_DESC", "Locks to a target in front, switches to regular cam if target not in range.");
22 | ht.Add("MAIN_MENU_ENABLE_DRONE_DESC", "Free drone camera to spectate/fly around. Different modes available.");
23 | ht.Add("MAIN_MENU_LEAD_CHASE_CONF", "Lead/chase cam parameters");
24 | ht.Add("MAIN_MENU_DRONE_CONF", "Drone cam parameters");
25 | ht.Add("MAIN_MENU_LEAD_CHASE_CONF_DESC", "Tune parameters for lead and chase camera");
26 | ht.Add("MAIN_MENU_DRONE_CONF_DESC", "Tune parameters for drone camera");
27 | ht.Add("MAIN_MENU_CREDITS", "Credits");
28 | ht.Add("MAIN_MENU_CREDITS_DESC", "~g~Shrimp~s~ - idea and execution\n" +
29 | "~g~Tom Grobbe~s~ - MenuAPI used for GUI, code snippets for saving/loading\n" +
30 | "~g~QuadrupleTurbo~s~ - Help with ideas and testing\n" +
31 | "~y~No Name Drift~s~ and ~y~Velocity~s~ drift servers - playtesting and feedback\n" +
32 | "~r~ZeroDream~s~ - Implement menu localization and Chinese translate\n");
33 |
34 | // Custom Camera
35 | ht.Add("CUSTOM_CAM_MANAGE", "Manage Camera");
36 | ht.Add("CUSTOM_CAM_MANAGE_DESC", "Manage this saved camera.");
37 | ht.Add("CUSTOM_CAM_TITLE", "Enhanced camera");
38 | ht.Add("CUSTOM_CAM_DESC", "Lead/chase camera parameters");
39 | ht.Add("CUSTOM_CAM_LOCK_POSITION", "Lock position offset");
40 | ht.Add("CUSTOM_CAM_LOCK_POSITION_DESC", "Locks position offset, useful when sticking camera to the car - on top of hood, as FPV cam, etc.");
41 | ht.Add("CUSTOM_CAM_LINEAR", "Linear position offset");
42 | ht.Add("CUSTOM_CAM_LINEAR_DESC", "Instead of circular motion around the car, the camera moves along car's X axis. Dope for cinematic shots.");
43 | ht.Add("CUSTOM_CAM_LOCK_ROTATE", "Lock rotation to camera plane");
44 | ht.Add("CUSTOM_CAM_LOCK_ROTATE_DESC", "Changes the way that camera rotates around car (mostly visible on uneven ground).");
45 | ht.Add("CUSTOM_CAM_MODIFIER", "Modifier");
46 | ht.Add("CUSTOM_CAM_MODIFIER_DESC", "This modifier * angular velocity = target rotation. Higher values make camera move further from lock. (-1,1)");
47 | ht.Add("CUSTOM_CAM_YAW", "Yaw interpolation");
48 | ht.Add("CUSTOM_CAM_YAW_DESC", "Lower values - smoother movement. WARNING: Slider is inversed for chase camera - 0 is max interpolation, 1 is complete lock. (0,1)");
49 | ht.Add("CUSTOM_CAM_ROLL", "Roll interpolation");
50 | ht.Add("CUSTOM_CAM_ROLL_DESC", "Lower values - smoother movement. (0,1)");
51 | ht.Add("CUSTOM_CAM_PITCH", "Pitch interpolation");
52 | ht.Add("CUSTOM_CAM_PITCH_DESC", "Lower values - smoother movement. (0,1)");
53 | ht.Add("CUSTOM_CAM_OFFSET", "Camera offset");
54 | ht.Add("CUSTOM_CAM_OFFSET_DESC", "Offsets chase camera target towards its velocity vector. (0,5)");
55 | ht.Add("CUSTOM_CAM_POSITION", "Position interpolation");
56 | ht.Add("CUSTOM_CAM_POSITION_DESC", "Lower values - smoother movement, higher delay. (0,1)");
57 | ht.Add("CUSTOM_CAM_FOV", "FOV");
58 | ht.Add("CUSTOM_CAM_FOV_DESC", "Change custom camera's FOV. (20,120)");
59 | ht.Add("CUSTOM_CAM_Y_OFFSET", "Y offset");
60 | ht.Add("CUSTOM_CAM_Y_OFFSET_DESC", "Custom camera offset in forward direction. (-8,8)");
61 | ht.Add("CUSTOM_CAM_X_OFFSET", "X offset");
62 | ht.Add("CUSTOM_CAM_X_OFFSET_DESC", "Custom camera offset in side direction. (-5,8)");
63 | ht.Add("CUSTOM_CAM_Z_OFFSET", "Z offset");
64 | ht.Add("CUSTOM_CAM_Z_OFFSET_DESC", "Custom camera offset in up direction. (-5,8)");
65 | ht.Add("CUSTOM_CAM_MAX_ANGLE", "Max angle to lock.");
66 | ht.Add("CUSTOM_CAM_MAX_ANGLE_DESC", "Max angle from velocity vector to keep the lock on, if angle exceeds this limit, camera switches back to normal. (25,360)");
67 | ht.Add("CUSTOM_CAM_PRESETS", "Presets");
68 | ht.Add("CUSTOM_CAM_PRESETS_DESC", "Spawn camera presets");
69 | ht.Add("CUSTOM_CAM_PRESETS_TANDEM", "Tandem Camera 1.0");
70 | ht.Add("CUSTOM_CAM_PRESETS_TANDEM_DESC", "Chef's specialty");
71 | ht.Add("CUSTOM_CAM_PRESETS_FPV", "FPV camera base");
72 | ht.Add("CUSTOM_CAM_PRESETS_FPV_DESC", "Best to use with chicken model");
73 | ht.Add("CUSTOM_CAM_PRESETS_NFS", "NFS camera");
74 | ht.Add("CUSTOM_CAM_PRESETS_NFS_DESC", "Arcade game experience");
75 | ht.Add("CUSTOM_CAM_PRESETS_MENU", "Presets menu");
76 | ht.Add("CUSTOM_CAM_PRESETS_MENU_DESC", "Get started here");
77 | ht.Add("CUSTOM_CAM_SAVED", "Saved cameras");
78 | ht.Add("CUSTOM_CAM_SAVED_DESC", "User created cameras");
79 | ht.Add("CUSTOM_CAM_SAVE_CURRENT", "Save Current Camera");
80 | ht.Add("CUSTOM_CAM_SAVE_CURRENT_DESC", "Save the current camera.");
81 | ht.Add("CUSTOM_CAM_SPAWN", "Spawn Camera");
82 | ht.Add("CUSTOM_CAM_SPAWN_DESC", "Spawn this saved camera.");
83 | ht.Add("CUSTOM_CAM_RENAME", "Rename Camera");
84 | ht.Add("CUSTOM_CAM_RENAME_DESC", "Rename your saved camera.");
85 | ht.Add("CUSTOM_CAM_DELETE", "~r~Delete Camera");
86 | ht.Add("CUSTOM_CAM_DELETE_DESC", "~r~This will delete your saved camera. Warning: this can NOT be undone!");
87 |
88 | // Drones Menu
89 | ht.Add("DRONE_MANAGE_TITLE", "Manage Drone");
90 | ht.Add("DRONE_MANAGE_DESC", "Manage this saved drone parameters.");
91 | ht.Add("DRONE_TITLE", "Enhanced camera");
92 | ht.Add("DRONE_DESC", "Drone Camera parameters");
93 | ht.Add("DRONE_RACE", "Race drone");
94 | ht.Add("DRONE_ZERO_G", "Zero-G drone");
95 | ht.Add("DRONE_SPECTATOR", "Spectator drone");
96 | ht.Add("DRONE_HOMING", "Homing drone");
97 | ht.Add("DRONE_INVERT_PITCH", "Invert pitch");
98 | ht.Add("DRONE_INVERT_PITCH_DESC", "Inverts user input in pitch axis.");
99 | ht.Add("DRONE_INVERT_ROLL", "Invert roll");
100 | ht.Add("DRONE_INVERT_ROLL_DESC", "Inverts user input in roll axis.");
101 | ht.Add("DRONE_GRAVITY", "Gravity multiplier");
102 | ht.Add("DRONE_GRAVITY_DESC", "Modifies gravity constant, higher values makes drone fall quicker during freefall.");
103 | ht.Add("DRONE_TIMESTEP", "Timestep multiplier");
104 | ht.Add("DRONE_TIMESTEP_DESC", "Affects gravity and drone responsiveness.");
105 | ht.Add("DRONE_DRAG", "Drag multiplier");
106 | ht.Add("DRONE_DRAG_DESC", "How much air ressistance there is - higher values make drone lose velocity quicker.");
107 | ht.Add("DRONE_ACCELE", "Acceleration multiplier");
108 | ht.Add("DRONE_ACCELE_DESC", "How responsive drone is in terms of acceleration.");
109 | ht.Add("DRONE_PITCH", "Pitch multiplier");
110 | ht.Add("DRONE_PITCH_DESC", "How responsive drone is in terms of rotation (pitch).");
111 | ht.Add("DRONE_ROLL", "Roll multiplier");
112 | ht.Add("DRONE_ROLL_DESC", "How responsive drone is in terms of rotation (roll).");
113 | ht.Add("DRONE_YAW", "Yaw multiplier");
114 | ht.Add("DRONE_YAW_DESC", "How responsive drone is in terms of rotation (yaw).");
115 | ht.Add("DRONE_TILT", "Tilt angle");
116 | ht.Add("DRONE_TILT_DESC", "Defines how much is camera tilted relative to the drone.");
117 | ht.Add("DRONE_FOV", "FOV");
118 | ht.Add("DRONE_FOV_DESC", "Field of view of the camera");
119 | ht.Add("DRONE_MAX_VELOCITY", "Max velocity");
120 | ht.Add("DRONE_MAX_VELOCITY_DESC", "Max velocity of the drone");
121 | ht.Add("DRONE_SAVED", "Saved drones");
122 | ht.Add("DRONE_SAVED_DESC", "User created drone params");
123 | ht.Add("DRONE_SAVED_TITLE", "Saved drone params");
124 | ht.Add("DRONE_SAVE_CURRENT", "Save Current Drone");
125 | ht.Add("DRONE_SAVE_CURRENT_DESC", "Save the current drone parameters.");
126 | ht.Add("DRONE_SPAWN", "Spawn Drone");
127 | ht.Add("DRONE_SPAWN_DESC", "Spawn this saved drone.");
128 | ht.Add("DRONE_RENAME", "Rename Drone");
129 | ht.Add("DRONE_RENAME_DESC", "Rename your saved drone.");
130 | ht.Add("DRONE_DELETE", "~r~Delete Drone");
131 | ht.Add("DRONE_DELETE_DESC", "~r~This will delete your saved drone. Warning: this can NOT be undone!");
132 | ht.Add("DRONE_MODE", "Mode");
133 | ht.Add("DRONE_MODE_DESC", "Select drone flight mode.\n" +
134 | "~r~Race drone~s~ - regular, gravity based drone cam\n" +
135 | "~g~Zero-G drone~s~ - gravity set to 0, added deceleration\n" +
136 | "~b~Spectator drone~s~ - easy to operate for spectating\n" +
137 | "~y~Homing drone~s~ - acquire target and keep it in center");
138 | return ht;
139 | }
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/EnhancedCamera/MainMenu.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using CitizenFX.Core;
4 | using static CitizenFX.Core.Native.API;
5 | using MenuAPI;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Collections;
9 | using CustomCamera.langs;
10 |
11 | namespace CustomCamera
12 | {
13 | public class MainMenu : BaseScript {
14 |
15 | #region variables
16 |
17 | // Private variables
18 | private Menu Menu;
19 | private static MenuCheckboxItem leadCam;
20 | private static MenuCheckboxItem chaseCam;
21 | private static MenuCheckboxItem droneCam;
22 | private static Control MenuToggleControl;
23 | private static bool chaseCameraConfigEnabled;
24 | private static bool droneCameraConfigEnabled;
25 |
26 | // Public variables
27 | public static CustomCam CustomCamMenu { get; private set; }
28 | public static DroneCam DroneCamMenu { get; private set; }
29 | public static Camera driftCamera = null;
30 | public static Camera chaseCamera = null;
31 | public static Camera droneCamera = null;
32 | public static float userTilt = 0.0f;
33 | public static float userYaw = 0.0f;
34 | public static bool userLookBehind = false;
35 | public static Hashtable langData;
36 |
37 | #endregion
38 |
39 | ///
40 | /// Constructor.
41 | ///
42 | public MainMenu() {
43 |
44 | if (langData == null) {
45 | // Load language data
46 | int langId = GetCurrentLanguage();
47 |
48 | switch (langId) {
49 | case 9:
50 | langData = new zh_TW().data();
51 | break;
52 | case 12:
53 | langData = new zh_CN().data();
54 | break;
55 | default:
56 | langData = new en_US().data();
57 | break;
58 | }
59 | }
60 |
61 | // Disable menu opening via gamepad (interferes with vMenu)
62 | MenuController.EnableMenuToggleKeyOnController = false;
63 | // Setup menu open/close key
64 | SetConfigParameters();
65 | // Setup main menu and submenus
66 | CreateSubmenus();
67 | // Register console command
68 | RegisterCommand("enhancedCam", new Action((source) => {
69 | if (MenuController.IsAnyMenuOpen()) {
70 | MenuController.CloseAllMenus();
71 | } else {
72 | MenuController.MainMenu.OpenMenu();
73 | }
74 | }), false);
75 | // Right align menu
76 | try {
77 | MenuController.MenuAlignment = MenuController.MenuAlignmentOption.Right;
78 | }catch(Exception e) {
79 | Debug.WriteLine("[EnhancedCamera] Exception: Cannot align menu to the right.");
80 | }
81 | // Initiate tick
82 | Tick += OnTick;
83 | Tick += GeneralUpdate;
84 | Tick += SlowUpdate;
85 | }
86 |
87 | ///
88 | /// Main OnTick task runs every game tick and handles all the menu stuff.
89 | ///
90 | ///
91 | private async Task OnTick() {
92 | Game.DisableControlThisFrame(0, MenuToggleControl);
93 | }
94 |
95 | #region Setup main menu and submenus
96 |
97 | ///
98 | /// Add the menu to the menu pool and set it up correctly.
99 | /// Also add and bind the menu buttons.
100 | ///
101 | ///
102 | ///
103 | private void AddMenu(Menu parentMenu, Menu submenu, MenuItem menuButton) {
104 | parentMenu.AddMenuItem(menuButton);
105 | MenuController.AddSubmenu(parentMenu, submenu);
106 | MenuController.BindMenuItem(parentMenu, submenu, menuButton);
107 | submenu.RefreshIndex();
108 | }
109 |
110 | ///
111 | /// Creates all the submenus of main menu
112 | ///
113 | ///
114 | private void CreateSubmenus() {
115 | // Create the menu.
116 | Menu = new Menu(_t("MAIN_MENU_TITLE"), _t("MAIN_MENU_DESC"));
117 | MenuController.AddMenu(Menu);
118 |
119 | #region checkbox items
120 |
121 | // Enabling angular drift cam
122 | leadCam = new MenuCheckboxItem(_t("MAIN_MENU_ENABLE_LEAD"), _t("MAIN_MENU_ENABLE_LEAD_DESC"), false);
123 | // Enabling chase cam
124 | chaseCam = new MenuCheckboxItem(_t("MAIN_MENU_ENABLE_CHASE"), _t("MAIN_MENU_ENABLE_CHASE"), false);
125 | // Enabling chase cam
126 | droneCam = new MenuCheckboxItem(_t("MAIN_MENU_ENABLE_DRONE"), _t("MAIN_MENU_ENABLE_DRONE"), false);
127 |
128 | #endregion
129 |
130 | #region adding menu items
131 | // Checkboxes
132 | Menu.AddMenuItem(leadCam);
133 | if(chaseCameraConfigEnabled)
134 | Menu.AddMenuItem(chaseCam);
135 | if(droneCameraConfigEnabled)
136 | Menu.AddMenuItem(droneCam);
137 |
138 | // Custom cam parameters menu
139 | CustomCamMenu = new CustomCam();
140 | Menu customCamMenu = CustomCamMenu.GetMenu();
141 | MenuItem buttonCustom = new MenuItem(_t("MAIN_MENU_LEAD_CHASE_CONF"), _t("MAIN_MENU_LEAD_CHASE_CONF_DESC"))
142 | {
143 | Label = "→→→"
144 | };
145 | AddMenu(Menu, customCamMenu, buttonCustom);
146 |
147 | // Drone cam parameters menu
148 | DroneCamMenu = new DroneCam();
149 | Menu droneCamMenu = DroneCamMenu.GetMenu();
150 | MenuItem buttonDrone = new MenuItem(_t("MAIN_MENU_DRONE_CONF"), _t("MAIN_MENU_DRONE_CONF_DESC"))
151 | {
152 | Label = "→→→"
153 | };
154 |
155 | if (droneCameraConfigEnabled)
156 | AddMenu(Menu, droneCamMenu, buttonDrone);
157 |
158 | // Credits
159 | MenuItem credits = new MenuItem(_t("MAIN_MENU_CREDITS"), _t("MAIN_MENU_CREDITS_DESC")) {};
160 | Menu.AddMenuItem(credits);
161 |
162 | #endregion
163 |
164 | #region handling menu changes
165 |
166 | // Handle checkbox changes
167 | Menu.OnCheckboxChange += (_menu, _item, _index, _checked) => {
168 | if (_item == leadCam)
169 | {
170 | CustomCam.LeadCam = _checked;
171 | chaseCam.Checked = false;
172 | droneCam.Checked = false;
173 | CustomCam.ChaseCam = false;
174 | DroneCam.DroneCamVar = false;
175 |
176 | if (!_checked){ ResetCameras(); }
177 | }
178 | if (_item == chaseCam)
179 | {
180 | CustomCam.ChaseCam = _checked;
181 | leadCam.Checked = false;
182 | droneCam.Checked = false;
183 | CustomCam.LeadCam = false;
184 | DroneCam.DroneCamVar = false;
185 |
186 | if (!_checked){
187 | ResetCameras();
188 | }else{
189 | CustomCam.target = CustomCam.GetClosestVehicle(2000, CustomCam.maxAngle);
190 | }
191 | }
192 | if (_item == droneCam)
193 | {
194 | DroneCam.DroneCamVar = _checked;
195 | chaseCam.Checked = false;
196 | leadCam.Checked = false;
197 | CustomCam.ChaseCam = false;
198 | CustomCam.LeadCam = false;
199 |
200 | if (!_checked){ ResetCameras(); }
201 |
202 | }
203 | };
204 | #endregion
205 | }
206 |
207 | #endregion
208 |
209 | #region math functions
210 |
211 | public class CamMath
212 | {
213 | public const float DegToRad = (float)Math.PI / 180.0f;
214 |
215 | ///
216 | /// Lerps two float values by a step
217 | ///
218 | /// lerped float value in between two supplied
219 | public static float Lerp(float current, float target, float by)
220 | {
221 | return current * (1 - by) + target * by;
222 | }
223 |
224 | ///
225 | /// Calculates angle between two vectors
226 | ///
227 | /// Angle between vectors in degrees
228 | public static float AngleBetween(Vector3 a, Vector3 b)
229 | {
230 | double sinA = a.X * b.Y - b.X * a.Y;
231 | double cosA = a.X * b.X + a.Y * b.Y;
232 | return (float)Math.Atan2(sinA, cosA) / DegToRad;
233 | }
234 |
235 | public static Vector3 RotateRadians(Vector3 v, float degree)
236 | {
237 | float ca = Cos(degree);
238 | float sa = Sin(degree);
239 | return new Vector3(ca * v.X - sa * v.Y, sa * v.X + ca * v.Y, v.Z);
240 | }
241 |
242 | public static Vector3 RotateAroundAxis(Vector3 v, Vector3 axis, float angle)
243 | {
244 | return Vector3.TransformCoordinate(v, Matrix.RotationAxis(Vector3.Normalize(axis), angle));
245 | }
246 |
247 | public static float Fmod(float a, float b)
248 | {
249 | return (a - b * Floor(a / b));
250 | }
251 |
252 | public static Vector3 QuaternionToEuler(Quaternion q)
253 | {
254 | double r11 = (-2 * (q.X * q.Y - q.W * q.Z));
255 | double r12 = (q.W * q.W - q.X * q.X + q.Y * q.Y - q.Z * q.Z);
256 | double r21 = (2 * (q.Y * q.Z + q.W * q.X));
257 | double r31 = (-2 * (q.X * q.Z - q.W * q.Y));
258 | double r32 = (q.W * q.W - q.X * q.X - q.Y * q.Y + q.Z * q.Z);
259 |
260 | float ax = (float)Math.Asin(r21);
261 | float ay = (float)Math.Atan2(r31, r32);
262 | float az = (float)Math.Atan2(r11, r12);
263 |
264 | return new Vector3(ax / DegToRad, ay / DegToRad, az / DegToRad);
265 | }
266 | }
267 |
268 | #endregion
269 |
270 | #region camera switching
271 |
272 | public static void SwitchCameraToDrift()
273 | {
274 | SwitchToGameplayCam();
275 | CustomCam.LeadCam = true;
276 | leadCam.Checked = true;
277 | }
278 |
279 | public static void SwitchCameraToChase()
280 | {
281 | SwitchToGameplayCam();
282 | CustomCam.ChaseCam = true;
283 | chaseCam.Checked = true;
284 | }
285 |
286 | public static void SwitchToGameplayCam()
287 | {
288 | CustomCam.LeadCam = false;
289 | CustomCam.ChaseCam = false;
290 | DroneCam.DroneCamVar = false;
291 | ResetCameras();
292 | leadCam.Checked = false;
293 | chaseCam.Checked = false;
294 | droneCam.Checked = false;
295 | }
296 |
297 | #endregion
298 |
299 | #region camera operations
300 |
301 | ///
302 | /// Creates a base camera for lead and chase cam that is not
303 | /// attached to any entity
304 | ///
305 | ///
306 | public static Camera CreateNonAttachedCamera()
307 | {
308 | // Create new camera as a copy of GameplayCamera
309 | Camera newCam = World.CreateCamera(GameplayCamera.Position, GameplayCamera.Rotation, CustomCam.fov);
310 | newCam.IsActive = true;
311 | RenderScriptCams(true, true, 500, true, true);
312 | return newCam;
313 | }
314 |
315 | ///
316 | /// Used to reset lead and chase camera
317 | ///
318 | ///
319 | public static void ResetCameras()
320 | {
321 | RenderScriptCams(false, true, 500, true, true);
322 | driftCamera = null;
323 | chaseCamera = null;
324 | droneCamera = null;
325 | World.DestroyAllCameras();
326 | SetFocusArea(GameplayCamera.Position.X, GameplayCamera.Position.Y, GameplayCamera.Position.Z, 0, 0, 0);
327 | EnableGameplayCam(true);
328 | UnlockMinimapAngle();
329 | ClearFocus();
330 | Game.Player.CanControlCharacter = true;
331 | }
332 |
333 | private const float USER_YAW_RETURN_INTERPOLATION = 0.015f;
334 | private static float yawReturnTimer = 0f;
335 |
336 | ///
337 | /// Additional Update function, currently takes care
338 | /// of user's analog stick up and down movement to
339 | /// control the camera tilt
340 | ///
341 | ///
342 | private async Task GeneralUpdate()
343 | {
344 | if (Menu != null)
345 | {
346 | if (CustomCam.LeadCam || CustomCam.ChaseCam)
347 | {
348 | // User controls the tilt offset
349 | float tiltControl = ((float)(GetControlValue(1, 2) / 256f) - 0.5f);
350 | float yawControl = ((float)(GetControlValue(1, 1) / 256f) - 0.5f);
351 | userLookBehind = IsControlPressed(1, 26);
352 |
353 | if ((Math.Abs(tiltControl) > 0.01f) || (Math.Abs(yawControl) > 0.01f))
354 | {
355 | //Account for difference in gamepad and mouse acceleration
356 | if (IsInputDisabled(1))
357 | {
358 | userTilt -= tiltControl * 12f;
359 | userYaw -= yawControl * 32;
360 | }
361 | else
362 | {
363 | userTilt -= tiltControl;
364 | userYaw -= yawControl * 4f;
365 | }
366 | userTilt = (Math.Abs(userTilt) > 80f) ? (Math.Sign(userTilt) * 80f) : (userTilt);
367 |
368 | userYaw = (CamMath.Fmod((userYaw + 180.0f), 360.0f) - 180.0f);
369 | yawReturnTimer = 1f; // Set the timer before yaw starts to return to 0f
370 |
371 | // Slow return of user yaw to 0f
372 | }
373 | else if ((Math.Abs(yawControl) <= 0.01f) && (Math.Abs(userYaw) > (USER_YAW_RETURN_INTERPOLATION + 0.01f)))
374 | {
375 | // Only return to 0f if user is not moving
376 | int vehicleEntity = GetVehiclePedIsIn(PlayerPedId(), false);
377 | if (yawReturnTimer <= 0f)
378 | {
379 | float speedModifier = (Math.Abs(GetEntityVelocity(vehicleEntity).Length()) < 3f) ? (Math.Abs(GetEntityVelocity(vehicleEntity).Length()) / 3f) : (1f);
380 | userYaw = Math.Sign(userYaw) * CamMath.Lerp(Math.Abs(userYaw), 0f, USER_YAW_RETURN_INTERPOLATION * speedModifier);
381 | }
382 | else
383 | {
384 | yawReturnTimer -= USER_YAW_RETURN_INTERPOLATION;
385 | }
386 | }
387 | }
388 | }
389 | else
390 | {
391 | await Delay(1);
392 | }
393 | }
394 |
395 | private async Task SlowUpdate()
396 | {
397 | // Refocus render distance of the camera (too heavy for normal update)
398 | if (Menu != null)
399 | {
400 | if (DroneCam.DroneCamVar)
401 | {
402 | if (droneCamera != null)
403 | {
404 | SetFocusArea(droneCamera.Position.X, droneCamera.Position.Y, droneCamera.Position.Z, 0, 0, 0);
405 | await Delay(250);
406 | }
407 | }
408 | }
409 | else
410 | {
411 | await Delay(1);
412 | }
413 | }
414 |
415 | #endregion
416 |
417 | #region other functions
418 |
419 | public static void Notify(string message)
420 | {
421 | SetNotificationTextEntry("STRING");
422 | AddTextComponentString3(message);
423 | AddTextComponentSubstringPlayerName("Enhanced Camera");
424 | DrawNotification(false, false);
425 | }
426 |
427 | private static Dictionary LoadConfig(string filename = "config.ini") {
428 | string stringEntries = null;
429 | stringEntries = LoadResourceFile("enhancedcamera", filename);
430 | Dictionary entries = new Dictionary();
431 |
432 | var splitted = stringEntries
433 | .Split('\n')
434 | .Where((line) => !line.Trim().StartsWith("#"))
435 | .Select((line) => line.Trim().Split('='))
436 | .Where((line) => line.Length == 2);
437 |
438 | foreach (var tuple in splitted) {
439 | entries.Add(tuple[0], tuple[1]);
440 | }
441 | return entries;
442 | }
443 |
444 | private static void SetConfigParameters() {
445 | Dictionary config = LoadConfig();
446 |
447 | // Set menu key
448 | config.TryGetValue("toggleMenu", out string value);
449 | if (int.TryParse(value, out int result)) {
450 | MenuToggleControl = (Control)result;
451 | } else {
452 | MenuToggleControl = (Control)344;
453 | }
454 | MenuController.MenuToggleKey = MenuToggleControl;
455 |
456 | // Set chase and drone camera bools
457 | config.TryGetValue("chaseCameraEnabled", out string chaseCamEnabledStr);
458 | if (int.TryParse(chaseCamEnabledStr, out int chaseCamEnabled)) {
459 | chaseCameraConfigEnabled = (chaseCamEnabled==1)?(true):(false);
460 | } else {
461 | chaseCameraConfigEnabled = true;
462 | }
463 |
464 | config.TryGetValue("droneCameraEnabled", out string droneCameraEnabledStr);
465 | if (int.TryParse(droneCameraEnabledStr, out int droneCameraEnabled)) {
466 | droneCameraConfigEnabled = (droneCameraEnabled == 1) ? (true) : (false);
467 | } else {
468 | droneCameraConfigEnabled = true;
469 | }
470 |
471 | }
472 |
473 | public static async Task GetUserInput(string windowTitle, string defaultText, int maxInputLength)
474 | {
475 | // Create the window title string.
476 | var spacer = "\t";
477 | AddTextEntry($"{GetCurrentResourceName().ToUpper()}_WINDOW_TITLE", $"{windowTitle ?? "Enter"}:{spacer}(MAX {maxInputLength.ToString()} Characters)");
478 |
479 | // Display the input box.
480 | DisplayOnscreenKeyboard(1, $"{GetCurrentResourceName().ToUpper()}_WINDOW_TITLE", "", defaultText ?? "", "", "", "", maxInputLength);
481 | await Delay(0);
482 |
483 | // Wait for a result.
484 | while (true){
485 | int keyboardStatus = UpdateOnscreenKeyboard();
486 | switch (keyboardStatus){
487 | case 3: // not displaying input field anymore somehow
488 | case 2: // cancelled
489 | return null;
490 | case 1: // finished editing
491 | return GetOnscreenKeyboardResult();
492 | default:
493 | await Delay(0);
494 | break;
495 | }
496 | }
497 | }
498 |
499 | private static string _t(string key) {
500 | return Language.get(key);
501 | }
502 |
503 | #endregion
504 | }
505 | }
506 |
--------------------------------------------------------------------------------
/EnhancedCamera/menus/DroneCam.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 | using CitizenFX.Core;
5 | using static CitizenFX.Core.Native.API;
6 | using MenuAPI;
7 | using Newtonsoft.Json;
8 |
9 | namespace CustomCamera
10 | {
11 | public class DroneCam : BaseScript
12 | {
13 | #region variables
14 |
15 | // Public variables
16 | public static bool DroneCamVar = false;
17 |
18 | // Private variables
19 | private Menu menu;
20 | private Menu savedDronesMenu;
21 | private Menu selectedDroneMenu = new Menu(_t("DRONE_MANAGE_TITLE"), _t("DRONE_MANAGE_DESC"));
22 | private MenuListItem modeList;
23 | private Dictionary