public void OnPlayerLeft(Player player) { var apiUser = player.field_Private_APIUser_0; if (!JoinNotifierSettings.ShouldNotifyInCurrentInstance()) { return; } if (Environment.TickCount - myLastLevelLoad < 5_000) { return; } var isFriendsWith = APIUser.IsFriendsWith(apiUser.id); if (JoinNotifierSettings.ShowFriendsOnly() && !isFriendsWith) { return; } var playerName = player.field_Private_APIUser_0.displayName ?? "!null!"; if (JoinNotifierSettings.ShouldBlinkIcon(false)) { MelonCoroutines.Start(BlinkIconCoroutine(myLeaveImage)); } if (JoinNotifierSettings.ShouldPlaySound(false)) { myLeaveSource.Play(); } if (JoinNotifierSettings.ShouldShowNames(false)) { MelonCoroutines.Start(ShowName(myLeaveText, myLeaveNames, playerName, false, isFriendsWith)); } }
public void OnPlayerJoined(Player player) { var apiUser = player.field_Private_APIUser_0; if (APIUser.CurrentUser.id == apiUser.id) { myObservedLocalPlayerJoin = true; myLastLevelLoad = Environment.TickCount; } if (!myObservedLocalPlayerJoin || Environment.TickCount - myLastLevelLoad < 5_000) { return; } if (!JoinNotifierSettings.ShouldNotifyInCurrentInstance()) { return; } var playerName = apiUser.displayName ?? "!null!"; if (JoinNotifierSettings.ShouldBlinkIcon(true)) { MelonCoroutines.Start(BlinkIconCoroutine(myJoinImage)); } if (JoinNotifierSettings.ShouldPlaySound(true)) { myJoinSource.Play(); } if (JoinNotifierSettings.ShouldShowNames(true)) { MelonCoroutines.Start(ShowName(myJoinText, playerName)); } }