Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameScreen"/> class.
        /// </summary>
        /// <param name="screenManager">The <see cref="IScreenManager"/> to add this <see cref="GameScreen"/> to.</param>
        /// <param name="name">Unique name of the screen that can be used to identify and
        /// call it from other screens</param>
        /// <exception cref="ArgumentNullException"><paramref name="screenManager"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="name"/> is null or empty.</exception>
        protected GameScreen(IScreenManager screenManager, string name)
        {
            if (screenManager == null)
                throw new ArgumentNullException("screenManager");
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");

            _screenManager = screenManager;
            _name = name;

            var font = GetScreenManagerFont(ScreenManager) ?? screenManager.DefaultFont;
            _guiManager = ScreenManager.CreateGUIManager(font);

            screenManager.Add(this);
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameScreen"/> class.
        /// </summary>
        /// <param name="screenManager">The <see cref="IScreenManager"/> to add this <see cref="GameScreen"/> to.</param>
        /// <param name="name">Unique name of the screen that can be used to identify and
        /// call it from other screens</param>
        /// <exception cref="ArgumentNullException"><paramref name="screenManager"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="name"/> is null or empty.</exception>
        protected GameScreen(IScreenManager screenManager, string name)
        {
            if (screenManager == null)
            {
                throw new ArgumentNullException("screenManager");
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            _screenManager = screenManager;
            _name          = name;

            var font = GetScreenManagerFont(ScreenManager) ?? screenManager.DefaultFont;

            _guiManager = ScreenManager.CreateGUIManager(font);

            screenManager.Add(this);
        }
Пример #3
0
 protected void AddChild(Screen screen)
 {
     _manager.Add(screen);
 }