private void Press() { UISystemProfilerApi.AddMarker("Button.onClick", this); Sharpness = GameObject.Find("HUD/SharpnessButton"); Lifesteal = GameObject.Find("HUD/LifestealButton"); Invoke("sup", 0f); }
protected virtual void Set(float input, float input2, bool sendCallback = true) { // Clamp the input float newValue = ClampValue(input); float newValue2 = ClampValue(input2); if (newValue2 - newValue < minGap) { newValue2 = ClampValue(input + minGap); } // If the stepped value doesn't match the last one, it's time to update if (m_Value == newValue && m_Value2 == newValue2) { return; } m_Value = newValue; m_Value2 = newValue2; UpdateVisuals(); if (sendCallback) { UISystemProfilerApi.AddMarker("Slider.value", this); m_OnValueChanged.Invoke(newValue, newValue2); } }
void Set(bool value, bool sendCallback) { if (m_IsOn == value) { return; } // if we are in a group and set to true, do group logic m_IsOn = value; if (m_Group != null && IsActive()) { if (m_IsOn || (!m_Group.AnyTogglesOn() && !m_Group.allowSwitchOff)) { m_IsOn = true; m_Group.NotifyToggleOn(this); } } // Always send event when toggle is clicked, even if value didn't change // due to already active toggle in a toggle group being clicked. // Controls like Dropdown rely on this. // It's up to the user to ignore a selection being set to the same value it already was, if desired. PlayEffect(toggleTransition == ToggleTransition.None); if (sendCallback) { UISystemProfilerApi.AddMarker("Toggle.value", this); onValueChanged.Invoke(m_IsOn); } }
void Set(float input, bool sendCallback) { //If our scrollbar is full size we don't have content to scroll if (size == 1) { return; } float currentValue = m_Value; // Clamp the input m_Value = Mathf.Clamp01(input); // If the stepped value doesn't match the last one, it's time to update if (currentValue == value) { return; } UpdateVisuals(); if (sendCallback) { UISystemProfilerApi.AddMarker("Scrollbar.value", this); m_OnValueChanged.Invoke(value); } }
protected virtual void LateUpdate() { if (!(bool)((UnityEngine.Object) this.m_Content)) { return; } this.EnsureLayoutHasRebuilt(); this.UpdateBounds(); float unscaledDeltaTime = Time.unscaledDeltaTime; Vector2 offset = this.CalculateOffset(Vector2.zero); if (!this.m_Dragging && (offset != Vector2.zero || this.m_Velocity != Vector2.zero)) { Vector2 anchoredPosition = this.m_Content.anchoredPosition; for (int index = 0; index < 2; ++index) { if (this.m_MovementType == CHScrollRect.MovementType.Elastic && (double)offset[index] != 0.0) { float currentVelocity = this.m_Velocity[index]; anchoredPosition[index] = Mathf.SmoothDamp(this.m_Content.anchoredPosition[index], this.m_Content.anchoredPosition[index] + offset[index], ref currentVelocity, this.m_Elasticity, float.PositiveInfinity, unscaledDeltaTime); if ((double)Mathf.Abs(currentVelocity) < 1.0) { currentVelocity = 0.0f; } this.m_Velocity[index] = currentVelocity; } else if (this.m_Inertia) { this.m_Velocity[index] *= Mathf.Pow(this.m_DecelerationRate, unscaledDeltaTime); if ((double)Mathf.Abs(this.m_Velocity[index]) < 1.0) { this.m_Velocity[index] = 0.0f; } anchoredPosition[index] += this.m_Velocity[index] * unscaledDeltaTime; } else { this.m_Velocity[index] = 0.0f; } } if (this.m_MovementType == CHScrollRect.MovementType.Clamped) { offset = this.CalculateOffset(anchoredPosition - this.m_Content.anchoredPosition); anchoredPosition += offset; } this.SetContentAnchoredPosition(anchoredPosition); } if (this.m_Dragging && this.m_Inertia) { this.m_Velocity = (Vector2)Vector3.Lerp((Vector3)this.m_Velocity, (Vector3)((this.m_Content.anchoredPosition - this.m_PrevPosition) / unscaledDeltaTime), unscaledDeltaTime * 10f); } if (this.m_ViewBounds != this.m_PrevViewBounds || this.m_ContentBounds != this.m_PrevContentBounds || this.m_Content.anchoredPosition != this.m_PrevPosition) { this.UpdateScrollbars(offset); UISystemProfilerApi.AddMarker("ScrollRect.value", (UnityEngine.Object) this); this.m_OnValueChanged.Invoke(this.normalizedPosition); this.UpdatePrevData(); } this.UpdateScrollbarVisibility(); }
protected override void OnDidApplyAnimationProperties() { // Has value changed? Various elements of the slider have the old normalisedValue assigned, we can use this to perform a comparison. // We also need to ensure the value stays within min/max. m_Value = ClampValue(m_Value); float oldNormalizedValue = normalizedValue; if (m_FillContainerRect != null) { if (m_FillImage != null && m_FillImage.type == Image.Type.Filled) { oldNormalizedValue = m_FillImage.fillAmount; } else { oldNormalizedValue = (reverseValue ? 1 - m_FillRect.anchorMin[(int)axis] : m_FillRect.anchorMax[(int)axis]); } } else if (m_HandleContainerRect != null) { oldNormalizedValue = (reverseValue ? 1 - m_HandleRect.anchorMin[(int)axis] : m_HandleRect.anchorMin[(int)axis]); } UpdateVisuals(); if (oldNormalizedValue != normalizedValue) { UISystemProfilerApi.AddMarker("Slider.value", this); onValueChanged.Invoke(m_Value); } }
protected override void OnDidApplyAnimationProperties() { this.m_Value = this.ClampValue(this.m_Value); float num = this.normalizedValue; if (this.m_FillContainerRect != null) { if (this.m_FillImage != null && this.m_FillImage.type == Image.Type.Filled) { num = this.m_FillImage.fillAmount; } else { num = ((!this.reverseValue) ? this.m_FillRect.anchorMax[(int)this.axis] : (1f - this.m_FillRect.anchorMin[(int)this.axis])); } } else if (this.m_HandleContainerRect != null) { num = ((!this.reverseValue) ? this.m_HandleRect.anchorMin[(int)this.axis] : (1f - this.m_HandleRect.anchorMin[(int)this.axis])); } this.UpdateVisuals(); if (num != this.normalizedValue) { UISystemProfilerApi.AddMarker("Slider.value", this); this.onValueChanged.Invoke(this.m_Value); } }
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(); }
void Update() { if (_down) { UISystemProfilerApi.AddMarker("Button.onDown", this); m_OnDown.Invoke(); } }
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); } }
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 PointerDown() { if (!IsActive() || !IsInteractable()) { return; } UISystemProfilerApi.AddMarker("Button.onPointerDown", this); m_OnPointerDown.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 ButtonRelease() { if (!IsActive() || !IsInteractable()) { return; } UISystemProfilerApi.AddMarker("Button.onRelease", this); m_OnRelease.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 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(); } }
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(); }
private void Press() { if (!IsActive() || !IsInteractable()) { return; } Debug.LogError("custom presss Runtime"); UISystemProfilerApi.AddMarker("Button.onClick", this); m_OnClick.Invoke(); }
private void Up() { if (!IsActive() || !IsInteractable()) { return; } _down = false; UISystemProfilerApi.AddMarker("Button.onUp", this); m_OnUp.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 UpdateCull(bool cull) { var cullingChanged = canvasRenderer.cull != cull; canvasRenderer.cull = cull; if (cullingChanged) { UISystemProfilerApi.AddMarker("MaskableGraphic.cullingChanged", this); m_OnCullStateChanged.Invoke(cull); SetVerticesDirty(); } }
protected override void OnDisable() { base.OnDisable(); #if UNITY_EDITOR Subscribe(false); #endif DisableEventHandler disable = DisableEvent; if (disable != null) { UISystemProfilerApi.AddMarker("UIElement.onDisable", this); disable(); } }