Directory and file path change, added new option to disable Esc pause

This commit is contained in:
sausage
2022-05-25 11:32:34 +08:00
parent 382ab834d4
commit 897d02ee1d
15 changed files with 53 additions and 23 deletions

View File

@ -115,7 +115,7 @@ namespace RageCoop.Client
/// </summary> /// </summary>
public static bool IsOnServer() public static bool IsOnServer()
{ {
return Networking.IsOnServer(); return Networking.IsOnServer;
} }
/// <summary> /// <summary>

View File

@ -23,7 +23,7 @@ namespace RageCoop.Client
private bool _gameLoaded = false; private bool _gameLoaded = false;
private static bool _isGoingToCar = false; private static bool _isGoingToCar = false;
public static readonly string CurrentVersion = "V0_1"; public static readonly string CurrentVersion = "V0_2";
public static int LocalPlayerID=0; public static int LocalPlayerID=0;
public static bool NPCsAllowed = false; public static bool NPCsAllowed = false;
@ -116,7 +116,7 @@ namespace RageCoop.Client
_isGoingToCar = false; _isGoingToCar = false;
} }
DoQueuedActions(); DoQueuedActions();
if (!Networking.IsOnServer()) if (!Networking.IsOnServer)
{ {
return; return;
} }
@ -183,7 +183,12 @@ namespace RageCoop.Client
Function.Call(Hash.ACTIVATE_FRONTEND_MENU, Function.Call<int>(Hash.GET_HASH_KEY, "FE_MENU_VERSION_SP_PAUSE"), false, 0); Function.Call(Hash.ACTIVATE_FRONTEND_MENU, Function.Call<int>(Hash.GET_HASH_KEY, "FE_MENU_VERSION_SP_PAUSE"), false, 0);
return; return;
} }
if(e.KeyCode == Settings.MenuKey) if (Game.IsControlPressed(GTA.Control.FrontendPauseAlternate)&&Settings.DisableAlternatePause)
{
Function.Call(Hash.ACTIVATE_FRONTEND_MENU, Function.Call<int>(Hash.GET_HASH_KEY, "FE_MENU_VERSION_SP_PAUSE"), false, 0);
return;
}
if (e.KeyCode == Settings.MenuKey)
{ {
if (MainMenu.MenuPool.AreAnyVisible) if (MainMenu.MenuPool.AreAnyVisible)
{ {
@ -197,7 +202,7 @@ namespace RageCoop.Client
} }
else if (Game.IsControlJustPressed(GTA.Control.MultiplayerInfo)) else if (Game.IsControlJustPressed(GTA.Control.MultiplayerInfo))
{ {
if (Networking.IsOnServer()) if (Networking.IsOnServer)
{ {
ulong currentTimestamp = Util.GetTickCount64(); ulong currentTimestamp = Util.GetTickCount64();
PlayerList.Pressed = (currentTimestamp - PlayerList.Pressed) < 5000 ? (currentTimestamp - 6000) : currentTimestamp; PlayerList.Pressed = (currentTimestamp - PlayerList.Pressed) < 5000 ? (currentTimestamp - 6000) : currentTimestamp;
@ -205,7 +210,7 @@ namespace RageCoop.Client
} }
else if (Game.IsControlJustPressed(GTA.Control.MpTextChatAll)) else if (Game.IsControlJustPressed(GTA.Control.MpTextChatAll))
{ {
if (Networking.IsOnServer()) if (Networking.IsOnServer)
{ {
MainChat.Focused = true; MainChat.Focused = true;
} }

View File

@ -19,7 +19,10 @@ namespace RageCoop.Client.Menus.Sub
private readonly NativeCheckboxItem _disableTrafficItem = new NativeCheckboxItem("Disable Traffic (NPCs/Vehicles)", "Local traffic only", Main.Settings.DisableTraffic); private readonly NativeCheckboxItem _disableTrafficItem = new NativeCheckboxItem("Disable Traffic (NPCs/Vehicles)", "Local traffic only", Main.Settings.DisableTraffic);
private readonly NativeCheckboxItem _flipMenuItem = new NativeCheckboxItem("Flip menu", Main.Settings.FlipMenu); private readonly NativeCheckboxItem _flipMenuItem = new NativeCheckboxItem("Flip menu", Main.Settings.FlipMenu);
private readonly NativeCheckboxItem _disablePauseAlt = new NativeCheckboxItem("Disable Alternate Pause", "Don't freeze game time when Esc pressed", Main.Settings.DisableTraffic);
private readonly NativeCheckboxItem _showNetworkInfoItem = new NativeCheckboxItem("Show Network Info", Networking.ShowNetworkInfo); private readonly NativeCheckboxItem _showNetworkInfoItem = new NativeCheckboxItem("Show Network Info", Networking.ShowNetworkInfo);
private static NativeItem _menuKey = new NativeItem("Menu Key","The key to open menu", Main.Settings.MenuKey.ToString()); private static NativeItem _menuKey = new NativeItem("Menu Key","The key to open menu", Main.Settings.MenuKey.ToString());
private static NativeItem _passengerKey = new NativeItem("Passenger Key", "The key to enter a vehicle as passenger", Main.Settings.PassengerKey.ToString()); private static NativeItem _passengerKey = new NativeItem("Passenger Key", "The key to enter a vehicle as passenger", Main.Settings.PassengerKey.ToString());
@ -32,18 +35,26 @@ namespace RageCoop.Client.Menus.Sub
MainMenu.Title.Color = Color.FromArgb(255, 165, 0); MainMenu.Title.Color = Color.FromArgb(255, 165, 0);
_disableTrafficItem.CheckboxChanged += DisableTrafficCheckboxChanged; _disableTrafficItem.CheckboxChanged += DisableTrafficCheckboxChanged;
_disablePauseAlt.CheckboxChanged+=_disablePauseAlt_CheckboxChanged;
_flipMenuItem.CheckboxChanged += FlipMenuCheckboxChanged; _flipMenuItem.CheckboxChanged += FlipMenuCheckboxChanged;
_showNetworkInfoItem.CheckboxChanged += ShowNetworkInfoCheckboxChanged; _showNetworkInfoItem.CheckboxChanged += ShowNetworkInfoCheckboxChanged;
_menuKey.Activated+=ChaneMenuKey; _menuKey.Activated+=ChaneMenuKey;
_passengerKey.Activated+=ChangePassengerKey; _passengerKey.Activated+=ChangePassengerKey;
MainMenu.Add(_disableTrafficItem); MainMenu.Add(_disableTrafficItem);
MainMenu.Add(_disablePauseAlt);
MainMenu.Add(_flipMenuItem); MainMenu.Add(_flipMenuItem);
MainMenu.Add(_showNetworkInfoItem); MainMenu.Add(_showNetworkInfoItem);
MainMenu.Add(_menuKey); MainMenu.Add(_menuKey);
MainMenu.Add(_passengerKey); MainMenu.Add(_passengerKey);
} }
private void _disablePauseAlt_CheckboxChanged(object sender, EventArgs e)
{
Main.Settings.DisableAlternatePause=_disablePauseAlt.Checked;
Util.SaveSettings();
}
private void ChaneMenuKey(object sender, EventArgs e) private void ChaneMenuKey(object sender, EventArgs e)
{ {
try try
@ -75,6 +86,7 @@ namespace RageCoop.Client.Menus.Sub
public void DisableTrafficCheckboxChanged(object a, System.EventArgs b) public void DisableTrafficCheckboxChanged(object a, System.EventArgs b)
{ {
Main.Settings.DisableTraffic = _disableTrafficItem.Checked; Main.Settings.DisableTraffic = _disableTrafficItem.Checked;
Util.SaveSettings() ;
} }
public void FlipMenuCheckboxChanged(object a, System.EventArgs b) public void FlipMenuCheckboxChanged(object a, System.EventArgs b)

View File

@ -13,7 +13,7 @@ namespace RageCoop.Client
public static void AddFile(byte id, string name, long length) public static void AddFile(byte id, string name, long length)
{ {
string downloadFolder = $"scripts\\resources\\{Main.Settings.LastServerAddress.Replace(":", ".")}"; string downloadFolder = $"Scripts\\RageCoop\\Resources\\{Main.Settings.LastServerAddress.Replace(":", ".")}";
if (!Directory.Exists(downloadFolder)) if (!Directory.Exists(downloadFolder))
{ {

View File

@ -59,7 +59,7 @@ namespace RageCoop.Client
public static void LoadAll() public static void LoadAll()
{ {
string downloadFolder = $"scripts\\resources\\{Main.Settings.LastServerAddress.Replace(":", ".")}"; string downloadFolder = $"Scripts\\RageCoop\\Resources\\{Main.Settings.LastServerAddress.Replace(":", ".")}";
if (!Directory.Exists(downloadFolder)) if (!Directory.Exists(downloadFolder))
{ {

View File

@ -22,7 +22,7 @@ namespace RageCoop.Client
public static void DisConnectFromServer(string address) public static void DisConnectFromServer(string address)
{ {
if (IsOnServer()) if (IsOnServer)
{ {
Client.Disconnect("Bye!"); Client.Disconnect("Bye!");
} }
@ -68,9 +68,9 @@ namespace RageCoop.Client
Client.Connect(ip[0], short.Parse(ip[1]), outgoingMessage); Client.Connect(ip[0], short.Parse(ip[1]), outgoingMessage);
} }
} }
public static bool IsOnServer() public static bool IsOnServer
{ {
return Client?.ConnectionStatus == NetConnectionStatus.Connected; get { return Client?.ConnectionStatus == NetConnectionStatus.Connected; }
} }
public static void Start() public static void Start()
{ {

View File

@ -18,7 +18,7 @@ namespace RageCoop.Client
public static List<PlayerData> Players=new List<PlayerData> { }; public static List<PlayerData> Players=new List<PlayerData> { };
public static void Tick() public static void Tick()
{ {
if (!Networking.IsOnServer()) if (!Networking.IsOnServer)
{ {
return; return;
} }

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.2.0.0")]

View File

@ -39,7 +39,8 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<DocumentationFile>bin\Release\RageCoop.Client.xml</DocumentationFile> <DocumentationFile>
</DocumentationFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ClearScript.Core, Version=7.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="ClearScript.Core, Version=7.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

View File

@ -45,6 +45,11 @@ namespace RageCoop.Client
/// </summary> /// </summary>
public bool DisableTraffic { get; set; } = true; public bool DisableTraffic { get; set; } = true;
/// <summary>
/// Bring up pause menu but don't freeze time when FrontEndPauseAlternate(Esc) is pressed.
/// </summary>
public bool DisableAlternatePause { get; set; } = true;
} }
} }

View File

@ -35,7 +35,14 @@ namespace RageCoop.Client
return; return;
} }
Game.DisableControlThisFrame(Control.FrontendPause); if (Networking.IsOnServer)
{
Game.DisableControlThisFrame(Control.FrontendPause);
if (Main.Settings.DisableAlternatePause)
{
Game.DisableControlThisFrame(Control.FrontendPauseAlternate);
}
}
// Sets a value that determines how aggressive the ocean waves will be. // Sets a value that determines how aggressive the ocean waves will be.
// Values of 2.0 or more make for very aggressive waves like you see during a thunderstorm. // Values of 2.0 or more make for very aggressive waves like you see during a thunderstorm.

View File

@ -6,10 +6,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Any CPU</Platform> <Platform>Any CPU</Platform>
<PublishDir>bin\Release\net6.0\publish\linux-x64\</PublishDir> <PublishDir>bin\Release\net6.0\publish\osx-x64\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier> <RuntimeIdentifier>osx-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained> <SelfContained>true</SelfContained>
<PublishSingleFile>True</PublishSingleFile> <PublishSingleFile>True</PublishSingleFile>
<PublishTrimmed>True</PublishTrimmed> <PublishTrimmed>True</PublishTrimmed>

View File

@ -4,6 +4,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
--> -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<History>True|2022-05-24T03:00:13.3617113Z;True|2022-05-22T16:56:31.0481188+08:00;True|2022-05-18T13:35:57.1402751+08:00;True|2022-05-18T13:10:28.4995253+08:00;True|2022-05-01T18:35:01.9624101+08:00;True|2022-05-01T12:32:20.8671319+08:00;False|2022-05-01T12:30:25.4596227+08:00;</History> <History>True|2022-05-25T02:30:00.0927959Z;True|2022-05-25T10:26:50.6739643+08:00;True|2022-05-25T10:20:36.6658425+08:00;True|2022-05-25T10:19:47.8333108+08:00;True|2022-05-24T11:00:13.3617113+08:00;True|2022-05-22T16:56:31.0481188+08:00;True|2022-05-18T13:35:57.1402751+08:00;True|2022-05-18T13:10:28.4995253+08:00;True|2022-05-01T18:35:01.9624101+08:00;True|2022-05-01T12:32:20.8671319+08:00;False|2022-05-01T12:30:25.4596227+08:00;</History>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -3,8 +3,8 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<AssemblyVersion>0.1</AssemblyVersion> <AssemblyVersion>0.2</AssemblyVersion>
<FileVersion>0.1</FileVersion> <FileVersion>0.2</FileVersion>
<RepositoryUrl>https://github.com/RAGECOOP/RAGECOOP-V</RepositoryUrl> <RepositoryUrl>https://github.com/RAGECOOP/RAGECOOP-V</RepositoryUrl>
<PackageProjectUrl>https://ragecoop.online/</PackageProjectUrl> <PackageProjectUrl>https://ragecoop.online/</PackageProjectUrl>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
@ -12,7 +12,7 @@
<Product>$(AssemblyName)-V</Product> <Product>$(AssemblyName)-V</Product>
<PackageId>RAGECOOP-V</PackageId> <PackageId>RAGECOOP-V</PackageId>
<Authors>RAGECOOP</Authors> <Authors>RAGECOOP</Authors>
<Version>0.1</Version> <Version>0.2</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -22,7 +22,7 @@ namespace RageCoop.Server
public class Server public class Server
{ {
private static readonly string _compatibleVersion = "V0_1"; private static readonly string _compatibleVersion = "V0_2";
private static long _currentTick = 0; private static long _currentTick = 0;
public static readonly Settings MainSettings = Util.Read<Settings>("Settings.xml"); public static readonly Settings MainSettings = Util.Read<Settings>("Settings.xml");