当前位置: 首页>>代码示例>>C#>>正文


C# Game.GetType方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Game.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Game.GetType方法的具体用法?C# Game.GetType怎么用?C# Game.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Game的用法示例。


在下文中一共展示了Game.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RainMaker

 public RainMaker(Game game)
     : base(game)
 {
     terrariaAssembly = Assembly.GetAssembly(game.GetType());
     main = terrariaAssembly.GetType("Terraria.Main");
     worldGen = terrariaAssembly.GetType("Terraria.WorldGen");
 }
开发者ID:RomSteady,项目名称:RomTerraria,代码行数:7,代码来源:RainMaker.cs

示例2: BindGame

        /// <summary>
        /// Binds the game into the kernel.
        /// </summary>
        /// <param name="game">The game.</param>
        /// <param name="kernel">The kernel to bind into.</param>
        /// <param name="bindGraphicsDevice">if set to <c>true</c> binds game.GraphicsDevice.</param>
        /// <param name="bindContentManager">if set to <c>true</c> binds game.Content.</param>
        /// <param name="bindServiceContainer">if set to <c>true</c> binds game.Services.</param>
        public static void BindGame(Game game, IKernel kernel, bool bindGraphicsDevice = true, bool bindContentManager = true, bool bindServiceContainer = true, bool bindComponentCollection = true)
        {
            // bind the game to a singleton instance
            var thisType = game.GetType();
            kernel.Bind(thisType).ToConstant(game);
            kernel.Bind<Game>().ToConstant(game);

            // bind the graphics device
            if (bindGraphicsDevice)
                kernel.Bind<GraphicsDevice>().ToMethod(c => game.GraphicsDevice);

            // bind the content manager
            if (bindContentManager)
                kernel.Bind<ContentManager>().ToMethod(c => game.Content);

            // bind services
            if (bindServiceContainer)
            {
                kernel.Bind<GameServiceContainer>().ToMethod(c => game.Services);
                kernel.Bind<IServiceProvider>().ToMethod(c => game.Services);
            }

            if (bindComponentCollection)
            {
                kernel.Bind<GameComponentCollection>().ToMethod(c => game.Components);
            }
        }
开发者ID:ylyking,项目名称:Myre,代码行数:35,代码来源:NinjectKernel.cs

示例3: GamePlayScreen

        public GamePlayScreen(Game game, GameStateManager manager)
            : base(game, manager)
        {
            if (!(game is MainGame))
                throw new Exception("GamePlayScreen constructor: Param 'game' is of type " + game.GetType() + "!");

            Log.Info("Setting game world...");
            World = ((MainGame) game).World;
        }
开发者ID:Sharparam,项目名称:DiseasedToast,代码行数:9,代码来源:GamePlayScreen.cs

示例4: GamerServicesComponent

		public GamerServicesComponent(Game game)
			: base(game)
		{
#if WINDOWS_PHONE
            var assembly = game.GetType().Assembly;
            if (assembly != null)
            {
                object[] objects = assembly.GetCustomAttributes(typeof(System.Runtime.InteropServices.GuidAttribute), false);
                if (objects.Length > 0)
                {
                    MonoGamerPeer.applicationIdentifier = ((System.Runtime.InteropServices.GuidAttribute)objects[0]).Value;
                }
            }
#endif
			Guide.Initialise(game);
			
		}
开发者ID:GhostTap,项目名称:MonoGame,代码行数:17,代码来源:GamerServicesComponent.cs


注:本文中的Microsoft.Xna.Framework.Game.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。