public override void SetVerticesDirty() { //Debug.Log("SetVerticesDirty() on Object ID: " + this.GetInstanceID()); if (m_verticesAlreadyDirty || this == null || !this.IsActive() || CanvasUpdateRegistry.IsRebuildingGraphics()) { return; } m_verticesAlreadyDirty = true; CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild((ICanvasElement)this); }
/// <summary> /// /// </summary> public override void SetMaterialDirty() { //Debug.Log("SetMaterialDirty()"); if (!this.IsActive()) { return; } m_isMaterialDirty = true; CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild((ICanvasElement)this); }
/// <summary> /// Delay registration of text object for graphic rebuild by one frame. /// </summary> /// <returns></returns> IEnumerator DelayedMaterialRebuild() { yield return(null); m_isMaterialDirty = true; CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); if (m_OnDirtyMaterialCallback != null) { m_OnDirtyMaterialCallback(); } }
public void MarkGeometryAsDirty() { #if UNITY_EDITOR if (!Application.isPlaying || UnityEditor.PrefabUtility.GetPrefabObject(gameObject) != null) { return; } #endif // request update graphic by adding this ICanvasElement to CanvasUpdateRegistry's graphic rebuilding queue. // Rebuild() will be called on next canvas update. CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); }
/// <summary> /// Delay registration of text object for graphic rebuild by one frame. /// </summary> /// <returns></returns> IEnumerator DelayedGraphicRebuild() { yield return(null); CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); if (m_OnDirtyVertsCallback != null) { m_OnDirtyVertsCallback(); } m_DelayedGraphicRebuild = null; }
/// <summary> /// Override to Cull function of MaskableGraphic to prevent Culling. /// </summary> /// <param name="clipRect"></param> /// <param name="validRect"></param> public override void Cull(Rect clipRect, bool validRect) { //Debug.Log("***** Cull (" + clipRect + ") Valid Rect: " + validRect + " Cull: " + canvasRenderer.cull + " *****"); if (validRect) { canvasRenderer.cull = false; CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); return; } base.Cull(clipRect, validRect); }
protected virtual void SetTextDirty() { m_textDirty = true; m_renderNodeDirty = true; SetMaterialDirty(); FreeDraws(); if (isActiveAndEnabled) { CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); } }
/// <summary> /// /// </summary> public override void SetMaterialDirty() { //Debug.Log("SetMaterialDirty()"); if (this == null || !this.IsActive() || CanvasUpdateRegistry.IsRebuildingGraphics()) { return; } m_isMaterialDirty = true; CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild((ICanvasElement)this); //UpdateMaterial(); }
public override void SetVerticesDirty() { if (m_verticesAlreadyDirty || this == null || !this.IsActive() || CanvasUpdateRegistry.IsRebuildingGraphics()) { return; } m_verticesAlreadyDirty = true; CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild((ICanvasElement)this); if (m_OnDirtyVertsCallback != null) { m_OnDirtyVertsCallback(); } }
public static int RegisterCanvasElementForGraphicRebuild_s(IntPtr l) { int result; try { ICanvasElement element; LuaObject.checkType <ICanvasElement>(l, 1, out element); CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(element); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public override void SetVerticesDirty() { if (this == null || !this.IsActive()) { return; } if (CanvasUpdateRegistry.IsRebuildingGraphics()) { return; } CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); if (m_OnDirtyVertsCallback != null) { m_OnDirtyVertsCallback(); } }
/// <summary> /// /// </summary> public override void SetMaterialDirty() { if (this == null || !this.IsActive()) { return; } if (CanvasUpdateRegistry.IsRebuildingGraphics()) { return; } m_isMaterialDirty = true; CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); if (m_OnDirtyMaterialCallback != null) { m_OnDirtyMaterialCallback(); } }
public override void UpdateSelf(float deltaTime) { base.UpdateSelf(deltaTime); int f = frameIndex; UpdateAnim(deltaTime); if (f != frameIndex || (currentIsEmpty && cartoon.frames[f].sprite.Get() != null)) { CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); } #if UNITY_EDITOR else { if (Application.isEditor) { CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); } } #endif }
public override void UpdateSelf(float deltaTime) { base.UpdateSelf(deltaTime); int f = frameIndex; UpdateAnim(deltaTime); if (f != frameIndex) { CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); } #if UNITY_EDITOR else { if (Application.isEditor) { CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); } } #endif }
public override void UpdateSelf(float deltaTime) { base.UpdateSelf(deltaTime); if (currentWidth >= maxWidth || m_Data == null) { return; } float temp = currentWidth; for (int i = 0; i < m_Data.lines.Count; ++i) { DrawLineStruct.Line l = m_Data.lines[i]; if (temp >= l.width) { temp -= l.width; } else { // 还未达到,使用这个速度来 float t = (l.width - temp) / l.dynSpeed; if (t >= deltaTime) { // 所用的时间要大于当前间隔时间 currentWidth += deltaTime * l.dynSpeed; break; } else { currentWidth += l.dynSpeed * t; deltaTime -= t; temp -= l.dynSpeed * t; } } } CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); // 重绘 }
protected virtual void UpdateVisible() { this.canvasRenderer.cull = !m_Visible; if (inlineImages != null) { int count = inlineImages.Count; for (int i = 0; i < count; i++) { InLineImage item = inlineImages[i]; if (item.image != null) { bool cull = !m_Visible || item.cull; if (cull != item.image.canvasRenderer.cull) { item.image.canvasRenderer.cull = cull; if (!cull) { CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(item.image);//不加这个在隐藏状态时有变化不会更新 } } } } } }
protected override void OnEnable() { CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); }
private void MarkGeometryAsDirty() { CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); }
protected virtual void Update() { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); }