public override SCNScene GetInitialScene()
        {
            Panels = SCNScene.FromFile("art.scnassets/basic-panels.scn")
                     .RootNode
                     .ChildNodes
                     .Where(x => x.Name.StartsWith("m"))
                     .ToDictionary(x => x.Name);

            foreach (var pf in Panels.Values)
            {
                pf.RemoveFromParentNode();
                pf.Scale = new SCNVector3(pf.Scale.X * .1f, pf.Scale.Y * .1f, pf.Scale.Z * .1f);
            }

            TitleDialog = new EBTextDialogViewController(24);
            TitleDialog.Label.TextAlignment = UITextAlignment.Center;

            InfoDialog = new EBTextDialogViewController(24);
            InfoDialog.Label.TextAlignment = UITextAlignment.Center;

            View.AddSubview(InfoDialog.View);
            View.AddSubview(TitleDialog.View);

            View.AddConstraints(new[]
            {
                NSLayoutConstraint.Create(TitleDialog.View, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0),
                NSLayoutConstraint.Create(TitleDialog.View, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, InfoDialog.View, NSLayoutAttribute.Top, 1, -65),
                NSLayoutConstraint.Create(TitleDialog.View, NSLayoutAttribute.Width, NSLayoutRelation.LessThanOrEqual, View, NSLayoutAttribute.Width, 1, -125),

                NSLayoutConstraint.Create(InfoDialog.View, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0),
                NSLayoutConstraint.Create(InfoDialog.View, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterY, 1, 0),
                NSLayoutConstraint.Create(InfoDialog.View, NSLayoutAttribute.Width, NSLayoutRelation.LessThanOrEqual, View, NSLayoutAttribute.Width, 1, -40),
            });
            InfoDialog.View.Transform   = CGAffineTransform.MakeTranslation(0, View.Frame.Height);
            TitleDialog.View.Transform  = CGAffineTransform.MakeTranslation(0, View.Frame.Height);
            InfoDialog.Label.TextColor  = UIColor.White;
            TitleDialog.Label.TextColor = UIColor.White;

            return(base.GetInitialScene());
        }
Ejemplo n.º 2
0
        private async Task DisplayPreparePrompt()
        {
            var text = new EBTextDialogViewController(36);

            text.View.TranslatesAutoresizingMaskIntoConstraints = false;
            text.AddToView(View,
                           NSLayoutConstraint.Create(text.View, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterY, 1, -20),
                           NSLayoutConstraint.Create(text.View, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0),
                           NSLayoutConstraint.Create(text.View, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, View, NSLayoutAttribute.Leading, 1, 40)
                           );

            var offScreen = CGAffineTransform.MakeTranslation(0, View.Frame.Height);
            var onScreen  = CGAffineTransform.MakeIdentity();

            text.View.Transform = offScreen;
            await UIView.AnimateAsync(.15, () => text.View.Transform = onScreen);

            await text.Label.SetTextAnimated(GetPrepareText());

            await _pendingTouchCompleter.Task;
            await UIView.AnimateAsync(.15, () => text.View.Transform = offScreen);

            text.View.RemoveFromSuperview();
        }