这是一个在编辑状态下渲染UI的功能类。EM=Edit Mode
Esempio n. 1
0
        void OnEnable()
        {
            if (Application.isPlaying)
            {
                CreateContainer();

                if (!string.IsNullOrEmpty(packagePath) && UIPackage.GetByName(packageName) == null)
                {
                    UIPackage.AddPackage(packagePath);
                }
            }
            else
            {
                //不在播放状态时我们不在OnEnable创建,因为Prefab也会调用OnEnable,延迟到Update里创建(Prefab不调用Update)
                //每次播放前都会disable/enable一次。。。
                if (container != null)                //如果不为null,可能是因为Prefab revert, 而不是因为Assembly reload,
                {
                    OnDestroy();
                }

                EMRenderSupport.Add(this);
                screenSizeVer     = 0;
                uiBounds.position = position;
                uiBounds.size     = cachedUISize;
                if (uiBounds.size == Vector2.zero)
                {
                    uiBounds.size = new Vector2(30, 30);
                }
            }
        }
 void OnDisable()
 {
     if (!Application.isPlaying)
     {
         EMRenderSupport.Remove(this);
     }
 }
Esempio n. 3
0
 void OnRenderObject()
 {
     //Update和OnGUI在EditMode的调用都不那么及时,OnRenderObject则比较频繁,可以保证界面及时刷新。所以使用OnRenderObject
     if (isMain && !Application.isPlaying)
     {
         EMRenderSupport.Update();
     }
 }
Esempio n. 4
0
 void OnRenderObject()
 {
     //call only edit mode
     if (isMain && !Application.isPlaying)
     {
         EMRenderSupport.Update();
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         FairyGUI.EMRenderSupport o;
         o = new FairyGUI.EMRenderSupport();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 6
0
 void OnDisable()
 {
     if (Application.isPlaying)
     {
         if (this.container != null)
         {
             this.container._disabled = true;
         }
     }
     else
     {
         EMRenderSupport.Remove(this);
     }
 }
Esempio n. 7
0
        void OnEnable()
        {
            if (Application.isPlaying)
            {
                CreateContainer();

                if (!string.IsNullOrEmpty(packagePath) && UIPackage.GetByName(packageName) == null)
                {
                    UIPackage.AddPackage(packagePath);
                }
            }
            else
            {
                EMRenderSupport.Add(this);
            }
        }
Esempio n. 8
0
        void OnDestroy()
        {
            if (container != null)
            {
                if (!Application.isPlaying)
                {
                    EMRenderSupport.Remove(this);
                }

                if (_ui != null)
                {
                    _ui.Dispose();
                    _ui = null;
                }

                container.Dispose();
                container = null;
            }
        }
        void OnDestroy()
        {
            if (Application.isPlaying)
            {
                if (_ui != null)
                {
                    _ui.Dispose();
                    _ui = null;
                }

                container.Dispose();
                container = null;
            }
            else
            {
                EMRenderSupport.Remove(this);
            }

            DestroyTexture();
        }
Esempio n. 10
0
        void OnDestroy()
        {
            Debug.Log("UIPanel.OnDestroy");
            if (container != null)
            {
                if (!Application.isPlaying)
                {
                    EMRenderSupport.Remove(this);
                }

                if (_ui != null)
                {
                    _ui.Dispose();
                    _ui = null;
                }

                container.Dispose();
                container = null;
            }

            _renders = null;
        }
Esempio n. 11
0
 public void ApplyModifiedProperties()
 {
     EMRenderSupport.Reload();
 }
Esempio n. 12
0
        void OnEnable()
        {
            if (Application.isPlaying)
            {
                if (this.container == null)
                {
                    CreateContainer();

                    if (!string.IsNullOrEmpty(packagePath) && UIPackage.GetByName(packageName) == null)
                    {
                        UIPackage.AddPackage(packagePath, (string name, string extension, System.Type type) =>
                        {
#if UNITY_EDITOR
                            return(UnityEditor.AssetDatabase.LoadAssetAtPath(name + extension, type));
#else
                            return(null);
#endif
                        });

                        if (dependPkgPath != "")
                        {
                            string[] paths = dependPkgPath.Split(';');
                            for (int i = 0; i < paths.Length; ++i)
                            {
                                string path = string.Format("assets/abasset/ui/package/&{0}/{1}", paths[i], paths[i]);
                                UIPackage.AddPackage(path, (string name, string extension, System.Type type) =>
                                {
#if UNITY_EDITOR
                                    return(UnityEditor.AssetDatabase.LoadAssetAtPath(name + extension, type));
#else
                                    return(null);
#endif
                                });
                            }
                        }
                    }
                }
                else
                {
                    this.container._disabled = false;
                }
            }
            else
            {
                //不在播放状态时我们不在OnEnable创建,因为Prefab也会调用OnEnable,延迟到Update里创建(Prefab不调用Update)
                //每次播放前都会disable/enable一次。。。
                if (container != null)                //如果不为null,可能是因为Prefab revert, 而不是因为Assembly reload,
                {
                    OnDestroy();
                }

                EMRenderSupport.Add(this);
                screenSizeVer     = 0;
                uiBounds.position = position;
                uiBounds.size     = cachedUISize;
                if (uiBounds.size == Vector2.zero)
                {
                    uiBounds.size = new Vector2(30, 30);
                }
            }
        }