Tunable debug values
This commit is contained in:
@ -66,6 +66,7 @@ namespace RageCoop.Client.Menus
|
||||
MenuPool.Add(DevToolMenu.Menu);
|
||||
MenuPool.Add(DebugMenu.Menu);
|
||||
MenuPool.Add(DebugMenu.DiagnosticMenu);
|
||||
MenuPool.Add(DebugMenu.TuneMenu);
|
||||
MenuPool.Add(ServersMenu.Menu);
|
||||
MenuPool.Add(PopUp);
|
||||
|
||||
@ -174,13 +175,13 @@ namespace RageCoop.Client.Menus
|
||||
#region ITEMS
|
||||
|
||||
private static readonly NativeItem _usernameItem = new NativeItem("Username")
|
||||
{ AltTitle = Settings.Username };
|
||||
{ AltTitle = Settings.Username };
|
||||
|
||||
private static readonly NativeItem _passwordItem = new NativeItem("Password")
|
||||
{ AltTitle = new string('*', Settings.Password.Length) };
|
||||
{ AltTitle = new string('*', Settings.Password.Length) };
|
||||
|
||||
public static readonly NativeItem ServerIpItem = new NativeItem("Server IP")
|
||||
{ AltTitle = Settings.LastServerAddress };
|
||||
{ AltTitle = Settings.LastServerAddress };
|
||||
|
||||
internal static readonly NativeItem _serverConnectItem = new NativeItem("Connect");
|
||||
|
||||
@ -188,7 +189,7 @@ namespace RageCoop.Client.Menus
|
||||
"https://github.com/RAGECOOP~n~" +
|
||||
"~y~VERSION~s~~n~" +
|
||||
Main.ModVersion)
|
||||
{ LeftBadge = new ScaledTexture("commonmenu", "shop_new_star") };
|
||||
{ LeftBadge = new ScaledTexture("commonmenu", "shop_new_star") };
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
@ -1,39 +1,76 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using GTA.UI;
|
||||
using LemonUI.Menus;
|
||||
using RageCoop.Core;
|
||||
|
||||
namespace RageCoop.Client
|
||||
{
|
||||
internal static class DebugMenu
|
||||
{
|
||||
public static NativeMenu Menu = new NativeMenu("RAGECOOP", "Debug", "Debug settings")
|
||||
public static NativeMenu Menu = new("RAGECOOP", "Debug", "Debug settings")
|
||||
{
|
||||
UseMouse = false,
|
||||
Alignment = Settings.FlipMenu ? Alignment.Right : Alignment.Left
|
||||
};
|
||||
|
||||
public static NativeMenu DiagnosticMenu = new NativeMenu("RAGECOOP", "Diagnostic", "Performence and Diagnostic")
|
||||
public static NativeMenu DiagnosticMenu = new("RAGECOOP", "Diagnostic", "Performence and Diagnostic")
|
||||
{
|
||||
UseMouse = false,
|
||||
Alignment = Settings.FlipMenu ? Alignment.Right : Alignment.Left
|
||||
};
|
||||
|
||||
|
||||
public static NativeMenu TuneMenu = new("RAGECOOP", "Change tunable values")
|
||||
{
|
||||
UseMouse = false,
|
||||
Alignment = Settings.FlipMenu ? Alignment.Right : Alignment.Left
|
||||
};
|
||||
|
||||
public static NativeItem SimulatedLatencyItem =
|
||||
new NativeItem("Simulated network latency", "Simulated network latency in ms (one way)", "0");
|
||||
new("Simulated network latency", "Simulated network latency in ms (one way)", "0");
|
||||
|
||||
public static NativeCheckboxItem ShowOwnerItem = new NativeCheckboxItem("Show entity owner",
|
||||
public static NativeCheckboxItem ShowOwnerItem = new("Show entity owner",
|
||||
"Show the owner name of the entity you're aiming at", false);
|
||||
|
||||
private static readonly NativeCheckboxItem ShowNetworkInfoItem =
|
||||
new NativeCheckboxItem("Show Network Info", Networking.ShowNetworkInfo);
|
||||
new("Show Network Info", Networking.ShowNetworkInfo);
|
||||
|
||||
static DebugMenu()
|
||||
{
|
||||
Menu.Banner.Color = Color.FromArgb(225, 0, 0, 0);
|
||||
Menu.Title.Color = Color.FromArgb(255, 165, 0);
|
||||
|
||||
|
||||
TuneMenu.Opening += (s, e) =>
|
||||
{
|
||||
TuneMenu.Clear();
|
||||
foreach (var t in typeof(Main).Assembly.GetTypes())
|
||||
{
|
||||
foreach (var field in t.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic))
|
||||
{
|
||||
var attri = field.GetCustomAttribute<DebugTunableAttribute>();
|
||||
if (attri == null)
|
||||
continue;
|
||||
var item = new NativeItem($"{t}.{field.Name}");
|
||||
item.AltTitle = field.GetValue(null).ToString();
|
||||
item.Activated += (s, e) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
field.SetValue(null, Convert.ChangeType(Game.GetUserInput(), field.FieldType));
|
||||
item.AltTitle = field.GetValue(null).ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex);
|
||||
}
|
||||
};
|
||||
TuneMenu.Add(item);
|
||||
}
|
||||
}
|
||||
};
|
||||
DiagnosticMenu.Opening += (sender, e) =>
|
||||
{
|
||||
DiagnosticMenu.Clear();
|
||||
@ -70,6 +107,7 @@ namespace RageCoop.Client
|
||||
Menu.Add(ShowNetworkInfoItem);
|
||||
Menu.Add(ShowOwnerItem);
|
||||
Menu.AddSubMenu(DiagnosticMenu);
|
||||
Menu.AddSubMenu(TuneMenu);
|
||||
}
|
||||
}
|
||||
}
|
@ -15,6 +15,10 @@ using System.Text;
|
||||
|
||||
namespace RageCoop.Client
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
class DebugTunableAttribute : Attribute
|
||||
{
|
||||
}
|
||||
internal static class Shared
|
||||
{
|
||||
private static unsafe string GetBasePath()
|
||||
|
@ -57,7 +57,8 @@ namespace RageCoop.Client
|
||||
internal bool IsSubmarineCar;
|
||||
internal bool IsDeluxo;
|
||||
internal bool IsTrain;
|
||||
private const float RotCalMult = 10f;
|
||||
[DebugTunable]
|
||||
static float RotCalMult = 10f;
|
||||
|
||||
#endregion
|
||||
|
||||
|
Reference in New Issue
Block a user