improved function naming
This commit is contained in:
parent
1e5ce5fda2
commit
b37cca33c4
13 changed files with 95 additions and 37 deletions
18
CONTRIBUTING.md
Normal file
18
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Contribution guide
|
||||||
|
|
||||||
|
## feature structure
|
||||||
|
|
||||||
|
- All features should be contained in the `WBM/features` folder.
|
||||||
|
|
||||||
|
### Feature functions
|
||||||
|
|
||||||
|
- All features can have at most one function to be called in each event functions.
|
||||||
|
- feature function should have the following format: `<prefix><feature name>`
|
||||||
|
|
||||||
|
| Event function | feature function prefix |
|
||||||
|
| -------------: | :---------------------- |
|
||||||
|
| `Awake` | `init` |
|
||||||
|
| `Start` | `setup` |
|
||||||
|
| `Update` | `do` |
|
||||||
|
| `OnGUI` | `draw` |
|
||||||
|
| `onDestroy` | `destroy` |
|
23
WBM/WBM.cs
23
WBM/WBM.cs
|
@ -29,7 +29,7 @@ namespace WBM
|
||||||
|
|
||||||
this.setupOldGunSound();
|
this.setupOldGunSound();
|
||||||
this.setupWSSever();
|
this.setupWSSever();
|
||||||
this.setupClearChatOnKeyPress();
|
this.setupClearChat();
|
||||||
this.setupShiftToCrouch();
|
this.setupShiftToCrouch();
|
||||||
this.setupShowEloOnLeaderBoard();
|
this.setupShowEloOnLeaderBoard();
|
||||||
this.setupShowSquadServer();
|
this.setupShowSquadServer();
|
||||||
|
@ -47,19 +47,18 @@ namespace WBM
|
||||||
this.moveUIOnKeyPress();
|
this.moveUIOnKeyPress();
|
||||||
this.resetUIOnKeyPress();
|
this.resetUIOnKeyPress();
|
||||||
this.toggleUIOnKeyPress();
|
this.toggleUIOnKeyPress();
|
||||||
this.toggleKillStreakSFXOnKeyPress();
|
this.doKillStreakSFX();
|
||||||
this.togglePlayerStatsOnKeyPress();
|
this.doPlayerStats();
|
||||||
this.toggleWeaponStatsOnKeyPress();
|
this.doWeaponStats();
|
||||||
this.toggleTeamStatsOnKeyPress();
|
this.doTeamStats();
|
||||||
this.toggleLeaderboardEloOnKeyPress();
|
this.doLeaderboardElo();
|
||||||
this.toggleShowSquadServerOnKeyPress();
|
this.doShowSquadServer();
|
||||||
this.toggleTestingServerOnKeyPress();
|
this.doTestingServer();
|
||||||
this.clearChatOnKeyPress();
|
this.doClearChat();
|
||||||
this.clearDeathLogOnKeyPress();
|
this.doclearMessage();
|
||||||
this.showConfigOnKeyPress();
|
this.showConfigOnKeyPress();
|
||||||
|
|
||||||
this.toggleShiftToCrouchOnKeyPress();
|
this.doShiftToCrouch();
|
||||||
this.crouchOnKeyPress();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called multiple times per frame in response to GUI events.
|
/// Called multiple times per frame in response to GUI events.
|
||||||
|
|
|
@ -12,13 +12,13 @@ namespace WBM
|
||||||
|
|
||||||
private ConfigEntry<KeyboardShortcut> clearChatShortcut;
|
private ConfigEntry<KeyboardShortcut> clearChatShortcut;
|
||||||
|
|
||||||
private void setupClearChatOnKeyPress()
|
private void setupClearChat()
|
||||||
{
|
{
|
||||||
this.drawChatMessageFuncRef = webguyType.GetMethod("EBDKFEJMEMB", bindFlags);
|
this.drawChatMessageFuncRef = webguyType.GetMethod("EBDKFEJMEMB", bindFlags);
|
||||||
this.clearChatShortcut = Config.Bind("Hotkeys", "clear chat", new KeyboardShortcut(KeyCode.Z, KeyCode.RightShift));
|
this.clearChatShortcut = Config.Bind("Hotkeys", "clear chat", new KeyboardShortcut(KeyCode.Z, KeyCode.RightShift));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearChatOnKeyPress()
|
private void doClearChat()
|
||||||
{
|
{
|
||||||
if (this.clearChatShortcut.Value.IsDown()) this.clearChat();
|
if (this.clearChatShortcut.Value.IsDown()) this.clearChat();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace WBM
|
||||||
{
|
{
|
||||||
private ConfigEntry<KeyboardShortcut> clearDeathLogShortcut;
|
private ConfigEntry<KeyboardShortcut> clearDeathLogShortcut;
|
||||||
|
|
||||||
private void clearDeathLogOnKeyPress()
|
private void doclearMessage()
|
||||||
{
|
{
|
||||||
if (this.clearDeathLogShortcut.Value.IsDown()) this.clearMessagesFuncRef.Invoke(this.webguy, new object[] { });
|
if (this.clearDeathLogShortcut.Value.IsDown()) this.clearMessagesFuncRef.Invoke(this.webguy, new object[] { });
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,11 @@ namespace WBM
|
||||||
this.killStreakSFXShortcut = Config.Bind("Hotkeys", "kill streak sound effect", new KeyboardShortcut(KeyCode.F, KeyCode.RightShift));
|
this.killStreakSFXShortcut = Config.Bind("Hotkeys", "kill streak sound effect", new KeyboardShortcut(KeyCode.F, KeyCode.RightShift));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doKillStreakSFX()
|
||||||
|
{
|
||||||
|
this.toggleKillStreakSFXOnKeyPress();
|
||||||
|
}
|
||||||
|
|
||||||
private void toggleKillStreakSFXOnKeyPress()
|
private void toggleKillStreakSFXOnKeyPress()
|
||||||
{
|
{
|
||||||
if (this.killStreakSFXShortcut.Value.IsDown()) this.killStreakSFX.Value = !this.killStreakSFX.Value;
|
if (this.killStreakSFXShortcut.Value.IsDown()) this.killStreakSFX.Value = !this.killStreakSFX.Value;
|
||||||
|
|
|
@ -49,7 +49,22 @@ namespace WBM
|
||||||
}
|
}
|
||||||
private AudioClip newSMGSound;
|
private AudioClip newSMGSound;
|
||||||
|
|
||||||
private void useOldGunSoundChanged(object sender, EventArgs e)
|
private void setupOldGunSound()
|
||||||
|
{
|
||||||
|
this.oldGunSoundRef = webguyType.GetField("PINGEJAHHDI", bindFlags);
|
||||||
|
this.AKSoundRef = webguyType.GetField("BJFBGCMEELH", bindFlags);
|
||||||
|
this.SMGSoundRef = webguyType.GetField("HKDDIMFIHCE", bindFlags);
|
||||||
|
|
||||||
|
this.useOldGunSoundConf = Config.Bind("Config", "use old gun sound", true);
|
||||||
|
this.useOldGunSoundConf.SettingChanged += this.onOldGunSoundChange;
|
||||||
|
this.onOldGunSoundChange(new object(), new EventArgs());
|
||||||
|
|
||||||
|
this.oldGunSound = this.oldGunSoundRaw;
|
||||||
|
this.newAKSound = this.AKSoundRaw.ADCOCHNNCHM;
|
||||||
|
this.newSMGSound = this.SMGSoundRaw.ADCOCHNNCHM;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onOldGunSoundChange(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (this.useOldGunSoundConf.Value)
|
if (this.useOldGunSoundConf.Value)
|
||||||
{
|
{
|
||||||
|
@ -62,20 +77,5 @@ namespace WBM
|
||||||
this.SMGSoundRaw.ADCOCHNNCHM = this.newSMGSound;
|
this.SMGSoundRaw.ADCOCHNNCHM = this.newSMGSound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupOldGunSound()
|
|
||||||
{
|
|
||||||
this.oldGunSoundRef = webguyType.GetField("PINGEJAHHDI", bindFlags);
|
|
||||||
this.AKSoundRef = webguyType.GetField("BJFBGCMEELH", bindFlags);
|
|
||||||
this.SMGSoundRef = webguyType.GetField("HKDDIMFIHCE", bindFlags);
|
|
||||||
|
|
||||||
this.useOldGunSoundConf = Config.Bind("Config", "use old gun sound", true);
|
|
||||||
this.useOldGunSoundConf.SettingChanged += this.useOldGunSoundChanged;
|
|
||||||
this.useOldGunSoundChanged(new object(), new EventArgs());
|
|
||||||
|
|
||||||
this.oldGunSound = this.oldGunSoundRaw;
|
|
||||||
this.newAKSound = this.AKSoundRaw.ADCOCHNNCHM;
|
|
||||||
this.newSMGSound = this.SMGSoundRaw.ADCOCHNNCHM;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,10 @@ namespace WBM
|
||||||
{
|
{
|
||||||
if (this.showPlayerStatsShortcut.Value.IsDown()) this.showPlayerStats.Value = !this.showPlayerStats.Value;
|
if (this.showPlayerStatsShortcut.Value.IsDown()) this.showPlayerStats.Value = !this.showPlayerStats.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doPlayerStats()
|
||||||
|
{
|
||||||
|
this.togglePlayerStatsOnKeyPress();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,12 @@ namespace WBM
|
||||||
this.shiftToCrouchShortcut = Config.Bind("Hotkeys", "shift to crouch", new KeyboardShortcut(KeyCode.C, KeyCode.RightShift));
|
this.shiftToCrouchShortcut = Config.Bind("Hotkeys", "shift to crouch", new KeyboardShortcut(KeyCode.C, KeyCode.RightShift));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doShiftToCrouch()
|
||||||
|
{
|
||||||
|
this.crouchOnKeyPress();
|
||||||
|
this.toggleShiftToCrouchOnKeyPress();
|
||||||
|
}
|
||||||
|
|
||||||
private void crouchOnKeyPress()
|
private void crouchOnKeyPress()
|
||||||
{
|
{
|
||||||
// Skip if this setting is not activated
|
// Skip if this setting is not activated
|
||||||
|
|
|
@ -30,17 +30,22 @@ namespace WBM
|
||||||
this.showEloOnLeaderboardRef = webguyType.GetField("KDOBENAOLLF", bindFlags);
|
this.showEloOnLeaderboardRef = webguyType.GetField("KDOBENAOLLF", bindFlags);
|
||||||
|
|
||||||
this.showEloOnLeaderboard = Config.Bind("Config", "show Elo on leaderboard", true);
|
this.showEloOnLeaderboard = Config.Bind("Config", "show Elo on leaderboard", true);
|
||||||
this.showEloOnLeaderboard.SettingChanged += this.onShowEloOnLeaderboardChanged;
|
this.showEloOnLeaderboard.SettingChanged += this.onShowEloOnLeaderboardChange;
|
||||||
this.showEloOnLeaderboardShortcut = Config.Bind("Hotkeys", "show Elo on leaderboard", new KeyboardShortcut(KeyCode.E, KeyCode.RightShift));
|
this.showEloOnLeaderboardShortcut = Config.Bind("Hotkeys", "show Elo on leaderboard", new KeyboardShortcut(KeyCode.E, KeyCode.RightShift));
|
||||||
this.showEloOnLeaderboardRaw = this.showEloOnLeaderboard.Value;
|
this.showEloOnLeaderboardRaw = this.showEloOnLeaderboard.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doLeaderboardElo()
|
||||||
|
{
|
||||||
|
this.toggleLeaderboardEloOnKeyPress();
|
||||||
|
}
|
||||||
|
|
||||||
private void toggleLeaderboardEloOnKeyPress()
|
private void toggleLeaderboardEloOnKeyPress()
|
||||||
{
|
{
|
||||||
if (this.showEloOnLeaderboardShortcut.Value.IsDown()) this.showEloOnLeaderboard.Value = !this.showEloOnLeaderboard.Value;
|
if (this.showEloOnLeaderboardShortcut.Value.IsDown()) this.showEloOnLeaderboard.Value = !this.showEloOnLeaderboard.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onShowEloOnLeaderboardChanged(object sender, EventArgs e)
|
private void onShowEloOnLeaderboardChange(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.showEloOnLeaderboardRaw = this.showEloOnLeaderboard.Value;
|
this.showEloOnLeaderboardRaw = this.showEloOnLeaderboard.Value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,17 +30,22 @@ namespace WBM
|
||||||
this.showSquadServerRef = webguyType.GetField("PHPIBBCFKFI", bindFlags);
|
this.showSquadServerRef = webguyType.GetField("PHPIBBCFKFI", bindFlags);
|
||||||
|
|
||||||
this.showSquadServer = Config.Bind("Config", "show squad server", true);
|
this.showSquadServer = Config.Bind("Config", "show squad server", true);
|
||||||
this.showSquadServer.SettingChanged += this.onShowSquadServerChanged;
|
this.showSquadServer.SettingChanged += this.onShowSquadServerChange;
|
||||||
this.showSquadServerShortcut = Config.Bind("Hotkeys", "show squad server", new KeyboardShortcut(KeyCode.S, KeyCode.RightShift));
|
this.showSquadServerShortcut = Config.Bind("Hotkeys", "show squad server", new KeyboardShortcut(KeyCode.S, KeyCode.RightShift));
|
||||||
this.showSquadServerRaw = this.showSquadServer.Value;
|
this.showSquadServerRaw = this.showSquadServer.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doShowSquadServer()
|
||||||
|
{
|
||||||
|
this.toggleShowSquadServerOnKeyPress();
|
||||||
|
}
|
||||||
|
|
||||||
private void toggleShowSquadServerOnKeyPress()
|
private void toggleShowSquadServerOnKeyPress()
|
||||||
{
|
{
|
||||||
if (this.showSquadServerShortcut.Value.IsDown()) this.showSquadServer.Value = !this.showSquadServer.Value;
|
if (this.showSquadServerShortcut.Value.IsDown()) this.showSquadServer.Value = !this.showSquadServer.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onShowSquadServerChanged(object sender, EventArgs e)
|
private void onShowSquadServerChange(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.showSquadServerRaw = this.showSquadServer.Value;
|
this.showSquadServerRaw = this.showSquadServer.Value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,17 +30,22 @@ namespace WBM
|
||||||
this.showTestingServerRef = webguyType.GetField("LHHEGFHLNJE", bindFlags);
|
this.showTestingServerRef = webguyType.GetField("LHHEGFHLNJE", bindFlags);
|
||||||
|
|
||||||
this.showTestingServer = Config.Bind("Config", "show testing server", true);
|
this.showTestingServer = Config.Bind("Config", "show testing server", true);
|
||||||
this.showTestingServer.SettingChanged += this.onShowTestingServerChanged;
|
this.showTestingServer.SettingChanged += this.onShowTestingServerChange;
|
||||||
this.showTestingServerShortcut = Config.Bind("Hotkeys", "show testing server", new KeyboardShortcut(KeyCode.T, KeyCode.RightShift));
|
this.showTestingServerShortcut = Config.Bind("Hotkeys", "show testing server", new KeyboardShortcut(KeyCode.T, KeyCode.RightShift));
|
||||||
this.showTestingServerRaw = this.showTestingServer.Value;
|
this.showTestingServerRaw = this.showTestingServer.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doTestingServer()
|
||||||
|
{
|
||||||
|
this.toggleTestingServerOnKeyPress();
|
||||||
|
}
|
||||||
|
|
||||||
private void toggleTestingServerOnKeyPress()
|
private void toggleTestingServerOnKeyPress()
|
||||||
{
|
{
|
||||||
if (this.showTestingServerShortcut.Value.IsDown()) this.showTestingServer.Value = !this.showTestingServer.Value;
|
if (this.showTestingServerShortcut.Value.IsDown()) this.showTestingServer.Value = !this.showTestingServer.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onShowTestingServerChanged(object sender, EventArgs e)
|
private void onShowTestingServerChange(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.showTestingServerRaw = this.showTestingServer.Value;
|
this.showTestingServerRaw = this.showTestingServer.Value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,11 @@ namespace WBM
|
||||||
private ConfigEntry<bool> showTeamStats;
|
private ConfigEntry<bool> showTeamStats;
|
||||||
private ConfigEntry<KeyboardShortcut> showTeamStatsShortcut;
|
private ConfigEntry<KeyboardShortcut> showTeamStatsShortcut;
|
||||||
|
|
||||||
|
private void doTeamStats()
|
||||||
|
{
|
||||||
|
this.toggleTeamStatsOnKeyPress();
|
||||||
|
}
|
||||||
|
|
||||||
private void toggleTeamStatsOnKeyPress()
|
private void toggleTeamStatsOnKeyPress()
|
||||||
{
|
{
|
||||||
if (this.showTeamStatsShortcut.Value.IsDown()) this.showTeamStats.Value = !this.showTeamStats.Value;
|
if (this.showTeamStatsShortcut.Value.IsDown()) this.showTeamStats.Value = !this.showTeamStats.Value;
|
||||||
|
|
|
@ -7,6 +7,11 @@ namespace WBM
|
||||||
private ConfigEntry<bool> showWeaponStats;
|
private ConfigEntry<bool> showWeaponStats;
|
||||||
private ConfigEntry<KeyboardShortcut> showWeaponStatsShortcut;
|
private ConfigEntry<KeyboardShortcut> showWeaponStatsShortcut;
|
||||||
|
|
||||||
|
private void doWeaponStats()
|
||||||
|
{
|
||||||
|
this.toggleWeaponStatsOnKeyPress();
|
||||||
|
}
|
||||||
|
|
||||||
private void toggleWeaponStatsOnKeyPress()
|
private void toggleWeaponStatsOnKeyPress()
|
||||||
{
|
{
|
||||||
if (this.showWeaponStatsShortcut.Value.IsDown()) this.showWeaponStats.Value = !this.showWeaponStats.Value;
|
if (this.showWeaponStatsShortcut.Value.IsDown()) this.showWeaponStats.Value = !this.showWeaponStats.Value;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue