예제 #1
0
        // Initializates list items
        private void InitializeList(List <UiLayoutPreset> list, UiLayoutPreset.Type type)
        {
            for (int i = 0; i < list.Count; i++)
            {
                UiLayoutPreset item = list[i];

                if (item != null && !string.IsNullOrEmpty(item.PrefabPath))
                {
                    item.PresetType = type;
                    UiLayout.InitializePreset(item);
                }
            }
        }
예제 #2
0
        // Signal show handler
        private void OnSignalShow()
        {
            switch (PresetType)
            {
            case Type.Screen:
                UiLayout.SetActiveScreen(Instance as UiLayoutElementScreen);
                break;

            case Type.Panel:
                Instance.Show();
                break;

            case Type.Popup:
                UiLayout.CreatePopup(PrefabPath, Container);
                break;
            }
        }
예제 #3
0
        /// <summary>
        /// Initializates layout preset.
        /// </summary>
        public void Initialization()
        {
            switch (PresetType)
            {
            case Type.Screen:
                Instance = UiLayout.CreateScreen(PrefabPath, Container);
                Instance.SetActive(false);

                if (ActiveByDefault)
                {
                    if (ActiveByDefaultImmediately)
                    {
                        UiLayout.SetActiveScreenImmediately(Instance as UiLayoutElementScreen);
                    }
                    else
                    {
                        UiLayout.SetActiveScreen(Instance as UiLayoutElementScreen);
                    }
                }
                break;

            case Type.Panel:
                Instance = UiLayout.CreatePanel(PrefabPath, Container);
                Instance.SetActive(false);

                if (ActiveByDefault)
                {
                    if (ActiveByDefaultImmediately)
                    {
                        Instance.ShowImmediately();
                    }
                    else
                    {
                        Instance.Show();
                    }
                }

                break;
            }

            InitializeSignalsShow(OnSignalShow);
            InitializeSignalsHide(OnSignalHide);
        }