コード例 #1
0
        /// <summary>
        /// Adds a new view to this GameState
        /// </summary>
        /// <typeparam name="ViewType">The type of view</typeparam>
        /// <param name="viewName">The name of the view</param>
        /// <param name="priority">The view's priority</param>
        /// <returns>The created view</returns>
        public ViewType AddView <ViewType>(string viewName, GameViewPriority priority = GameViewPriority.Normal, bool active = true) where ViewType : IGameView, new()
        {
            ViewType newView = new ViewType();

            newView.Added(StateManager.GameManager, viewName);
            newView.IsActive = active;
            Add(newView);

            return(newView);
        }
コード例 #2
0
        /// <summary>
        /// Adds a view of the specified type, using the type's name as the view name
        /// </summary>
        /// <typeparam name="ViewType">The type of view</typeparam>
        /// <param name="priority">The priority of the view</param>
        /// <param name="active">Whether or not this view is active</param>
        /// <returns></returns>
        public ViewType AddView <ViewType>(GameViewPriority priority = GameViewPriority.Normal, bool active = true) where ViewType : IGameView, new()
        {
            ViewType newView = new ViewType();

            newView.SetParentState(this);
            newView.Added(StateManager.GameManager, newView.GetType().Name);
            Add(newView);

            return(newView);
        }
コード例 #3
0
        public SingletonViewType AddSingletonView <SingletonViewType>(GameViewPriority priority = GameViewPriority.Normal, bool active = true) where SingletonViewType : GameViewSingleton <SingletonViewType>, new()
        {
            SingletonViewType view = GameViewSingleton <SingletonViewType> .Instance;

            // TODO: Fix this shit, add IsInitialized stuffs.

            if (view.Id == null)
            {
                view.Added(StateManager.GameManager, view.GetType().Name);
            }

            Add(view);

            return(view);
        }