Begin() public method

public Begin ( ) : void
return void
コード例 #1
0
ファイル: Stage.cs プロジェクト: blueberryWT/CatLib
        internal void InternalUpdate()
        {
            HandleEvents();

            _updateContext.Begin();
            Update(_updateContext);
            _updateContext.End();

            if (DynamicFont.textRebuildFlag)
            {
                //字体贴图更改了,重新渲染一遍,防止本帧文字显示错误
                _updateContext.Begin();
                Update(_updateContext);
                _updateContext.End();

                DynamicFont.textRebuildFlag = false;
            }
        }
コード例 #2
0
        internal int InternalUpdate()
        {
            HandleEvents();

            _updateContext.Begin();
            Update(_updateContext);
            _updateContext.End();

            if (textRebuildFlag)
            {
                //字体贴图更改了,重新渲染一遍,防止本帧文字显示错误
                _updateContext.Begin();
                Update(_updateContext);
                _updateContext.End();

                textRebuildFlag = false;
            }

            return(_updateContext.counter);
        }
コード例 #3
0
 static public int Begin(IntPtr l)
 {
     try {
         FairyGUI.UpdateContext self = (FairyGUI.UpdateContext)checkSelf(l);
         self.Begin();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #4
0
        /// <summary>
        /// 由StageCamera调用
        /// </summary>
        public static void Update()
        {
            if (Application.isPlaying)
            {
                return;
            }

            if (_updateContext == null)
            {
                _updateContext = new UpdateContext();
            }

            if (orderChanged)
            {
                _targets.Sort(CompareDepth);
                orderChanged = false;
            }

            int cnt = _targets.Count;

            for (int i = 0; i < cnt; i++)
            {
                EMRenderTarget panel = _targets[i];
                panel.EM_BeforeUpdate();
            }

            if (packageListReady)
            {
                _updateContext.Begin();
                for (int i = 0; i < cnt; i++)
                {
                    EMRenderTarget panel = _targets[i];
                    panel.EM_Update(_updateContext);
                }
                _updateContext.End();
            }
        }
コード例 #5
0
ファイル: UIPanel.cs プロジェクト: qutin/github-kgui-qutin
        public static void RenderAllPanels()
        {
            if (Application.isPlaying)
            {
                return;
            }

            if (_updateContext == null)
            {
                _updateContext = new UpdateContext();
            }

            if (_renderTargetsChanged)
            {
                _renderTargets.Sort(CompareDepth);
                _renderTargetsChanged = false;
            }

            int cnt = _renderTargets.Count;

            for (int i = 0; i < cnt; i++)
            {
                UIPanel panel = _renderTargets[i];
                panel.PreRender();
            }

            if (packageListReady)
            {
                _updateContext.Begin();
                for (int i = 0; i < cnt; i++)
                {
                    _renderTargets[i].container.Update(_updateContext);
                }
                _updateContext.End();
            }
        }
コード例 #6
0
        void CaptureInEditMode()
        {
            if (!EMRenderSupport.packageListReady || UIPackage.GetByName(packageName) == null)
            {
                return;
            }

            _captured = true;

            DisplayOptions.SetEditModeHideFlags();
            GComponent view = (GComponent)UIPackage.CreateObject(packageName, componentName);

            if (view != null)
            {
                DestroyTexture();

                _texture = CaptureCamera.CreateRenderTexture(Mathf.RoundToInt(view.width), Mathf.RoundToInt(view.height), false);

                Container root = (Container)view.displayObject;
                root.layer = CaptureCamera.layer;
                root.SetChildrenLayer(CaptureCamera.layer);
                root.gameObject.hideFlags = HideFlags.None;
                root.gameObject.SetActive(true);

                GameObject cameraObject = new GameObject("Temp Capture Camera");
                Camera     camera       = cameraObject.AddComponent <Camera>();
                camera.depth         = 0;
                camera.cullingMask   = 1 << CaptureCamera.layer;
                camera.clearFlags    = CameraClearFlags.Depth;
                camera.orthographic  = true;
                camera.nearClipPlane = -30;
                camera.farClipPlane  = 30;
                camera.enabled       = false;
                camera.targetTexture = _texture;

                float halfHeight = (float)_texture.height / 2;
                camera.orthographicSize = halfHeight;
                cameraObject.transform.localPosition = root.cachedTransform.TransformPoint(halfHeight * camera.aspect, -halfHeight, 0);

                UpdateContext context = new UpdateContext();
                //run two times
                context.Begin();
                view.displayObject.Update(context);
                context.End();

                context.Begin();
                view.displayObject.Update(context);
                context.End();

                RenderTexture old = RenderTexture.active;
                RenderTexture.active = _texture;
                GL.Clear(true, true, Color.clear);
                camera.Render();
                RenderTexture.active = old;

                camera.targetTexture = null;
                view.Dispose();
                GameObject.DestroyImmediate(cameraObject);

                if (_renderer != null)
                {
                    _renderer.sharedMaterial.mainTexture = _texture;
                }
            }
        }
コード例 #7
0
 public void OnUpdate()
 {
     _updateContext.Begin();
     Update(_updateContext);
     _updateContext.End();
 }
コード例 #8
0
ファイル: UIPainter.cs プロジェクト: fairygui/FairyGUI-unity
        void CaptureInEditMode()
        {
            if (!EMRenderSupport.packageListReady || UIPackage.GetByName(packageName) == null)
                return;

            _captured = true;

            UIObjectFactory.packageItemExtensions.Clear();
            UIObjectFactory.loaderConstructor = null;
            DisplayOptions.SetEditModeHideFlags();

            GComponent view = (GComponent)UIPackage.CreateObject(packageName, componentName);

            if (view != null)
            {
                DestroyTexture();

                _texture = CaptureCamera.CreateRenderTexture(Mathf.RoundToInt(view.width), Mathf.RoundToInt(view.height), false);

                Container root = (Container)view.displayObject;
                root.layer = CaptureCamera.layer;
                root.SetChildrenLayer(CaptureCamera.layer);
                root.gameObject.hideFlags = HideFlags.None;
                root.gameObject.SetActive(true);

                GameObject cameraObject = new GameObject("Temp Capture Camera");
                Camera camera = cameraObject.AddComponent<Camera>();
                camera.depth = 0;
                camera.cullingMask = 1 << CaptureCamera.layer;
                camera.clearFlags = CameraClearFlags.Depth;
                camera.orthographic = true;
                camera.nearClipPlane = -30;
                camera.farClipPlane = 30;
                camera.enabled = false;
                camera.targetTexture = _texture;

                float halfHeight = (float)_texture.height / 2;
                camera.orthographicSize = halfHeight;
                cameraObject.transform.localPosition = root.cachedTransform.TransformPoint(halfHeight * camera.aspect, -halfHeight, 0);

                UpdateContext context = new UpdateContext();
                //run two times
                context.Begin();
                view.displayObject.Update(context);
                context.End();

                context.Begin();
                view.displayObject.Update(context);
                context.End();

                RenderTexture old = RenderTexture.active;
                RenderTexture.active = _texture;
                GL.Clear(true, true, Color.clear);
                camera.Render();
                RenderTexture.active = old;

                camera.targetTexture = null;
                view.Dispose();
                GameObject.DestroyImmediate(cameraObject);

                if (_renderer != null)
                    _renderer.sharedMaterial.mainTexture = _texture;
            }
        }
コード例 #9
0
ファイル: UIPainter.cs プロジェクト: qutin/github-kgui-qutin
        void CaptureInEditMode()
        {
            if (!packageListReady || UIPackage.GetByName(packageName) == null)
            {
                return;
            }

            _captured = true;
            GameObject tempGo = new GameObject("Temp Object");

            tempGo.layer = CaptureCamera.layer;

            UIObjectFactory.packageItemExtensions.Clear();
            UIObjectFactory.loaderConstructor = null;
            DisplayOptions.SetEditModeHideFlags();
            DisplayOptions.defaultRoot = new Transform[] { tempGo.transform };
            GComponent view = (GComponent)UIPackage.CreateObject(packageName, componentName);

            DisplayOptions.defaultRoot = null;

            if (view != null)
            {
                if (texture != null)
                {
                    DestroyTexture();
                }

                CreateTexture(Mathf.CeilToInt(view.width), Mathf.CeilToInt(view.height));

                Container root = (Container)view.displayObject;
                root.layer = CaptureCamera.layer;
                root.SetChildrenLayer(CaptureCamera.layer);
                root.gameObject.hideFlags = HideFlags.None;
                root.gameObject.SetActive(true);

                GameObject cameraObject = new GameObject("Temp Capture Camera");
                Camera     camera       = cameraObject.AddComponent <Camera>();
                camera.depth            = 0;
                camera.cullingMask      = 1 << CaptureCamera.layer;
                camera.clearFlags       = CameraClearFlags.Depth;
                camera.orthographic     = true;
                camera.orthographicSize = view.height / 2;
                camera.nearClipPlane    = -30;
                camera.farClipPlane     = 30;
                camera.enabled          = false;
                camera.targetTexture    = texture;

                Vector3 pos = root.cachedTransform.position;
                pos.x += camera.orthographicSize * camera.aspect;
                pos.y -= camera.orthographicSize;
                pos.z  = 0;
                cameraObject.transform.localPosition = pos;

                UpdateContext context = new UpdateContext();
                //run two times
                context.Begin();
                view.displayObject.Update(context);
                context.End();

                context.Begin();
                view.displayObject.Update(context);
                context.End();

                RenderTexture old = RenderTexture.active;
                RenderTexture.active = texture;
                GL.Clear(true, true, Color.clear);
                camera.Render();
                RenderTexture.active = old;

                camera.targetTexture = null;
                view.Dispose();
                GameObject.DestroyImmediate(cameraObject);
                GameObject.DestroyImmediate(tempGo);

                this.GetComponent <Renderer>().sharedMaterial.mainTexture = texture;
            }
        }