/// <summary>
        /// 添加新的GUI子对象
        /// </summary>
        /// <param name="parent">Bahavior.</param>
        public void SetParent(EditorWindowRect parent)
        {
            if (parent == this)
            {
                ReDebug.LogError(ReLogType.System, "EditorWIndowBehavior", "不能将自己作为自己的子对象");
                return;
            }

            if (this is EditorWindowPanel && !(parent is EditorWindowPanel))
            {
                ReDebug.LogError(ReLogType.System, "EditorWIndowBehavior", "Panel只能放入Panel下");
                return;
            }

            if (this.parent == parent)
            {
                return;
            }

            if (this.parent != null)
            {
                this.parent.behaviorList.Remove(this);
            }

            this.parent = parent;
            if (this.parent != null)
            {
                this.parent.behaviorList.Add(this);
            }
        }
Example #2
0
 public MenuProvider(EditorWindowRect parent)
 {
     this.parentWindow = parent;
     menu = new GenericMenu();
     SetParent(parent);
 }