improved code readability

- added mangled name dictionary
- added class alias
This commit is contained in:
Kim, Jimin 2022-03-18 20:52:43 +09:00
parent 854cf56bce
commit 5df7dca06f
2 changed files with 22 additions and 8 deletions

View file

@ -5,6 +5,8 @@ using UnityEngine;
using System;
using System.Reflection;
using CAudioClip = HKPCKNFOBNA;
namespace WBM
{
public partial class WBM
@ -16,17 +18,17 @@ namespace WBM
{
get
{
return ((HKPCKNFOBNA)this.oldGunSoundRef.GetValue(this.webguy)).DDKAHAAKKME;
return ((CAudioClip)this.oldGunSoundRef.GetValue(this.webguy)).DDKAHAAKKME;
}
}
private AudioClip oldGunSound;
private FieldInfo AKSoundRef;
private HKPCKNFOBNA AKSoundRaw
private CAudioClip AKSoundRaw
{
get
{
return (HKPCKNFOBNA)this.AKSoundRef.GetValue(this.webguy);
return (CAudioClip)this.AKSoundRef.GetValue(this.webguy);
}
set
{
@ -36,11 +38,11 @@ namespace WBM
private AudioClip newAKSound;
private FieldInfo SMGSoundRef;
private HKPCKNFOBNA SMGSoundRaw
private CAudioClip SMGSoundRaw
{
get
{
return (HKPCKNFOBNA)this.SMGSoundRef.GetValue(this.webguy);
return (CAudioClip)this.SMGSoundRef.GetValue(this.webguy);
}
set
{
@ -51,9 +53,9 @@ namespace WBM
private void setupOldGunSound()
{
this.oldGunSoundRef = webguyType.GetField("ICMCDLNEIAI", bindFlags);
this.AKSoundRef = webguyType.GetField("DGEJAAPKEAD", bindFlags);
this.SMGSoundRef = webguyType.GetField("OFAALIJFKEI", bindFlags);
this.oldGunSoundRef = webguyType.GetField(MangledNames.gunShotClip, bindFlags);
this.AKSoundRef = webguyType.GetField(MangledNames.AKRifleShotClip, bindFlags);
this.SMGSoundRef = webguyType.GetField(MangledNames.SMGShotClip, bindFlags);
this.useOldGunSoundConf = Config.Bind("Config", "use old gun sound", true);
this.useOldGunSoundConf.SettingChanged += this.onOldGunSoundChange;

12
WBM/mangledNames.cs Normal file
View file

@ -0,0 +1,12 @@
/// This file contains all information related to matching
/// mangles names to something more readable
namespace WBM
{
public static class MangledNames
{
public static readonly string gunShotClip = "ICMCDLNEIAI";
public static readonly string AKRifleShotClip = "DGEJAAPKEAD";
public static readonly string SMGShotClip = "OFAALIJFKEI";
}
}