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.setupWSSever();
|
||||
this.setupClearChatOnKeyPress();
|
||||
this.setupClearChat();
|
||||
this.setupShiftToCrouch();
|
||||
this.setupShowEloOnLeaderBoard();
|
||||
this.setupShowSquadServer();
|
||||
|
@ -47,19 +47,18 @@ namespace WBM
|
|||
this.moveUIOnKeyPress();
|
||||
this.resetUIOnKeyPress();
|
||||
this.toggleUIOnKeyPress();
|
||||
this.toggleKillStreakSFXOnKeyPress();
|
||||
this.togglePlayerStatsOnKeyPress();
|
||||
this.toggleWeaponStatsOnKeyPress();
|
||||
this.toggleTeamStatsOnKeyPress();
|
||||
this.toggleLeaderboardEloOnKeyPress();
|
||||
this.toggleShowSquadServerOnKeyPress();
|
||||
this.toggleTestingServerOnKeyPress();
|
||||
this.clearChatOnKeyPress();
|
||||
this.clearDeathLogOnKeyPress();
|
||||
this.doKillStreakSFX();
|
||||
this.doPlayerStats();
|
||||
this.doWeaponStats();
|
||||
this.doTeamStats();
|
||||
this.doLeaderboardElo();
|
||||
this.doShowSquadServer();
|
||||
this.doTestingServer();
|
||||
this.doClearChat();
|
||||
this.doclearMessage();
|
||||
this.showConfigOnKeyPress();
|
||||
|
||||
this.toggleShiftToCrouchOnKeyPress();
|
||||
this.crouchOnKeyPress();
|
||||
this.doShiftToCrouch();
|
||||
}
|
||||
|
||||
/// Called multiple times per frame in response to GUI events.
|
||||
|
|
|
@ -12,13 +12,13 @@ namespace WBM
|
|||
|
||||
private ConfigEntry<KeyboardShortcut> clearChatShortcut;
|
||||
|
||||
private void setupClearChatOnKeyPress()
|
||||
private void setupClearChat()
|
||||
{
|
||||
this.drawChatMessageFuncRef = webguyType.GetMethod("EBDKFEJMEMB", bindFlags);
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace WBM
|
|||
{
|
||||
private ConfigEntry<KeyboardShortcut> clearDeathLogShortcut;
|
||||
|
||||
private void clearDeathLogOnKeyPress()
|
||||
private void doclearMessage()
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
private void doKillStreakSFX()
|
||||
{
|
||||
this.toggleKillStreakSFXOnKeyPress();
|
||||
}
|
||||
|
||||
private void toggleKillStreakSFXOnKeyPress()
|
||||
{
|
||||
if (this.killStreakSFXShortcut.Value.IsDown()) this.killStreakSFX.Value = !this.killStreakSFX.Value;
|
||||
|
|
|
@ -49,7 +49,22 @@ namespace WBM
|
|||
}
|
||||
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)
|
||||
{
|
||||
|
@ -62,20 +77,5 @@ namespace WBM
|
|||
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;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
private void doShiftToCrouch()
|
||||
{
|
||||
this.crouchOnKeyPress();
|
||||
this.toggleShiftToCrouchOnKeyPress();
|
||||
}
|
||||
|
||||
private void crouchOnKeyPress()
|
||||
{
|
||||
// Skip if this setting is not activated
|
||||
|
|
|
@ -30,17 +30,22 @@ namespace WBM
|
|||
this.showEloOnLeaderboardRef = webguyType.GetField("KDOBENAOLLF", bindFlags);
|
||||
|
||||
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.showEloOnLeaderboardRaw = this.showEloOnLeaderboard.Value;
|
||||
}
|
||||
|
||||
private void doLeaderboardElo()
|
||||
{
|
||||
this.toggleLeaderboardEloOnKeyPress();
|
||||
}
|
||||
|
||||
private void toggleLeaderboardEloOnKeyPress()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -30,17 +30,22 @@ namespace WBM
|
|||
this.showSquadServerRef = webguyType.GetField("PHPIBBCFKFI", bindFlags);
|
||||
|
||||
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.showSquadServerRaw = this.showSquadServer.Value;
|
||||
}
|
||||
|
||||
private void doShowSquadServer()
|
||||
{
|
||||
this.toggleShowSquadServerOnKeyPress();
|
||||
}
|
||||
|
||||
private void toggleShowSquadServerOnKeyPress()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -30,17 +30,22 @@ namespace WBM
|
|||
this.showTestingServerRef = webguyType.GetField("LHHEGFHLNJE", bindFlags);
|
||||
|
||||
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.showTestingServerRaw = this.showTestingServer.Value;
|
||||
}
|
||||
|
||||
private void doTestingServer()
|
||||
{
|
||||
this.toggleTestingServerOnKeyPress();
|
||||
}
|
||||
|
||||
private void toggleTestingServerOnKeyPress()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,11 @@ namespace WBM
|
|||
private ConfigEntry<bool> showTeamStats;
|
||||
private ConfigEntry<KeyboardShortcut> showTeamStatsShortcut;
|
||||
|
||||
private void doTeamStats()
|
||||
{
|
||||
this.toggleTeamStatsOnKeyPress();
|
||||
}
|
||||
|
||||
private void toggleTeamStatsOnKeyPress()
|
||||
{
|
||||
if (this.showTeamStatsShortcut.Value.IsDown()) this.showTeamStats.Value = !this.showTeamStats.Value;
|
||||
|
|
|
@ -7,6 +7,11 @@ namespace WBM
|
|||
private ConfigEntry<bool> showWeaponStats;
|
||||
private ConfigEntry<KeyboardShortcut> showWeaponStatsShortcut;
|
||||
|
||||
private void doWeaponStats()
|
||||
{
|
||||
this.toggleWeaponStatsOnKeyPress();
|
||||
}
|
||||
|
||||
private void toggleWeaponStatsOnKeyPress()
|
||||
{
|
||||
if (this.showWeaponStatsShortcut.Value.IsDown()) this.showWeaponStats.Value = !this.showWeaponStats.Value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue