Ejemplo n.º 1
0
 private void CreateTranslationLabel(IFontBuddy font, StackLayout questionStack, Translation translation)
 {
     try
     {
         QuestionWordLabel = new QuestionLabel(false, translation.Word, font, font)
         {
             Vertical         = VerticalAlignment.Center,
             Horizontal       = HorizontalAlignment.Center,
             Highlightable    = false,
             TransitionObject = new WipeTransitionObject(TransitionWipeType.PopTop),
             Scale            = 1.2f,
         };
         QuestionWordLabel.ShrinkToFit(Resolution.TitleSafeArea.Width);
         questionStack.AddItem(QuestionWordLabel);
         questionStack.AddItem(new Shim(0, 8));
     }
     catch (Exception ex)
     {
         ScreenManager.ErrorScreen(ex);
         throw new Exception($"Error creating menu entry for {translation.Word}", ex);
     }
 }
Ejemplo n.º 2
0
        private void AddListenButton(QuestionLabel label, SoundEffect soundEffect)
        {
            //create the button
            var button = new RelativeLayoutButton()
            {
                TransitionObject = new WipeTransitionObject(TransitionWipeType.PopRight, Transition),
                Size             = new Vector2(48f),
                Vertical         = VerticalAlignment.Center,
                Horizontal       = HorizontalAlignment.Right,
                Position         = new Point(Resolution.TitleSafeArea.Right, label.Rect.Center.Y),
                IsQuiet          = true
            };

            //create the image for the button
            var image = new Image(Content.Load <Texture2D>("volume-high"))
            {
                TransitionObject = new WipeTransitionObject(TransitionWipeType.PopRight, Transition),
                Size             = new Vector2(48f),
                Vertical         = VerticalAlignment.Center,
                Horizontal       = HorizontalAlignment.Right,
                Highlightable    = false,
                FillRect         = true
            };

            button.AddItem(image);

            button.OnClick += (obj, e) =>
            {
                //send the listen again message
                QuestionScreen.QuestionStateMachine.SendStateMessage((int)QuestionStateMachine.QuestionMessage.Listen);
                //set the override of the label
                QuestionScreen.SetLabelOverride(label);

                //play the sound
                QuestionScreen.PlaySoundEffect(soundEffect);
            };
            AddItem(button);
        }
Ejemplo n.º 3
0
 public void SetLabelOverride(QuestionLabel label)
 {
     label.OverrideColor = Color.Yellow;
     label.Scale         = 1.5f;
 }