Ejemplo n.º 1
0
        /// <summary>
        /// 设置ui显示层级
        /// </summary>
        /// <param name="ui"></param>
        /// <param name="layer"></param>
        private void SetViewParent(UI ui, string layer)
        {
            if (string.IsNullOrEmpty(layer))
            {
                //公共货币栏
                return;
            }
            RectTransform _rt = ui.GameObject.GetComponent <RectTransform>();

            _rt.SetParent(m_allLayers[layer].transform);
            _rt.anchorMin        = Vector2.zero;
            _rt.anchorMax        = Vector2.one;
            _rt.offsetMax        = Vector2.zero;
            _rt.offsetMin        = Vector2.zero;
            _rt.pivot            = new Vector2(0.5f, 0.5f);
            _rt.localScale       = Vector3.one;
            _rt.localPosition    = Vector3.zero;
            _rt.localRotation    = Quaternion.identity;
            ui.UiComponent.Layer = layer;
            if (!layer.Equals(UILayerType.Hide))
            {
                ui.SetAsLastSibling();
            }
        }