这是一个在编辑状态下渲染UI的功能类。EM=Edit Mode
Exemplo 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);
                }
            }
        }
Exemplo n.º 2
0
 void OnDisable()
 {
     if (!Application.isPlaying)
     {
         EMRenderSupport.Remove(this);
     }
 }
Exemplo n.º 3
0
 void OnRenderObject()
 {
     //Update和OnGUI在EditMode的调用都不那么及时,OnRenderObject则比较频繁,可以保证界面及时刷新。所以使用OnRenderObject
     if (isMain && !Application.isPlaying)
     {
         EMRenderSupport.Update();
     }
 }
Exemplo 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));
     }
 }
Exemplo n.º 6
0
 void OnDisable()
 {
     if (Application.isPlaying)
     {
         if (this.container != null)
         {
             this.container._disabled = true;
         }
     }
     else
     {
         EMRenderSupport.Remove(this);
     }
 }
Exemplo n.º 7
0
        void OnEnable()
        {
            if (Application.isPlaying)
            {
                CreateContainer();

                if (!string.IsNullOrEmpty(packagePath) && UIPackage.GetByName(packageName) == null)
                {
                    UIPackage.AddPackage(packagePath);
                }
            }
            else
            {
                EMRenderSupport.Add(this);
            }
        }
Exemplo 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;
            }
        }
Exemplo n.º 9
0
        void OnDestroy()
        {
            if (Application.isPlaying)
            {
                if (_ui != null)
                {
                    _ui.Dispose();
                    _ui = null;
                }

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

            DestroyTexture();
        }
Exemplo 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;
        }
Exemplo n.º 11
0
 public void ApplyModifiedProperties()
 {
     EMRenderSupport.Reload();
 }
Exemplo 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);
                }
            }
        }