private void CreateGameObjects() { if (myJoinImage != null) { return; } var hudRoot = GameObject.Find("UserInterface/UnscaledUI/HudContent/Hud"); if (hudRoot == null) { MelonLogger.Log("Not creating gameobjects - no hud root"); return; } MelonLogger.Log("Creating gameobjects"); // var pathToThing = "UserInterface/UnscaledUI/HudContent/Hud/NotificationDotParent/NotificationDot"; myJoinImage = CreateNotifierImage("join", 0f, JoinNotifierSettings.GetJoinIconColor()); myJoinSource = CreateAudioSource(myJoinClip, myJoinImage.gameObject); myJoinText = CreateTextNear(myJoinImage, 110f, TextAnchor.LowerRight); myLeaveImage = CreateNotifierImage("leave", 100f, JoinNotifierSettings.GetLeaveIconColor()); myLeaveSource = CreateAudioSource(myLeaveClip, myLeaveImage.gameObject); myLeaveText = CreateTextNear(myLeaveImage, 110f, TextAnchor.LowerLeft); }
public IEnumerator ShowName(Text text, List <string> namesList, string name, bool isJoin, bool isFriend) { var color = JoinNotifierSettings.ShowFriendsInDifferentColor() && isFriend ? (isJoin ? JoinNotifierSettings.GetFriendJoinIconColor() : JoinNotifierSettings.GetFriendLeaveIconColor()) : (isJoin ? JoinNotifierSettings.GetJoinIconColor() : JoinNotifierSettings.GetLeaveIconColor()); var playerLine = $"<color={RenderHex(color)}>{name}</color>"; namesList.Add(playerLine); text.text = string.Join("\n", namesList); yield return(new WaitForSeconds(3)); namesList.Remove(playerLine); text.text = string.Join("\n", namesList); }
public override void OnModSettingsApplied() { MelonLogger.Log("Settings apply start"); if (myJoinSource != null) { myJoinSource.volume = JoinNotifierSettings.GetSoundVolume(); myJoinSource.outputAudioMixerGroup = JoinNotifierSettings.GetUseUiMixer() ? VRCAudioManager.field_Private_Static_VRCAudioManager_0.uiGroup : null; } if (myLeaveSource != null) { myLeaveSource.volume = JoinNotifierSettings.GetSoundVolume(); myLeaveSource.outputAudioMixerGroup = JoinNotifierSettings.GetUseUiMixer() ? VRCAudioManager.field_Private_Static_VRCAudioManager_0.uiGroup : null; } if (myJoinImage != null) { myJoinImage.color = JoinNotifierSettings.GetJoinIconColor(); } if (myLeaveImage != null) { myLeaveImage.color = JoinNotifierSettings.GetLeaveIconColor(); } if (myJoinText != null) { myJoinText.fontSize = JoinNotifierSettings.GetTextSize(); myJoinText.color = JoinNotifierSettings.GetJoinIconColor(); } if (myLeaveText != null) { myLeaveText.fontSize = JoinNotifierSettings.GetTextSize(); myLeaveText.color = JoinNotifierSettings.GetLeaveIconColor(); } MelonLogger.Log("Settings apply done"); }