當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。