private Text CreateTextNear(Image image, float offset, TextAnchor alignment) { var gameObject = new GameObject(image.gameObject.name + "-text"); gameObject.AddComponent <Text>(); gameObject.transform.SetParent(image.transform, false); gameObject.transform.localScale = Vector3.one; gameObject.transform.localPosition = Vector3.up * offset; var text = gameObject.GetComponent <Text>(); text.color = image.color; text.fontStyle = FontStyle.Bold; text.horizontalOverflow = HorizontalWrapMode.Overflow; text.verticalOverflow = VerticalWrapMode.Overflow; text.alignment = alignment; text.fontSize = JoinNotifierSettings.GetTextSize(); text.font = Resources.GetBuiltinResource <Font>("Arial.ttf"); gameObject.SetActive(true); return(text); }
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"); }