Exemplo n.º 1
0
 protected void StartProcess()
 {
     if (m_ProcessCount == 0)
     {
         UIControlLog.Trace("[ilib-ui] OnStartProcess");
         OnStartProcess();
     }
     m_ProcessCount++;
 }
Exemplo n.º 2
0
        protected async Task <UIInstance> Open <T>(string path, TParam prm, UIInstance parent = null) where T : UControl
        {
            UIControlLog.Debug("[ilib-ui] Open:{0}, prm:{1}, parent:{2}", path, prm, parent);
            StartProcess();
            try
            {
                await OnBeginOpen();

                var prefab = await Load <T>(path, prm);

                var obj = Instantiate(prefab, transform);
                var ui  = obj.GetComponent <T>();

                ui.SetController(this);

                var behind = parent?.Control?.OnBehind(prm);

                await ui.OnCreated(prm);

                OnOpen(ui);

                if (behind != null && IsWaitBehindBeforeOnFront <T>(path, prm))
                {
                    var hide = await behind;
                    behind = null;
                    if (hide && parent != null && parent.Control != null)
                    {
                        parent.Object.SetActive(false);
                    }
                }

                await ui.OnFront(open : true);

                if (behind != null)
                {
                    var hide = await behind;
                    if (hide && parent != null && parent.Control != null)
                    {
                        parent.Object.SetActive(false);
                    }
                }

                await OnEndOpen();

                var ret = new UIInstance();
                ret.Control = ui;
                ret.Object  = obj;
                ret.Parent  = parent;
                return(ret);
            }
            finally
            {
                UIControlLog.Trace("[ilib-ui] Complete Open:{0}", path);
                EndProcess();
            }
        }
Exemplo n.º 3
0
 protected void EndProcess()
 {
     m_ProcessCount--;
     if (m_ProcessCount == 0)
     {
         UIControlLog.Trace("[ilib-ui] OnEndProcess");
         OnEndProcess();
         while (m_ProcessRequest.Count > 0 && !HasProcess)
         {
             m_ProcessRequest.Dequeue().Invoke();
         }
     }
 }
Exemplo n.º 4
0
        protected async Task <UIInstance> Change <T>(string path, TParam prm, UIInstance parent, UIInstance[] releases) where T : UControl
        {
            UIControlLog.Debug("[ilib-ui] Change:{0}, prm:{1}, parent:{2}", path, prm, parent);

            StartProcess();
            try
            {
                await OnBeginChange();

                var loading = Load <T>(path, prm);

                var close = CloseControls(releases);

                var prefab = await loading;

                if (IsWaitCloseBeforeOnOpen <T>(path, prm))
                {
                    await close;
                }

                var obj = Instantiate(prefab, transform);
                var ui  = obj.GetComponent <T>();

                ui.SetController(this);

                await ui.OnCreated(prm);

                OnOpen(ui);

                await ui.OnFront(open : true);

                if (!close.IsCompleted)
                {
                    await close;
                }

                await OnEndChange();

                var ret = new UIInstance();
                ret.Control = ui;
                ret.Object  = obj;
                ret.Parent  = parent;
                return(ret);
            }
            finally
            {
                UIControlLog.Trace("[ilib-ui] Complete Change:{0}", path);
                EndProcess();
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// IExecuteBackを実装したUIに対してバック処理を行います。
 /// </summary>
 public bool ExecuteBack()
 {
     // 実行中は処理した扱いにする
     if (HasProcess)
     {
         return(true);
     }
     UIControlLog.Trace("[ilib-ui] Do ExecuteBack()");
     return(ExecuteAnyOne <IExecuteBack>(x =>
     {
         var ret = x.TryBack();
         if (ret)
         {
             UIControlLog.Debug("[ilib-ui] ExecuteBack:{0}", x);
         }
         return ret;
     }));
 }
Exemplo n.º 6
0
        protected async Task Close(UIInstance[] releases, UIInstance front = null)
        {
            UIControlLog.Debug("[ilib-ui] Close, next front:{0}", front);
            StartProcess();
            try
            {
                await OnBeginClose();

                var close = CloseControls(releases);

                if (front != null)
                {
                    if (!front.Object.activeSelf)
                    {
                        front.Object.SetActive(true);
                    }
                    if (IsWaitCloseBeforeOnFront(front.Control as UControl))
                    {
                        await close;
                    }
                    await front.Control.OnFront(open : false);
                }

                if (!close.IsCompleted)
                {
                    await close;
                }

                await OnEndClose();
            }
            finally
            {
                UIControlLog.Trace("[ilib-ui] Complete Close");
                EndProcess();
            }
        }