Example #1
0
    // other name candidates ToggleOn, Show, SwitchTo
    public static void Show <T>() where T : UiBehaviour
    {
        CheckAndInit();

        UiBehaviour newUi = Get <T>();

        TabGroup group = tabGroups[newUi.TabGroup];

        group.SwitchTo(newUi);
    }
Example #2
0
 private void ShowNextUi(UiBehaviour nextUi)
 {
     prevUi = currUi;
     currUi = nextUi;
     if (nextUi != null)
     {
         nextUi.RequestShow(EndOfSwitching);
     }
     else
     {
         EndOfSwitching();
     }
 }
Example #3
0
        public void SwitchTo(UiBehaviour nextUi)
        {
            if (state != State.Switch)
            {
                state = State.Switch;

                if (currUi != null)
                {
                    currUi.RequestHide(() => { ShowNextUi(nextUi); });
                }
                else
                {
                    ShowNextUi(nextUi);
                }
            }
            else
            {
                Debug.LogError($"You try switch to ui '{nextUi.GetType().ToString()}' but group '{id.ToString()}' is alredy in switching state.");
            }
        }