protected virtual void LateUpdate() { if (!m_Content) { return; } EnsureLayoutHasRebuilt(); UpdateBounds(); float deltaTime = Time.unscaledDeltaTime; Vector2 offset = CalculateOffset(Vector2.zero); if (offset != Vector2.zero || m_Velocity != Vector2.zero) { Vector2 position = m_Content.anchoredPosition; for (int axis = 0; axis < 2; axis++) { if (m_Inertia) { m_Velocity[axis] *= Mathf.Pow(m_DecelerationRate, deltaTime); if (Mathf.Abs(m_Velocity[axis]) < 1) { m_Velocity[axis] = 0; } position[axis] += m_Velocity[axis] * deltaTime; } // If we have neither elaticity or friction, there shouldn't be any velocity. else { m_Velocity[axis] = 0; } } if (m_MovementType == MovementType.Clamped) { offset = CalculateOffset(position - m_Content.anchoredPosition); position += offset; } SetContentAnchoredPosition(position); } if (m_Inertia) { Vector3 newVelocity = (m_Content.anchoredPosition - m_PrevPosition) / deltaTime; m_Velocity = Vector3.Lerp(m_Velocity, newVelocity, deltaTime * 10); } if (m_ViewBounds != m_PrevViewBounds || m_ContentBounds != m_PrevContentBounds || m_Content.anchoredPosition != m_PrevPosition) { UISystemProfilerApi.AddMarker("ScrollRect.value", this); m_OnValueChanged.Invoke(normalizedPosition); UpdatePrevData(); } //Moved "UpdateScrollbars" out of the if condition above to fix broken toolbar update UpdateScrollbars(offset); UpdateScrollbarVisibility(); }
private void Press() { if (this.IsActive() && this.IsInteractable()) { UISystemProfilerApi.AddMarker("Button.onClick", this); this.m_OnClick.Invoke(); } }
protected virtual void SendOnValueChanged() { UISystemProfilerApi.AddMarker("InputField.value", this); if (onValueChanged != null) { onValueChanged.Invoke(text); } }
void Update() { if (_down) { UISystemProfilerApi.AddMarker("Button.onDown", this); m_OnDown.Invoke(); } }
private void PerformUpdate() { UISystemProfilerApi.BeginSample(UISystemProfilerApi.SampleType.Layout); this.CleanInvalidItems(); this.m_PerformingLayoutUpdate = true; this.m_LayoutRebuildQueue.Sort(CanvasUpdateRegistry.s_SortLayoutFunction); for (int i = 0; i <= 2; i++) { for (int j = 0; j < this.m_LayoutRebuildQueue.Count; j++) { ICanvasElement canvasElement = CanvasUpdateRegistry.instance.m_LayoutRebuildQueue[j]; try { if (this.ObjectValidForUpdate(canvasElement)) { canvasElement.Rebuild((CanvasUpdate)i); } } catch (Exception exception) { Debug.LogException(exception, canvasElement.transform); } } } for (int k = 0; k < this.m_LayoutRebuildQueue.Count; k++) { this.m_LayoutRebuildQueue[k].LayoutComplete(); } CanvasUpdateRegistry.instance.m_LayoutRebuildQueue.Clear(); this.m_PerformingLayoutUpdate = false; ClipperRegistry.instance.Cull(); this.m_PerformingGraphicUpdate = true; for (int l = 3; l < 5; l++) { for (int m = 0; m < CanvasUpdateRegistry.instance.m_GraphicRebuildQueue.Count; m++) { try { ICanvasElement canvasElement2 = CanvasUpdateRegistry.instance.m_GraphicRebuildQueue[m]; if (this.ObjectValidForUpdate(canvasElement2)) { canvasElement2.Rebuild((CanvasUpdate)l); } } catch (Exception exception2) { Debug.LogException(exception2, CanvasUpdateRegistry.instance.m_GraphicRebuildQueue[m].transform); } } } for (int n = 0; n < this.m_GraphicRebuildQueue.Count; n++) { this.m_GraphicRebuildQueue[n].GraphicUpdateComplete(); } CanvasUpdateRegistry.instance.m_GraphicRebuildQueue.Clear(); this.m_PerformingGraphicUpdate = false; UISystemProfilerApi.EndSample(UISystemProfilerApi.SampleType.Layout); }
private void Press() { if (!IsActive() || !IsInteractable()) { return; } UISystemProfilerApi.AddMarker("Button.onClick", this); m_OnClick.Invoke(); }
private void UpdateCull(bool cull) { if (canvasRenderer.cull != cull) { canvasRenderer.cull = cull; UISystemProfilerApi.AddMarker("MaskableGraphic.cullingChanged", this); graphic.OnCullingChanged(); } }
private void Cancel() { if (!IsActive() || !IsInteractable()) { return; } UISystemProfilerApi.AddMarker("Button.onCancel", this); m_OnCancel.Invoke(); }
private void ButtonExit() { if (!IsActive() || !IsInteractable()) { return; } Debug.Log("exit"); UISystemProfilerApi.AddMarker("Button.onExit", this); m_OnRelease.Invoke(); }
private void ButtonRelease() { if (!IsActive() || !IsInteractable()) { return; } UISystemProfilerApi.AddMarker("Button.onRelease", this); m_OnRelease.Invoke(); }
private void Press() { Debug.LogFormat("Button was pressed."); if (!IsActive() || !IsInteractable()) { return; } UISystemProfilerApi.AddMarker("TargetButton.onClick", this); chooseTargetEvent.Invoke(); // Attacks the target chosen by UIManager }
private void PointerDown() { if (!IsActive() || !IsInteractable()) { return; } UISystemProfilerApi.AddMarker("Button.onPointerDown", this); m_OnPointerDown.Invoke(); }
private void UpdateCull(bool cull) { if (base.canvasRenderer.cull != cull) { base.canvasRenderer.cull = cull; UISystemProfilerApi.AddMarker("MaskableGraphic.cullingChanged", this); this.m_OnCullStateChanged.Invoke(cull); this.OnCullingChanged(); } }
public override void OnDeselect(BaseEventData eventData) { base.OnDeselect(eventData); DeselectEventHandler deselect = DeselectEvent; if (deselect != null) { UISystemProfilerApi.AddMarker("UIElement.onDeselect", this); deselect(); } }
protected override void OnEnable() { base.OnEnable(); EnableEventHandler enable = EnableEvent; if (enable != null) { UISystemProfilerApi.AddMarker("UIElement.onEnable", this); enable(); } }
private void UpdateCull(bool cull) { if (canvasRenderer.cull != cull) { canvasRenderer.cull = cull; // TODO ²»¶® UISystemProfilerApi.AddMarker("MaskableGraphic.cullingChanged", this); m_OnCullStateChanged.Invoke(cull); OnCullingChanged(); } }
private void Set(bool value, bool sendCallback = true) { isExpanded = value; PlayEffect(fadeTime <= 0); if (sendCallback) { UISystemProfilerApi.AddMarker("TreeItemExpander.value", this); onValueChanged?.Invoke(isExpanded); } UpdateState(); }
public override void OnPointerExit(PointerEventData eventData) { base.OnPointerExit(eventData); MouseLeaveEventHandler mouseLeave = MouseLeaveEvent; if (mouseLeave != null) { UISystemProfilerApi.AddMarker("UIElement.onMouseLeave", this); mouseLeave(); } }
public override void OnPointerEnter(PointerEventData eventData) { base.OnPointerEnter(eventData); MouseEnterEventHandler mouseEnter = MouseEnterEvent; if (mouseEnter != null) { UISystemProfilerApi.AddMarker("UIElement.onMouseEnter", this); mouseEnter(); } }
private void Press() { if (!IsActive() || !IsInteractable()) { return; } Debug.LogError("custom presss Runtime"); UISystemProfilerApi.AddMarker("Button.onClick", this); m_OnClick.Invoke(); }
private void UpdateCull(bool cull) { bool flag = base.canvasRenderer.cull != cull; base.canvasRenderer.cull = cull; if (flag) { UISystemProfilerApi.AddMarker("MaskableGraphic.cullingChanged", this); this.m_OnCullStateChanged.Invoke(cull); this.SetVerticesDirty(); } }
private void Up() { if (!IsActive() || !IsInteractable()) { return; } _down = false; UISystemProfilerApi.AddMarker("Button.onUp", this); m_OnUp.Invoke(); }
protected override void OnDisable() { base.OnDisable(); #if UNITY_EDITOR Subscribe(false); #endif DisableEventHandler disable = DisableEvent; if (disable != null) { UISystemProfilerApi.AddMarker("UIElement.onDisable", this); disable(); } }
private void Press() { if (IsActive() && IsInteractable()) { UISystemProfilerApi.AddMarker("TextToggleButton.OnClick", this); if (texts.Length > 1) { int newTextIndex = (currentTextIndex + 1) % texts.Length; ChangeText(newTextIndex); } this.OnClick.Invoke(CurrentText.text); } }
private void UpdateCull(bool cull) { var cullingChanged = canvasRenderer.cull != cull; canvasRenderer.cull = cull; if (cullingChanged) { UISystemProfilerApi.AddMarker("MaskableGraphic.cullingChanged", this); m_OnCullStateChanged.Invoke(cull); SetVerticesDirty(); } }
public override void OnPointerClick(PointerEventData eventData) { if (eventData.button != PointerEventData.InputButton.Left) { return; } if (_holdActionOngoing || !IsActive() || !IsInteractable()) { return; } UISystemProfilerApi.AddMarker("Button.onClick", this); onClick.Invoke(); }
public override void OnPointerUp(PointerEventData eventData) { if (eventData.button != PointerEventData.InputButton.Left) { return; } if (!IsActive() || !IsInteractable()) { return; } UISystemProfilerApi.AddMarker("Button.onUp", this); onUp.Invoke(); }
protected virtual void Set(float input, bool sendCallback) { float num = this.ClampValue(input); if (this.m_Value != num) { this.m_Value = num; this.UpdateVisuals(); if (sendCallback) { UISystemProfilerApi.AddMarker("Slider.value", this); this.m_OnValueChanged.Invoke(num); } } }
private void Set(float input, bool sendCallback) { float value = this.m_Value; this.m_Value = Mathf.Clamp01(input); if (value != this.value) { this.UpdateVisuals(); if (sendCallback) { UISystemProfilerApi.AddMarker("Scrollbar.value", this); this.m_OnValueChanged.Invoke(this.value); } } }
protected virtual void OnPointerClick(PointerEventData eventData) { if (eventData.button != PointerEventData.InputButton.Left) { return; } ClickEventHandler click = ClickEvent; if (click != null) { UISystemProfilerApi.AddMarker("UIElement.onClick", this); click(); } }