public override IEnumerator Enter(Oui from) { // start running Enter, so that the menu is initialized IEnumerator enterEnum = base.Enter(from); if (enterEnum.MoveNext()) { yield return(enterEnum.Current); } if (savedMenuIndex != -1 && currentMenu != null && (from.GetType() == typeof(OuiRandomizerOptions) || from.GetType() == typeof(OuiCategorySubmenu))) { // restore selection if coming from submenu currentMenu.Selection = savedMenuIndex; currentMenu.Position.Y = currentMenu.ScrollTargetY; } // finish running Enter while (enterEnum.MoveNext()) { yield return(enterEnum.Current); } }
public override IEnumerator Enter(Oui from) { ReloadMenu(); // restore selection if coming from a submenu. if (savedMenuIndex != -1 && typeof(ISubmenu).IsAssignableFrom(from.GetType())) { menu.Selection = Math.Min(savedMenuIndex, menu.LastPossibleSelection); menu.Position.Y = menu.ScrollTargetY; } menu.Visible = Visible = true; menu.Focused = false; for (float p = 0f; p < 1f; p += Engine.DeltaTime * 4f) { menu.X = offScreenX + -1920f * Ease.CubeOut(p); alpha = Ease.CubeOut(p); yield return(null); } menu.Focused = true; }