public void SwitchNavController <T>(CONTROLLER_TYPE controllerType) where T : UIViewControllerBase { UIViewControllerBase reportExit = null; UIViewControllerBase reportEntry = null; if (controllerType == CONTROLLER_TYPE.ALL) { foreach (var item in _currentNav) { if (item.Value != null) { item.Value.OnNavigationExit(); } } } else if (_currentNav.ContainsKey(controllerType) && _currentNav[controllerType] != null) { reportExit = _currentNav[controllerType]; } var temp = GetNav <T>(controllerType); if (temp != null) { OnNavLog?.Invoke(temp); reportEntry = temp; var doReportEntry = true; if (_currentNav.ContainsKey(temp.controllerType) && _currentNav[temp.controllerType] != null) { doReportEntry = _currentNav[temp.controllerType].controllerId != reportEntry.controllerId; } _currentNav[controllerType] = null; _currentNav[temp.controllerType] = temp; if (doReportEntry) { if (reportExit != null) { reportExit.OnNavigationExit(); } if (reportEntry != null) { reportEntry.OnNavigationEnter(); } } else { Debug.Log($"NavController Already Active {temp.name}"); } } else { if (reportExit != null) { reportExit.OnNavigationExit(); } _currentNav[controllerType] = null; } }
public BaseController(CONTROLLER_TYPE Type, CONTROLLER_MODE Mode) { type = Type; mode = Mode; }