本文整理汇总了C#中Content.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Content.Load方法的具体用法?C# Content.Load怎么用?C# Content.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Content
的用法示例。
在下文中一共展示了Content.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Ball
public Ball(Paddle paddle, Content content, InputCommands inputCommands)
: base(content.Load<Image>("Ball"), Rectangle.Zero)
{
this.paddle = paddle;
UpdateOnPaddle();
fireBallSound = content.Load<Sound>("PaddleBallStart");
collisionSound = content.Load<Sound>("BallCollision");
RegisterFireBallCommand(inputCommands);
}
示例2: Level
public Level(Content content, Renderer renderer, Score score)
{
brickImage = content.Load<Image>("Brick");
explosionImage = content.Load<Image>("Explosion");
explosionSound = content.Load<Sound>("BrickExplosion");
lostBallSound = content.Load<Sound>("LostBall");
this.renderer = renderer;
this.score = score;
Initialize();
}
示例3: RabbitsGrid
public RabbitsGrid(Content content, Renderer renderer, Time time, Score score)
: base(GetColumns(renderer.Screen.Viewport), GetRows(renderer.Screen.Viewport))
{
rabbitImage = content.Load<Image>("Rabbit");
deadRabbitImage = content.Load<Image>("DeadRabbit");
malletHitSound = content.Load<Sound>("MalletHit");
malletBloodImage = content.Load<Image>("BloodSplatter");
this.renderer = renderer;
this.score = score;
this.time = time;
}
示例4: Score
public Score(Content content, ScreenSpace screen)
: base(null, Rectangle.Zero)
{
this.screen = screen;
RenderLayer = MaxRenderLayer;
for (int digit = 0; digit < 10; digit++)
images[digit] = content.Load<Image>(digit.ToString(CultureInfo.InvariantCulture));
images[DollarSign] = content.Load<Image>("Dollar");
images[RabbitKillSign] = content.Load<Image>("DeadRabbit");
digitWidth = images[0].PixelSize.Width / QuadraticFullscreenSize.Width;
}
示例5: Level
public Level(Content content, Renderer renderer, Score score)
{
brickImage = content.Load<Image>("Brick");
explosionImage = content.Load<Image>("Explosion");
explosionSound = content.Load<Sound>("BrickExplosion");
lostBallSound = content.Load<Sound>("LostBall");
this.renderer = renderer;
this.score = score;
Initialize();
renderer.Screen.ViewportSizeChanged += UpdateDrawAreas;
}
示例6: Icon
public Icon(Content content, int iconIndex, ScreenSpace screen)
: base(content.Load<Image>(IconNames[iconIndex]), GetIconDrawArea(iconIndex, screen.Viewport))
{
RenderLayer = MaxRenderLayer - 1;
Color = Color.Gray;
screen.ViewportSizeChanged += () => DrawArea = GetIconDrawArea(iconIndex, screen.Viewport);
}
示例7: BouncingLogo
public BouncingLogo(Content content, Randomizer random)
: base(content.Load<Image>("DeltaEngineLogo"), Rectangle.One, Color.GetRandomColor())
{
DrawArea = Rectangle.FromCenter(Point.Half, new Size(random.Get(0.1f, 0.2f)));
velocity = new Point(random.Get(-0.4f, +0.4f), random.Get(-0.4f, +0.4f));
Rotation = random.Get(0, 360);
rotationSpeed = random.Get(-50, 50);
}
示例8: AddUIRight
private void AddUIRight(Content content, Renderer renderer)
{
var rightImage = content.Load<Image>("UIRight");
rightWidth = rightImage.PixelSize.Width / Score.QuadraticFullscreenSize.Width;
rightBorder = new Sprite(rightImage,
new Rectangle(DrawArea.Right - rightWidth, DrawArea.Top + topHeight, rightWidth,
DrawArea.Height - (bottomHeight + topHeight))) { RenderLayer = ForegroundLayer };
renderer.Add(rightBorder);
}
示例9: Game
public Game(Content content, Renderer renderer, Time time, Score score, RabbitsGrid rabbits)
{
gameOverImage = content.Load<Image>("GameOver");
this.time = time;
this.score = score;
this.renderer = renderer;
this.rabbits = rabbits;
rabbits.InitializeRabbits();
}
示例10: AddUIBottom
private void AddUIBottom(Content content, Renderer renderer)
{
var bottomImage = content.Load<Image>("UIBottom");
bottomHeight = bottomImage.PixelSize.Height / Score.QuadraticFullscreenSize.Height;
bottomBorder = new Sprite(bottomImage,
new Rectangle(DrawArea.Left, DrawArea.Bottom - bottomHeight, DrawArea.Width, bottomHeight))
{
RenderLayer = ForegroundLayer
};
renderer.Add(bottomBorder);
}
示例11: CreateEmptyImage
public void CreateEmptyImage()
{
var resolver = new TestResolver();
resolver.RegisterAllUnknownTypesAutomatically();
var content = new Content(resolver);
Rectangle centered = Rectangle.FromCenter(Point.Half, new Size(0.2f));
var newSprite = new Sprite(content.Load<Image>("test"), centered);
Assert.IsTrue(newSprite.IsVisible);
Assert.AreEqual(centered.Center, newSprite.DrawArea.Center);
Assert.AreEqual(Color.White, newSprite.Color);
}
示例12: AddUITop
private void AddUITop(Content content, Renderer renderer)
{
var topImage = content.Load<Image>("UITop");
topHeight = topImage.PixelSize.Height / Score.QuadraticFullscreenSize.Height;
topBorder = new Sprite(topImage,
new Rectangle(DrawArea.Left, DrawArea.Top, DrawArea.Width, topHeight))
{
RenderLayer = ForegroundLayer
};
renderer.Add(topBorder);
}
示例13: CreateEmptyAnimatedSprite
public void CreateEmptyAnimatedSprite()
{
var resolver = new TestResolver();
resolver.RegisterAllUnknownTypesAutomatically();
var content = new Content(resolver);
Rectangle centered = Rectangle.FromCenter(Point.Half, new Size(0.2f));
var redFrames = new[] { new Point(1.0f, 0), new Point(2.0f, 0), new Point(3.0f, 0),
new Point(4.0f, 0) };
var animatedSprite = new AnimatedSprite(content.Load<Image>("test"), centered, Color.Blue,
32, 32, 4, redFrames);
Assert.AreEqual(centered.Center, animatedSprite.DrawArea.Center);
Assert.AreEqual(Color.Blue, animatedSprite.Color);
}
示例14: UI
public UI(ItemHandler items, Score score, Content content, Renderer renderer, Window window,
InputCommands inputCommands)
: base(content.Load<Image>("GrassBackground"), renderer.Screen.Viewport)
{
window.ShowCursor = false;
window.Title = "Game Of Death - Kill rabbits before they occupy more than 75% of the world!";
inputCommands.Add(Key.Escape, window.Dispose);
RenderLayer = MinRenderLayer;
AddUITop(content, renderer);
AddUIBottom(content, renderer);
AddUILeft(content, renderer);
AddUIRight(content, renderer);
renderer.Screen.ViewportSizeChanged += () => Update(renderer);
}
示例15: Paddle
public Paddle(Content content, InputCommands inputCommands, Time time)
: base(content.Load<Image>("Paddle"), Rectangle.FromCenter(Point.Half, Size.Zero))
{
RegisterInputCommands(inputCommands, time);
}