private bool ObjectValidForUpdate(ICanvasElement element)
 {
   bool flag = element != null;
   if (element is UnityEngine.Object)
     flag = element as UnityEngine.Object != (UnityEngine.Object) null;
   return flag;
 }
Ejemplo n.º 2
0
        private bool ObjectValidForUpdate(ICanvasElement element)
        {
            var valid = element != null;

            var isUnityObject = element is Object;
            if (isUnityObject)
                valid = (element as Object) != null; //Here we make use of the overloaded UnityEngine.Object == null, that checks if the native object is alive.

            return valid;
        }
Ejemplo n.º 3
0
 private void InternalRegisterCanvasElementForGraphicRebuild(ICanvasElement element)
 {
     if (this.m_PerformingGraphicUpdate)
     {
         Debug.LogError(string.Format("Trying to add {0} for graphic rebuild while we are already inside a graphic rebuild loop. This is not supported.", element));
     }
     else
     {
         this.m_GraphicRebuildQueue.Add(element);
     }
 }
Ejemplo n.º 4
0
 private void InternalUnRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
 {
     if (this.m_PerformingLayoutUpdate)
     {
         Debug.LogError(string.Format("Trying to remove {0} from rebuild list while we are already inside a rebuild loop. This is not supported.", element));
     }
     else
     {
         instance.m_LayoutRebuildQueue.Remove(element);
     }
 }
Ejemplo n.º 5
0
 public static bool TryRegisterCanvasElementForGraphicRebuild(ICanvasElement element)
 {
     return instance.InternalRegisterCanvasElementForGraphicRebuild(element);
 }
Ejemplo n.º 6
0
 public static void UnRegisterCanvasElementForRebuild(ICanvasElement element)
 {
     instance.InternalUnRegisterCanvasElementForLayoutRebuild(element);
     instance.InternalUnRegisterCanvasElementForGraphicRebuild(element);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Remove the given element from both the graphic and the layout rebuild lists.
 /// </summary>
 /// <param name="element"></param>
 public static void UnRegisterCanvasElementForRebuild(ICanvasElement element)
 {
     instance.InternalUnRegisterCanvasElementForLayoutRebuild(element);
     instance.InternalUnRegisterCanvasElementForGraphicRebuild(element);
 }
Ejemplo n.º 8
0
        private bool InternalRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
        {
            if (m_LayoutRebuildQueue.Contains(element))
                return false;

            if (m_PerformingLayoutUpdate)
            {
                Debug.LogError(string.Format("Trying to add {0} for layout rebuild while we are already inside a layout rebuild loop. This is not supported.", element));
                return false;
            }

            return m_LayoutRebuildQueue.AddUnique(element);
        }
 /// <summary>
 /// 
 /// <para>
 /// Rebuild the layout of the given element.
 /// </para>
 /// 
 /// </summary>
 /// <param name="element">Element to rebuild.</param>
 public static void RegisterCanvasElementForLayoutRebuild(ICanvasElement element)
 {
   CanvasUpdateRegistry.instance.InternalRegisterCanvasElementForLayoutRebuild(element);
 }
 public static IDisposable BindScaleTo(this ICanvasElement input, IReactiveProperty <Vector3> property, BindingTypes bindingType = BindingTypes.Default, params IFilter <Vector3>[] filters)
 {
     return(input.transform.BindScaleTo(property, bindingType, filters).AddTo(input as MonoBehaviour));
 }
Ejemplo n.º 11
0
        private bool InternalRegisterCanvasElementForGraphicRebuild(ICanvasElement element)
        {
            int id = (element as Object).GetInstanceID();

            if (this.m_GraphicQueueLookup.ContainsKey(id))
                return false;

            m_GraphicQueueLookup[id] = id;
            this.m_GraphicRebuildQueue.Add(element);

            return true;
        }
 private bool InternalRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
 {
   if (this.m_LayoutRebuildQueue.Contains(element))
     return false;
   return this.m_LayoutRebuildQueue.AddUnique(element);
 }
Ejemplo n.º 13
0
        private void InternalUnRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
        {
            int id = (element as Object).GetInstanceID();

            //element.LayoutComplete();
            TMP_UpdateRegistry.instance.m_LayoutRebuildQueue.Remove(element);
            m_GraphicQueueLookup.Remove(id);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Function to unregister elements which no longer require a rebuild.
 /// </summary>
 /// <param name="element"></param>
 public static void UnRegisterCanvasElementForRebuild(ICanvasElement element)
 {
     TMP_UpdateRegistry.instance.InternalUnRegisterCanvasElementForLayoutRebuild(element);
     TMP_UpdateRegistry.instance.InternalUnRegisterCanvasElementForGraphicRebuild(element);
 }
Ejemplo n.º 15
0
        private bool ObjectValidForUpdate(ICanvasElement element)
        {
            var valid = element != null;

            var isUnityObject = element is Object;
            if (isUnityObject)
                valid = (element as Object) != null;

            return valid;
        }
Ejemplo n.º 16
0
 private void InternalRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
 {
     if (m_LayoutRebuildQueue.Contains(element))
         return;
     m_LayoutRebuildQueue.Add(element);
 }
 public static IDisposable BindScaleTo(this ICanvasElement input, Func <Vector3> getter, Action <Vector3> setter, BindingTypes bindingType = BindingTypes.Default, params IFilter <Vector3>[] filters)
 {
     return(input.transform.BindScaleTo(getter, setter, bindingType, filters).AddTo(input as MonoBehaviour));
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Disable the given element from both the graphic and the layout rebuild lists.
 /// </summary>
 /// <param name="element"></param>
 public static void DisableCanvasElementForRebuild(ICanvasElement element)
 {
     instance.InternalDisableCanvasElementForLayoutRebuild(element);
     instance.InternalDisableCanvasElementForGraphicRebuild(element);
 }
Ejemplo n.º 19
0
 private static int SortLayoutList(ICanvasElement x, ICanvasElement y)
 {
     return(CanvasUpdateRegistry.ParentCount(x.transform) - CanvasUpdateRegistry.ParentCount(y.transform));
 }
Ejemplo n.º 20
0
        /// <summary>

        /// Method to handle objects that need updating.

        /// </summary>

        private void PerformUpdateForCanvasRendererObjects()

        {
            //Debug.Log("Performing update of CanvasRenderer objects at Frame: " + Time.frameCount);



            // Processing elements that require a layout rebuild.

            //this.m_PerformingLayoutUpdate = true;

            for (int index = 0; index < m_LayoutRebuildQueue.Count; index++)

            {
                ICanvasElement element = TMP_UpdateRegistry.instance.m_LayoutRebuildQueue[index];



                element.Rebuild(CanvasUpdate.Prelayout);
            }

            //this.m_PerformingLayoutUpdate = false;

            if (m_LayoutRebuildQueue.Count > 0)

            {
                m_LayoutRebuildQueue.Clear();

                m_LayoutQueueLookup.Clear();
            }



            // Processing elements that require a graphic rebuild.

            //this.m_PerformingGraphicUpdate = true;

            for (int index = 0; index < m_GraphicRebuildQueue.Count; index++)

            {
                ICanvasElement element = TMP_UpdateRegistry.instance.m_GraphicRebuildQueue[index];



                element.Rebuild(CanvasUpdate.PreRender);
            }

            //this.m_PerformingGraphicUpdate = false;



            // If there are no objects in the queue, we don't need to clear the lists again.

            if (m_GraphicRebuildQueue.Count > 0)

            {
                m_GraphicRebuildQueue.Clear();

                m_GraphicQueueLookup.Clear();
            }
        }
 /// <summary>
 /// Function to register elements which require a layout rebuild.
 /// </summary>
 /// <param name="element"></param>
 public static void RegisterCanvasElementForLayoutRebuild(ICanvasElement element)
 {
     TMP_UpdateRegistry.instance.InternalRegisterCanvasElementForLayoutRebuild(element);
 }
 private static int SortLayoutList(ICanvasElement x, ICanvasElement y)
 {
   return CanvasUpdateRegistry.ParentCount(x.transform) - CanvasUpdateRegistry.ParentCount(y.transform);
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Try and add the given element to the rebuild list.
 /// Will not return if successfully added.
 /// </summary>
 /// <param name="element">The element that is needing rebuilt.</param>
 public static void RegisterCanvasElementForGraphicRebuild(ICanvasElement element)
 {
     instance.InternalRegisterCanvasElementForGraphicRebuild(element);
 }
 /// <summary>
 /// 
 /// <para>
 /// Was the element scheduled.
 /// </para>
 /// 
 /// </summary>
 /// <param name="element">Element to rebuild.</param>
 /// <returns>
 /// 
 /// <para>
 /// Was the element scheduled.
 /// </para>
 /// 
 /// </returns>
 public static bool TryRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
 {
   return CanvasUpdateRegistry.instance.InternalRegisterCanvasElementForLayoutRebuild(element);
 }
Ejemplo n.º 25
0
 /// <summary>
 ///   <para>Was the element scheduled.</para>
 /// </summary>
 /// <param name="element">Element to rebuild.</param>
 /// <returns>
 ///   <para>Was the element scheduled.</para>
 /// </returns>
 public static bool TryRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
 {
     return(CanvasUpdateRegistry.instance.InternalRegisterCanvasElementForLayoutRebuild(element));
 }
 /// <summary>
 /// Function to unregister elements which no longer require a rebuild.
 /// </summary>
 /// <param name="element"></param>
 public static void UnRegisterCanvasElementForRebuild(ICanvasElement element)
 {
     TMP_UpdateRegistry.instance.InternalUnRegisterCanvasElementForLayoutRebuild(element);
     TMP_UpdateRegistry.instance.InternalUnRegisterCanvasElementForGraphicRebuild(element);
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Creates an instance that will restore the control's position to the specified location.
 /// </summary>
 public RestoreLocation(ICanvasElement control, MathCore.Vector location)
     : this(control, new Point(location.X, location.Y))
 {
 }
Ejemplo n.º 28
0
 private void InternalRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
 {
     m_LayoutRebuildQueue.Add(element);
 }
Ejemplo n.º 29
0
        public IAndroidCanvasElement Create(ICanvasElement element)
        {
            var image = (ImageElement)element;

            return(new AndroidImageElement(image));
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Try and add the given element to the rebuild list.
 /// </summary>
 /// <param name="element">The element that is needing rebuilt.</param>
 /// <returns>
 /// True if the element was successfully added to the rebuilt list.
 /// False if either already inside a Graphic Update loop OR has already been added to the list.
 /// </returns>
 public static bool TryRegisterCanvasElementForGraphicRebuild(ICanvasElement element)
 {
     return(instance.InternalRegisterCanvasElementForGraphicRebuild(element));
 }
Ejemplo n.º 31
0
 public TimeSpanBinding(ICanvasElement graphic) : base(graphic)
 {
 }
Ejemplo n.º 32
0
        private static int SortLayoutList(ICanvasElement x, ICanvasElement y)
        {
            Transform t1 = x.transform;
            Transform t2 = y.transform;

            return ParentCount(t1) - ParentCount(t2);
        }
Ejemplo n.º 33
0
 public Binding(ICanvasElement graphic)
 {
     _graphic = graphic;
 }
Ejemplo n.º 34
0
 public static void RegisterCanvasElementForGraphicRebuild(ICanvasElement element)
 {
     instance.InternalRegisterCanvasElementForGraphicRebuild(element);
 }
Ejemplo n.º 35
0
 public TextBinding(ICanvasElement graphic, string formatting = "{0}") : base(graphic)
 {
     _formatting = formatting;
 }
Ejemplo n.º 36
0
        private bool InternalRegisterCanvasElementForGraphicRebuild(ICanvasElement element)
        {
            if (m_PerformingGraphicUpdate)
            {
                Debug.LogError(string.Format("Trying to add {0} for graphic rebuild while we are already inside a graphic rebuild loop. This is not supported.", element));
                return false;
            }

            return m_GraphicRebuildQueue.AddUnique(element);
        }
Ejemplo n.º 37
0
 public SliderBinding(ICanvasElement graphic) : base(graphic)
 {
 }
Ejemplo n.º 38
0
 private void InternalUnRegisterCanvasElementForGraphicRebuild(ICanvasElement element)
 {
     if (m_PerformingGraphicUpdate)
     {
         Debug.LogError(string.Format("Trying to remove {0} from rebuild list while we are already inside a rebuild loop. This is not supported.", element));
         return;
     }
     element.GraphicUpdateComplete();
     instance.m_GraphicRebuildQueue.Remove(element);
 }
Ejemplo n.º 39
0
 private void InternalRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
 {
     this.m_LayoutRebuildQueue.Add(element);
 }
Ejemplo n.º 40
0
 public void OnElementSelected(object sender, ICanvasElement element)
 {
     SelectedElement = element;
 }
 private bool InternalRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
 {
     return(!this.m_LayoutRebuildQueue.Contains(element) && this.m_LayoutRebuildQueue.AddUnique(element));
 }