Beispiel #1
0
        protected override void OnAdd(GUnit unit)
        {
            var unitData  = unit.GetData <UnitData>();
            var paramData = unit.GetData <PanelParamData>();
            var panelData = unit.GetData <PanelData>();

            paramData.stateTypeProperty.Subscribe(state =>
            {
                if (state == PanelStateType.Preload)
                {
                    var taskData = DataPool.Get <TaskData>();
                    OnPreload(unit, taskData.taskList);
                    TaskModule.Start(taskData, () =>
                    {
                        DataPool.Release(taskData);

                        UIProcess.ShowImmediate(paramData.assetPath);
                    });
                }
                else if (state == PanelStateType.Show)
                {
                    Show(unit, panelData, paramData);
                }
                else if (state == PanelStateType.Hide)
                {
                    Hide(unit, panelData);
                }
            }).AddTo(unitData.disposable);

            Init(unit, panelData);
        }
Beispiel #2
0
        public static void Hide(string assetPath)
        {
#if DEBUG
            if (_uiData.uiRoot == null)
            {
                Log.E("Hide panel {0} failed, ui root is null!", assetPath);
                return;
            }

            if (!IsShowed(assetPath))
            {
                Log.W("Hide panel {0} failed, panel is not showed!", assetPath);
                return;
            }
#endif
            HideImpl(assetPath);

            TaskModule.Start(_taskData);
        }
Beispiel #3
0
        internal static void ShowImmediate(string assetPath)
        {
            var unit      = _uiData.unitDict[assetPath];
            var panelData = unit.GetData <PanelData>();
            var paramData = unit.GetData <PanelParamData>();

            if (panelData.PanelMode != PanelMode.Alone)
            {
                ShowImpl(assetPath, paramData);
            }
            else
            {
                for (var i = 0; i < _uiData.showedList.Count;)
                {
                    var showed = _uiData.showedList[i];
                    HideImpl(showed);
                }

                TaskModule.Start(_taskData, () =>
                {
                    ShowImpl(assetPath, paramData);
                });
            }
        }