diff --git a/Overlayer/Core/Drawer.cs b/Overlayer/Core/Drawer.cs
index 2c0302e..aa917f2 100644
--- a/Overlayer/Core/Drawer.cs
+++ b/Overlayer/Core/Drawer.cs
@@ -20,7 +20,7 @@ namespace Overlayer.Core;
public static class Drawer {
public static CodeEditor.CodeEditor codeEditor = new("OverlayerCodeEditor",
- new CodeTheme() {
+ new CodeTheme {
background = "#333333",
linenumbg = "#222222",
color = "#FFFFFF",
@@ -104,7 +104,7 @@ static Drawer() {
} else if(name.EndsWith("Hex")) {
try {
var val = (string)TagManager.tags[name].Tag.Getter.Invoke(null,
- new object[] { "-1", Overlayer.Utils.Extensions.DefaultTrimStr });
+ ["-1", Overlayer.Utils.Extensions.DefaultTrimStr]);
str = str.Replace("{" + match.Groups[1].Value + "}",
"{" + match.Groups[1].Value + "}");
} catch {
@@ -543,7 +543,8 @@ public static bool DrawEnum(ref T @enum) where T : Enum {
public static bool DrawEase(ref Ease ease) {
string[] names = Enum.GetNames(typeof(Ease));
int current = (int)ease;
- Texture2D[] easeImages = new Texture2D[] { null, Icon_EaseLinear, Icon_EaseInSine, Icon_EaseOutSine, Icon_EaseInOutSine, Icon_EaseInQuad, Icon_EaseOutQuad, Icon_EaseInOutQuad, Icon_EaseInCubic, Icon_EaseOutCubic, Icon_EaseInOutCubic, Icon_EaseInQuart, Icon_EaseOutQuart, Icon_EaseInOutQuart, Icon_EaseInQuint, Icon_EaseOutQuint, Icon_EaseInOutQuint, Icon_EaseInExpo, Icon_EaseOutExpo, Icon_EaseInOutExpo, Icon_EaseInCirc, Icon_EaseOutCirc, Icon_EaseInOutCirc, Icon_EaseInElastic, Icon_EaseOutElastic, Icon_EaseInOutElastic, Icon_EaseInBack, Icon_EaseOutBack, Icon_EaseInOutBack, Icon_EaseInBounce, Icon_EaseOutBounce, Icon_EaseInOutBounce };
+ Texture2D[] easeImages = [null, Icon_EaseLinear, Icon_EaseInSine, Icon_EaseOutSine, Icon_EaseInOutSine, Icon_EaseInQuad, Icon_EaseOutQuad, Icon_EaseInOutQuad, Icon_EaseInCubic, Icon_EaseOutCubic, Icon_EaseInOutCubic, Icon_EaseInQuart, Icon_EaseOutQuart, Icon_EaseInOutQuart, Icon_EaseInQuint, Icon_EaseOutQuint, Icon_EaseInOutQuint, Icon_EaseInExpo, Icon_EaseOutExpo, Icon_EaseInOutExpo, Icon_EaseInCirc, Icon_EaseOutCirc, Icon_EaseInOutCirc, Icon_EaseInElastic, Icon_EaseOutElastic, Icon_EaseInOutElastic, Icon_EaseInBack, Icon_EaseOutBack, Icon_EaseInOutBack, Icon_EaseInBounce, Icon_EaseOutBounce, Icon_EaseInOutBounce
+ ];
bool result = SelectionPopup(ref current, names, easeImages, "");
if(result) {
ease = (Ease)current;
@@ -663,7 +664,7 @@ private static bool DrawExprInternal(Texture2D icon, string label, string id,
Color old = GUI.color;
bool isExpr = value.IsExpr;
GUILayout.BeginHorizontal();
- if(icon != null) {
+ if(icon) {
GUILayout.Label(icon);
GUILayout.Space(4);
}
diff --git a/Overlayer/Core/ImageManager.cs b/Overlayer/Core/ImageManager.cs
index fcd6062..56fd30b 100644
--- a/Overlayer/Core/ImageManager.cs
+++ b/Overlayer/Core/ImageManager.cs
@@ -10,7 +10,7 @@ public static class ImageManager {
public static bool Initialized { get; private set; } = false;
public static Sprite DefaultSprite {
get {
- if(_defaultSprite == null) {
+ if(_defaultSprite is null) {
CreateDefault();
}
return _defaultSprite;
@@ -23,7 +23,7 @@ public static Sprite DefaultSprite {
static void CreateDefault() {
Texture2D tex = new(2, 2);
- tex.SetPixels(new Color[4] { Color.clear, Color.clear, Color.clear, Color.clear });
+ tex.SetPixels([Color.clear, Color.clear, Color.clear, Color.clear]);
tex.Apply();
_defaultSprite = Sprite.Create(tex, new Rect(0, 0, 2, 2), new Vector2(0.5f, 0.5f));
}
diff --git a/Overlayer/Core/ProfileManager.cs b/Overlayer/Core/ProfileManager.cs
index 67dbc3e..251e323 100644
--- a/Overlayer/Core/ProfileManager.cs
+++ b/Overlayer/Core/ProfileManager.cs
@@ -114,7 +114,7 @@ public static bool OrderByDrag(int from, int to) {
}
public static void Destroy(OverlayerProfile profile) {
- if(profile == null || !Profiles.Contains(profile)) {
+ if(profile is null || !Profiles.Contains(profile)) {
return;
}
diff --git a/Overlayer/Core/Scripting/Impl.cs b/Overlayer/Core/Scripting/Impl.cs
index 4980ed7..cb5fe39 100644
--- a/Overlayer/Core/Scripting/Impl.cs
+++ b/Overlayer/Core/Scripting/Impl.cs
@@ -377,11 +377,11 @@ public static bool TranspilerWithArgs(Engine engine, string typeColonMethodName,
harmony.Patch(target, transpiler: new HarmonyMethod(wrap));
return true;
}*/
- [Api("getLanguage", RequireTypes = new[] { typeof(SystemLanguage) })]
+ [Api("getLanguage", RequireTypes = [typeof(SystemLanguage)])]
public static SystemLanguage GetLanguage(Engine engine) => RDString.language;
- [Api("ease", RequireTypes = new Type[] { typeof(Ease) })]
+ [Api("ease", RequireTypes = [typeof(Ease)])]
public static float EasedValue(Engine engine, Ease ease, float lifetime) => DOVirtual.EasedValue(0, 1, lifetime, ease);
- [Api("easeColor", RequireTypes = new Type[] { typeof(Color) })]
+ [Api("easeColor", RequireTypes = [typeof(Color)])]
public static Color EasedColor(Engine engine, Color color, Ease ease, float lifetime) => color * DOVirtual.EasedValue(0, 1, lifetime, ease);
[Api("easeColorFromTo")]
public static Color EasedColor(Engine engine, Color from, Color to, Ease ease, float lifetime) => from + ((to - from) * DOVirtual.EasedValue(0, 1, lifetime, ease));
@@ -446,7 +446,7 @@ public static OverlayerText CreateTextFromJson(string json, OverlayerProfile pro
var config = TextConfigImporter.Import(token);
return profile.ObjectManager.Create(config);
}
- [Api("createTexture", RequireTypes = new[] { typeof(Texture2D) })]
+ [Api("createTexture", RequireTypes = [typeof(Texture2D)])]
public static Texture2D CreateTexture(string imagePath) {
if(!File.Exists(imagePath)) {
return null;
@@ -477,10 +477,10 @@ public static void PlaySound(string path) {
};
AudioPlayer.Play(sound);
}
- [Api("loadAudio", Comment = new string[]
- {
+ [Api("loadAudio", Comment =
+ [
"Load Audio(UnityEngine.AudioClip) With Callback (.mp3, .ogg, .aiff, .wav)"
- }, RequireTypes = new Type[] { typeof(AudioClip) })]
+ ], RequireTypes = [typeof(AudioClip)])]
public static void LoadAudio(string path, JsValue callback) {
if(callback is not Function func) {
return;
@@ -489,16 +489,16 @@ public static void LoadAudio(string path, JsValue callback) {
FIWrapper fi = new(func);
AudioPlayer.LoadAudio(path, ac => fi.Call(ac));
}
- [Api("setAudio", Comment = new string[]
- {
+ [Api("setAudio", Comment =
+ [
"Set Audio(UnityEngine.AudioClip) With Callback (.mp3, .ogg, .aiff, .wav)"
- }, RequireTypes = new Type[] { typeof(AudioSource) })]
+ ], RequireTypes = [typeof(AudioSource)])]
public static void SetAudio(string path, AudioSource source) => AudioPlayer.LoadAudio(path, clip => source.clip = clip);
public class On {
- [Api("rewind", Comment = new[]
- {
+ [Api("rewind", Comment =
+ [
"On ADOFAI Rewind (Level Start, Scene Moved, etc..)"
- })]
+ ])]
public static void Rewind(Engine engine, JsValue func) {
if(func is not Function fi) {
return;
@@ -507,10 +507,10 @@ public static void Rewind(Engine engine, JsValue func) {
FIWrapper wrapper = new(fi);
harmony.Postfix(MiscUtils.MethodByName("scrController:Awake_Rewind"), new Action(() => wrapper.Call()));
}
- [Api("hit", Comment = new[]
- {
+ [Api("hit", Comment =
+ [
"On Tile Hit"
- })]
+ ])]
public static void Hit(Engine engine, JsValue func) {
if(func is not Function fi) {
return;
@@ -519,10 +519,10 @@ public static void Hit(Engine engine, JsValue func) {
FIWrapper wrapper = new(fi);
harmony.Postfix(MiscUtils.MethodByName("scrController:Hit"), new Action(() => wrapper.Call()));
}
- [Api("dead", Comment = new[]
- {
+ [Api("dead", Comment =
+ [
"On Dead"
- })]
+ ])]
public static void Dead(Engine engine, JsValue func) {
if(func is not Function fi) {
return;
@@ -535,10 +535,10 @@ public static void Dead(Engine engine, JsValue func) {
}
}));
}
- [Api("fail", Comment = new[]
- {
+ [Api("fail", Comment =
+ [
"On Fail"
- })]
+ ])]
public static void Fail(Engine engine, JsValue func) {
if(func is not Function fi) {
return;
@@ -547,10 +547,10 @@ public static void Fail(Engine engine, JsValue func) {
FIWrapper wrapper = new(fi);
harmony.Postfix(MiscUtils.MethodByName("scrController:FailAction"), new Action(__instance => wrapper.Call()));
}
- [Api("clear", Comment = new[]
- {
+ [Api("clear", Comment =
+ [
"On Clear"
- })]
+ ])]
public static void Clear(Engine engine, JsValue func) {
if(func is not Function fi) {
return;
@@ -564,26 +564,26 @@ public static void Clear(Engine engine, JsValue func) {
}));
}
#region KeyEvents
- [Api("anyKey", Comment = new[]
- {
+ [Api("anyKey", Comment =
+ [
"On Any Key Pressed"
- })]
+ ])]
public static void AnyKey(Engine engine, JsValue func) {
if(func is not Function fi) {
return;
}
FIWrapper wrapper = new(fi);
- harmony.Postfix(MiscUtils.MethodByName("scrController:Update"), new Action(() => {
+ harmony.Postfix(MiscUtils.MethodByName("scrController:Update"), () => {
if(Input.anyKey) {
wrapper.Call();
}
- }));
+ });
}
- [Api("anyKeyDown", Comment = new[]
- {
+ [Api("anyKeyDown", Comment =
+ [
"On Any Key Down"
- })]
+ ])]
public static void AnyKeyDown(Engine engine, JsValue func) {
if(func is not Function fi) {
return;
@@ -596,75 +596,74 @@ public static void AnyKeyDown(Engine engine, JsValue func) {
}
}));
}
- [Api("key", Comment = new[]
- {
+ [Api("key", Comment =
+ [
"On Key Pressed"
- })]
+ ])]
public static void Key(Engine engine, KeyCode key, JsValue func) {
if(func is not Function fi) {
return;
}
FIWrapper wrapper = new(fi);
- harmony.Postfix(MiscUtils.MethodByName("scrController:Update"), new Action(() => {
+ harmony.Postfix(MiscUtils.MethodByName("scrController:Update"), () => {
if(Input.GetKey(key)) {
wrapper.Call();
}
- }));
+ });
}
- [Api("keyUp", Comment = new[]
- {
+ [Api("keyUp", Comment =
+ [
"On Key Up"
- })]
+ ])]
public static void KeyUp(Engine engine, KeyCode key, JsValue func) {
if(func is not Function fi) {
return;
}
FIWrapper wrapper = new(fi);
- harmony.Postfix(MiscUtils.MethodByName("scrController:Update"), new Action(() => {
+ harmony.Postfix(MiscUtils.MethodByName("scrController:Update"), () => {
if(Input.GetKeyUp(key)) {
wrapper.Call();
}
- }));
+ });
}
- [Api("keyDown", Comment = new[]
- {
+ [Api("keyDown", Comment =
+ [
"On Key Down"
- })]
+ ])]
public static void KeyDown(Engine engine, KeyCode key, JsValue func) {
if(func is not Function fi) {
return;
}
FIWrapper wrapper = new(fi);
- harmony.Postfix(MiscUtils.MethodByName("scrController:Update"), new Action(() => {
+ harmony.Postfix(MiscUtils.MethodByName("scrController:Update"), () => {
if(Input.GetKeyDown(key)) {
wrapper.Call();
}
- }));
+ });
}
#endregion
}
- [Api(Comment = new string[]
- {
- "These Methods Are Recommended To Use In 'On.rewind' Callback."
- },
- RequireTypes = new Type[]
- {
- typeof(SpriteRenderer),
+ [Api(Comment =
+ [
+ "These Methods Are Recommended To Use In 'On.rewind' Callback."
+ ],
+ RequireTypes =
+ [
+ typeof(SpriteRenderer),
typeof(scrHitTextMesh),
typeof(HitMargin),
typeof(SfxSound),
typeof(HitSound)
- })]
+ ])]
public class Adofai {
[Api("getPlanetRenderer", ReturnComment = "UnityEngine.SpriteRenderer (Planet SpriteRenderer)")]
public static SpriteRenderer GetPlanetRenderer(scrPlanet planet, PlanetRenderer planetrenderer) => planet.GetOrAddRenderer(planetrenderer);
[Api("scalePlanet")]
public static void ScalePlanet(PlanetRenderer planetrender, Vector2 vec) {
- ScaleAll(new[]
- {
+ ScaleAll([
(mr.GetValue(planetrender.sprite) as SpriteRenderer)?.transform,
planetrender.coreParticles?.transform,
planetrender.tailParticles?.transform,
@@ -675,8 +674,8 @@ public static void ScalePlanet(PlanetRenderer planetrender, Vector2 vec) {
planetrender.faceSprite?.transform,
planetrender.faceDetails?.transform,
planetrender.faceHolder?.transform,
- planetrender.samuraiSprite?.transform,
- }, vec);
+ planetrender.samuraiSprite?.transform
+ ], vec);
}
[Api("setDiscordRp")]
public static void SetDiscordRp(string title, string state, string details) {
@@ -702,10 +701,10 @@ public static void SetAutoText(string text) {
betaText.gameObject.SetActive(true);
betaText.GetComponent().text = text;
}
- [Api("configAutoText", ParamComment = new string[]
- {
+ [Api("configAutoText", ParamComment =
+ [
"UnityEngine.UI.Text Callback"
- })]
+ ])]
public static void ConfigAutoText(Engine engine, JsValue configFunc) {
if(configFunc is not Function func) {
return;
@@ -740,7 +739,7 @@ public static void ConfigTiles(Engine engine, JsValue configFunc) {
FIWrapper wrapper = new(func);
var list = scrLevelMaker.instance.listFloors;
for(int i = 0; i < list.Count; i++) {
- wrapper.Call(wrapper.args.Length == 1 ? new object[] { list[i] } : new object[] { i, list[i] });
+ wrapper.Call(wrapper.args.Length == 1 ? [list[i]] : [i, list[i]]);
}
}
[Api("setJudgeText")]
@@ -755,10 +754,10 @@ public static void SetJudgeText(HitMargin hitMargin, string text) {
}
}));
}
- [Api("configJudgeText", ParamComment = new string[]
- {
+ [Api("configJudgeText", ParamComment =
+ [
"scrHitTextMesh Callback"
- })]
+ ])]
public static void ConfigJudgeText(Engine engine, HitMargin hitMargin, JsValue configFunc) {
if(configFunc is not Function func) {
return;
@@ -805,7 +804,7 @@ private static void InjectAutoTextUpdate() {
return;
}
- harmony.Patch(typeof(scrShowIfDebug).GetMethod("Update", (BindingFlags)15420), new HarmonyMethod(EmitUtils.Wrap(new Func(() => false))));
+ harmony.Patch(typeof(scrShowIfDebug).GetMethod("Update", (BindingFlags)15420), new HarmonyMethod(EmitUtils.Wrap(() => false)));
autoTextInjected = true;
}
private static void InjectStartRadius() {
diff --git a/Overlayer/Core/Scripting/JSNet/Utils/EmitUtils.cs b/Overlayer/Core/Scripting/JSNet/Utils/EmitUtils.cs
index 72df9be..58ac863 100644
--- a/Overlayer/Core/Scripting/JSNet/Utils/EmitUtils.cs
+++ b/Overlayer/Core/Scripting/JSNet/Utils/EmitUtils.cs
@@ -21,7 +21,7 @@ public static class EmitUtils {
static EmitUtils() {
accessIgnored = [];
- iact = typeof(IgnoresAccessChecksToAttribute).GetConstructor(new Type[1] { typeof(string) });
+ iact = typeof(IgnoresAccessChecksToAttribute).GetConstructor([typeof(string)]);
AssemblyName assemblyName = new("JSNet.Utils.RuntimeAssembly");
ass = AssemblyBuilder.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
mod = ass.DefineDynamicModule(assemblyName.Name);
@@ -65,7 +65,7 @@ public static void Convert(this ILGenerator il, Type to) {
il.Emit(OpCodes.Conv_R8);
break;
case TypeCode.String:
- il.Emit(OpCodes.Call, typeof(Convert).GetMethod("ToString", new Type[1] { to }));
+ il.Emit(OpCodes.Call, typeof(Convert).GetMethod("ToString", [to]));
break;
case TypeCode.DBNull:
case TypeCode.Decimal:
@@ -115,7 +115,7 @@ public static void IgnoreAccessCheck(Type type) {
private static CustomAttributeBuilder GetIACT(string name) {
ConstructorInfo con = iact;
- object[] constructorArgs = new string[1] { name };
+ object[] constructorArgs = [name];
return new CustomAttributeBuilder(con, constructorArgs);
}
diff --git a/Overlayer/Core/Scripting/JSNet/Utils/FIWrapper.cs b/Overlayer/Core/Scripting/JSNet/Utils/FIWrapper.cs
index f6d23c3..a90aa4b 100644
--- a/Overlayer/Core/Scripting/JSNet/Utils/FIWrapper.cs
+++ b/Overlayer/Core/Scripting/JSNet/Utils/FIWrapper.cs
@@ -25,7 +25,7 @@ public FIWrapper(Function fi) {
args = fi.FunctionDeclaration.Params.Select((Node n) => ((Identifier)n).Name).ToArray();
}
- public object Call(params object[] args) => fi.Call(null, (args != null) ? Array.ConvertAll(args, (object o) => JsValue.FromObject(engine, o)) : new JsValue[0]).ToObject();
+ public object Call(params object[] args) => fi.Call(null, (args != null) ? Array.ConvertAll(args, (object o) => JsValue.FromObject(engine, o)) : []).ToObject();
- public JsValue CallRaw(params object[] args) => fi.Call(null, (args != null) ? Array.ConvertAll(args, (object o) => JsValue.FromObject(engine, o)) : new JsValue[0]);
+ public JsValue CallRaw(params object[] args) => fi.Call(null, (args != null) ? Array.ConvertAll(args, (object o) => JsValue.FromObject(engine, o)) : []);
}
diff --git a/Overlayer/Core/Scripting/JSNet/Utils/Type.cs b/Overlayer/Core/Scripting/JSNet/Utils/Type.cs
index 4099011..c8920ee 100644
--- a/Overlayer/Core/Scripting/JSNet/Utils/Type.cs
+++ b/Overlayer/Core/Scripting/JSNet/Utils/Type.cs
@@ -23,7 +23,7 @@ static Type() {
}
private static AddrGetter CreateAddrGetter() {
- DynamicMethod dynamicMethod = new(typeof(T).FullName + "_Address", typeof(IntPtr), new Type[1] { typeof(T).MakeByRefType() });
+ DynamicMethod dynamicMethod = new(typeof(T).FullName + "_Address", typeof(IntPtr), [typeof(T).MakeByRefType()]);
ILGenerator iLGenerator = dynamicMethod.GetILGenerator();
iLGenerator.Emit(OpCodes.Ldarg_0);
iLGenerator.Emit(OpCodes.Conv_U);
diff --git a/Overlayer/Core/Scripting/Scripting.cs b/Overlayer/Core/Scripting/Scripting.cs
index d7e16ff..2f72eb3 100644
--- a/Overlayer/Core/Scripting/Scripting.cs
+++ b/Overlayer/Core/Scripting/Scripting.cs
@@ -263,7 +263,7 @@ public static byte[] ExportTexts(IEnumerable texts) {
.SelectMany(t => t.PlayingReplacer.References
.Union(t.NotPlayingReplacer.References)
.Select(ResolveScriptTag)
- .Where(tg => tg is not null))
+ .Where(tg => tg != null))
.Select(st => {
var scriptNode = new JObject {
["Name"] = st.Path != null ? Path.GetFileName(st.Path) : $"{Guid.NewGuid()}.js",
diff --git a/Overlayer/Main.cs b/Overlayer/Main.cs
index fb9ec6d..69b7b92 100644
--- a/Overlayer/Main.cs
+++ b/Overlayer/Main.cs
@@ -32,7 +32,7 @@ public static class Main {
[Tag(NotPlaying = true)]
public static string MipaNyang => "MipaNyang is God";
[Tag(NotPlaying = true)]
- public static string Kyulio => "Kyulio is Sexy";
+ public static string Kyulio => "Kyulio is lazy";
[Tag("imBBBT", NotPlaying = true)]
public static string ImBBBT => "imBBBT is not beepbit futures";
@@ -168,7 +168,7 @@ public static bool OnToggle(ModEntry modEntry, bool toggle) {
if(EgEnabled) {
EgEnabled = false;
}
- if(Logo != null) {
+ if(Logo) {
Logo = null;
}
ProfileManager.Release();
@@ -320,7 +320,7 @@ public static bool IsPlaying {
get {
var ctrl = scrController.instance;
var cdt = scrConductor.instance;
- return ctrl != null && cdt != null && !ctrl.paused && cdt.isGameWorld;
+ return ctrl is not null && cdt is not null && !ctrl.paused && cdt.isGameWorld;
}
}
@@ -344,7 +344,7 @@ public static void LogoInit(string path) {
}
}
public static void LogoRelease() {
- if(Logo != null) {
+ if(Logo is not null) {
UnityEngine.Object.Destroy(Logo);
Logo = null;
}
diff --git a/Overlayer/Models/ProfileConfig.cs b/Overlayer/Models/ProfileConfig.cs
index f256b94..ca43eb4 100644
--- a/Overlayer/Models/ProfileConfig.cs
+++ b/Overlayer/Models/ProfileConfig.cs
@@ -46,8 +46,8 @@ public void Deserialize(JToken node) {
Active = node[nameof(Active)]?.Value() ?? defaults.Active;
Opacity = node[nameof(Opacity)]?.Value() ?? defaults.Opacity;
Objects = [];
- var objectTokens = (node[nameof(Objects)] as JArray)
- ?? (node["Texts"] as JArray)
+ var objectTokens = node[nameof(Objects)] as JArray
+ ?? node["Texts"] as JArray
?? [];
foreach(var obj in objectTokens) {
string typeName = obj["Type"]?.Value()?.Trim() ?? "";
diff --git a/Overlayer/Olly/Olly.cs b/Overlayer/Olly/Olly.cs
index a308953..c319f62 100644
--- a/Overlayer/Olly/Olly.cs
+++ b/Overlayer/Olly/Olly.cs
@@ -115,7 +115,7 @@ private void OnGUI() {
private void DrawWindow(int windowID) {
GUI.BringWindowToFront(windowID);
- string[] lines = string.IsNullOrEmpty(displayedText) ? Array.Empty() : displayedText.Split('\n');
+ string[] lines = string.IsNullOrEmpty(displayedText) ? [] : displayedText.Split('\n');
int lineCount = lines.Length;
if(lineCount > 0 && string.IsNullOrEmpty(lines[lineCount - 1])) {
diff --git a/Overlayer/Olly/OllyRender.cs b/Overlayer/Olly/OllyRender.cs
index 0b4610b..79a5c38 100644
--- a/Overlayer/Olly/OllyRender.cs
+++ b/Overlayer/Olly/OllyRender.cs
@@ -15,7 +15,8 @@ public static class Anchor {
public static readonly Vector2 EyelidBGAnchor = new(53, 92);
public static readonly Vector2 NoseAnchor = new(121, 134);
- public static readonly Vector2[] EyebrowAnchor = new Vector2[] {
+ public static readonly Vector2[] EyebrowAnchor =
+ [
new(72, 76), // Normal
new(75, 87), // Sad
new(69, 74), // Angry
@@ -24,22 +25,25 @@ public static class Anchor {
new(62, 75), // Twist
new(63, 66), // Pity
new(65, 65) // NormalHigh
- };
+ ];
- public static readonly (Vector2, Vector2)[] EyesAnchor = new (Vector2, Vector2)[] {
+ public static readonly (Vector2, Vector2)[] EyesAnchor =
+ [
(new Vector2(81, 101), new Vector2(143, 101)), // Normal
(new Vector2(82, 109), new Vector2(144, 108)) // Small
- };
+ ];
- public static readonly Vector2[] EyeSpecialAnchor = new Vector2[] {
+ public static readonly Vector2[] EyeSpecialAnchor =
+ [
new(59, 115), // Up
new(55, 112) // Down
- };
+ ];
public static readonly (Vector2, Vector2) EyeHighlightAnchor =
(new Vector2(82, 108), new Vector2(146, 107));
- public static readonly Vector2[] MouthAnchor = new Vector2[] {
+ public static readonly Vector2[] MouthAnchor =
+ [
new(119, 155), // Normal
new(115, 152), // Shift
new(117, 153), // CaretWide
@@ -60,20 +64,22 @@ public static readonly (Vector2, Vector2) EyeHighlightAnchor =
new(102, 143), // Surprise
new(107, 150), // SurpriseSmall
new(110, 149) // WideStretch
- };
+ ];
- public static readonly Vector2[] EffectAnchor = new Vector2[] {
+ public static readonly Vector2[] EffectAnchor =
+ [
new(61, 125), // Tear
new(79, 111), // Sweat
new(63, 129) // Blush
- };
+ ];
- public static readonly Vector2[] EffectForwardAnchor = new Vector2[] {
+ public static readonly Vector2[] EffectForwardAnchor =
+ [
new(3, 186), // Cloud
new(16, 8), // Tremble
new(65, 39), // Tendon
new(50, 96) // BlushBig
- };
+ ];
}
public struct FaceShape {
public Eyebrow Eyebrow;
diff --git a/Overlayer/Olly/OllyResources.cs b/Overlayer/Olly/OllyResources.cs
index 57fa17d..3252ba1 100644
--- a/Overlayer/Olly/OllyResources.cs
+++ b/Overlayer/Olly/OllyResources.cs
@@ -137,19 +137,19 @@ public static bool LoadAll(UnityModManager.ModEntry modEntry) {
}
}
Loaded =
- Base != null &&
- BG != null &&
+ Base != null&&
+ BG != null&&
Eyes != null && Eyes.Length == Enum.GetValues(typeof(Eye)).Length - 1 &&
Mouths != null && Mouths.Length == Enum.GetValues(typeof(Mouth)).Length &&
- Hair != null &&
- EyelidUp != null &&
- EyelidDown != null &&
- EyelidBG != null &&
- Nose != null &&
+ Hair != null&&
+ EyelidUp != null&&
+ EyelidDown != null&&
+ EyelidBG != null&&
+ Nose != null&&
Eyebrows != null && Eyebrows.Length == Enum.GetValues(typeof(Eyebrow)).Length - 1 &&
EyeSpecials != null && EyeSpecials.Length == Enum.GetValues(typeof(EyeSpecial)).Length - 1 &&
- EyeHighlightLeft != null &&
- EyeHighlightRight != null &&
+ EyeHighlightLeft != null&&
+ EyeHighlightRight != null&&
Effects != null && Effects.Length == Enum.GetValues(typeof(Effect)).Length - 1 &&
EffectForwards != null && EffectForwards.Length == Enum.GetValues(typeof(EffectForward)).Length - 1;
if(Loaded) {
diff --git a/Overlayer/Patches/BlockUMMClosing.cs b/Overlayer/Patches/BlockUMMClosing.cs
index fc49259..5192cd5 100644
--- a/Overlayer/Patches/BlockUMMClosing.cs
+++ b/Overlayer/Patches/BlockUMMClosing.cs
@@ -5,7 +5,7 @@ namespace Overlayer.Patches;
public static class BlockUMMClosing {
public static bool Block;
- [LazyPatch("Patches.BlockUMMClosing", "UnityModManagerNet.UnityModManager+UI", "ToggleWindow", new string[] { "System.Boolean" })]
+ [LazyPatch("Patches.BlockUMMClosing", "UnityModManagerNet.UnityModManager+UI", "ToggleWindow", ["System.Boolean"])]
public static class BlockUMMClosingPatch {
public static bool Prefix() => !Block;
}
diff --git a/Overlayer/RapidGUI/Component/Fold.cs b/Overlayer/RapidGUI/Component/Fold.cs
index 7084cec..18d0afe 100644
--- a/Overlayer/RapidGUI/Component/Fold.cs
+++ b/Overlayer/RapidGUI/Component/Fold.cs
@@ -46,7 +46,7 @@ static Style() {
style.margin.left = 0;
tex = new Texture2D(1, 1);
- tex.SetPixels(new[] { new Color(0.5f, 0.5f, 0.5f, 0.5f) });
+ tex.SetPixels([new Color(0.5f, 0.5f, 0.5f, 0.5f)]);
tex.Apply();
style.hover.background = tex;
diff --git a/Overlayer/RapidGUI/Component/Utilities/RGUIStyle.cs b/Overlayer/RapidGUI/Component/Utilities/RGUIStyle.cs
index 6bc0e0d..685422d 100644
--- a/Overlayer/RapidGUI/Component/Utilities/RGUIStyle.cs
+++ b/Overlayer/RapidGUI/Component/Utilities/RGUIStyle.cs
@@ -45,7 +45,7 @@ static void CreateFlatButton() {
style.hover.textColor = toggle.hover.textColor;
flatButtonTex = new Texture2D(1, 1);
- flatButtonTex.SetPixels(new[] { new Color(0.5f, 0.5f, 0.5f, 0.5f) });
+ flatButtonTex.SetPixels([new Color(0.5f, 0.5f, 0.5f, 0.5f)]);
flatButtonTex.Apply();
style.hover.background = flatButtonTex;
@@ -71,7 +71,7 @@ static void CreatePopup() {
popupTex = new Texture2D(1, 1);
var brightness = 0.2f;
var alpha = 0.9f;
- popupTex.SetPixels(new[] { new Color(brightness, brightness, brightness, alpha) });
+ popupTex.SetPixels([new Color(brightness, brightness, brightness, alpha)]);
popupTex.Apply();
style.normal.background =
diff --git a/Overlayer/RapidGUI/Component/Utilities/RapidGUIBehaviour.cs b/Overlayer/RapidGUI/Component/Utilities/RapidGUIBehaviour.cs
index 9eef63d..53699bd 100644
--- a/Overlayer/RapidGUI/Component/Utilities/RapidGUIBehaviour.cs
+++ b/Overlayer/RapidGUI/Component/Utilities/RapidGUIBehaviour.cs
@@ -9,9 +9,9 @@ public class RapidGUIBehaviour : MonoBehaviour {
static RapidGUIBehaviour instance;
public static RapidGUIBehaviour Instance {
get {
- if(instance == null) {
+ if(instance is null) {
instance = FindObjectOfType();
- if(instance == null) {
+ if(instance is null) {
var ga = new GameObject("RapidGUI");
instance = ga.AddComponent();
}
diff --git a/Overlayer/RapidGUI/RGUI/CustomGUI/CustomGUI.cs b/Overlayer/RapidGUI/RGUI/CustomGUI/CustomGUI.cs
index 39700be..c06e5e0 100644
--- a/Overlayer/RapidGUI/RGUI/CustomGUI/CustomGUI.cs
+++ b/Overlayer/RapidGUI/RGUI/CustomGUI/CustomGUI.cs
@@ -26,7 +26,7 @@ public static bool IgnoreMember(string memberName) {
public static bool AddRange(string memberName, float max) => AddRange(memberName, 0f, max);
- public static bool AddRange(string memberName, float min, float max) => AddRange(memberName, new MinMaxFloat() { min = min, max = max });
+ public static bool AddRange(string memberName, float min, float max) => AddRange(memberName, new MinMaxFloat { min = min, max = max });
public static bool AddRange(string memberName, MinMaxFloat range) {
var infos = TypeUtility.GetMemberInfoList(typeof(T));
diff --git a/Overlayer/RapidGUI/RGUI/Field/ListField.cs b/Overlayer/RapidGUI/RGUI/Field/ListField.cs
index 59c8883..0d98690 100644
--- a/Overlayer/RapidGUI/RGUI/Field/ListField.cs
+++ b/Overlayer/RapidGUI/RGUI/Field/ListField.cs
@@ -6,7 +6,7 @@
namespace RapidGUI;
public static partial class RGUI {
- static readonly string[] ListPopupButtonNames = new[] { "Add Element", "Delete Element" };
+ static readonly string[] ListPopupButtonNames = ["Add Element", "Delete Element"];
public static T ListField(T list, Func customElementGUI = null, Func customLabelRightFunc = null)
where T : IList => ListField(list, null, customElementGUI, customLabelRightFunc);
@@ -167,7 +167,7 @@ static object CreateNewElement(object baseElem, Type elemType) {
ret = baseElem;
}
// has copy constructor
- else if(elemType.GetConstructor(new[] { elemType }) != null) {
+ else if(elemType.GetConstructor([elemType]) != null) {
ret = Activator.CreateInstance(elemType, baseElem);
}
}
diff --git a/Overlayer/RapidGUI/RGUI/MinMaxSlider/MinMaxSliderCore.cs b/Overlayer/RapidGUI/RGUI/MinMaxSlider/MinMaxSliderCore.cs
index c44feb0..8a4e4e4 100644
--- a/Overlayer/RapidGUI/RGUI/MinMaxSlider/MinMaxSliderCore.cs
+++ b/Overlayer/RapidGUI/RGUI/MinMaxSlider/MinMaxSliderCore.cs
@@ -9,7 +9,7 @@ public class Style {
static Style() => InitStyle();
static void InitStyle() {
- minMaxSliderThumb = new GUIStyle() {
+ minMaxSliderThumb = new GUIStyle {
border = new RectOffset(7, 7, 0, 0),
clipping = TextClipping.Clip,
fixedHeight = 12f,
diff --git a/Overlayer/RapidGUI/RGUI/Popup.cs b/Overlayer/RapidGUI/RGUI/Popup.cs
index 99ad66e..e24f5ac 100644
--- a/Overlayer/RapidGUI/RGUI/Popup.cs
+++ b/Overlayer/RapidGUI/RGUI/Popup.cs
@@ -250,7 +250,7 @@ public void DoGUIWindow() {
var image = images != null && j < images.Length ? images[j] : null;
- if(image != null) {
+ if(image is not null) {
lastRect.x += 5;
lastRect.width = image.width * 4;
lastRect.height = image.height * 4;
diff --git a/Overlayer/Tags/Bpm.cs b/Overlayer/Tags/Bpm.cs
index c2ee617..1a7bb28 100644
--- a/Overlayer/Tags/Bpm.cs
+++ b/Overlayer/Tags/Bpm.cs
@@ -60,7 +60,7 @@ public static double GetRealBpm(scrFloor floor, float bpm) {
}
public static void Update(scrFloor floor) {
- if(floor.nextfloor == null) {
+ if(floor.nextfloor is null) {
return;
}
diff --git a/Overlayer/Tags/Effect.cs b/Overlayer/Tags/Effect.cs
index 7ecfca7..d894d2d 100644
--- a/Overlayer/Tags/Effect.cs
+++ b/Overlayer/Tags/Effect.cs
@@ -150,7 +150,7 @@ getter is Func fss ?
var easedValue = ee.Compute(rawFunc);
var prev = ee.GetPrevValue(rawFunc);
- return (prev + ((ee.Value - prev) * easedValue)).Round(digits);
+ return (prev + (ee.Value - prev) * easedValue).Round(digits);
}
[Tag(NotPlaying = true)]
@@ -158,7 +158,7 @@ public static string Rainbow(double speed = 18) {
double hue = Environment.TickCount % (int)(360 * speed) / speed;
double c = 1;
- double x = 1 - Math.Abs((hue / 60 % 2) - 1);
+ double x = 1 - Math.Abs(hue / 60 % 2 - 1);
double m = 0;
double r, g = 0, b;
diff --git a/Overlayer/Tags/FailStats.cs b/Overlayer/Tags/FailStats.cs
index 084a3c8..47ac8ed 100644
--- a/Overlayer/Tags/FailStats.cs
+++ b/Overlayer/Tags/FailStats.cs
@@ -17,9 +17,9 @@ public static float OverloadCounter() {
[Tag(ProcessingFlags = ValueProcessing.RoundNumber)]
public static float MultipressCounter() {
var controller = scrController.instance;
- return controller == null
+ return !controller
? float.NaN
- : controller.failbar == null
+ : !controller.failbar
? float.NaN
: IsImmortal(controller) ? 100f : CalculateFailValue(controller.failbar.multipressCounter);
}
diff --git a/Overlayer/Tags/OverlayerTag.cs b/Overlayer/Tags/OverlayerTag.cs
index b7b98a6..c01efed 100644
--- a/Overlayer/Tags/OverlayerTag.cs
+++ b/Overlayer/Tags/OverlayerTag.cs
@@ -224,7 +224,7 @@ public static DynamicMethod CreateMemberAccessor(Type type, string accessor, boo
return dm;
}
- string[] accessors = accessor.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
+ string[] accessors = accessor.Split(['.'], StringSplitOptions.RemoveEmptyEntries);
if(accessors.Length < 1) {
return null;
}
@@ -250,7 +250,7 @@ public static DynamicMethod CreateMemberAccessor(Type type, string accessor, boo
}
MemberInfo last = toEmitMembers.Last();
Type rt = last is FieldInfo ff ? ff.FieldType : last is PropertyInfo pp ? pp.PropertyType : typeof(object);
- accessorCacheDM[name] = dm = new DynamicMethod(name, typeof(object), new[] { typeof(object) }, typeof(OverlayerTag), true);
+ accessorCacheDM[name] = dm = new DynamicMethod(name, typeof(object), [typeof(object)], typeof(OverlayerTag), true);
ILGenerator il = dm.GetILGenerator();
if(!staticAccess) {
il.Emit(OpCodes.Ldarg_0);
@@ -285,9 +285,10 @@ public static DynamicMethod CreateMemberAccessor(Type type, string accessor, boo
private static Dictionary> accessorCache = [];
private static Dictionary accessorCacheDM = [];
static OverlayerTag() {
- runtimeAccessor = typeof(OverlayerTag).GetMethod(nameof(RuntimeAccess), (BindingFlags)15420, null, new[] { typeof(object), typeof(string) }, null);
- round = typeof(Extensions).GetMethod("Round", new[] { typeof(double), typeof(int) });
- trim = typeof(Extensions).GetMethod("Trim", new[] { typeof(string), typeof(int), typeof(string) });
- toString = typeof(Extensions).GetMethod("ToString", new[] { typeof(double), typeof(string) });
+ runtimeAccessor = typeof(OverlayerTag).GetMethod(nameof(RuntimeAccess), (BindingFlags)15420, null, [typeof(object), typeof(string)
+ ], null);
+ round = typeof(Extensions).GetMethod("Round", [typeof(double), typeof(int)]);
+ trim = typeof(Extensions).GetMethod("Trim", [typeof(string), typeof(int), typeof(string)]);
+ toString = typeof(Extensions).GetMethod("ToString", [typeof(double), typeof(string)]);
}
}
diff --git a/Overlayer/Tags/Patches/M_MonsterLove.cs b/Overlayer/Tags/Patches/M_MonsterLove.cs
index 1d230de..3dd1f6d 100644
--- a/Overlayer/Tags/Patches/M_MonsterLove.cs
+++ b/Overlayer/Tags/Patches/M_MonsterLove.cs
@@ -5,12 +5,13 @@
namespace Overlayer.Tags.Patches;
public class M_MonsterLove : PatchBase {
- [LazyPatch("Tags.M_MonsterLove.Tile__ChangeState__StateMachine__StateBehaviour", "MonsterLove.StateMachine.StateBehaviour", "ChangeState", ["System.Enum"], Triggers = new string[] {
+ [LazyPatch("Tags.M_MonsterLove.Tile__ChangeState__StateMachine__StateBehaviour", "MonsterLove.StateMachine.StateBehaviour", "ChangeState", ["System.Enum"], Triggers =
+ [
nameof(Tile.IsStarted), nameof(Tile.StartTile), nameof(Tile.StartProgress),
// Dependency
- nameof(AccuracyStats.MaxXAccuracy), nameof(AccuracyStats.AbsMaxXAccuracy),
- })]
+ nameof(AccuracyStats.MaxXAccuracy), nameof(AccuracyStats.AbsMaxXAccuracy)
+ ])]
public static class Tile__ChangeState__StateMachine__StateBehaviour__ChangeState {
public static void Prefix(StateBehaviour __instance, Enum newState) {
if(__instance is not scrController ctrl) {
diff --git a/Overlayer/Tags/Patches/P_Persistence.cs b/Overlayer/Tags/Patches/P_Persistence.cs
index 0489d62..35bf548 100644
--- a/Overlayer/Tags/Patches/P_Persistence.cs
+++ b/Overlayer/Tags/Patches/P_Persistence.cs
@@ -3,25 +3,30 @@
namespace Overlayer.Tags.Patches;
public class P_Persistence : PatchBase {
- [LazyPatch("Tags.P_Persistence.Status__SetCustomWorldAttempts", "Persistence", "SetCustomWorldAttempts", Triggers = new string[] {
+ [LazyPatch("Tags.P_Persistence.Status__SetCustomWorldAttempts", "Persistence", "SetCustomWorldAttempts", Triggers =
+ [
nameof(Status.Attempts)
- })]
+ ])]
public static class Status_AttemptsGame {
public static void Postfix() => Status.Attempts_UpdateGame();
}
- [LazyPatch("Tags.P_Persistence.Status__IncrementWorldAttempts", "Persistence", "IncrementWorldAttempts", Triggers = new string[] {
+ [LazyPatch("Tags.P_Persistence.Status__IncrementWorldAttempts", "Persistence", "IncrementWorldAttempts", Triggers =
+ [
nameof(Status.Attempts)
- })]
- [LazyPatch("Tags.P_Persistence.Status__IncrementWorldAttemptsWithoutNewBest", "Persistence", "IncrementWorldAttemptsWithoutNewBest", Triggers = new string[] {
+ ])]
+ [LazyPatch("Tags.P_Persistence.Status__IncrementWorldAttemptsWithoutNewBest", "Persistence", "IncrementWorldAttemptsWithoutNewBest", Triggers =
+ [
nameof(Status.Attempts)
- })]
- [LazyPatch("Tags.P_Persistence.Status__SetWorldAttempts", "Persistence", "SetWorldAttempts", Triggers = new string[] {
+ ])]
+ [LazyPatch("Tags.P_Persistence.Status__SetWorldAttempts", "Persistence", "SetWorldAttempts", Triggers =
+ [
nameof(Status.Attempts)
- })]
- [LazyPatch("Tags.P_Persistence.Status__SetWorldAttemptsWithoutNewBest", "Persistence", "SetWorldAttemptsWithoutNewBest", Triggers = new string[] {
+ ])]
+ [LazyPatch("Tags.P_Persistence.Status__SetWorldAttemptsWithoutNewBest", "Persistence", "SetWorldAttemptsWithoutNewBest", Triggers =
+ [
nameof(Status.Attempts)
- })]
+ ])]
public static class Status_AttemptsOfficial {
public static void Postfix() => Status.Attempts_UpdateOfficial();
}
diff --git a/Overlayer/Tags/Patches/P_ffxSetDefaultText.cs b/Overlayer/Tags/Patches/P_ffxSetDefaultText.cs
index 05bb5cd..e34cd74 100644
--- a/Overlayer/Tags/Patches/P_ffxSetDefaultText.cs
+++ b/Overlayer/Tags/Patches/P_ffxSetDefaultText.cs
@@ -3,30 +3,34 @@
namespace Overlayer.Tags.Patches;
public class P_ffxSetDefaultText : PatchBase {
- [LazyPatch("Tags.P_ffxSetDefaultText.Level_LevelNameText__StartEffect", "ffxSetDefaultText", "StartEffect", Triggers = new string[] {
+ [LazyPatch("Tags.P_ffxSetDefaultText.Level_LevelNameText__StartEffect", "ffxSetDefaultText", "StartEffect", Triggers =
+ [
nameof(Level.LevelNameText)
- })]
+ ])]
public static class Level_LevelNameText__StartEffect {
public static void Postfix() => Level.UpdateLevelNameText();
}
- [LazyPatch("Tags.P_ffxSetDefaultText.Level_LevelNameTextRaw__StartEffect", "ffxSetDefaultText", "StartEffect", Triggers = new string[] {
+ [LazyPatch("Tags.P_ffxSetDefaultText.Level_LevelNameTextRaw__StartEffect", "ffxSetDefaultText", "StartEffect", Triggers =
+ [
nameof(Level.LevelNameTextRaw)
- })]
+ ])]
public static class Level_LevelNameTextRaw__StartEffect {
public static void Postfix() => Level.UpdateLevelNameTextRaw();
}
- [LazyPatch("Tags.P_ffxSetDefaultText.Level_LevelNameTextColor__Decode", "ffxSetDefaultText", "Decode", Triggers = new string[] {
+ [LazyPatch("Tags.P_ffxSetDefaultText.Level_LevelNameTextColor__Decode", "ffxSetDefaultText", "Decode", Triggers =
+ [
nameof(Level.LevelNameTextColor)
- })]
+ ])]
public static class Level_LevelNameText__Decode {
public static void Postfix(ffxSetDefaultText __instance) => __instance.defaultTextColorUsed = true;
}
- [LazyPatch("Tags.P_ffxSetDefaultText.Level_LevelNameTextShadowColor__Decode", "ffxSetDefaultText", "Decode", Triggers = new string[] {
+ [LazyPatch("Tags.P_ffxSetDefaultText.Level_LevelNameTextShadowColor__Decode", "ffxSetDefaultText", "Decode", Triggers =
+ [
nameof(Level.LevelNameTextShadowColor)
- })]
+ ])]
public static class Level_LevelNameTextRaw__Decode {
public static void Postfix(ffxSetDefaultText __instance) => __instance.defaultTextShadowColorUsed = true;
}
diff --git a/Overlayer/Tags/Patches/P_scnEditor.cs b/Overlayer/Tags/Patches/P_scnEditor.cs
index f75428a..be3a3f5 100644
--- a/Overlayer/Tags/Patches/P_scnEditor.cs
+++ b/Overlayer/Tags/Patches/P_scnEditor.cs
@@ -3,23 +3,26 @@
namespace Overlayer.Tags.Patches;
public class P_scnEditor : PatchBase {
- [LazyPatch("Tags.P_scnEditor.ProgressStats__OpenLevelCo", "scnEditor", "OpenLevelCo", Triggers = new string[] {
+ [LazyPatch("Tags.P_scnEditor.ProgressStats__OpenLevelCo", "scnEditor", "OpenLevelCo", Triggers =
+ [
nameof(ProgressStats.BestProgress)
- })]
+ ])]
public static class ProgressStats__OpenLevelCo {
public static void Postfix() => ProgressStats.BestProgress_Reset();
}
- [LazyPatch("Tags.P_scnEditor.CheckPoint__Play", "scnEditor", "Play", Triggers = new string[] {
- nameof(CheckPointStats.CurCheckPoint),
- })]
+ [LazyPatch("Tags.P_scnEditor.CheckPoint__Play", "scnEditor", "Play", Triggers =
+ [
+ nameof(CheckPointStats.CurCheckPoint)
+ ])]
public static class CheckPoint__Play {
public static void Postfix() => CheckPointStats.TotalCheckPoients_Update();
}
- [LazyPatch("Tags.P_scnEditor.Tile__ResetScene", "scnEditor", "ResetScene", Triggers = new string[] {
- nameof(Tile.IsStarted),
- })]
+ [LazyPatch("Tags.P_scnEditor.Tile__ResetScene", "scnEditor", "ResetScene", Triggers =
+ [
+ nameof(Tile.IsStarted)
+ ])]
public static class Tile__ResetScene {
public static void Postfix(scrController __instance) => Tile.IsStarted = false;
}
diff --git a/Overlayer/Tags/Patches/P_scnGame.cs b/Overlayer/Tags/Patches/P_scnGame.cs
index a2add47..ccca53f 100644
--- a/Overlayer/Tags/Patches/P_scnGame.cs
+++ b/Overlayer/Tags/Patches/P_scnGame.cs
@@ -3,34 +3,38 @@
namespace Overlayer.Tags.Patches;
public class P_scnGame : PatchBase {
- [LazyPatch("Tags.P_scnGame.ProgressStats__LoadLevel", "scnGame", "LoadLevel", Triggers = new string[] {
+ [LazyPatch("Tags.P_scnGame.ProgressStats__LoadLevel", "scnGame", "LoadLevel", Triggers =
+ [
nameof(ProgressStats.BestProgress)
- })]
+ ])]
public static class ProgressStats__LoadLevel {
public static void Postfix() => ProgressStats.BestProgress_Reset();
}
- [LazyPatch("Tags.P_scnGame.Bpm__Play", "scnGame", "Play", Triggers = new string[] {
+ [LazyPatch("Tags.P_scnGame.Bpm__Play", "scnGame", "Play", Triggers =
+ [
nameof(Bpm.TileBpm), nameof(Bpm.CurBpm), nameof(Bpm.RecKPS),
- nameof(Bpm.TileBpmWithoutPitch), nameof(Bpm.CurBpmWithoutPitch), nameof(Bpm.RecKPSWithoutPitch),
- })]
+ nameof(Bpm.TileBpmWithoutPitch), nameof(Bpm.CurBpmWithoutPitch), nameof(Bpm.RecKPSWithoutPitch)
+ ])]
public static class Bpm__Play {
public static void Postfix(scrController __instance) => Bpm.Init(__instance);
}
- [LazyPatch("Tags.P_scnGame.Level__Play", "scnGame", "Play", Triggers = new string[] {
+ [LazyPatch("Tags.P_scnGame.Level__Play", "scnGame", "Play", Triggers =
+ [
nameof(Level.Title), nameof(Level.Author), nameof(Level.Artist),
nameof(Level.TitleRaw), nameof(Level.AuthorRaw), nameof(Level.ArtistRaw),
nameof(Level.DefaultTextColor), nameof(Level.DefaultTextShadowColor),
nameof(Level.LevelNameTextColor), nameof(Level.LevelNameTextShadowColor)
- })]
+ ])]
public static class Level__Play {
public static void Postfix() => Level.Init();
}
- [LazyPatch("Tags.P_scnGame.Tile__Play", "scnGame", "Play", Triggers = new string[] {
+ [LazyPatch("Tags.P_scnGame.Tile__Play", "scnGame", "Play", Triggers =
+ [
nameof(Tile.TileAngle), nameof(Tile.TileEntryAngle), nameof(Tile.TileExitAngle)
- })]
+ ])]
public static class Tile__Play {
public static void Postfix() {
scrFloor floor = scrController.instance?.currFloor;
@@ -40,14 +44,15 @@ public static void Postfix() {
}
}
- [LazyPatch("Tags.P_scnGame.Play", "scnGame", "Play", Triggers = new string[] {
+ [LazyPatch("Tags.P_scnGame.Play", "scnGame", "Play", Triggers =
+ [
nameof(CheckPointStats.TotalCheckPoints), nameof(CheckPointStats.CurCheckPoint),
nameof(Tile.StartTile), nameof(Tile.StartProgress),
// Dependency
nameof(AccuracyStats.MaxXAccuracy), nameof(AccuracyStats.AbsMaxXAccuracy),
nameof(Status.FileTileAttempts), nameof(Status.IsAutoTile)
- })]
+ ])]
public static class Play {
public static void Postfix(int seqID = 0) {
CheckPointStats.InterCheckPoints_Update();
@@ -55,9 +60,10 @@ public static void Postfix(int seqID = 0) {
}
}
- [LazyPatch("Tags.P_scnGame.Tile__ResetScene", "scnGame", "ResetScene", Triggers = new string[] {
- nameof(Tile.IsStarted),
- })]
+ [LazyPatch("Tags.P_scnGame.Tile__ResetScene", "scnGame", "ResetScene", Triggers =
+ [
+ nameof(Tile.IsStarted)
+ ])]
public static class Tile__ResetScene {
public static void Postfix() => Tile.IsStarted = false;
}
diff --git a/Overlayer/Tags/Patches/P_scrCamera.cs b/Overlayer/Tags/Patches/P_scrCamera.cs
index 10cbe5c..cce7513 100644
--- a/Overlayer/Tags/Patches/P_scrCamera.cs
+++ b/Overlayer/Tags/Patches/P_scrCamera.cs
@@ -2,9 +2,10 @@
namespace Overlayer.Tags.Patches;
public class P_scrCamera : PatchBase {
- [LazyPatch("Tags.P_scrCamera.FrameRate__Update", "scrCamera", "Update", Triggers = new string[] {
- nameof(FrameRate.Fps), nameof(FrameRate.FrameTime),
- })]
+ [LazyPatch("Tags.P_scrCamera.FrameRate__Update", "scrCamera", "Update", Triggers =
+ [
+ nameof(FrameRate.Fps), nameof(FrameRate.FrameTime)
+ ])]
public static class FrameRate__Update {
public static void Postfix() {
var deltaTime = UnityEngine.Time.deltaTime;
diff --git a/Overlayer/Tags/Patches/P_scrConductor.cs b/Overlayer/Tags/Patches/P_scrConductor.cs
index fef9612..8a5277c 100644
--- a/Overlayer/Tags/Patches/P_scrConductor.cs
+++ b/Overlayer/Tags/Patches/P_scrConductor.cs
@@ -5,10 +5,11 @@
namespace Overlayer.Tags.Patches;
public class P_scrConductor : PatchBase {
- [LazyPatch("Tags.P_scrConductor.Song__Update", "scrConductor", "Update", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrConductor.Song__Update", "scrConductor", "Update", Triggers =
+ [
nameof(Song.CurMinute), nameof(Song.CurSecond),nameof(Song.CurMilliSecond),
- nameof(Song.TotalMinute), nameof(Song.TotalSecond),nameof(Song.TotalMilliSecond),
- })]
+ nameof(Song.TotalMinute), nameof(Song.TotalSecond),nameof(Song.TotalMilliSecond)
+ ])]
public static class Song__Update {
public static void Postfix(scrConductor __instance) {
if(scrController.instance.paused || !__instance.isGameWorld) {
diff --git a/Overlayer/Tags/Patches/P_scrController.cs b/Overlayer/Tags/Patches/P_scrController.cs
index 7686e1b..cc66899 100644
--- a/Overlayer/Tags/Patches/P_scrController.cs
+++ b/Overlayer/Tags/Patches/P_scrController.cs
@@ -3,9 +3,10 @@
namespace Overlayer.Tags.Patches;
public class P_scrController : PatchBase {
- [LazyPatch("Tags.P_scrController.HitTiming__Awake_Rewind", "scrController", "Awake_Rewind", Triggers = new string[] {
- nameof(HitTiming.Timing), nameof(HitTiming.TimingAvg),
- })]
+ [LazyPatch("Tags.P_scrController.HitTiming__Awake_Rewind", "scrController", "Awake_Rewind", Triggers =
+ [
+ nameof(HitTiming.Timing), nameof(HitTiming.TimingAvg)
+ ])]
public static class HitTiming__Awake_Rewind {
public static void Postfix() {
HitTiming.Timing = 0;
@@ -13,16 +14,18 @@ public static void Postfix() {
}
}
- [LazyPatch("Tags.P_scrController.ProgressStats__FailAction", "scrController", "FailAction", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrController.ProgressStats__FailAction", "scrController", "FailAction", Triggers =
+ [
nameof(ProgressStats.BestProgress)
- })]
+ ])]
public static class ProgressStats__FailAction {
public static void Postfix() => ProgressStats.BestProgress_Update();
}
- [LazyPatch("Tags.P_scrController.Hit__OnDamage", "scrController", "OnDamage", Triggers = new string[] {
- nameof(Hit.Multipress),
- })]
+ [LazyPatch("Tags.P_scrController.Hit__OnDamage", "scrController", "OnDamage", Triggers =
+ [
+ nameof(Hit.Multipress)
+ ])]
public static class Hit__OnDamage {
public static void Postfix(scrController __instance, bool multipress, bool applyMultipressDamage) {
if(multipress) {
@@ -33,9 +36,10 @@ public static void Postfix(scrController __instance, bool multipress, bool apply
}
}
- [LazyPatch("Tags.P_scrController.ProgressStats__OnLandOnPortal", "scrController", "OnLandOnPortal", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrController.ProgressStats__OnLandOnPortal", "scrController", "OnLandOnPortal", Triggers =
+ [
nameof(ProgressStats.BestProgress)
- })]
+ ])]
public static class ProgressStats__OnLandOnPortal {
public static void Postfix() => ProgressStats.BestProgress_Fix();
}
diff --git a/Overlayer/Tags/Patches/P_scrMisc.cs b/Overlayer/Tags/Patches/P_scrMisc.cs
index 92f417d..5d37e32 100644
--- a/Overlayer/Tags/Patches/P_scrMisc.cs
+++ b/Overlayer/Tags/Patches/P_scrMisc.cs
@@ -4,7 +4,8 @@
namespace Overlayer.Tags.Patches;
public class P_scrMisc : PatchBase {
- [LazyPatch("Tags.P_scrMisc.Hit__GetHitMargin", "scrMisc", "GetHitMargin", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrMisc.Hit__GetHitMargin", "scrMisc", "GetHitMargin", Triggers =
+ [
nameof(Hit.LHit), nameof(Hit.LTE), nameof(Hit.LVE), nameof(Hit.LEP), nameof(Hit.LP), nameof(Hit.LLP), nameof(Hit.LVL), nameof(Hit.LTL),
nameof(Hit.NHit), nameof(Hit.NTE), nameof(Hit.NVE), nameof(Hit.NEP), nameof(Hit.NP), nameof(Hit.NLP), nameof(Hit.NVL), nameof(Hit.NTL),
nameof(Hit.SHit), nameof(Hit.STE), nameof(Hit.SVE), nameof(Hit.SEP), nameof(Hit.SP), nameof(Hit.SLP), nameof(Hit.SVL), nameof(Hit.STL),
@@ -15,8 +16,8 @@ public class P_scrMisc : PatchBase {
nameof(Hit.CT), nameof(Hit.CV), nameof(Hit.CELP),
"LHitRaw", "NHitRaw", "SHitRaw", "CHitRaw",
nameof(Hit.LFast), nameof(Hit.NFast), nameof(Hit.SFast), nameof(Hit.CFast),
- nameof(Hit.LSlow), nameof(Hit.NSlow), nameof(Hit.SSlow), nameof(Hit.CSlow),
- })]
+ nameof(Hit.LSlow), nameof(Hit.NSlow), nameof(Hit.SSlow), nameof(Hit.CSlow)
+ ])]
public static class Hit__GetHitMargin {
public static bool Prefix(float hitangle, float refangle, bool isCW, float bpmTimesSpeed, float conductorPitch, double marginScale, ref HitMargin __result) {
var controller = scrController.instance;
@@ -40,14 +41,15 @@ public static bool Prefix(float hitangle, float refangle, bool isCW, float bpmTi
}
}
- [LazyPatch("Tags.P_scrMisc.ComboStats__GetHitMargin", "scrMisc", "GetHitMargin", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrMisc.ComboStats__GetHitMargin", "scrMisc", "GetHitMargin", Triggers =
+ [
nameof(ComboStats.Combo), nameof(ComboStats.MaxCombo),
nameof(ComboStats.LMarginCombo), nameof(ComboStats.NMarginCombo), nameof(ComboStats.SMarginCombo), nameof(ComboStats.MarginCombo),
nameof(ComboStats.LMarginMaxCombo), nameof(ComboStats.NMarginMaxCombo), nameof(ComboStats.SMarginMaxCombo), nameof(ComboStats.MarginMaxCombo),
nameof(ComboStats.LMarginCombos), nameof(ComboStats.NMarginCombos), nameof(ComboStats.SMarginCombos), nameof(ComboStats.MarginCombos),
nameof(ComboStats.LMarginMaxCombos), nameof(ComboStats.NMarginMaxCombos), nameof(ComboStats.SMarginMaxCombos), nameof(ComboStats.MarginMaxCombos),
- nameof(ComboStats.SpecialPlayMark),
- })]
+ nameof(ComboStats.SpecialPlayMark)
+ ])]
public static class Combo__GetHitMargin {
public static void Postfix(float hitangle, float refangle, bool isCW, float bpmTimesSpeed, float conductorPitch, double marginScale, ref HitMargin __result) {
var controller = scrController.instance;
@@ -75,9 +77,10 @@ public static void Postfix(float hitangle, float refangle, bool isCW, float bpmT
}
}
- [LazyPatch("Tags.P_scrMisc.Scores__GetHitMargin", "scrMisc", "GetHitMargin", Triggers = new string[] {
- nameof(Scores.LScore), nameof(Scores.NScore), nameof(Scores.SScore), nameof(Scores.Score),
- })]
+ [LazyPatch("Tags.P_scrMisc.Scores__GetHitMargin", "scrMisc", "GetHitMargin", Triggers =
+ [
+ nameof(Scores.LScore), nameof(Scores.NScore), nameof(Scores.SScore), nameof(Scores.Score)
+ ])]
public static class Scores__GetHitMargin {
public static void Postfix(float hitangle, float refangle, bool isCW, float bpmTimesSpeed, float conductorPitch, double marginScale, ref HitMargin __result) {
var controller = scrController.instance;
diff --git a/Overlayer/Tags/Patches/P_scrMistakeManager.cs b/Overlayer/Tags/Patches/P_scrMistakeManager.cs
index b28a168..7ba75f4 100644
--- a/Overlayer/Tags/Patches/P_scrMistakeManager.cs
+++ b/Overlayer/Tags/Patches/P_scrMistakeManager.cs
@@ -4,11 +4,12 @@
namespace Overlayer.Tags.Patches;
public class P_scrMistakeManager : PatchBase {
- [LazyPatch("Tags.P_scrMistakeManager.AccuracyStats__CalculatePercentAcc", "scrMistakesManager", "CalculatePercentAcc", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrMistakeManager.AccuracyStats__CalculatePercentAcc", "scrMistakesManager", "CalculatePercentAcc", Triggers =
+ [
nameof(AccuracyStats.Accuracy), nameof(AccuracyStats.MaxAccuracy),
nameof(AccuracyStats.XAccuracy), nameof(AccuracyStats.MaxXAccuracy),
- nameof(AccuracyStats.AbsXAccuracy), nameof(AccuracyStats.AbsMaxXAccuracy),
- })]
+ nameof(AccuracyStats.AbsXAccuracy), nameof(AccuracyStats.AbsMaxXAccuracy)
+ ])]
public static class AccuracyStats__CalculatePercentAcc {
public static void Postfix(scrMistakesManager __instance) {
int perfect = __instance.GetHits(HitMargin.Perfect);
@@ -40,7 +41,7 @@ public static void Postfix(scrMistakesManager __instance) {
AccuracyStats.AbsXAccuracy = 100.0 * (weightedHits / totalHits);
AccuracyStats.XAccuracy = AccuracyStats.AbsXAccuracy * checkpointminus;
- if(ADOBase.lm != null && ADOBase.lm.listFloors != null &&
+ if(ADOBase.lm is not null && ADOBase.lm.listFloors != null &&
Tile.CurTile >= 0 && Tile.CurTile < ADOBase.lm.listFloors.Count &&
ADOBase.lm.listFloors[Tile.CurTile] != null) {
diff --git a/Overlayer/Tags/Patches/P_scrPlanet.cs b/Overlayer/Tags/Patches/P_scrPlanet.cs
index c723177..7d71b8f 100644
--- a/Overlayer/Tags/Patches/P_scrPlanet.cs
+++ b/Overlayer/Tags/Patches/P_scrPlanet.cs
@@ -5,17 +5,19 @@
namespace Overlayer.Tags.Patches;
public class P_scrPlanet : PatchBase {
- [LazyPatch("Tags.P_scrPlanet.Bpm__MoveToNextFloor", "scrPlanet", "MoveToNextFloor", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrPlanet.Bpm__MoveToNextFloor", "scrPlanet", "MoveToNextFloor", Triggers =
+ [
nameof(Bpm.TileBpm), nameof(Bpm.CurBpm), nameof(Bpm.RecKPS),
- nameof(Bpm.TileBpmWithoutPitch), nameof(Bpm.CurBpmWithoutPitch), nameof(Bpm.RecKPSWithoutPitch),
- })]
+ nameof(Bpm.TileBpmWithoutPitch), nameof(Bpm.CurBpmWithoutPitch), nameof(Bpm.RecKPSWithoutPitch)
+ ])]
public static class Bpm__MoveToNextFloor {
public static void Postfix(scrFloor floor) => Bpm.Update(floor);
}
- [LazyPatch("Tags.P_scrPlanet.CheckPoint__MoveToNextFloor", "scrPlanet", "MoveToNextFloor", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrPlanet.CheckPoint__MoveToNextFloor", "scrPlanet", "MoveToNextFloor", Triggers =
+ [
nameof(CheckPointStats.CurCheckPoint)
- })]
+ ])]
public static class CheckPoint__MoveToNextFloor {
public static void Postfix(scrFloor floor) {
if(CheckPointStats.AllCheckPoints != null) {
@@ -24,23 +26,26 @@ public static void Postfix(scrFloor floor) {
}
}
- [LazyPatch("Tags.P_scrPlanet.ProgressStats__MoveToNextFloor", "scrPlanet", "MoveToNextFloor", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrPlanet.ProgressStats__MoveToNextFloor", "scrPlanet", "MoveToNextFloor", Triggers =
+ [
nameof(ProgressStats.BestProgress)
- })]
+ ])]
public static class ProgressStats__MoveToNextFloor {
public static void Postfix() => ProgressStats.BestProgress_Update();
}
- [LazyPatch("Tags.P_scrPlanet.Tile__MoveToNextFloor", "scrPlanet", "MoveToNextFloor", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrPlanet.Tile__MoveToNextFloor", "scrPlanet", "MoveToNextFloor", Triggers =
+ [
nameof(Tile.TileAngle), nameof(Tile.TileEntryAngle), nameof(Tile.TileExitAngle)
- })]
+ ])]
public static class Tile__MoveToNextFloor {
public static void Postfix(scrFloor floor) => Tile.Angle_Update(floor);
}
- [LazyPatch("Tags.P_scrPlanet.HitTiming__SwitchChosen", "scrPlanet", "SwitchChosen", Triggers = new string[] {
- nameof(HitTiming.Timing), nameof(HitTiming.TimingAvg),
- })]
+ [LazyPatch("Tags.P_scrPlanet.HitTiming__SwitchChosen", "scrPlanet", "SwitchChosen", Triggers =
+ [
+ nameof(HitTiming.Timing), nameof(HitTiming.TimingAvg)
+ ])]
public static class HitTiming__SwitchChosen {
public static void Prefix(scrPlanet __instance) {
if(Main.IsPlaying) {
@@ -57,12 +62,13 @@ public static void Prefix(scrPlanet __instance) {
}
}
- [LazyPatch("Tags.P_scrPlanet.Tile__SwitchChosen", "scrPlanet", "SwitchChosen", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrPlanet.Tile__SwitchChosen", "scrPlanet", "SwitchChosen", Triggers =
+ [
nameof(Tile.CurTile), nameof(Tile.LeftTile), nameof(Tile.TotalTile),
// Dependency
- nameof(AccuracyStats.MaxAccuracy), nameof(AccuracyStats.MaxXAccuracy), nameof(AccuracyStats.AbsMaxXAccuracy),
- })]
+ nameof(AccuracyStats.MaxAccuracy), nameof(AccuracyStats.MaxXAccuracy), nameof(AccuracyStats.AbsMaxXAccuracy)
+ ])]
public static class Tile__SwitchChosen {
public static void Postfix() {
if(Main.IsPlaying) {
diff --git a/Overlayer/Tags/Patches/P_scrPressToStart.cs b/Overlayer/Tags/Patches/P_scrPressToStart.cs
index f46df67..d4f486e 100644
--- a/Overlayer/Tags/Patches/P_scrPressToStart.cs
+++ b/Overlayer/Tags/Patches/P_scrPressToStart.cs
@@ -3,27 +3,30 @@
namespace Overlayer.Tags.Patches;
public class P_scrPressToStart : PatchBase {
- [LazyPatch("Tags.P_scrPressToStart.Bpm__ShowText", "scrPressToStart", "ShowText", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrPressToStart.Bpm__ShowText", "scrPressToStart", "ShowText", Triggers =
+ [
nameof(Bpm.TileBpm), nameof(Bpm.CurBpm), nameof(Bpm.RecKPS),
- nameof(Bpm.TileBpmWithoutPitch), nameof(Bpm.CurBpmWithoutPitch), nameof(Bpm.RecKPSWithoutPitch),
- })]
+ nameof(Bpm.TileBpmWithoutPitch), nameof(Bpm.CurBpmWithoutPitch), nameof(Bpm.RecKPSWithoutPitch)
+ ])]
public static class Bpm__ShowText {
public static void Postfix(scrController __instance) => Bpm.Init(__instance);
}
- [LazyPatch("Tags.P_scrPressToStart.Level__ShowText", "scrPressToStart", "ShowText", Triggers = new string[] {
+ [LazyPatch("Tags.P_scrPressToStart.Level__ShowText", "scrPressToStart", "ShowText", Triggers =
+ [
nameof(Level.Title), nameof(Level.Author), nameof(Level.Artist),
nameof(Level.TitleRaw), nameof(Level.AuthorRaw), nameof(Level.ArtistRaw),
nameof(Level.DefaultTextColor), nameof(Level.DefaultTextShadowColor),
nameof(Level.LevelNameTextColor), nameof(Level.LevelNameTextShadowColor)
- })]
+ ])]
public static class Level__ShowText {
public static void Postfix() => Level.Init();
}
- [LazyPatch("Tags.P_scrPressToStart.Status__ShowText", "scrPressToStart", "ShowText", Triggers = new string[] {
- nameof(CheckPointStats.TotalCheckPoints), nameof(CheckPointStats.CurCheckPoint),
- })]
+ [LazyPatch("Tags.P_scrPressToStart.Status__ShowText", "scrPressToStart", "ShowText", Triggers =
+ [
+ nameof(CheckPointStats.TotalCheckPoints), nameof(CheckPointStats.CurCheckPoint)
+ ])]
public static class Status__ShowText {
public static void Postfix() => CheckPointStats.InterCheckPoints_Update();
}
diff --git a/Overlayer/Tags/Patches/P_scrUIController.cs b/Overlayer/Tags/Patches/P_scrUIController.cs
index f867aa5..23dd3f8 100644
--- a/Overlayer/Tags/Patches/P_scrUIController.cs
+++ b/Overlayer/Tags/Patches/P_scrUIController.cs
@@ -3,9 +3,10 @@
namespace Overlayer.Tags.Patches;
public class P_scrUIController : PatchBase {
- [LazyPatch("Tags.P_scrUIController.Status__WipeFromBlack", "scrUIController", "WipeFromBlack", Triggers = new string[] {
- nameof(Status.Attempts),
- })]
+ [LazyPatch("Tags.P_scrUIController.Status__WipeFromBlack", "scrUIController", "WipeFromBlack", Triggers =
+ [
+ nameof(Status.Attempts)
+ ])]
public static class Status__WipeFromBlack {
public static void Prefix() => Status.Attempts_Update();
}
diff --git a/Overlayer/Unity/OverlayerImage.cs b/Overlayer/Unity/OverlayerImage.cs
index 3dd75bb..56d20c1 100644
--- a/Overlayer/Unity/OverlayerImage.cs
+++ b/Overlayer/Unity/OverlayerImage.cs
@@ -66,7 +66,7 @@ public void Init(OverlayerProfile profile, ImageConfig config) {
}
public void Update() {
- if(!Initialized || _mainImage == null || Images.Count == 0) {
+ if(!Initialized || _mainImage is null || Images.Count == 0) {
return;
}
@@ -92,7 +92,7 @@ public void Update() {
_mainImage.rectTransform.rotation = Quaternion.Euler(rot);
}
- if(isDragging && OverlayerProfile.DragObj != null && OverlayerProfile.DragImage != null) {
+ if(isDragging && OverlayerProfile.DragObj is not null && OverlayerProfile.DragImage is not null) {
OverlayerProfile.DragObj.transform.position = _mainImage.transform.position;
OverlayerProfile.DragObj.transform.rotation = _mainImage.transform.rotation;
OverlayerProfile.DragImage.rectTransform.pivot = _mainImage.rectTransform.pivot;
diff --git a/Overlayer/Unity/OverlayerProfile.cs b/Overlayer/Unity/OverlayerProfile.cs
index 4d787a0..a27443c 100644
--- a/Overlayer/Unity/OverlayerProfile.cs
+++ b/Overlayer/Unity/OverlayerProfile.cs
@@ -71,11 +71,12 @@ public static void DragInit() {
DragImage = DragObj.AddComponent();
Texture2D outlinetex = new(3, 3, TextureFormat.RGBA32, false);
- Color[] outlinetexpixels = new Color[] {
+ Color[] outlinetexpixels =
+ [
Color.white, Color.white, Color.white,
Color.white, Color.clear, Color.white,
- Color.white, Color.white, Color.white,
- };
+ Color.white, Color.white, Color.white
+ ];
outlinetex.SetPixels(outlinetexpixels);
outlinetex.Apply();
outlinetex.filterMode = FilterMode.Point;
diff --git a/Overlayer/Unity/OverlayerText.cs b/Overlayer/Unity/OverlayerText.cs
index 3c3ccd8..07880f5 100644
--- a/Overlayer/Unity/OverlayerText.cs
+++ b/Overlayer/Unity/OverlayerText.cs
@@ -70,7 +70,7 @@ public void Init(OverlayerProfile profile, TextConfig config) {
}
public void Update() {
- if(!Initialized || Text == null) {
+ if(!Initialized || Text is null) {
return;
}
@@ -103,7 +103,7 @@ public void Update() {
if(_fontChanged || _instancedMaterials == null || _instancedMaterials.Length == 0) {
Material[] shared = Text.fontSharedMaterials;
- if(shared != null && shared.Length > 0 && shared[0] != null) {
+ if(shared != null && shared.Length > 0 && shared[0] is not null) {
RefreshMaterials(shared);
_fontChanged = false;
}
@@ -113,7 +113,7 @@ public void Update() {
UpdateMaterialExpressions();
}
- if(isDragging && OverlayerProfile.DragObj != null && OverlayerProfile.DragImage != null) {
+ if(isDragging && OverlayerProfile.DragObj is not null && OverlayerProfile.DragImage is not null) {
OverlayerProfile.DragObj.transform.position = Text.gameObject.transform.position;
OverlayerProfile.DragObj.transform.rotation = Text.gameObject.transform.rotation;
OverlayerProfile.DragImage.rectTransform.pivot = Text.rectTransform.pivot;
@@ -249,7 +249,7 @@ private void SetFont() {
}
TMP_FontAsset targetFont = font.fontTMP;
- if(targetFont == null) {
+ if(targetFont is null) {
return;
}
Text.font = targetFont;
@@ -303,7 +303,7 @@ private void UpdateMaterials() {
private void RefreshMaterials(Material[] shared) {
_instancedMaterials = new Material[shared.Length];
for(int i = 0; i < shared.Length; i++) {
- if(shared[i] == null) {
+ if(shared[i] is null) {
continue;
}
_instancedMaterials[i] = new Material(shared[i]);
@@ -319,7 +319,7 @@ private void RefreshMaterials(Material[] shared) {
private void UpdateMaterialExpressions() {
bool changed = false;
foreach(var mat in _instancedMaterials) {
- if(mat == null) {
+ if(mat is null) {
continue;
}
diff --git a/Overlayer/Utils/AutoUpdater.cs b/Overlayer/Utils/AutoUpdater.cs
index 41af0c3..4e48dd8 100644
--- a/Overlayer/Utils/AutoUpdater.cs
+++ b/Overlayer/Utils/AutoUpdater.cs
@@ -38,9 +38,9 @@ public static void Reload(ModEntry modEntry) {
PropertyInfo canReloadProp = entryType.GetProperty("CanReload", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
MethodInfo setMethod = canReloadProp?.GetSetMethod(true);
MethodInfo reloadMethod = entryType.GetMethod("Reload", BindingFlags.Instance | BindingFlags.NonPublic);
- setMethod?.Invoke(modEntry, new object[] { true });
+ setMethod?.Invoke(modEntry, [true]);
reloadMethod?.Invoke(modEntry, null);
- setMethod?.Invoke(modEntry, new object[] { false });
+ setMethod?.Invoke(modEntry, [false]);
}
public static async Task InitAndUpdate(ModEntry modEntry, bool update = false, bool allowBeta = false, Action ok = null, Action err = null, bool latestIsError = false) {
diff --git a/Overlayer/Utils/DeletePopup.cs b/Overlayer/Utils/DeletePopup.cs
index 523b614..767c0a1 100644
--- a/Overlayer/Utils/DeletePopup.cs
+++ b/Overlayer/Utils/DeletePopup.cs
@@ -39,10 +39,11 @@ public void Initialize(OverlayerProfile profile, Action onDelete = null) {
this.obj = null;
this.OnDelete = onDelete;
- contentLines = new[] {
+ contentLines =
+ [
"" + Main.Lang.Get("DESTROY_ASK", "Destroy?") + "\n",
"" + profile.Config.Name + "\n"
- };
+ ];
SetupWindow();
}
@@ -130,7 +131,7 @@ private void DrawWindow(int windowID) {
if(Drawer.Button($"{Main.Lang.Get("YES", "Yes")}", GUILayout.Width(150), GUILayout.Height(52))) {
obj?.Parent.ObjectManager.Destroy(obj);
- if(profile != null) {
+ if(profile is not null) {
ProfileManager.Destroy(profile);
}
diff --git a/Overlayer/Utils/Extensions.cs b/Overlayer/Utils/Extensions.cs
index 0b611b2..f0fcc3a 100644
--- a/Overlayer/Utils/Extensions.cs
+++ b/Overlayer/Utils/Extensions.cs
@@ -63,7 +63,7 @@ public static bool Convert(this ILGenerator il, Type to) {
il.Emit(OpCodes.Conv_R8);
return true;
case TypeCode.String:
- il.Emit(OpCodes.Call, typeof(Convert).GetMethod("ToString", new[] { to }));
+ il.Emit(OpCodes.Call, typeof(Convert).GetMethod("ToString", [to]));
return true;
default:
return false;
diff --git a/Overlayer/Utils/MiscUtils.cs b/Overlayer/Utils/MiscUtils.cs
index bc2e074..76285fa 100644
--- a/Overlayer/Utils/MiscUtils.cs
+++ b/Overlayer/Utils/MiscUtils.cs
@@ -105,7 +105,7 @@ public static bool SetAttr(object obj, string accessor = "", object value = null
Type objType = obj is Type t ? t : obj.GetType();
accessor = accessor.TrimEnd('.');
object result = obj;
- string[] accessors = accessor.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
+ string[] accessors = accessor.Split(['.'], StringSplitOptions.RemoveEmptyEntries);
if(accessors.Length < 1) {
return false;
}
diff --git a/Overlayer/Utils/StringUtils.cs b/Overlayer/Utils/StringUtils.cs
index b6aaafa..d034359 100644
--- a/Overlayer/Utils/StringUtils.cs
+++ b/Overlayer/Utils/StringUtils.cs
@@ -124,8 +124,8 @@ public static unsafe string InvertAlternately(this string s) {
public static string[] Split2(this string str, char separator) {
int index = str.IndexOf(separator);
return index < 0
- ? (new string[] { str })
- : (new string[] { str.Substring(0, index), str.Substring(index + 1, str.Length - (index + 1)) });
+ ? [str]
+ : [str.Substring(0, index), str.Substring(index + 1, str.Length - (index + 1))];
}
public static char ToLower(this char c) => c.IsLower() ? c : (char)(c + 32);
public static unsafe string ToLowerFast(this string s) {
diff --git a/Overlayer/Views/ProfileDrawer.cs b/Overlayer/Views/ProfileDrawer.cs
index 2a29a80..df57674 100644
--- a/Overlayer/Views/ProfileDrawer.cs
+++ b/Overlayer/Views/ProfileDrawer.cs
@@ -55,7 +55,7 @@ public override void Draw() {
string[] texts = StandaloneFileBrowser.OpenFilePanel(
Main.Lang.Get("SELECT_OBJECT", "Select Object"),
Main.Mod.Path,
- new[] { new ExtensionFilter(Main.Lang.Get("OVERLAYER_OBJECT_JSON", "Overlayer Object JSON"), "json") },
+ [new ExtensionFilter(Main.Lang.Get("OVERLAYER_OBJECT_JSON", "Overlayer Object JSON"), "json")],
true
);
if(texts == null || texts.Length == 0) {
diff --git a/Overlayer/Views/SettingsDrawer.cs b/Overlayer/Views/SettingsDrawer.cs
index 2120a02..1814f21 100644
--- a/Overlayer/Views/SettingsDrawer.cs
+++ b/Overlayer/Views/SettingsDrawer.cs
@@ -289,7 +289,7 @@ public override void Draw() {
string[] pfs = StandaloneFileBrowser.OpenFilePanel(
Main.Lang.Get("SELECT_PROFILE", "Select Profile"),
Main.ProfilePath,
- new[] { new ExtensionFilter(Main.Lang.Get("OVERLAYER_PROFILE_JSON", "Overlayer Profile JSON"), "json") },
+ [new ExtensionFilter(Main.Lang.Get("OVERLAYER_PROFILE_JSON", "Overlayer Profile JSON"), "json")],
true
);
foreach(var pf in pfs) {