protected override void OnValidate() { base.OnValidate(); Set(m_IsOn, false); PlayEffect(toggleTransition == ToggleTransition.None); #if UNITY_2018_3_OR_NEWER if (!Application.isPlaying) #else var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) #endif { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
private static void MarkLayoutRootForRebuild(RectTransform controller) { if (controller == null) { return; } var rebuilder = s_Rebuilders.Get(); rebuilder.Initialize(controller); if (!CanvasUpdateRegistry.TryRegisterCanvasElementForLayoutRebuild(rebuilder)) { s_Rebuilders.Release(rebuilder); } }
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 OnDestroy() { #if UNITY_EDITOR GraphicRebuildTracker.UnTrackGraphic(this); #endif GraphicRegistry.UnregisterGraphicForCanvas(canvas, this); CanvasUpdateRegistry.UnRegisterCanvasElementForRebuild(this); if (m_CachedMesh) { Destroy(m_CachedMesh); } m_CachedMesh = null; base.OnDestroy(); }
private static void MarkLayoutRootForRebuild(RectTransform controller) { if ((UnityEngine.Object)controller == (UnityEngine.Object)null) { return; } LayoutRebuilder element = LayoutRebuilder.s_Rebuilders.Get(); element.Initialize(controller); if (CanvasUpdateRegistry.TryRegisterCanvasElementForLayoutRebuild((ICanvasElement)element)) { return; } LayoutRebuilder.s_Rebuilders.Release(element); }
protected override void OnRectTransformDimensionsChange() { if (base.gameObject.activeInHierarchy) { if (CanvasUpdateRegistry.IsRebuildingLayout()) { this.SetVerticesDirty(); } else { this.SetVerticesDirty(); this.SetLayoutDirty(); } } }
public virtual void SetMaterialDirty() { if (!IsActive()) { return; } m_MaterialDirty = true; CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); if (m_OnDirtyMaterialCallback != null) { m_OnDirtyMaterialCallback(); } }
/// <summary> /// Clear references. /// </summary> protected override void OnDisable() { #if UNITY_EDITOR GraphicRebuildTracker.UnTrackGraphic(this); #endif GraphicRegistry.UnregisterGraphicForCanvas(canvas, this); CanvasUpdateRegistry.UnRegisterCanvasElementForRebuild(this); if (canvasRenderer != null) { canvasRenderer.Clear(); } LayoutRebuilder.MarkLayoutForRebuild(rectTransform); base.OnDisable(); }
protected override void OnRectTransformDimensionsChange() { if (gameObject.activeInHierarchy) { // prevent double dirtying... if (CanvasUpdateRegistry.IsRebuildingLayout()) { SetVerticesDirty(); } else { SetVerticesDirty(); SetLayoutDirty(); } } }
protected override void OnValidate() { base.OnValidate(); this.m_Size = Mathf.Clamp01(this.m_Size); if (this.IsActive()) { this.UpdateCachedReferences(); this.Set(this.m_Value, false); this.UpdateVisuals(); } if (PrefabUtility.GetPrefabType((UnityEngine.Object) this) == PrefabType.Prefab || Application.isPlaying) { return; } CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild((ICanvasElement)this); }
protected override void OnDisable() { CanvasUpdateRegistry.UnRegisterCanvasElementForRebuild(this); if (m_HorizontalScrollbar) { m_HorizontalScrollbar.onValueChanged.RemoveListener(SetHorizontalNormalizedPosition); } if (m_VerticalScrollbar) { m_VerticalScrollbar.onValueChanged.RemoveListener(SetVerticalNormalizedPosition); } m_HasRebuiltLayout = false; base.OnDisable(); }
protected override void OnValidate() { base.OnValidate(); Set(m_IsOn, false); PlayEffect(toggleTransition == ToggleTransition.None); #pragma warning disable CS0618 // Type or member is obsolete var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); #pragma warning restore CS0618 // Type or member is obsolete #pragma warning disable CS0618 // Type or member is obsolete if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) #pragma warning restore CS0618 // Type or member is obsolete { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected void SetDirty() { if (!IsActive()) { return; } if (!CanvasUpdateRegistry.IsRebuildingLayout()) { LayoutRebuilder.MarkLayoutForRebuild(rectTransform); } else { StartCoroutine(DelayedSetDirty(rectTransform)); } }
/// <summary> /// Mark the vertices as dirty and needing rebuilt. /// </summary> /// <remarks> /// Send a OnDirtyVertsCallback notification if any elements are registered. See RegisterDirtyVerticesCallback /// </remarks> public virtual void SetVerticesDirty() { if (!IsActive()) { return; } m_VertsDirty = true; //加入待渲染队列 CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); if (m_OnDirtyVertsCallback != null) { m_OnDirtyVertsCallback(); } }
protected override void OnValidate() { base.OnValidate(); size = size; UpdateCachedReferences(); Set(m_Value, false); // Update rects since other things might affect them even if value didn't change. UpdateVisuals(); var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnDisable() { CanvasUpdateRegistry.UnRegisterCanvasElementForRebuild(this); if (this.m_HorizontalScrollbar) { this.m_HorizontalScrollbar.onValueChanged.RemoveListener(new UnityAction <float>(this.SetHorizontalNormalizedPosition)); } if (this.m_VerticalScrollbar) { this.m_VerticalScrollbar.onValueChanged.RemoveListener(new UnityAction <float>(this.SetVerticalNormalizedPosition)); } this.m_HasRebuiltLayout = false; this.m_Tracker.Clear(); this.m_Velocity = Vector2.zero; LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform); base.OnDisable(); }
protected override void OnValidate() { base.OnValidate(); this.m_Size = Mathf.Clamp01(this.m_Size); if (this.IsActive()) { this.UpdateCachedReferences(); this.Set(this.m_Value, false); this.UpdateVisuals(); } PrefabType prefabType = PrefabUtility.GetPrefabType(this); if (prefabType != PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnValidate() { base.OnValidate(); Set(m_IsOn, false); if (!IsActive()) { return; } PlayEffect(toggleTransition == Ease.None); var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
/// <summary> /// <para>Called by the [FontUpdateTracker] when the texture associated with a font is modified.</para> /// </summary> public void FontTextureChanged() { if ((this != null) && !this.m_DisableFontTextureRebuiltCallback) { this.cachedTextGenerator.Invalidate(); if (this.IsActive()) { if (CanvasUpdateRegistry.IsRebuildingGraphics() || CanvasUpdateRegistry.IsRebuildingLayout()) { this.UpdateGeometry(); } else { this.SetAllDirty(); } } } }
protected override void OnValidate() { base.OnValidate(); if (wholeNumbers) { m_MinValue = Mathf.Round(m_MinValue); m_MaxValue = Mathf.Round(m_MaxValue); } UpdateCachedReferences(); var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
public void FontTextureChanged() { if (!this || m_DisableFontTextureRebuiltCallback) { return; } cachedTextGenerator.Invalidate(); if (IsActive()) { if (CanvasUpdateRegistry.IsRebuildingGraphics() || CanvasUpdateRegistry.IsRebuildingLayout()) { UpdateGeometry(); } else { SetAllDirty(); } } }
protected override void OnValidate() { base.OnValidate(); if (this.wholeNumbers) { this.m_MinValue = Mathf.Round(this.m_MinValue); this.m_MaxValue = Mathf.Round(this.m_MaxValue); } if (this.IsActive()) { this.UpdateCachedReferences(); this.Set(this.m_Value, false); this.UpdateVisuals(); } if ((PrefabUtility.GetPrefabType(this) != 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(); } if (!UnityEditor.PrefabUtility.IsPartOfPrefabAsset(this) && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnDisable() { CanvasUpdateRegistry.UnRegisterCanvasElementForRebuild(this); if (m_HorizontalScrollbar) { m_HorizontalScrollbar.onValueChanged.RemoveListener(SetHorizontalNormalizedPosition); } if (m_VerticalScrollbar) { m_VerticalScrollbar.onValueChanged.RemoveListener(SetVerticalNormalizedPosition); } m_Dragging = false; m_Scrolling = false; m_HasRebuiltLayout = false; m_Tracker.Clear(); m_Velocity = Vector2.zero; LayoutRebuilder.MarkLayoutForRebuild(rectTransform); base.OnDisable(); }
/// <summary> /// 标记根节点重新布局 /// </summary> /// <param name="controller"></param> private static void MarkLayoutRootForRebuild(RectTransform controller) { if (controller == null) { return; } var rebuilder = s_Rebuilders.Get(); rebuilder.Initialize(controller); //如果注册rebuild队列中已经包含了这个gameobject,就直接进行释放回收 //不包含的话,就注册进去,暂时不回收 // 19/5 2020 Image 源码学习 //这里注册的到rebuild队列的对象类型为继承自ICanvasElement的LayoutRebuilder //主要是受s_rebuilders的影响,这样在CanvasUpdateRegistry中进行layoutRebuid的时候调用的就是LayoutRebuilder重写的rebuild方法了 //TryRegisterCanvasElementForLayoutRebuild这个方法使用了多态的概念 if (!CanvasUpdateRegistry.TryRegisterCanvasElementForLayoutRebuild(rebuilder)) { s_Rebuilders.Release(rebuilder); } }
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(); var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected virtual void OnDisable() { if (Application.isQuitting != null) { return; } CanvasUpdateRegistry.UnRegisterCanvasElementForRebuild((ICanvasElement)this); if (Object.op_Implicit((Object)this.m_HorizontalScrollbar)) { // ISSUE: method pointer ((UnityEvent <float>) this.m_HorizontalScrollbar.get_onValueChanged()).RemoveListener(new UnityAction <float>((object)this, __methodptr(SetHorizontalNormalizedPosition))); } if (Object.op_Implicit((Object)this.m_VerticalScrollbar)) { // ISSUE: method pointer ((UnityEvent <float>) this.m_VerticalScrollbar.get_onValueChanged()).RemoveListener(new UnityAction <float>((object)this, __methodptr(SetVerticalNormalizedPosition))); } this.m_HasRebuiltLayout = false; ((DrivenRectTransformTracker) ref this.m_Tracker).Clear(); LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform); base.OnDisable(); }
protected override void OnValidate() { base.OnValidate(); if (wholeNumbers) { m_MinValue = Mathf.Round(m_MinValue); m_MaxValue = Mathf.Round(m_MaxValue); } //Onvalidate is called before OnEnabled. We need to make sure not to touch any other objects before OnEnable is run. if (IsActive()) { UpdateCachedReferences(); Set(m_Value, false); // Update rects since other things might affect them even if value didn't change. UpdateVisuals(); } if (Application.isPlaying) { return; } #if UNITY_2018_3_OR_NEWER var prefabType = UnityEditor.PrefabUtility.GetPrefabAssetType(this); if (prefabType == UnityEditor.PrefabAssetType.Regular) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } #else var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } #endif }
protected override void OnValidate() { base.OnValidate(); if (wholeNumbers) { m_MinValue = Mathf.Round(m_MinValue); m_MaxValue = Mathf.Round(m_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. m_DelayedUpdateVisuals = true; } if (!UnityEditor.PrefabUtility.IsPartOfPrefabAsset(this) && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
// Token: 0x06002971 RID: 10609 RVA: 0x00459518 File Offset: 0x00457718 protected override void OnEnable() { base.OnEnable(); if (this.m_HorizontalScrollbar) { this.m_HorizontalScrollbar.onValueChanged.AddListener(new UnityAction <float>(this.SetHorizontalNormalizedPosition)); } if (this.m_VerticalScrollbar) { this.m_VerticalScrollbar.onValueChanged.AddListener(new UnityAction <float>(this.SetVerticalNormalizedPosition)); } CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); if (this.bPageMoving) { this.setCurrentIndex(this.NowPageIndex, true); if (this.m_PageMoveHandler != null) { this.m_PageMoveHandler.EndPageMove(); } this.MoveEndX = -1f; this.bPageMoving = false; } }