Esempio n. 1
0
        public static Option <T> SwitchPerspective <T>(this IPerspectiveSwitcher control)
            where T : IPerspectiveView
        {
            Ensure.That(control, nameof(control)).IsNotNull();

            var perspective = control.Perspectives.OfType <T>().Find(p => p.Valid && !p.Active);

            perspective.Iter(p => control.Perspective = p);

            return(perspective);
        }
Esempio n. 2
0
        public static T SwitchPerspective <T>([NotNull] this IPerspectiveSwitcher control) where T : IPerspectiveView
        {
            Ensure.Any.IsNotNull(control, nameof(control));

            var perspective = control.Perspectives.OfType <T>().FirstOrDefault(p => p.Valid && !p.Active);

            if (perspective != null)
            {
                control.Perspective = perspective;
            }

            return(perspective);
        }
Esempio n. 3
0
 public static Option <IThirdPersonView> SwitchToThirdPerson(this IPerspectiveSwitcher control) =>
 SwitchPerspective <IThirdPersonView>(control);
Esempio n. 4
0
 public static IThirdPersonView SwitchToThirdPerson([NotNull] this IPerspectiveSwitcher control) =>
 SwitchPerspective <IThirdPersonView>(control);
Esempio n. 5
0
 public static IFirstPersonView SwitchToFirstPerson([NotNull] this IPerspectiveSwitcher control) =>
 SwitchPerspective <IFirstPersonView>(control);