-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📝 Adding the codes from version [0.1.0.2] (#3)
- Loading branch information
Showing
20 changed files
with
352 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,156 +1,106 @@ | ||
using GTA; | ||
using GTAControl | ||
= GTA.Control; | ||
|
||
using System.Windows.Forms; | ||
|
||
using CTimer | ||
= Alternative_yaw_control.tools.Timer; | ||
|
||
using Alternative_throttle_control.settings; | ||
using Alternative_yaw_control.script; | ||
using Alternative_yaw_control.user_interfaces; | ||
using GTA; | ||
|
||
namespace Alternative_yaw_control | ||
{ | ||
internal class Main : Script | ||
internal sealed class Main : Script | ||
{ | ||
private readonly Keys _keyForTheYawRigth; | ||
|
||
private readonly Keys _keyForTheYawLeft; | ||
|
||
private float _yawSensitivity; | ||
private AlternativeYawControl _alternativeYawControl; | ||
|
||
private float _yawRigthValue; | ||
|
||
private float _yawLeftValue; | ||
private UserInterfaces _userInterfaces; | ||
|
||
public Main() | ||
{ | ||
var keyThatDeterminesTheIncreaseOrDecreaseOfTheValues | ||
= Keys.NumPad2; | ||
|
||
var timer | ||
= new CTimer(); | ||
|
||
var settingsManager | ||
= new SettingsManager(); | ||
Tick += (o, e) => | ||
{ | ||
if (Game.IsLoading) | ||
{ | ||
return; | ||
} | ||
_keyForTheYawRigth | ||
= settingsManager | ||
.ReturnTheKeyForTheYawRight(); | ||
switch (Game.Player.Character.IsInFlyingVehicle) | ||
{ | ||
case true: | ||
{ | ||
if (_alternativeYawControl is null | ||
|| | ||
_userInterfaces is null) | ||
{ | ||
_alternativeYawControl | ||
= InstantiateScript<AlternativeYawControl>(); | ||
_keyForTheYawLeft | ||
= settingsManager | ||
.ReturnTheKeyForTheYawLeft(); | ||
_userInterfaces | ||
= InstantiateScript<UserInterfaces>(); | ||
_yawSensitivity | ||
= settingsManager | ||
.ReturnTheYawSensitivity(); | ||
_alternativeYawControl | ||
.Resume(); | ||
_yawRigthValue | ||
= 0.25f; | ||
_yawLeftValue | ||
= 0.25f; | ||
_userInterfaces | ||
.Resume(); | ||
} | ||
Tick += (o, e) => | ||
{ | ||
switch (Game.Player.Character.IsInFlyingVehicle) | ||
{ | ||
case false: | ||
{ | ||
if (_yawRigthValue != 0.25f) | ||
_yawRigthValue = 0.25f; | ||
if (_alternativeYawControl.IsPaused | ||
|| | ||
_userInterfaces.IsPaused) | ||
{ | ||
_alternativeYawControl | ||
.Resume(); | ||
if (_yawLeftValue != 0.25f) | ||
_yawLeftValue = 0.25f; | ||
_userInterfaces | ||
.Resume(); | ||
} | ||
} | ||
return; | ||
case true: | ||
case false: | ||
{ | ||
Game | ||
.SetControlValueNormalized(GTAControl | ||
.VehicleFlyYawRight, _yawRigthValue); | ||
Game | ||
.SetControlValueNormalized(GTAControl | ||
.VehicleFlyYawLeft, _yawLeftValue); | ||
if (Game | ||
.IsKeyPressed(_keyForTheYawRigth)) | ||
if (_alternativeYawControl is null | ||
|| | ||
_userInterfaces is null) | ||
{ | ||
if (keyThatDeterminesTheIncreaseOrDecreaseOfTheValues == _keyForTheYawRigth) | ||
{ | ||
if (_yawRigthValue > 1f) | ||
_yawRigthValue = 1f; | ||
if (_yawRigthValue < 1f) | ||
_yawRigthValue += _yawSensitivity; | ||
} | ||
if (keyThatDeterminesTheIncreaseOrDecreaseOfTheValues == _keyForTheYawLeft) | ||
{ | ||
if (_yawLeftValue < 0.25f) | ||
_yawLeftValue = 0.25f; | ||
if (timer | ||
.ReturnsTrueForEach(1)) | ||
{ | ||
if (_yawLeftValue == 0.25f) | ||
keyThatDeterminesTheIncreaseOrDecreaseOfTheValues = Keys.NumPad2; | ||
} | ||
if (_yawLeftValue > 0.25f) | ||
_yawLeftValue -= _yawSensitivity; | ||
} | ||
return; | ||
} | ||
if (Game | ||
.IsKeyPressed(_keyForTheYawLeft)) | ||
if (_alternativeYawControl.IsPaused | ||
|| | ||
_userInterfaces.IsPaused) | ||
{ | ||
if (keyThatDeterminesTheIncreaseOrDecreaseOfTheValues == _keyForTheYawRigth) | ||
{ | ||
if (_yawRigthValue < 0.25f) | ||
_yawRigthValue = 0.25f; | ||
if (timer | ||
.ReturnsTrueForEach(1)) | ||
{ | ||
if (_yawRigthValue == 0.25f) | ||
keyThatDeterminesTheIncreaseOrDecreaseOfTheValues = Keys.NumPad2; | ||
} | ||
if (_yawRigthValue > 0.25f) | ||
_yawRigthValue -= _yawSensitivity; | ||
} | ||
if (keyThatDeterminesTheIncreaseOrDecreaseOfTheValues == _keyForTheYawLeft) | ||
{ | ||
if (_yawLeftValue > 1f) | ||
_yawLeftValue = 1f; | ||
if (_yawLeftValue < 1f) | ||
_yawLeftValue += _yawSensitivity; | ||
} | ||
return; | ||
} | ||
_alternativeYawControl | ||
.Pause(); | ||
_userInterfaces | ||
.Pause(); | ||
} | ||
return; | ||
} | ||
} | ||
Interval = 2000; | ||
}; | ||
|
||
KeyDown += (o, e) => | ||
Aborted += (o, e) => | ||
{ | ||
if (e.KeyCode == _keyForTheYawRigth | ||
if (_alternativeYawControl is null | ||
|| | ||
e.KeyCode == _keyForTheYawLeft) | ||
_userInterfaces is null) | ||
{ | ||
if (keyThatDeterminesTheIncreaseOrDecreaseOfTheValues == Keys.NumPad2) | ||
{ | ||
keyThatDeterminesTheIncreaseOrDecreaseOfTheValues = e.KeyCode; | ||
} | ||
return; | ||
} | ||
_alternativeYawControl | ||
.Abort(); | ||
_userInterfaces | ||
.Abort(); | ||
_alternativeYawControl | ||
= null; | ||
_userInterfaces | ||
= null; | ||
}; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Resources; | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Alternative-yaw-control")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Alternative-yaw-control")] | ||
[assembly: AssemblyCopyright("Copyright © 2022 - 2023 niziulluizin")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("61654175-D64A-4B55-8544-5C2290D06A0B")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("0.1.0.2")] | ||
[assembly: AssemblyFileVersion("0.1.0.2")] | ||
[assembly: NeutralResourcesLanguage("en")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="ScriptHookVDotNet3" version="3.6.0" targetFramework="net48" /> | ||
</packages> |
Oops, something went wrong.