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-09-28 14:44:10 +02:00
|
|
|
|
private readonly NativeCheckboxItem DisableTraffic = new NativeCheckboxItem("Disable Traffic (Npcs/Vehicles)", "Local traffic only", Main.DisableTraffic);
|
2021-12-08 10:04:38 +01:00
|
|
|
|
private readonly NativeCheckboxItem ShareNpcsItem = new NativeCheckboxItem("Share NPCs", "20 NPCs = 1mb / 12 seconds (UPLOAD)", Main.ShareNpcsWithPlayers) { Enabled = false };
|
|
|
|
|
private readonly NativeSliderItem StreamedNpcsItem = new NativeSliderItem($"Streamed NPCs ({Main.MainSettings.StreamedNpc})", 20, Main.MainSettings.StreamedNpc > 20 ? 20 : Main.MainSettings.StreamedNpc);
|
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-08-06 12:31:25 +02:00
|
|
|
|
ShareNpcsItem.CheckboxChanged += (item, check) => { Main.ShareNpcsWithPlayers = ShareNpcsItem.Checked; };
|
|
|
|
|
StreamedNpcsItem.ValueChanged += StreamedNpcsValueChanged;
|
|
|
|
|
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-08-06 12:31:25 +02:00
|
|
|
|
MainMenu.Add(ShareNpcsItem);
|
|
|
|
|
MainMenu.Add(StreamedNpcsItem);
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
if (ShareNpcsItem.Checked)
|
|
|
|
|
{
|
|
|
|
|
ShareNpcsItem.Checked = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ShareNpcsItem.Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
else if (Main.NpcsAllowed && !ShareNpcsItem.Enabled)
|
|
|
|
|
{
|
|
|
|
|
ShareNpcsItem.Enabled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-03 20:30:00 +01:00
|
|
|
|
internal void StreamedNpcsValueChanged(object a, System.EventArgs b)
|
2021-08-06 12:31:25 +02:00
|
|
|
|
{
|
|
|
|
|
Main.MainSettings.StreamedNpc = StreamedNpcsItem.Value;
|
|
|
|
|
Util.SaveSettings();
|
|
|
|
|
StreamedNpcsItem.Title = string.Format("Streamed Npcs ({0})", Main.MainSettings.StreamedNpc);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|