2021-08-06 12:31:25 +02:00
using LemonUI.Menus ;
namespace CoopClient.Menus.Sub
{
2021-12-03 20:30:00 +01:00
/// <summary>
/// Don't use it!
/// </summary>
public class Settings
2021-08-06 12:31:25 +02:00
{
2021-12-03 20:30:00 +01:00
internal NativeMenu MainMenu = new NativeMenu ( "GTACOOP:R" , "Settings" , "Go to the settings" )
2021-08-06 12:31:25 +02:00
{
UseMouse = false ,
Alignment = Main . MainSettings . FlipMenu ? GTA . UI . Alignment . Right : GTA . UI . Alignment . Left
} ;
2021-08-18 11:47:59 +02:00
2021-12-12 20:05:55 +01:00
private readonly NativeCheckboxItem DisableTraffic = new NativeCheckboxItem ( "Disable Traffic (NPCs/Vehicles)" , "Local traffic only" , Main . DisableTraffic ) ;
2021-12-14 22:39:15 +01:00
private readonly NativeCheckboxItem ShareNPCsItem = new NativeCheckboxItem ( "Share NPCs" , "~y~WARNING:~s~ High network traffic!" , Main . ShareNPCsWithPlayers ) { Enabled = false } ;
2021-08-06 12:31:25 +02:00
private readonly NativeCheckboxItem FlipMenuItem = new NativeCheckboxItem ( "Flip menu" , Main . MainSettings . FlipMenu ) ;
2021-08-22 13:59:15 +02:00
#if DEBUG
2021-08-06 12:31:25 +02:00
private readonly NativeCheckboxItem UseDebugItem = new NativeCheckboxItem ( "Debug" , Main . UseDebug ) ;
2021-08-18 11:47:59 +02:00
private readonly NativeCheckboxItem ShowNetworkInfo = new NativeCheckboxItem ( "Show Network Info" , Main . MainNetworking . ShowNetworkInfo ) ;
2021-08-22 13:59:15 +02:00
#endif
2021-08-06 12:31:25 +02:00
2021-12-03 20:30:00 +01:00
/// <summary>
/// Don't use it!
/// </summary>
2021-08-06 12:31:25 +02:00
public Settings ( )
{
2021-08-22 13:59:15 +02:00
DisableTraffic . CheckboxChanged + = DisableTrafficCheckboxChanged ;
2021-12-14 22:39:15 +01:00
ShareNPCsItem . CheckboxChanged + = ( item , check ) = > { Main . ShareNPCsWithPlayers = ShareNPCsItem . Checked ; } ;
2021-08-06 12:31:25 +02:00
FlipMenuItem . CheckboxChanged + = FlipMenuCheckboxChanged ;
#if DEBUG
UseDebugItem . CheckboxChanged + = UseDebugCheckboxChanged ;
2021-08-18 11:47:59 +02:00
ShowNetworkInfo . CheckboxChanged + = ShowNetworkInfoCheckboxChanged ;
2021-08-06 12:31:25 +02:00
#endif
2021-08-22 13:59:15 +02:00
MainMenu . Add ( DisableTraffic ) ;
2021-12-13 17:48:00 +01:00
MainMenu . Add ( ShareNPCsItem ) ;
2021-08-06 12:31:25 +02:00
MainMenu . Add ( FlipMenuItem ) ;
#if DEBUG
MainMenu . Add ( UseDebugItem ) ;
2021-08-18 11:47:59 +02:00
MainMenu . Add ( ShowNetworkInfo ) ;
2021-08-06 12:31:25 +02:00
#endif
}
2021-12-03 20:30:00 +01:00
internal void DisableTrafficCheckboxChanged ( object a , System . EventArgs b )
2021-08-22 13:59:15 +02:00
{
Main . DisableTraffic = DisableTraffic . Checked ;
if ( DisableTraffic . Checked )
{
2021-12-13 17:48:00 +01:00
if ( ShareNPCsItem . Checked )
2021-08-22 13:59:15 +02:00
{
2021-12-13 17:48:00 +01:00
ShareNPCsItem . Checked = false ;
2021-08-22 13:59:15 +02:00
}
2021-12-13 17:48:00 +01:00
ShareNPCsItem . Enabled = false ;
2021-08-22 13:59:15 +02:00
}
2021-12-14 22:39:15 +01:00
else if ( Main . NPCsAllowed & & ! ShareNPCsItem . Enabled )
2021-08-22 13:59:15 +02:00
{
2021-12-13 17:48:00 +01:00
ShareNPCsItem . Enabled = true ;
2021-08-22 13:59:15 +02:00
}
}
2021-12-03 20:30:00 +01:00
internal void FlipMenuCheckboxChanged ( object a , System . EventArgs b )
2021-08-06 12:31:25 +02:00
{
2021-09-26 20:52:23 -06:00
#if ! NON_INTERACTIVE
2021-08-06 12:31:25 +02:00
Main . MainMenu . MainMenu . Alignment = FlipMenuItem . Checked ? GTA . UI . Alignment . Right : GTA . UI . Alignment . Left ;
2021-09-26 20:52:23 -06:00
#endif
2021-08-06 12:31:25 +02:00
MainMenu . Alignment = FlipMenuItem . Checked ? GTA . UI . Alignment . Right : GTA . UI . Alignment . Left ;
Main . MainSettings . FlipMenu = FlipMenuItem . Checked ;
Util . SaveSettings ( ) ;
}
2021-08-22 13:59:15 +02:00
#if DEBUG
2021-12-03 20:30:00 +01:00
internal void UseDebugCheckboxChanged ( object a , System . EventArgs b )
2021-08-06 12:31:25 +02:00
{
Main . UseDebug = UseDebugItem . Checked ;
if ( ! UseDebugItem . Checked & & Main . DebugSyncPed ! = null )
{
if ( Main . DebugSyncPed . Character . Exists ( ) )
{
Main . DebugSyncPed . Character . Kill ( ) ;
Main . DebugSyncPed . Character . Delete ( ) ;
}
Main . DebugSyncPed = null ;
2021-08-15 11:33:52 +02:00
Main . LastFullDebugSync = 0 ;
2021-08-16 14:03:05 +02:00
Main . Players . Remove ( 0 ) ;
2021-08-06 12:31:25 +02:00
}
}
2021-08-18 11:47:59 +02:00
2021-12-03 20:30:00 +01:00
internal void ShowNetworkInfoCheckboxChanged ( object a , System . EventArgs b )
2021-08-18 11:47:59 +02:00
{
Main . MainNetworking . ShowNetworkInfo = ShowNetworkInfo . Checked ;
if ( ! Main . MainNetworking . ShowNetworkInfo )
{
Main . MainNetworking . BytesReceived = 0 ;
Main . MainNetworking . BytesSend = 0 ;
}
}
2021-08-22 13:59:15 +02:00
#endif
2021-08-06 12:31:25 +02:00
}
}