本文整理汇总了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");
}
示例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);
}
}
示例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;
}
示例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);
}