GetRenderOrder() public static method

public static GetRenderOrder ( ) : int
return int
Esempio n. 1
0
    public static void Show()
    {
        if (layer)
        {
            return;
        }
        layer = Templates.GetDuplicate(key);

        layer.transform.SetParent(Global.MessageCanvas, false);
        layer.gameObject.SetActive(true);

        var rect = layer.GetComponent <RectTransform>();

        rect.sizeDelta        = new Vector2(100, 100);
        rect.anchorMin        = new Vector2(0.5f, 0.5f);
        rect.anchorMax        = new Vector2(0.5f, 0.5f);
        rect.pivot            = new Vector2(0.5f, 0.5f);
        rect.anchoredPosition = Vector3.zero;


        var img = layer.GetComponent <Image>();

        /*
         * if(rotator != null)
         * {
         *  rotator.Play();
         * }
         * else
         * {
         *  rotator = img.transform.DORotate(new Vector3(0, 0, 10), 0.2f, RotateMode.Fast).SetLoops(-1, LoopType.Incremental);
         * }
         */

        if (layer)
        {
            modalKey = ModleLayer.Open(layer, color: new Color(0.0f, 0.0f, 0.0f, 0.5f));
        }
        else
        {
            modalKey = null;
        }


        if (LoadingLayer.IsShow)
        {
            layer.transform.SetSiblingIndex(LoadingLayer.GetRenderOrder() - 1);
            if (modalKey != null)
            {
                ModleLayer.SetRenderOrder((int)modalKey, layer.transform.GetSiblingIndex());
            }
        }
        else
        {
            Stick();
        }
        isShow = true;
    }