public virtual void AddSelectButton(UISelectButton select) { if (select == null) { return; } if (select.m_LeftArrow == null || select.m_RightArrow == null) { return; } Transform transform = select.transform.FindDeepChild("Title"); if (!transform) { DebugUtils.Assert(transform, "Slider object is missing 'Title'!", true, DebugUtils.AssertType.Info); return; } Transform transform2 = select.transform.FindDeepChild("Text"); if (!transform2) { DebugUtils.Assert(transform2, "Slider object is missing 'Text' option field!", true, DebugUtils.AssertType.Info); return; } if (!this.m_OptionsObjects.Values.Any((MenuBase.MenuOptionData d) => d.m_SelectButton == select)) { Text componentInChildren = transform.GetComponentInChildren <Text>(); Text componentInChildren2 = transform2.GetComponentInChildren <Text>(); RectTransform rectTransform = select.GetComponent <RectTransform>() ?? transform.GetComponent <RectTransform>(); this.m_OptionsObjects.Add(select.transform.gameObject, new MenuBase.MenuOptionData { m_SelectButton = select, m_Object = select.gameObject, m_Texts = new Text[] { componentInChildren, componentInChildren2 }, m_ExtentRectTransforms = new RectTransform[] { rectTransform, componentInChildren2.GetComponent <RectTransform>(), select.m_LeftArrow.GetComponent <RectTransform>(), select.m_RightArrow.GetComponent <RectTransform>() }, m_InteractRectTransforms = new RectTransform[] { select.m_LeftArrow.GetComponent <RectTransform>(), select.m_RightArrow.GetComponent <RectTransform>() } }); } }
private void UpdateButton(UISelectButton button) { RectTransform component = button.GetComponent <RectTransform>(); if (RectTransformUtility.RectangleContainsScreenPoint(component, Input.mousePosition)) { this.m_ActiveButton = button.gameObject; } component = button.m_Title.GetComponent <RectTransform>(); Vector3 localPosition = component.localPosition; float num = (!(this.m_ActiveButton == button.gameObject)) ? this.m_ButtonTextStartX : this.m_SelectedButtonX; float num2 = Mathf.Ceil(num - localPosition.x) * Time.unscaledDeltaTime * 10f; localPosition.x += num2; component.localPosition = localPosition; if (this.m_ActiveButton == button.gameObject) { Color color = button.GetColor(); color.a = 1f; button.SetColor(color); } }