Пример #1
0
        protected unsafe void LoadUIElement(HGUI.UIElement tar, FakeStruct fake, HGUI.UIInitializer initializer)
        {
            UIElementData tmp = new UIElementData();

            unsafe
            {
                UIElementData *src = &tmp;
                ElementHelper.LoadData((byte *)src, fake.ip);
            }
            tar.mod = fake;
            var buffer = fake.buffer;

            tar.activeSelf      = tmp.activeSelf;
            tar.name            = buffer.GetData(tmp.name) as string;
            tar.localPosition   = tmp.localPosition;
            tar.localScale      = tmp.localScale;
            tar.localRotation   = tmp.localRotation;
            tar.m_sizeDelta     = tmp.m_sizeDelta;
            tar.Pivot           = tmp.Pivot;
            tar.scaleType       = tmp.scaleType;
            tar.anchorType      = tmp.anchorType;
            tar.anchorPointType = tmp.anchorPointType;
            tar.anchorOffset    = tmp.anchorOffset;
            tar.marginType      = tmp.marginType;
            tar.parentType      = tmp.parentType;
            tar.margin          = tmp.margin;
            tar.Mask            = tmp.Mask;
            tar.eventType       = tmp.eventType;
            tar.compositeType   = tmp.compositeType;
            tar.userEvent       = null;
            tar.composite       = null;
            tar.SizeChanged     = null;
            Int16[] chi = buffer.GetData(tmp.child) as Int16[];
            if (chi != null)
            {
                for (int i = 0; i < chi.Length; i++)
                {
                    var fs = buffer.GetData(chi[i]) as FakeStruct;
                    if (fs != null)
                    {
                        var son = uiBuffer.Clone(fs, initializer);
                        if (son != null)
                        {
                            son.SetParent(tar);
                        }
                    }
                    else
                    {
                        Debug.LogError("child is null");
                    }
                }
            }
#if UNITY_EDITOR
            if (Application.isPlaying)
#endif
            tar.Initial(fake, initializer);
            if (initializer != null)
            {
                initializer.Initialiezd(fake, tar);
                initializer.AddContext(tar, tmp.insID);
            }
        }
Пример #2
0
 public override void LoadUI(HGUI.UIElement tar, FakeStruct fake, HGUI.UIInitializer initializer)
 {
     LoadUIElement(tar, fake, initializer);
 }