protected override void OnValidate() { base.OnValidate(); if (!UnityEditor.PrefabUtility.IsPartOfPrefabAsset(this) && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
public override void OnShowBegin(System.Action callback, bool resetAnimation = true) { this.isAlive = true; CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); this.SetComponentState(WindowObjectState.Showing); ME.Utilities.CallInSequence(() => base.OnShowBegin(callback, resetAnimation), this.subComponents, (e, c) => e.OnShowBegin(c, resetAnimation)); }
/// <summary> /// <para>Override to alter or add to the code that caches data to avoid repeated heavy operations.</para> /// </summary> protected void SetDirtyCaching() { if (!this.IsActive()) { return; } CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild((ICanvasElement)this); LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform); }
private new void SetDirty() { base.SetDirty(); if (!IsActive()) { return; } CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); }
/// <summary> /// Override to alter or add to the code that caches data to avoid repeated heavy operations. /// </summary> protected void SetDirtyCaching() { if (!IsActive()) { return; } CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); LayoutRebuilder.MarkLayoutForRebuild(rectTransform); m_ViewRect = null; }
public virtual void OnShowBegin(System.Action callback, bool resetAnimation = true) { this.isAlive = true; CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); //this.OnShowBeginEvent(); if (callback != null) { callback(); } }
protected override void OnValidate() { base.OnValidate(); ChangeGraphicalState(isOn); var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnValidate() { base.OnValidate(); Set(m_IsOn, false); //PlayEffect(toggleTransition == ToggleTransition.None); var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnEnable() { base.OnEnable(); if ((bool)((UnityEngine.Object) this.m_HorizontalScrollbar)) { this.m_HorizontalScrollbar.onValueChanged.AddListener(new UnityAction <float>(this.SetHorizontalNormalizedPosition)); } if ((bool)((UnityEngine.Object) this.m_VerticalScrollbar)) { this.m_VerticalScrollbar.onValueChanged.AddListener(new UnityAction <float>(this.SetVerticalNormalizedPosition)); } CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild((ICanvasElement)this); }
protected override void OnEnable() { base.OnEnable(); if (m_HorizontalScrollbar) { m_HorizontalScrollbar.onValueChanged.AddListener(SetHorizontalNormalizedPosition); } if (m_VerticalScrollbar) { m_VerticalScrollbar.onValueChanged.AddListener(SetVerticalNormalizedPosition); } CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); }
protected override void OnValidate() { base.OnValidate(); if (IsActive()) { UpdateVisuals(); } var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
public void SetDirty() { if (!IsActive()) { return; } if (CanvasUpdateRegistry.IsRebuildingLayout()) { StartCoroutine(DelayedSetDirty(rectTransform)); } else { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); LayoutRebuilder.MarkLayoutForRebuild(rectTransform); } }
protected override void OnValidate() { base.OnValidate(); Set(m_IsOn, false); PlayEffect(); if ((PrefabUtility.GetPrefabType(this) != PrefabType.Prefab) && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } if (animationDuration < 0) { animationDuration = 0; } }
protected override void OnValidate() { base.OnValidate(); //Onvalidate is called before OnEnabled. We need to make sure not to touch any other objects before OnEnable is run. if (IsActive()) { Title = _title; Set(QualitySettings.GetQualityLevel()); } var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
public static int RegisterCanvasElementForLayoutRebuild_s(IntPtr l) { int result; try { ICanvasElement element; LuaObject.checkType <ICanvasElement>(l, 1, out element); CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(element); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
protected override void OnValidate() { base.OnValidate(); if (Application.isPlaying && IsActive()) { UpdateSliders(); } _layoutTransform = _layoutGroup.GetComponent <RectTransform>(); var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
void ResetContentSize() { float sizeX, sizeY; if (IsVertical) { sizeX = _scroll.viewport.rect.width; sizeY = _colCellCount * (itemSize.y + itemSpace.y) - itemSpace.y + Padding.top + Padding.bottom; } else { sizeX = _rowCellCount * (itemSize.x + itemSpace.x) - itemSpace.x + Padding.right + Padding.left; sizeY = _scroll.viewport.rect.height; } //_scroll.content.localPosition = Vector3.zero; _scroll.content.sizeDelta = new Vector2(sizeX, sizeY); CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(_scroll); }
protected override void OnValidate() { base.OnValidate(); Set(_value, false); if (_buttonType == Type.Push) { Set(false, false); } UpdateMarker(_graphicTransition == ButtonTransition.None); var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnValidate() { base.OnValidate(); m_Size = Mathf.Clamp01(m_Size); //This can be invoked before OnEnabled is called. So we shouldn't be accessing other objects, before OnEnable is called. if (IsActive()) { UpdateCachedReferences(); Set(m_Value, false); // Update rects since other things might affect them even if value didn't change. UpdateVisuals(); } UnityEditor.PrefabType prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnValidate() { base.OnValidate(); if (WholeNumbers) { m_MinValue = Mathf.Round(m_MinValue); m_MaxValue = Mathf.Round(m_MaxValue); } UpdateCachedReferences(); SetX(m_ValueX, false); SetY(m_ValueY, false); // Update rects since other things might affect them even if value didn't change. UpdateVisuals(); UnityEditor.PrefabAssetType prefabType = UnityEditor.PrefabUtility.GetPrefabAssetType(this); if (prefabType != UnityEditor.PrefabAssetType.Regular && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnValidate() { base.OnValidate(); Set(m_IsOn, false); PlayEffect(); #if UNITY_2018_3_OR_NEWER bool isNotPrefab = PrefabUtility.GetPrefabAssetType(this) != PrefabAssetType.Regular; #else bool isNotPrefab = PrefabUtility.GetPrefabType(this) != PrefabType.Prefab; #endif if (isNotPrefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } if (animationDuration < 0) { animationDuration = 0; } }
protected override void OnValidate() { base.OnValidate(); if (WholeNumbers) { _minValue = Mathf.Round(_minValue); _maxValue = Mathf.Round(_maxValue); } //Onvalidate is called before OnEnabled. We need to make sure not to touch any other objects before OnEnable is run. if (IsActive()) { UpdateCachedReferences(); UpdateValue(_value, false); _delayedUpdateVisuals = true; } if (!UnityEditor.PrefabUtility.IsComponentAddedToPrefabInstance(this) && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnValidate() { base.OnValidate(); if (WholeNumbers) { m_MinValue = Mathf.Round(m_MinValue); m_MaxValue = Mathf.Round(m_MaxValue); } if (IsActive()) { UpdateCachedReferences(); SetLow(m_LowValue, false); SetHigh(m_HighValue, false); //Update rects since other things might affect them even if value didn't change m_DelayedUpdateVisuals = true; } if (!UnityEditor.PrefabUtility.IsPartOfPrefabAsset(this) && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnValidate() { base.OnValidate(); if (WholeNumbers) { _minValue = Mathf.Round(_minValue); _maxValue = Mathf.Round(_maxValue); } //Onvalidate is called before OnEnabled. We need to make sure not to touch any other objects before OnEnable is run. if (IsActive()) { UpdateCachedReferences(); // Update rects in next update since other things might affect them even if value didn't change. _delayedUpdateVisuals = true; Set(_value, false); } if (!UnityEditor.PrefabUtility.IsPartOfPrefabAsset(this) && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnEnable() { base.OnEnable(); if (m_Content == null) { throw new Exception("please pointed to the content panel"); } if (layout == null) layout = m_Content.GetComponentInParent<GridLayoutGroup>(); if (layout.constraint == GridLayoutGroup.Constraint.Flexible) { throw new Exception("currently can not support flexible with dynamic list"); } if (m_HorizontalScrollbar) m_HorizontalScrollbar.onValueChanged.AddListener(SetHorizontalNormalizedPosition); if (m_VerticalScrollbar) m_VerticalScrollbar.onValueChanged.AddListener(SetVerticalNormalizedPosition); CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); }
protected override void OnValidate() { base.OnValidate(); if (WholeNumbers) { _minValue = RoundValue(_minValue); _maxValue = RoundValue(_maxValue); } if (_resetValueTime < 0) { _resetValueTime = 0; } if (IsActive()) { UpdateCachedReferences(); Set(_value, false); UpdateVisuals(); } #if UNITY_2018_3_OR_NEWER var assetType = UnityEditor.PrefabUtility.GetPrefabAssetType(this); if (assetType == UnityEditor.PrefabAssetType.NotAPrefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } #else var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } #endif }
protected override void OnValidate() { base.OnValidate(); if (WholeNumbers) { _minValue = RoundValue(_minValue); _maxValue = RoundValue(_maxValue); } if (IsActive()) { UpdateCachedReferences(); Set(_value, false); UpdateVisuals(); } var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnEnable() { base.OnEnable(); m_IsEnable = true; CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); }
private void OnScrollRectValueChanged(Vector2 d) { //Debug.Log("[SRConsole] ScrollRect value changed"); CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); }
protected virtual void Update() { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); }