示例#1
0
 private void initTexts(out StrokeSpriteFont o_SpriteText, string i_Text, Vector2 i_Position)
 {
     o_SpriteText = new StrokeSpriteFont(k_FontName, string.Format(i_Text, SecondsLeft), this);
     o_SpriteText.Initialize();
     o_SpriteText.PositionOrigin = o_SpriteText.SourceRectangleCenter;
     o_SpriteText.RotationOrigin = o_SpriteText.SourceRectangleCenter;
     o_SpriteText.Position       = i_Position;
 }
 private void positionResult(string i_ResultText, GameScreen i_GameScreen)
 {
     m_Result = new StrokeSpriteFont(i_ResultText, i_GameScreen);
     m_Result.Initialize();
     m_Result.PositionOrigin = m_Result.SourceRectangleCenter;
     m_Result.RotationOrigin = m_Result.SourceRectangleCenter;
     m_Result.Position       = ResultPosition;
     i_GameScreen.Add(m_Result);
 }
示例#3
0
 public PauseScreen(Game i_Game)
     : base(i_Game)
 {
     r_InputManager          = this.Game.Services.GetService(typeof(IInputManager)) as IInputManager;
     r_ResumeText            = new StrokeSpriteFont(k_PauseMsg, this);
     this.IsOverlayed        = true;
     this.BlackTintAlpha     = k_BlackTintAlpha;
     this.UseFadeTransition  = true;
     this.ActivationLength   = TimeSpan.FromSeconds(k_ActivationLength);
     this.DeactivationLength = TimeSpan.FromSeconds(k_DeactivationLength);
     this.BlendState         = BlendState.NonPremultiplied;
     this.Add(r_ResumeText);
 }
示例#4
0
        public MenuItem(StrokeSpriteFont i_StrokeSpriteFont, GameScreen i_GameScreen, Menu i_LinkedMenu = null, Action <MenuItem> i_CheckMosueOrKBState = null)
            : base(string.Empty, i_GameScreen)
        {
            r_CheckMouseOrKBState = i_CheckMosueOrKBState;
            r_InputManager        = this.Game.Services.GetService(typeof(IInputManager)) as IInputManager;
            r_KeysToActions       = new List <KeyValuePair <Keys, Action <MenuItem> > >();
            r_ButtonsToActions    = new List <KeyValuePair <eInputButtons, Action <MenuItem> > >();

            this.StrokeSpriteFont = i_StrokeSpriteFont;
            this.VisibleChanged  += menuItem_VisibleChanged;
            this.LinkedMenu       = i_LinkedMenu;
            this.BlendState       = BlendState.NonPremultiplied;
        }
示例#5
0
        protected Menu(StrokeSpriteFont i_Title, GameScreen i_GameScreen)
            : base(string.Empty, i_GameScreen)
        {
            r_Options      = new List <MenuItem>();
            r_InputManager = this.Game.Services.GetService(typeof(IInputManager)) as IInputManager;
            r_SoundManager = this.Game.Services.GetService(typeof(SoundManager)) as ISoundManager;

            this.VisibleChanged += menu_VisibleChanged;
            this.BlendState      = BlendState.NonPremultiplied;
            this.GameSettings    = this.Game.Services.GetService(typeof(IGameSettings)) as IGameSettings;
            this.Title           = i_Title;
            this.Title.Visible   = false;

            i_GameScreen.Add(this);
            i_GameScreen.Add(Title);
        }
示例#6
0
        public override void Initialize()
        {
            if (!IsInitialized)
            {
                base.Initialize();

                IsInitialized = true;

                if (!StrokeSpriteFont.IsInitialized)
                {
                    StrokeSpriteFont.Initialize();
                }

                StrokeSpriteFont.Animations.Add(new PulseAnimator(TimeSpan.Zero, k_TargetScale, k_PulsePerSec));
                StrokeSpriteFont.Animations.Add(new WaypointsAnimator(100, TimeSpan.FromSeconds(0.2f), false, this.Position + new Vector2(-10, 0)));
                StrokeSpriteFont.Animations.Enabled = false;
            }
        }
示例#7
0
        public void AddMenuItem(StrokeSpriteFont i_Text, Action <MenuItem> i_CheckMouseOrKBState = null, Menu i_LinkedMenu = null)
        {
            MenuItem actionItem = new MenuItem(i_Text, this.GameScreen, i_LinkedMenu, i_CheckMouseOrKBState);

            AddMenuItem(actionItem);
        }
示例#8
0
 public SubMenu(StrokeSpriteFont i_Title, Menu i_PrevMenu, GameScreen i_GameScreen)
     : base(i_Title, i_GameScreen)
 {
     setPositionAndPrevMenu(i_PrevMenu);
 }