Exemplo n.º 1
0
        public FrameInfoCrawler(ReflectionCache rcache)
        {
            this.reflectionCache  = rcache;
            this.frameDebuggeUtil = reflectionCache.GetTypeObject("UnityEditorInternal.FrameDebuggerUtility");
            this.frameEventData   = reflectionCache.GetTypeObject("UnityEditorInternal.FrameDebuggerEventData");

            var frameDebuggerWindowType = this.reflectionCache.GetTypeObject("UnityEditor.FrameDebuggerWindow");
            var window = frameDebuggerWindowType.CallMethod <object>("ShowFrameDebuggerWindow", null, null);

            this.frameDebuggerWindowObj = new ReflectionClassWithObject(frameDebuggerWindowType, window);

            this.IsRunning = false;
            this.alreadyWriteTextureDict  = new Dictionary <int, TextureUtility.SaveTextureInfo>();
            this.savedRenderTexture       = new Dictionary <SavedRenderTextureInfo, TextureUtility.SaveTextureInfo>();
            this.renderTextureLastChanged = new Dictionary <int, int>();
        }
Exemplo n.º 2
0
        public void Execute(FrameInfoCrawler.CaptureFlag flag, System.Action endCall = null)
        {
            this.captureFlag = flag;
            if (this.reflectionCache == null)
            {
                this.reflectionCache = new ReflectionCache();
            }
            this.OnEndAct = endCall;

            var frameDebuggeUtil = reflectionCache.GetTypeObject("UnityEditorInternal.FrameDebuggerUtility");

            // show FrameDebuggerWindow
            var    frameDebuggerWindow = reflectionCache.GetTypeObject("UnityEditor.FrameDebuggerWindow");
            object windowObj           = frameDebuggerWindow.CallMethod <object>("ShowFrameDebuggerWindow", null, null);

            frameDebuggerWindow.CallMethod <object>("EnableIfNeeded", windowObj, null);
            if (crawler == null)
            {
                crawler = new FrameInfoCrawler(this.reflectionCache);
            }
            crawler.Request(flag, EndCrawler);
        }
Exemplo n.º 3
0
        public static List <T> CopyToListFromArray <T>(ReflectionCache cache, System.Array arr)
        {
            if (arr == null)
            {
                return(null);
            }
            List <T> list = new List <T>(arr.Length);

            if (arr.Length <= 0)
            {
                return(list);
            }

            foreach (var obj in arr)
            {
                T   dest                      = (T)System.Activator.CreateInstance(typeof(T));
                var reflectionType            = cache.GetTypeObject(obj.GetType());
                var reflectionClassWithObject = new ReflectionClassWithObject(reflectionType, obj);
                reflectionClassWithObject.CopyFieldsToObjectByVarName(ref dest);
                list.Add(dest);
            }
            return(list);
        }