Esempio n. 1
0
 protected void HandleParentRouteExit()
 {
     if (activeChild != null)
     {
         activeChild.Exit();
         activeChild = null;
     }
 }
Esempio n. 2
0
        protected void HandleParentRouteUpdate()
        {
            bool wasMatched = IsRouteMatched;

            match = RouteMatch.Match(FullPath, 0, new RouteMatch(parentRoute.CurrentMatch.url));

            if (!wasMatched && match.IsMatch)
            {
                Enter(match);
            }
            else if (wasMatched && !match.IsMatch)
            {
                Exit();
            }
            else if (wasMatched && match.IsMatch)
            {
                RouteMatch route = string.IsNullOrEmpty(path) ? parentRoute.CurrentMatch : CurrentMatch;
                Update(route); // todo -- not sure about this
                RouteElement[] routes = m_ChildRoutes.Array;
                for (int i = 0; i < m_ChildRoutes.Count; i++)
                {
                    RouteMatch childMatch;
                    if (routes[i].TryMatch(route, out childMatch))
                    {
                        if (activeChild == routes[i])
                        {
                            activeChild.Update(childMatch);
                            return;
                        }

                        activeChild?.Exit();
                        activeChild = routes[i];
                        activeChild.Enter(childMatch);
                        onRouteChanged?.Invoke();
                        return;
                    }
                }

                if (activeChild != null)
                {
                    activeChild.Exit();
                    activeChild = null;
                }

                onRouteChanged?.Invoke();
            }
        }