Skip to content

Commit

Permalink
Merge pull request #24 from pdcook/main
Browse files Browse the repository at this point in the history
Removed pre-battle countdown and re-added local keybind hints
  • Loading branch information
olavim authored Jun 17, 2022
2 parents 1443c26 + 291b307 commit 1b2332c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
8 changes: 6 additions & 2 deletions RoundsWithFriends/GameModes/RWFGameMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,17 @@ public virtual IEnumerator DoRoundStart()

yield return this.SyncBattleStart();

/*
for (int i = 3; i >= 1; i--)
{
UIHandler.instance.DisplayRoundStartText($"{i}");
SoundManager.Instance.Play(PointVisualizer.instance.sound_UI_Arms_Race_A_Ball_Shrink_Go_To_Left_Corner, this.transform);
yield return new WaitForSecondsRealtime(0.5f);
}
SoundManager.Instance.Play(PointVisualizer.instance.sound_UI_Arms_Race_C_Ball_Pop_Shake, this.transform);
UIHandler.instance.DisplayRoundStartText("FIGHT");
*/
SoundManager.Instance.Play(PointVisualizer.instance.sound_UI_Arms_Race_C_Ball_Pop_Shake, this.transform);
PlayerManager.instance.SetPlayersSimulated(true);

yield return GameModeManager.TriggerHook(GameModeHooks.HookBattleStart);
Expand Down Expand Up @@ -397,15 +399,17 @@ public virtual IEnumerator DoPointStart()

yield return this.SyncBattleStart();

/*
for (int i = 3; i >= 1; i--)
{
UIHandler.instance.DisplayRoundStartText($"{i}");
SoundManager.Instance.Play(PointVisualizer.instance.sound_UI_Arms_Race_A_Ball_Shrink_Go_To_Left_Corner, this.transform);
yield return new WaitForSecondsRealtime(0.5f);
}
SoundManager.Instance.Play(PointVisualizer.instance.sound_UI_Arms_Race_C_Ball_Pop_Shake, this.transform);
UIHandler.instance.DisplayRoundStartText("FIGHT");
*/
SoundManager.Instance.Play(PointVisualizer.instance.sound_UI_Arms_Race_C_Ball_Pop_Shake, this.transform);
PlayerManager.instance.SetPlayersSimulated(true);

yield return GameModeManager.TriggerHook(GameModeHooks.HookBattleStart);
Expand Down
26 changes: 26 additions & 0 deletions RoundsWithFriends/RoundsWithFriends.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,8 @@ public void InjectUIElements()
var mainMenuGo = uiGo.transform.Find("UI_MainMenu").Find("Canvas").gameObject;
var charSelectionGroupGo = mainMenuGo.transform.Find("ListSelector").Find("CharacterSelect").GetChild(0).gameObject;

StartCoroutine(InjectKeybindsWhenReady());

if (!charSelectionGroupGo.transform.Find("CharacterSelect 3"))
{
var charSelectInstanceGo1 = charSelectionGroupGo.transform.GetChild(0).gameObject;
Expand Down Expand Up @@ -541,6 +543,30 @@ public void InjectUIElements()
popupGo.transform.localScale = Vector3.one;
popupGo.AddComponent<UI.PopUpMenu>();
}

}
public IEnumerator InjectKeybindsWhenReady()
{
var uiGo = GameObject.Find("/Game/UI");
var mainMenuGo = uiGo.transform.Find("UI_MainMenu").Find("Canvas").gameObject;

var localGameModeGroupGo = mainMenuGo.transform.Find("ListSelector/LOCAL/Group/Grid/Scroll View/Viewport/Content")?.gameObject;
while (localGameModeGroupGo is null)
{
yield return new WaitForEndOfFrame();
localGameModeGroupGo = mainMenuGo.transform.Find("ListSelector/LOCAL/Group/Grid/Scroll View/Viewport/Content")?.gameObject;
}
foreach (Transform gameModeButtonGo in localGameModeGroupGo.transform)
{
if (gameModeButtonGo.name == "Test") { continue; } // we don't want to add keybind hints to Sandbox
var gameModeButton = gameModeButtonGo.GetComponent<Button>();
if (gameModeButton is null) { continue; }
gameModeButton.onClick.AddListener(() =>
{
KeybindHints.CreateLocalHints();
});
}
yield break;
}
}
}

0 comments on commit 1b2332c

Please sign in to comment.