static void OnGraphicsResourcesRecreate(bool recreate)
        {
            if (!recreate)
            {
                UIRenderDevice.PrepareForGfxDeviceRecreate();
            }

            var it = UIElementsUtility.GetPanelsIterator();

            while (it.MoveNext())
            {
                if (recreate)
                {
                    it.Current.Value.atlas?.Reset();
                }
                else
                {
                    (it.Current.Value.GetUpdater(VisualTreeUpdatePhase.Repaint) as UIRRepaintUpdater)?.DestroyRenderChain();
                }
            }

            if (!recreate)
            {
                UIRenderDevice.FlushAllPendingDeviceDisposes();
            }
            else
            {
                UIRenderDevice.WrapUpGfxDeviceRecreate();
            }
        }
Exemplo n.º 2
0
 internal static void GetAllPanels(List <Panel> panels, ContextType contextType)
 {
     Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator();
     while (panelsIterator.MoveNext())
     {
         KeyValuePair <int, Panel> current = panelsIterator.Current;
         bool flag = current.Value.contextType == contextType;
         if (flag)
         {
             current = panelsIterator.Current;
             panels.Add(current.Value);
         }
     }
 }
Exemplo n.º 3
0
 void IUIElementsUtility.RequestRepaintForPanels(Action <ScriptableObject> repaintCallback)
 {
     Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator();
     while (panelsIterator.MoveNext())
     {
         KeyValuePair <int, Panel> current = panelsIterator.Current;
         Panel value = current.Value;
         bool  flag  = value.contextType != ContextType.Editor;
         if (!flag)
         {
             bool isDirty = value.isDirty;
             if (isDirty)
             {
                 repaintCallback(value.ownerObject);
             }
         }
     }
 }
        void IUIElementsUtility.RequestRepaintForPanels(Action <ScriptableObject> repaintCallback)
        {
            var iterator = UIElementsUtility.GetPanelsIterator();

            while (iterator.MoveNext())
            {
                var panel = iterator.Current.Value;

                // Game panels' scheduler are ticked by the engine
                if (panel.contextType != ContextType.Editor)
                {
                    continue;
                }

                // Dispatch might have triggered a repaint request.
                if (panel.isDirty)
                {
                    repaintCallback(panel.ownerObject);
                }
            }
        }
        private static void OnGraphicsResourcesRecreate(bool recreate)
        {
            bool flag = !recreate;

            if (flag)
            {
                UIRenderDevice.PrepareForGfxDeviceRecreate();
            }
            Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator();
            while (panelsIterator.MoveNext())
            {
                KeyValuePair <int, Panel> current = panelsIterator.Current;
                UIRRepaintUpdater         expr_32 = current.Value.GetUpdater(VisualTreeUpdatePhase.Repaint) as UIRRepaintUpdater;
                RenderChain renderChain           = (expr_32 != null) ? expr_32.renderChain : null;
                if (recreate)
                {
                    if (renderChain != null)
                    {
                        renderChain.AfterRenderDeviceRelease();
                    }
                }
                else if (renderChain != null)
                {
                    renderChain.BeforeRenderDeviceRelease();
                }
            }
            bool flag2 = !recreate;

            if (flag2)
            {
                UIRenderDevice.FlushAllPendingDeviceDisposes();
            }
            else
            {
                UIRenderDevice.WrapUpGfxDeviceRecreate();
            }
        }