// Function to choose the view to show protected void DoRouting() { // First disable all the views if (routerMode == RouterMode.Disable) { Disable(); } else if (routerMode == RouterMode.Hide) { Hide(); } else { Erase(); } // By default the route is the default view REcanvas canvas = defaultRouteCanvas; // If other default view is set, that will be if (!String.IsNullOrEmpty(defaultRoute)) { if (routes.ContainsKey(defaultRoute)) { canvas = routes[defaultRoute]; } } // Is the route requested exist, that will be var peek = "Default"; if (statesQueue.Count() > 0) { peek = statesQueue.Peek(); if (routes.ContainsKey(statesQueue.Peek())) { canvas = routes[statesQueue.Peek()]; } } try { // Show the view if is hidded or disabled canvas.Draw(); canvas.Enable(); canvas.Show(); if (inDontDestroyOnLoad) { canvas.ToDontDestroyOnLoad(); } } catch (Exception e) { Debug.LogError("ReactorRouter: Error while rounting to :" + peek + " , " + e); } }
// Function to draw all the views, but hidded public void PreDraw() { // Only can be called before any route if (statesQueue.Count() > 0) { return; } if (routes == null) { return; } foreach (var urcanvas in routes) { if (urcanvas.Value == null) { continue; } urcanvas.Value.Draw(); if (inDontDestroyOnLoad) { urcanvas.Value.ToDontDestroyOnLoad(); } } defaultRouteCanvas.Draw(); if (inDontDestroyOnLoad) { defaultRouteCanvas.ToDontDestroyOnLoad(); } Hide(); //if (routerMode == RouterMode.Disable) // Disable(); //else if (routerMode == RouterMode.Hide) // Hide(); //else // Erase(); }