Beispiel #1
0
        void IInternalTransform.Clear()
        {
            if (Body == null)
            {
                if (TransformsSource == null)
                {
                    _transforms.Clear();
                }

                Forms.mainThread.Send(state =>
                {
                    foreach (var node in this)
                    {
                        node.DestroyMuxInMainThread();
                    }
                }, null);

                _components.Clear();
            }
            else
            {
                if (TransformsSource == null)
                {
                    _transforms.Clear();
                }
                else
                {
                    _transforms.ChangeSource(new object[0]);
                }

                Forms.mainThread.Send(state =>
                {
                    var parent       = Body.parent;
                    var siblingIndex = Body.GetSiblingIndex();

                    foreach (var node in this)
                    {
                        node.DestroyMuxInMainThread();
                    }

                    UnityEngine.Object.Destroy(Body.gameObject);
                    _components.Clear();
                    AddToInMainThread(parent.gameObject);
                    Body.SetSiblingIndex(siblingIndex);
                    AwakeInMainThread();
                }, null);

                _transforms.ChangeSource(TransformsSource);
            }

            SetValue(Xamarin.Forms.Internals.NameScope.NameScopeProperty, null);
        }
Beispiel #2
0
        public Transform()
        {
            _transforms = new TransformCollection(this);
            _transforms.ChangeSource(TransformsSource);
            _transforms.ChangeTemplate(TransformTemplate);

#if UNITY_EDITOR
            _this = new WeakReference <IInternalTransform>(this);

            for (var type = GetType(); type != typeof(Transform <T>); type = type.BaseType)
            {
                var path = GetXamlPath(type);

                if (path != null)
                {
                    Transforms.Add(path, _this);
                }
            }
#endif
        }