Esempio n. 1
0
 protected void SaveToUIElement(Core.HGUI.UIElement ui, bool activeSelf, bool haveChild = true)
 {
     //ui.activeSelf = gameObject.activeSelf;
     //ui.anchorOffset = this.anchorOffset;
     //ui.anchorPointType = this.anchorPointType;
     //ui.anchorType = this.anchorType;
     //ui.compositeType = this.compositeType;
     //ui.DataContext = this.DataContext;
     //ui.eventType = this.eventType;
     //ui.margin = margin;
     //ui.marginType = this.marginType;
     //ui.Mask = this.Mask;
     //ui.m_sizeDelta = this.m_sizeDelta;
     //ui.name = name;
     //ui.parentType = this.parentType;
     //ui.Pivot = this.Pivot;
     //ui.scaleType = this.scaleType;
     //var trans = transform;
     //ui.localPosition = trans.localPosition;
     //ui.localRotation = trans.localRotation;
     //ui.localScale = trans.localScale;
     //if(haveChild)
     //{
     //    int c = trans.childCount;
     //    for (int i = 0; i < c; i++)
     //    {
     //        var son = trans.GetChild(i);
     //        if (activeSelf)
     //            if (!son.gameObject.activeSelf)
     //                continue;
     //        var h = son.GetComponent<UIElement>();
     //        if (h == null)
     //        {
     //            var st = ToHGUI2(son, activeSelf);
     //            st.SetParent(ui);
     //            st.localPosition = son.localPosition;
     //            st.localScale = son.localScale;
     //            st.localRotation = son.localRotation;
     //        }
     //        else
     //        {
     //            var st = h.ToHGUI2(activeSelf);
     //            st.SetParent(ui);
     //            st.localPosition = son.localPosition;
     //            st.localScale = son.localScale;
     //            st.localRotation = son.localRotation;
     //        }
     //    }
     //}
     ContextID = ui.id;
 }
Esempio n. 2
0
        public static Core.HGUI.UIElement ToHGUI2(Transform trans, bool activeSelf)
        {
            Core.HGUI.UIElement ui = new Core.HGUI.UIElement();
            ui.activeSelf    = trans.gameObject.activeSelf;
            ui.localPosition = trans.localPosition;
            ui.localRotation = trans.localRotation;
            ui.localScale    = trans.localScale;
            ui.name          = trans.name;
            int c = trans.childCount;

            for (int i = 0; i < c; i++)
            {
                var son = trans.GetChild(i);
                if (activeSelf)
                {
                    if (!son.gameObject.activeSelf)
                    {
                        continue;
                    }
                }
                var h = son.GetComponent <UIElement>();
                if (h == null)
                {
                    var st = ToHGUI2(son, activeSelf);
                    st.SetParent(ui);
                    st.localPosition = son.localPosition;
                    st.localScale    = son.localScale;
                    st.localRotation = son.localRotation;
                }
                else
                {
                    var st = h.ToHGUI2(activeSelf);
                    st.SetParent(ui);
                    st.localPosition = son.localPosition;
                    st.localScale    = son.localScale;
                    st.localRotation = son.localRotation;
                }
            }
            return(ui);
        }
Esempio n. 3
0
 public virtual Core.HGUI.UIElement ToHGUI2(bool activeSelf, bool haveChild = true)
 {
     Core.HGUI.UIElement ui = new Core.HGUI.UIElement();
     SaveToUIElement(ui, activeSelf, haveChild);
     return(ui);
 }
Esempio n. 4
0
 public virtual void ToHGUI2(Core.HGUI.UIElement ui, bool activeSelf)
 {
     SaveToUIElement(ui, activeSelf, false);
 }