Exemple #1
0
 void CanvasSetState(UICanvasBase obj, bool active)
 {
     if (active)
     {
         obj.ChengeUIState(UICanvasBase.UISTATE.ACTIVE);
     }
     else
     {
         obj.ChengeUIState(UICanvasBase.UISTATE.CLOSE);
     }
 }
Exemple #2
0
 public override void AddCanvas(UICanvasBase target)
 {
     if (_openCanvasHirtory.Count > 0)
     {
         var head = _openCanvasHirtory.Peek();
         head.ChengeUIState(UICanvasBase.UISTATE.SLEEP);
     }
     CanvasSetState(target, true);
     target.GetComponent <Canvas>().sortingOrder = CaluculateNextSortOrder();
     _openCanvasHirtory.Push(target);
 }
Exemple #3
0
 //実際に遷移を実行する
 void RunTransition(UICanvasBase chengeUI, bool selfActive)
 {
     if (selfActive)
     {
         _uiCtrl.AddCanvas(chengeUI);
     }
     else
     {
         //_uiCtrl.CloseToNextCanvas(chengeUI);
         _uiCtrl.CloseAndAddCanvas(chengeUI);
     }
 }
Exemple #4
0
        public override void AddCanvas(UICanvasBase target)
        {
            if (_openCanvasHirtory.Count > 0)
            {
                var head = _openCanvasHirtory.Peek();
                head.ChengeUIState(UICanvasBase.UISTATE.SLEEP);
            }

            target.gameObject.SetActive(true);
            _openCanvasHirtory.Push(target);
            target.ChengeUIState(UICanvasBase.UISTATE.ACTIVE);
        }
        //UIのグループを閉じて別のUIを開く という動きをしたいができない
        public void CloseAndAddCanvas(UICanvasBase nextCanvas)
        {
            var impl = (DefaultCanvasImpl)_uiCvImpl;

            if (impl.ContaintHitory(nextCanvas))
            {
                CloseToNextCanvas(nextCanvas);
            }
            else
            {
                CloseCanvas(impl._historyTop);
                AddCanvas(nextCanvas);
            }
        }
Exemple #6
0
 public override void CloseCanvas(UICanvasBase nextCanvas, bool lastOpen)
 {
     if (_openCanvasHirtory.Contains(nextCanvas))
     {
         while (true)
         {
             //nextCanvasより上の階層のものをすべて閉じる
             //lastOpen=falseならnextCanvasも閉じる
             var next = _openCanvasHirtory.Peek();
             if (next != nextCanvas)
             {
                 _openCanvasHirtory.Pop();
                 next.gameObject.SetActive(false);
                 next.ChengeUIState(UICanvasBase.UISTATE.CLOSE);
             }
             else if (next == nextCanvas && !lastOpen)
             {
                 _openCanvasHirtory.Pop();
                 next.gameObject.SetActive(false);
                 next.ChengeUIState(UICanvasBase.UISTATE.CLOSE);
                 break;
             }
             else if (next == nextCanvas && lastOpen)
             {
                 next.ChengeUIState(UICanvasBase.UISTATE.ACTIVE);
                 break;
             }
         }
     }
     else
     {
         //閉じるものがスタックにないときのエラー
         //わかりやすいエラーコードにしたい
         Debug.Log("DefaultCanvasImpl error");
         return;
     }
 }
Exemple #7
0
 public override void CloseCanvas(UICanvasBase nextCanvas)
 {
     if (_openCanvasHirtory.Contains(nextCanvas))
     {
         while (true)
         {
             //nextCanvasより上の階層のものをすべて閉じる
             //lastOpen=falseならnextCanvasも閉じる
             var topCanvas = _openCanvasHirtory.Pop();
             CanvasSetState(topCanvas, false);
             if (topCanvas == nextCanvas)
             {
                 break;
             }
         }
     }
     else
     {
         //閉じるものがスタックにないときのエラー
         //わかりやすいエラーコードにしたい
         Debug.Log("DefaultCanvasImpl error");
         return;
     }
 }
 void SetSortOrder(UICanvasBase target, int order)
 {
     target.SelfCanvas.sortingOrder = order;
 }
Exemple #9
0
 public DefaultCanvasImpl(UICanvasBase firstCanvas) : base(firstCanvas)
 {
 }
Exemple #10
0
 //履歴stackに含まれているかどうか
 public bool ContaintHitory(UICanvasBase target)
 {
     return(_openCanvasHirtory.Contains(target));
 }
Exemple #11
0
 //履歴にあるキャンバスまで閉じる
 //lastOpen=trueならnextCanvasは閉じない
 public abstract void CloseCanvas(UICanvasBase nextCanvas, bool lastOpen);
Exemple #12
0
        //現在のキャンバスを閉じて別のものを開く ができない

        //キャンバスを開く処理
        public abstract void AddCanvas(UICanvasBase target);
Exemple #13
0
 //コンストラクタなくてもいいかも
 public UICanvasOpenImplementor(UICanvasBase firstCanvas)
 {
     AddCanvas(firstCanvas);
 }
 public void CloseToNextCanvas(UICanvasBase nextCanvas)
 {
     _uiCvImpl.CloseCanvas(nextCanvas, lastOpen: true);
 }
 public void CloseCanvas(UICanvasBase target)
 {
     _uiCvImpl.CloseCanvas(target, lastOpen: false);
 }
 public void AddCanvas(UICanvasBase target)
 {
     SetSortOrder(target, _uiCvImpl.CaluculateNextSortOrder());
     _uiCvImpl.AddCanvas(target);
 }
 //履歴にあるキャンバスまで閉じる
 //lastOpen=trueならnextCanvasは閉じない
 public abstract void CloseCanvas(UICanvasBase nextCanvas);