UnityEngine.DrivenRectTransformTracker.Add(UnityEngine.Object, UnityEngine.RectTransform, UnityEngine.DrivenTransformProperties)

Here are the examples of the csharp api UnityEngine.DrivenRectTransformTracker.Add(UnityEngine.Object, UnityEngine.RectTransform, UnityEngine.DrivenTransformProperties) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

10 Examples 7

19 View Source File : BoxSlider.cs
License : GNU General Public License v3.0
Project Creator : ARPOISE

private void UpdateVisuals()
		{
			#if UNITY_EDITOR
			if (!Application.isPlaying)
				UpdateCachedReferences();
			#endif
			
			m_Tracker.Clear();
			

			//to business!
			if (m_HandleContainerRect != null)
			{
				m_Tracker.Add(this, m_HandleRect, DrivenTransformProperties.Anchors);
				Vector2 anchorMin = Vector2.zero;
				Vector2 anchorMax = Vector2.one;
				anchorMin[0] = anchorMax[0] = (normalizedValue);
				anchorMin[1] = anchorMax[1] = ( normalizedValueY);

				m_HandleRect.anchorMin = anchorMin;
				m_HandleRect.anchorMax = anchorMax;
			}
		}

19 View Source File : BoxSlider.cs
License : GNU General Public License v2.0
Project Creator : Caeden117

private void UpdateVisuals()
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
                UpdateCachedReferences();
#endif

            mTracker.Clear();


            //to business!
            if (mHandleContainerRect != null)
            {
                mTracker.Add(this, mHandleRect, DrivenTransformProperties.Anchors);
                var anchorMin = Vector2.zero;
                var anchorMax = Vector2.one;
                anchorMin[0] = anchorMax[0] = NormalizedValue;
                anchorMin[1] = anchorMax[1] = NormalizedValueY;

                mHandleRect.anchorMin = anchorMin;
                mHandleRect.anchorMax = anchorMax;
            }
        }

19 View Source File : BoxSlider.cs
License : MIT License
Project Creator : cmaher

private void UpdateVisuals()
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
                UpdateCachedReferences();
#endif

            m_Tracker.Clear();


            //to business!
            if (m_HandleContainerRect != null)
            {
                m_Tracker.Add(this, m_HandleRect, DrivenTransformProperties.Anchors);
                Vector2 anchorMin = Vector2.zero;
                Vector2 anchorMax = Vector2.one;
                anchorMin[0] = anchorMax[0] = (NormalizedValueX);
                anchorMin[1] = anchorMax[1] = (NormalizedValueY);

                if (Application.isPlaying)
                {
                    m_HandleRect.anchorMin = anchorMin;
                    m_HandleRect.anchorMax = anchorMax;
                }

            }
        }

19 View Source File : ContentScrollSnapHorizontal.cs
License : MIT License
Project Creator : cmaher

private void SetupDrivenTransforms()
        {
            tracker = new DrivenRectTransformTracker();
            tracker.Clear();

            //So that we can calculate everything correctly
            foreach (RectTransform child in contentTransform)
            {
                tracker.Add(this, child, DrivenTransformProperties.Anchors);

                child.anchorMax = new Vector2(0, 1);
                child.anchorMin = new Vector2(0, 1);
            }
        }

19 View Source File : CurvedLayout.cs
License : MIT License
Project Creator : cmaher

void CalculateRadial() {
            m_Tracker.Clear();
            if (transform.childCount == 0)
                return;

            //one liner for figuring out the desired pivot (should be moved into a utility function)
            Vector2 pivot = new Vector2(((int)childAlignment % 3) * 0.5f, ((int)childAlignment / 3) * 0.5f);

            //this seems to work ok-ish
            Vector3 lastPos = new Vector3(
                GetStartOffset(0, GetTotalPreferredSize(0)),
                GetStartOffset(1, GetTotalPreferredSize(1)),
                0f
            );

            // 0 = first, 1 = last child
            float lerp = 0;
            //no need to catch divide by 0 as childCount > 0
            float step = 1f / transform.childCount;

            //normalize and create a distance between items
            var dist = itemAxis.normalized * itemSize;

            for (int i = 0; i < transform.childCount; i++) {
                RectTransform child = (RectTransform)transform.GetChild(i);
                if (child != null) {
                    //stop the user from altering certain values in the editor
                    m_Tracker.Add(this, child,
                    DrivenTransformProperties.Anchors |
                    DrivenTransformProperties.AncreplaceddPosition |
                    DrivenTransformProperties.Pivot);
                    Vector3 vPos = lastPos + dist;

                    child.localPosition = lastPos = vPos + (lerp - centerpoint) * CurveOffset;

                    child.pivot = pivot;
                    //child anchors are not yet calculated, each child should set it's own size for now
                    child.anchorMin = child.anchorMax = new Vector2(0.5f, 0.5f);
                    lerp += step;
                }
            }

        }

19 View Source File : RadialLayout.cs
License : MIT License
Project Creator : cmaher

void CalculateRadial()
        {
            m_Tracker.Clear();
            if (transform.childCount == 0)
                return;

            int ChildrenToFormat = 0;
            if (OnlyLayoutVisible)
            {
                for (int i = 0; i < transform.childCount; i++)
                {
                    RectTransform child = (RectTransform)transform.GetChild(i);
                    if ((child != null) && child.gameObject.activeSelf)
                        ++ChildrenToFormat;
                }
            }
            else
            {
                ChildrenToFormat = transform.childCount;
            }

            float fOffsetAngle = (MaxAngle - MinAngle) / ChildrenToFormat;

            float fAngle = StartAngle;
            for (int i = 0; i < transform.childCount; i++)
            {
                RectTransform child = (RectTransform)transform.GetChild(i);
                if ((child != null) && (!OnlyLayoutVisible || child.gameObject.activeSelf))
                {
                    //Adding the elements to the tracker stops the user from modifying their positions via the editor.
                    m_Tracker.Add(this, child,
                    DrivenTransformProperties.Anchors |
                    DrivenTransformProperties.AncreplaceddPosition |
                    DrivenTransformProperties.Pivot);
                    Vector3 vPos = new Vector3(Mathf.Cos(fAngle * Mathf.Deg2Rad), Mathf.Sin(fAngle * Mathf.Deg2Rad), 0);
                    child.localPosition = vPos * fDistance;
                    //Force objects to be center aligned, this can be changed however I'd suggest you keep all of the objects with the same anchor points.
                    child.anchorMin = child.anchorMax = child.pivot = new Vector2(0.5f, 0.5f);
                    fAngle += fOffsetAngle;
                }
            }
        }

19 View Source File : TileSizeFitter.cs
License : MIT License
Project Creator : cmaher

private void UpdateRect()
        {
            if (!IsActive())
                return;

            m_Tracker.Clear();

            m_Tracker.Add(this, rectTransform,
                DrivenTransformProperties.Anchors |
                DrivenTransformProperties.AncreplaceddPosition);
            rectTransform.anchorMin = Vector2.zero;
            rectTransform.anchorMax = Vector2.one;
            rectTransform.ancreplaceddPosition = Vector2.zero;

            m_Tracker.Add(this, rectTransform,
                DrivenTransformProperties.SizeDeltaX |
                DrivenTransformProperties.SizeDeltaY);
            Vector2 sizeDelta = GetParentSize() - Border;
            if (TileSize.x > 0.001f)
                sizeDelta.x -= Mathf.Floor(sizeDelta.x / TileSize.x) * TileSize.x;
            else
                sizeDelta.x = 0;
            if (TileSize.y > 0.001f)
                sizeDelta.y -= Mathf.Floor(sizeDelta.y / TileSize.y) * TileSize.y;
            else
                sizeDelta.y = 0;
            rectTransform.sizeDelta = -sizeDelta;
        }

19 View Source File : UnityEngine_DrivenRectTransformTracker_Wrap.cs
License : MIT License
Project Creator : focus-creative-games

[Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))]
        private static void M_Add(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data)
        {
            try
            {
                var obj = (UnityEngine.DrivenRectTransformTracker)Puerts.Utils.GetSelf((int)data, self);
                
                
                {
                    
                    var argHelper0 = new Puerts.ArgumentHelper((int)data, isolate, info, 0);
                    var argHelper1 = new Puerts.ArgumentHelper((int)data, isolate, info, 1);
                    var argHelper2 = new Puerts.ArgumentHelper((int)data, isolate, info, 2);
                    
                    
                    
                    {
                        
                        var Arg0 = argHelper0.Get<UnityEngine.Object>(false);
                        var Arg1 = argHelper1.Get<UnityEngine.RectTransform>(false);
                        var Arg2 = (UnityEngine.DrivenTransformProperties)argHelper2.GetInt32(false);
                        obj.Add(Arg0,Arg1,Arg2);
                        
                        
                        Puerts.Utils.SetSelf((int)data, self, obj);
                        
                    }
                }
                
                
            }
            catch (Exception e)
            {
                Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace);
            }
        }

19 View Source File : BoxSlider.cs
License : MIT License
Project Creator : Hertzole

private void UpdateVisuals()
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                UpdateCachedReferences();
            }
#endif

            m_Tracker.Clear();


            //to business!
            if (m_HandleContainerRect != null)
            {
                m_Tracker.Add(this, handleRect, DrivenTransformProperties.Anchors);
                Vector2 anchorMin = Vector2.zero;
                Vector2 anchorMax = Vector2.one;
                anchorMin[0] = anchorMax[0] = (NormalizedValue);
                anchorMin[1] = anchorMax[1] = (NormalizedValueY);

                handleRect.anchorMin = anchorMin;
                handleRect.anchorMax = anchorMax;
            }
        }

19 View Source File : OSCPad.cs
License : MIT License
Project Creator : hizzlehoff

private void UpdateVisuals()
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
                UpdateCachedReferences();
#endif

            _tracker.Clear();

            if (_handleContainerRect == null) return;

            _tracker.Add(this, _handleRect, DrivenTransformProperties.Anchors);

            var normal = ConvertVector(NormalizedValue, _handleAlignment);

            if (_xAxisRect != null)
            {
                _xAxisRect.anchorMin = new Vector2(normal.x, _xAxisRect.anchorMin.y);
                _xAxisRect.anchorMax = new Vector2(normal.x, _xAxisRect.anchorMax.y);

                _tracker.Add(this, _xAxisRect, DrivenTransformProperties.AnchorMaxX);
                _tracker.Add(this, _xAxisRect, DrivenTransformProperties.AnchorMinX);
            }

            if (_yAxisRect != null)
            {
                _yAxisRect.anchorMin = new Vector2(_yAxisRect.anchorMin.x, normal.y);
                _yAxisRect.anchorMax = new Vector2(_yAxisRect.anchorMax.x, normal.y);

                _tracker.Add(this, _yAxisRect, DrivenTransformProperties.AnchorMaxY);
                _tracker.Add(this, _yAxisRect, DrivenTransformProperties.AnchorMinY);
            }

            _handleRect.anchorMin = _handleRect.anchorMax = normal;
        }