public static void UpdatePartLabelText(LabelTextGroup textGroup) { PartInfo part = textGroup.partList.parts[textGroup.partList.index]; textGroup.labelTMP.text = part.partDisplayName + " (" + (textGroup.partList.index + 1).ToString() + "/" + textGroup.partList.parts.Count.ToString() + ")"; string[] partInfo = part.partReferenceName.Split('.'); textGroup.hoverHint.text = "Author : " + partInfo[0] + "\nPart Bundle : " + partInfo[1]; }
public static void UpdateMatLabelText(LabelTextGroup textGroup) { //update material display name and hover text MaterialInfo matInfo = textGroup.matList.mats[textGroup.matList.index]; textGroup.labelTMP.text = matInfo.materialDisplayName + " (" + (textGroup.matList.index + 1).ToString() + "/" + textGroup.matList.mats.Count.ToString() + ")"; string[] matRefNameData = matInfo.materialReferenceName.Split('.'); string ccText = "No"; if (matInfo.supportsCustomColors) { ccText = "Yes"; } textGroup.hoverHint.text = "Author : " + matRefNameData[0] + "\nPart Bundle : " + matRefNameData[1] + "\n\nUses Custom Colors : " + ccText; }
public static GameObject CreateMaterialSwapPanel(Transform parent, PartEditor.MatList matList, string panelLabel) { RectTransform newPanel = CreateRectPanel(parent, panelLabel); TextMeshProUGUI matNameText = BeatSaberUI.CreateText(newPanel, "mat name", new Vector2(20, 0), new Vector2(30, 10)); matNameText.alignment = TextAlignmentOptions.Center; matNameText.fontSize = 4; HoverHint matHoverHint = BeatSaberUI.AddHintText(matNameText.gameObject.GetComponent <RectTransform>(), "hint"); LabelTextGroup textGroup = new LabelTextGroup(matNameText, matHoverHint, matList); matTextGroups.Add(textGroup); //cry BeatSaberUI.CreateUIButton(newPanel, "DecButton", new Vector2(0, 0), new Vector2(8, 8), delegate { PartEditor.MoveThroughMatList(-1, matList); }); BeatSaberUI.CreateUIButton(newPanel, "IncButton", new Vector2(50, 0), new Vector2(8, 8), delegate { PartEditor.MoveThroughMatList(1, matList); }); //to set name and hint strings UpdateMatLabelText(textGroup); return(newPanel.gameObject); }
public static GameObject CreateModelSwapPanel(Transform parent, PartEditor.PartList partList, string panelLabel) { RectTransform newPanel = CreateRectPanel(parent, panelLabel); TextMeshProUGUI partNameText = BeatSaberUI.CreateText(newPanel, "part name", new Vector2(20, 0), new Vector2(30, 10)); partNameText.alignment = TextAlignmentOptions.Center; partNameText.fontSize = 4; HoverHint modelHoverHint = BeatSaberUI.AddHintText(partNameText.gameObject.GetComponent <RectTransform>(), "hint"); LabelTextGroup textGroup = new LabelTextGroup(partNameText, modelHoverHint, partList); partTextGroups.Add(textGroup); //cry delegate won't let me pass int as a ref, hence faff with index arrays BeatSaberUI.CreateUIButton(newPanel, "DecButton", new Vector2(0, 0), new Vector2(8, 8), delegate { PartEditor.MoveThroughPartList(-1, partList); }); BeatSaberUI.CreateUIButton(newPanel, "IncButton", new Vector2(50, 0), new Vector2(8, 8), delegate { PartEditor.MoveThroughPartList(1, partList); }); //to set name and hint strings UpdatePartLabelText(textGroup); return(newPanel.gameObject); }