Beispiel #1
0
        /// <summary>
        /// This method gets called when this menu entry is selected.
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        public void OnAnswer(object obj, ClickEventArgs e)
        {
            if (!QuestionAnswered)
            {
                _chosenAnswer = true;

                //Set the display color to the correct
                if (IsCorrectAnswer)
                {
                    //Set the font buddy to shaky text
                    Font = new PulsateBuddy()
                    {
                        PulsateSize  = 4.0f,
                        PulsateSpeed = 12.0f,
                        Font         = FontBuddy
                    };

                    CurrentColor = CorrectColor;
                }
                else
                {
                    //Set the font buddy to "wrong" text
                    Font = new WrongTextBuddy()
                    {
                        Font = FontBuddy
                    };

                    CurrentColor = WrongColor;
                }
            }
        }
Beispiel #2
0
        protected void InitializeFonts(ContentManager content)
        {
            switch (FontSize)
            {
            case FontSize.Large:
            {
                Font = new FontBuddy()
                {
                    Font = content.Load <SpriteFont>(StyleSheet.LargeFontResource)
                };
                HighlightedFont = new PulsateBuddy()
                {
                    Font = content.Load <SpriteFont>(StyleSheet.LargeFontResource)
                };
            }
            break;

            case FontSize.Medium:
            {
                Font = new ShadowTextBuddy()
                {
                    ShadowSize   = 1.0f,
                    ShadowOffset = new Vector2(7.0f, 7.0f),
                    Font         = content.Load <SpriteFont>(StyleSheet.MediumFontResource)
                };
                HighlightedFont = new PulsateBuddy()
                {
                    ShadowSize   = 1.0f,
                    ShadowOffset = new Vector2(7.0f, 7.0f),
                    Font         = content.Load <SpriteFont>(StyleSheet.MediumFontResource)
                };
            }
            break;

            default:
            {
                if (StyleSheet.SmallFontHasShadow)
                {
                    Font = new ShadowTextBuddy()
                    {
                        ShadowSize   = 1.0f,
                        ShadowOffset = new Vector2(3.0f, 4.0f),
                        Font         = content.Load <SpriteFont>(StyleSheet.SmallFontResource),
                    };
                }
                else
                {
                    Font = new FontBuddy()
                    {
                        Font = content.Load <SpriteFont>(StyleSheet.SmallFontResource),
                    };
                }

                HighlightedFont = new PulsateBuddy()
                {
                    ShadowSize   = 1.0f,
                    ShadowOffset = new Vector2(3.0f, 4.0f),
                    Font         = content.Load <SpriteFont>(StyleSheet.SmallFontResource),
                };
            }
            break;
            }
        }