Пример #1
0
        protected int SortBySiblingIndex(TabSubController a, TabSubController b)
        {
            int aSI = a.transform.GetSiblingIndex();
            int bSI = b.transform.GetSiblingIndex();

            if (aSI > bSI)
            {
                return(1);
            }
            else if (aSI < bSI)
            {
                return(-1);
            }

            return(0);
        }
Пример #2
0
        public void Load(string sceneName, object data = null, string folder = "Scenes")
        {
            var prefab = Resources.Load <GameObject>(string.Format("{0}/{1}", folder, sceneName));
            var scene  = Instantiate(prefab, Current.transform.parent);

            scene.transform.SetSiblingIndex(Current.transform.GetSiblingIndex());
            CopyRectTransform(Current.GetComponent <RectTransform>(), scene.GetComponent <RectTransform>());

            Current.OnHidden();
            Destroy(Current.gameObject);

            Current     = scene.GetComponent <TabSubController>();
            Current.tab = this;
            Current.OnActive(data);
            Current.Hide();
            Current.Play();
        }