当前位置: 首页>>代码示例>>C#>>正文


C# RectTransform.GetSiblingIndex方法代码示例

本文整理汇总了C#中UnityEngine.RectTransform.GetSiblingIndex方法的典型用法代码示例。如果您正苦于以下问题:C# RectTransform.GetSiblingIndex方法的具体用法?C# RectTransform.GetSiblingIndex怎么用?C# RectTransform.GetSiblingIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.RectTransform的用法示例。


在下文中一共展示了RectTransform.GetSiblingIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateRectTransform

 public static RectTransform CreateRectTransform(RectTransform prefab,Vector2 size)
 {
     var rect = Instantiate(prefab);
     rect.SetParent(prefab.parent);
     rect.localPosition = prefab.localPosition;
     rect.localScale = Vector3.one;
     rect.SetSiblingIndex(prefab.GetSiblingIndex() + 1);
     rect.sizeDelta = size;
     return rect;
 }
开发者ID:Blizzardx,项目名称:ClientFrameWork,代码行数:10,代码来源:DrawUtility.cs

示例2: CreateDetector

	public static PaintingDetector2D CreateDetector(RectTransform prefab)
    {
        var detectRect = Instantiate(prefab);
        detectRect.name = "detect";
        detectRect.SetParent(prefab.parent);
        detectRect.localPosition = prefab.localPosition;
        detectRect.localScale = Vector3.one;
        detectRect.SetSiblingIndex(prefab.GetSiblingIndex() + 1);
        //detectRect.localPosition = new Vector3(indicator.rect.width, indicator.rect.height,0);
        detectRect.sizeDelta = new Vector2(Screen.width, Screen.height);
        detectRect.GetComponent<RawImage>().color = Color.clear;
        var detector = detectRect.gameObject.AddComponent<PaintingDetector2D>();
        return detector;
    }
开发者ID:Blizzardx,项目名称:ClientFrameWork,代码行数:14,代码来源:DrawUtility.cs

示例3: Setup

        public void Setup(RippleData data, Vector2 positon, IRippleCreator creator, bool oscillate = false)
        {
            m_RippleData = data;
            m_RippleParent = (RectTransform)data.RippleParent;
            rectTransform.SetParent(m_RippleParent);
            rectTransform.SetSiblingIndex(0);
            m_Oscillate = oscillate;
            rectTransform.sizeDelta = Vector2.zero;

            switch (GetComponentInParent<Canvas>().renderMode)
            {
                case RenderMode.ScreenSpaceOverlay:
                    rectTransform.position = new Vector3(positon.x, positon.y, m_RippleParent.position.z);
                    break;
                case RenderMode.ScreenSpaceCamera:
                    rectTransform.position = new Ray(Camera.main.transform.position, Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, m_RippleParent.position.z))).GetPoint(Vector3.Distance(Camera.main.transform.position, m_RippleParent.position));
                    break;
                case RenderMode.WorldSpace:
                    rectTransform.position = new Ray(Camera.main.transform.position, Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, m_RippleParent.position.z))).GetPoint(Vector3.Distance(Camera.main.transform.position, m_RippleParent.position));
                    break;
            }

            rectTransform.localEulerAngles = Vector3.zero;
            image.color = data.Color;
            canvasGroup.alpha = data.StartAlpha;
            m_AnimationDuration = 4f / data.Speed;
            m_RippleCreator = creator;
            if (data.PlaceRippleBehind)
            {
                int index = m_RippleParent.GetSiblingIndex();
                rectTransform.SetParent(m_RippleParent.parent);
                rectTransform.SetSiblingIndex(index);
            }

        }
开发者ID:adamtelfer,项目名称:idlecraft,代码行数:35,代码来源:Ripple.cs

示例4: RefreshCPURectangleType

    private void RefreshCPURectangleType(List<RectTransform> existingTransforms, RectTransform prototype, int numOfCores)
    {
        for (int i = 0; i < numOfCores + existingTransforms.Count; i++)
        {
            bool cpuStateIsOn = i < numOfCores;
            bool transformExists = i < existingTransforms.Count;

            if (transformExists)
            {
                existingTransforms[i].gameObject.SetActive(cpuStateIsOn);
            }
            else if (cpuStateIsOn)
            {
                existingTransforms.Add(GameObject.Instantiate<RectTransform>(prototype));
                existingTransforms[i].SetParent(this.transform);
                existingTransforms[i].localScale = Vector3.one;
                existingTransforms[i].localRotation = Quaternion.identity;
                existingTransforms[i].localPosition = Vector3.zero;
                existingTransforms[i].gameObject.SetActive(true);
                existingTransforms[i].SetSiblingIndex(prototype.GetSiblingIndex() + 1);
            }
        }
    }
开发者ID:HarmonicOrder,项目名称:WarpedDrive,代码行数:23,代码来源:CPUStatus.cs


注:本文中的UnityEngine.RectTransform.GetSiblingIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。