Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: Speed up the reflection.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 6, 2023
1 parent 731694e commit 7a0c3e6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -519,5 +519,6 @@
"31323": 2.1,
"33041": 2.1,
"33341": 0.1,
"33708": 2.1
"33708": 2.1,
"33907": 2.1
}
18 changes: 12 additions & 6 deletions RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,21 +148,27 @@ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = Ac
private protected virtual IBaseAction Raise => null;
private protected virtual IBaseAction TankStance => null;

public virtual IBaseAction[] AllBaseActions => GetBaseActions(GetType()).ToArray();
IBaseAction[] _allBaseActions;
public virtual IBaseAction[] AllBaseActions => _allBaseActions ??= GetBaseActions(GetType()).ToArray();

public IAction[] AllActions => Array.Empty<IAction>().Union(GetBaseItems(GetType())).Union(AllBaseActions).ToArray();
IAction[] _allActions;
public IAction[] AllActions => _allActions ??= Array.Empty<IAction>().Union(GetBaseItems(GetType())).Union(AllBaseActions).ToArray();

public PropertyInfo[] AllBools => GetType().GetStaticProperties<bool>();
PropertyInfo[] _allBools;
public PropertyInfo[] AllBools => _allBools ??= GetType().GetStaticProperties<bool>();

public PropertyInfo[] AllBytes => GetType().GetStaticProperties<byte>();
PropertyInfo[] _allBytes;
public PropertyInfo[] AllBytes => _allBytes ??= GetType().GetStaticProperties<byte>();

public MethodInfo[] AllTimes => GetType().GetStaticBoolMethodInfo(m =>
MethodInfo[] _allTimes;
public MethodInfo[] AllTimes => _allTimes ??= GetType().GetStaticBoolMethodInfo(m =>
{
var types = m.GetParameters();
return types.Length == 1 && types[0].ParameterType == typeof(float);
});

public MethodInfo[] AllGCDs => GetType().GetStaticBoolMethodInfo(m =>
MethodInfo[] _allGCDs;
public MethodInfo[] AllGCDs => _allGCDs ??= GetType().GetStaticBoolMethodInfo(m =>
{
var types = m.GetParameters();
return types.Length == 2 && types[0].ParameterType == typeof(uint) && types[1].ParameterType == typeof(uint);
Expand Down
1 change: 0 additions & 1 deletion RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Dalamud.Utility;
using ECommons.DalamudServices;
using FFXIVClientStructs.FFXIV.Client.Game;
using Newtonsoft.Json.Linq;
using RotationSolver.Basic.Configuration;
using RotationSolver.Commands;
using RotationSolver.Helpers;
Expand Down

0 comments on commit 7a0c3e6

Please sign in to comment.