static bool messagePatch(ErrorMessage __instance, string messageText) { if (messageText.isNullOrEmpty() || messageText[0] != '[') { return(true); } int prefixEnd = messageText.IndexOf(']'); if (prefixEnd > 0) { string prefix = messageText.Substring(0, prefixEnd + 1); var msg = __instance.messages.Find(m => m.messageText.StartsWith(prefix)); if (msg != null) { msg.timeEnd = Time.time + __instance.timeFadeOut + __instance.timeDelay; text.set(messageEntry.GetValue(msg), messageText); return(false); } } return(true); }
protected override void UpdateLabel() { _slider ??= this.getFieldValue("slider"); _label ??= this.getFieldValue("label"); float res = (sliderValue.get <float>(_slider) - min) / (max - min); text.set(_label, "{0:P0}".format(res)); }
// recreates all ui controls in the options panel // keeps selected tab and scroll position public static void resetPanel() { if (!optionsPanel || !optionsPanel.enabled || optionsPanel.tabs.Count == 0) { return; } int currentTab = optionsPanel.currentTab; Debug.assert(currentTab < optionsPanel.tabs.Count); Component _getScroll() => optionsPanel.tabs[currentTab].pane.GetComponent(typeScrollRect); var scroll = _getScroll(); float scrollPos = propScrollPos.get <float>(scroll); optionsPanel.enabled = false; // all work is done by OnDisable() and OnEnable() optionsPanel.enabled = true; optionsPanel.SetVisibleTab(currentTab); scroll = _getScroll(); // new objects and components propScrollPos.set(scroll, scrollPos); }
public override void onGameObjectChange(UnityEngine.GameObject go) { raycastTarget.set(go.getChild("Slider/Caption").GetComponent(textMeshProUGUI), true); base.onGameObjectChange(go); }