Files
RAGECOOP-V/Client/Scripts/Menus/Sub/DevToolMenu.cs

74 lines
2.5 KiB
C#
Raw Normal View History

2022-10-23 19:02:39 +08:00
using System;
using System.Drawing;
2022-10-19 19:07:46 +08:00
using System.IO;
2022-10-23 19:02:39 +08:00
using GTA;
2022-10-19 19:07:46 +08:00
using GTA.Native;
2022-10-23 19:02:39 +08:00
using GTA.UI;
using LemonUI.Menus;
2022-11-16 17:37:31 +08:00
using RageCoop.Core;
namespace RageCoop.Client
{
internal static class DevToolMenu
{
2022-10-19 19:07:46 +08:00
public static NativeMenu Menu = new NativeMenu("RAGECOOP", "DevTool", "Internal testing tools")
{
UseMouse = false,
2023-02-13 20:44:50 +08:00
Alignment = Settings.FlipMenu ? Alignment.Right : Alignment.Left
};
2022-10-23 19:02:39 +08:00
2022-11-16 17:37:31 +08:00
private static readonly NativeCheckboxItem enableItem = new NativeCheckboxItem("Show weapon bones");
public static readonly NativeItem DumpFixItem = new NativeItem("Dump weapon fixes");
public static readonly NativeItem GetAnimItem = new NativeItem("Get current animation");
public static readonly NativeItem DumpVwHashItem = new NativeItem("Dump VehicleWeaponHash.cs");
static DevToolMenu()
{
Menu.Banner.Color = Color.FromArgb(225, 0, 0, 0);
Menu.Title.Color = Color.FromArgb(255, 165, 0);
2022-11-16 17:37:31 +08:00
enableItem.Activated += ShowBones;
2022-09-06 21:46:35 +08:00
enableItem.Checked = false;
2022-11-16 17:37:31 +08:00
DumpFixItem.Activated += (s, e) => WeaponUtil.DumpWeaponFix(WeaponFixDataPath);
GetAnimItem.Activated += (s, e) =>
{
2022-11-16 17:37:31 +08:00
if (File.Exists(AnimationsDataPath))
2022-10-19 19:07:46 +08:00
{
2023-02-12 22:06:57 +08:00
var anims = JsonDeserialize<AnimDic[]>(File.ReadAllText(AnimationsDataPath));
2022-10-23 19:02:39 +08:00
foreach (var anim in anims)
foreach (var a in anim.Animations)
2023-02-13 20:44:50 +08:00
if (Call<bool>(IS_ENTITY_PLAYING_ANIM, P, anim.DictionaryName, a, 3))
2022-10-19 19:07:46 +08:00
{
Console.PrintInfo(anim.DictionaryName + " : " + a);
2022-10-23 19:02:39 +08:00
Notification.Show(anim.DictionaryName + " : " + a);
2022-10-19 19:07:46 +08:00
}
}
else
{
2022-11-16 17:37:31 +08:00
Notification.Show($"~r~{AnimationsDataPath} not found");
2022-10-19 19:07:46 +08:00
}
};
Menu.Add(enableItem);
2022-11-16 17:37:31 +08:00
Menu.Add(DumpVwHashItem);
Menu.Add(DumpFixItem);
Menu.Add(GetAnimItem);
}
2022-11-16 17:37:31 +08:00
private static void ShowBones(object sender, EventArgs e)
{
if (enableItem.Checked)
{
2022-09-06 21:46:35 +08:00
DevTool.ToMark = Game.Player.Character.CurrentVehicle;
2022-10-19 19:07:46 +08:00
DevTool.Instance.Resume();
}
else
{
2022-10-09 22:07:52 +08:00
DevTool.Instance.Pause();
2022-09-06 21:46:35 +08:00
DevTool.ToMark = null;
}
}
}
2022-10-23 19:02:39 +08:00
}