本文整理汇总了C#中Page.Show方法的典型用法代码示例。如果您正苦于以下问题:C# Page.Show方法的具体用法?C# Page.Show怎么用?C# Page.Show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page.Show方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public override void Initialize()
{
base.Initialize();
new AssetCollector(this);
GetService<AssetCollector>().LoadXML(@"Content/AsteroidsGame/assets.xml");
//Change bgcolor to black
EntityGame.BackgroundColor = Color.Black;
EntityGame.DebugInfo.Color = Color.White;
_player = new PlayerShip(this, "PlayerShip");
//SpawnAsteroids(5);
//TEST ASTEROIDS
var a = new Asteroid(this, "Asteroid1");
a.Body.Position = new Vector2(300, 100);
a.Physics.AddForce(-a.Physics.Force);
var b = new Asteroid(this, "Asteroid2");
b.Body.Position = new Vector2(100, 100);
b.Physics.AddForce(-b.Physics.Force);
b.Physics.AddForce(30, 0);
Page p = new Page(this, "Page");
p.Show();
_statusLabel = new Label(p, "StatusLabel", new Point(0, 0));
_statusLabel.Color = Color.White;
_statusLabel.Visible = false;
}
示例2: Initialize
public override void Initialize()
{
base.Initialize();
new ControlHandler(this);
_collided = new SortedSet<string>();
Page p = new Page(this, "Page");
p.Show();
_collidedLabel = new Label(p, "CollidedLabel", new Point(0, 0));
_collidedLabel.Body.Position = new Vector2(10, 560);
for (int x = 0; x < 3; x++)
{
ResolutionTestNode c = new ResolutionTestNode(this, "A" + x);
c.Collision.Group.AddMask(0);
c.Collision.Pair.AddMask(0);
c.Collision.Pair.AddMask(2);
c.Collision.ResolutionGroup.AddMask(0);
c.Collision.ResolutionGroup.AddMask(1);
c.Collision.ResolutionGroup.AddMask(2);
c.Collision.CollideEvent +=
manifold =>
_collided.Add(manifold.A != c.Collision ? manifold.A.Parent.Name : manifold.B.Parent.Name);
c.Collision.Debug = true;
c.Body.Position = new Vector2(30, 80 * x + 20);
}
for (int x = 0; x < 3; x++)
{
ResolutionTestNode c = new ResolutionTestNode(this, "B" + x);
c.Collision.Group.AddMask(1);
c.Collision.Pair.AddMask(0);
c.Collision.Pair.AddMask(2);
c.Collision.ResolutionGroup.AddMask(0);
c.Collision.CollideEvent += manifold => _collided.Add(manifold.A != c.Collision ? manifold.A.Parent.Name : manifold.B.Parent.Name);
c.Collision.Debug = true;
c.Body.Position = new Vector2(510, 80 * x + 20);
c.Color = Color.Orange;
c.HoverColor = Color.Violet;
}
for (int x = 0; x < 3; x++)
{
ResolutionTestNode c = new ResolutionTestNode(this, "C" + x);
c.Collision.Group.AddMask(2);
c.Collision.Pair.AddMask(0);
c.Collision.Pair.AddMask(1);
c.Collision.ResolutionGroup.AddMask(0);
c.Collision.ResolutionGroup.AddMask(1);
c.Collision.CollideEvent += manifold => _collided.Add(manifold.A != c.Collision ? manifold.A.Parent.Name : manifold.B.Parent.Name);
c.Collision.Immovable = true;
c.Collision.Debug = true;
c.Body.Position = new Vector2(50 + x * 70, 450);
c.Color = Color.Green;
c.HoverColor = Color.DarkBlue;
}
}
示例3: Initialize
public override void Initialize()
{
base.Initialize();
ControlHandler ch = new ControlHandler(this);
Page page = new Page(this, "Page");
page.Show();
//Add our labels to the top
_drawingtoolsTitle = new Label(page, "drawingtoolsTitle", new Point(0, 0));
_drawingtoolsTitle.Text = "DrawingTools.Primitives";
_drawingtoolsTitle.Body.Position = new Vector2(EntityGame.Viewport.Width / 4 - _drawingtoolsTitle.Render.DrawRect.Width / 2, 15);
_renderTitle = new Label(page, "renderTitle", new Point(1, 0));
_renderTitle.Text = "Rendering.Primitives";
_renderTitle.Body.Position = new Vector2(EntityGame.Viewport.Width - (EntityGame.Viewport.Width / 4) - _renderTitle.Render.DrawRect.Width / 2, 15);
_middleLine = new DrawingTools.Line(new Vector2(EntityGame.Viewport.Width / 2f, 10), new Vector2(EntityGame.Viewport.Width / 2f, EntityGame.Viewport.Height - 10));
//Setup our prmitives
_r1 = new DrawingTools.Rectangle(20, 40, 260, 60);
_r1.Color = Color.Salmon;
_r1.Fill = true;
//Horizontal Lines
_lx1 = new DrawingTools.Line(new Vector2(20, 105), new Vector2(270, 105), Color.Red);
_lx1.Thickness = 1;
_lx2 = new DrawingTools.Line(new Vector2(20, 110), new Vector2(270, 110), Color.Orange);
_lx2.Thickness = 2;
_lx3 = new DrawingTools.Line(new Vector2(20, 115), new Vector2(270, 115), Color.Yellow);
_lx3.Thickness = 3;
_ly1 = new DrawingTools.Line(new Vector2(270, 120), new Vector2(270, 290), Color.MediumPurple);
_ly1.Thickness = 1;
_ly2 = new DrawingTools.Line(new Vector2(275, 120), new Vector2(275, 290), Color.DodgerBlue);
_ly2.Thickness = 2;
_ly3 = new DrawingTools.Line(new Vector2(280, 120), new Vector2(280, 290), Color.LawnGreen);
_ly3.Thickness = 3;
//Add component based classes
new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 75, 200, 30, 30, false, 3);
new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 75, 200, 30, 30, false, 2);
new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 75, 200, 30, 30, false, 1);
new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 150 + 75, 200, 30, 30, true);
new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 75, 300, 70, 30, false, 3);
new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 75, 300, 70, 30, false, 2);
new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 75, 300, 70, 30, false, 1);
new SpinningRect(this, "Spinning", EntityGame.Viewport.Width / 2f + 150 + 75, 300, 30, 70, true);
}
示例4: Initialize
public override void Initialize()
{
base.Initialize();
ControlHandler ch = new ControlHandler(this);
_collided = new SortedSet<string>();
Page p = new Page(this, "Page");
p.Show();
_collidedLabel = new Label(p, "CollidedLabel", new Point(0, 0));
_collidedLabel.Body.Position = new Vector2(10, 500);
Random rand = new Random();
for (int x = 0; x < 3; x++)
{
AabbNode c = new AabbNode(this, "A" + x);
c.Collision.Group.AddMask(0);
c.Collision.Pair.AddMask(0);
c.Collision.CollideEvent += manifold => _collided.Add(manifold.A != c.Collision ? manifold.A.Parent.Name : manifold.B.Parent.Name);
c.Collision.Debug = true;
c.Body.Position = new Vector2(0, 100 * x + 20);
c.Shape.Debug = true;
}
for (int x = 0; x < 3; x++)
{
AabbNode c = new AabbNode(this, "B" + x);
c.Collision.Group.AddMask(1);
c.Collision.Pair.AddMask(0);
c.Collision.CollideEvent += manifold => _collided.Add(manifold.A != c.Collision ? manifold.A.Parent.Name : manifold.B.Parent.Name);
c.Body.Position = new Vector2(510, 80 * x + 20);
c.Color = Color.Orange;
c.HoverColor = Color.Black;
c.Collision.Debug = true;
}
for (int x = 0; x < 3; x++)
{
CircleNode c = new CircleNode(this, "C" + x);
c.Collision.Group.AddMask(2);
c.Collision.Pair.AddMask(2);
c.Collision.CollideEvent += manifold => _collided.Add(manifold.A != c.Collision ? manifold.A.Parent.Name : manifold.B.Parent.Name); ;
c.Body.Position = new Vector2(80 * x + 20, 300);
c.Color = Color.LightBlue;
c.HoverColor = Color.DarkRed;
c.Shape.Debug = true;
}
}
示例5: Initialize
public override void Initialize()
{
base.Initialize();
int maxx = EntityGame.Viewport.Width / _size.X + 1;
int maxy = EntityGame.Viewport.Height / _size.Y + 1;
_hsv = new HSVTilemap(this, "tiles", new Point(maxx, maxy));
_hsv.Render.Scale = new Vector2(_size.X, _size.Y);
_xyz = new XYZTilemap(this, "tiles", new Point(maxx, maxy));
_xyz.Render.Scale = new Vector2(_size.X, _size.Y);
_xyz.Active = false;
_xyz.Visible = false;
Page p = new Page(this, "Page");
p.Show();
_label = new FadeOutLabel(p, "FadeOutLabel", new Point(0, 0));
_label.Text = "HSV Test";
_ctm = new ColorTestManager(this, "CTM");
}
示例6: Initialize
public override void Initialize()
{
base.Initialize();
EntityGame.ShowDebugInfo = true;
EntityGame.BackgroundColor = Color.Gray;
//Service init
new MouseService(this);
_upkey = new DoubleInput(this, "UpKey", Keys.Up, Buttons.DPadUp, PlayerIndex.One);
_downkey = new DoubleInput(this, "DownKey", Keys.Down, Buttons.DPadDown, PlayerIndex.One);
_leftkey = new DoubleInput(this, "LeftKey", Keys.Left, Buttons.DPadLeft, PlayerIndex.One);
_rightkey = new DoubleInput(this, "RightKey", Keys.Right, Buttons.DPadRight, PlayerIndex.One);
_selectkey = new DoubleInput(this, "SelectKey", Keys.Space, Buttons.A, PlayerIndex.One);
_page = new Page(this, "Page");
_page.Show();
AddMenuItem("Game of Life", () => (new GameOfLifeState()).Show());
AddMenuItem("Color Game of Life", () => (new ColorGameOfLifeState()).Show());
AddMenuItem("Asteroids Game", () => (new AsteroidsGame()).Show());
AddMenuItem("Tower Defence", () => (new TowerDefenceMenu()).Show());
AddMenuItem("Particle Test State", () => (new ParticleTestState()).Show());
AddMenuItem("Camera Test State", () => (new CameraTestState()).Show());
AddMenuItem("Control Test State", () => (new ControlTestState()).Show());
AddMenuItem("Spawn Test State", () => (new SpawnerTestState()).Show());
AddMenuItem("Fancy Spawn Test State", () => (new FancySpawnerTestState()).Show());
AddMenuItem("Collision Test State", () => (new CollisionTestState()).Show());
AddMenuItem("Collision Tester State", () => (new CollisionResolutionTest()).Show());
AddMenuItem("Resolution Test State", () => (new ResolutionTestState()).Show());
AddMenuItem("Color Test State", () => (new ColorTestState()).Show());
AddMenuItem("Render Test State", () => (new RenderTestState()).Show());
AddMenuItem("Primitives Test State", () => (new PrimitiveTestState()).Show());
_page.ProcessControls();
}
示例7: Initialize
public override void Initialize()
{
base.Initialize();
new ControlHandler(this);
_page = new Page(this, "GUIPage");
_manager = new ColorGameOfLifeManager(this, "Manager");
_manager.UpdateTimer.LastEvent += CheckAllCells;
//Cells = new Tilemap(this, "Cells", EntityGame.Game.Content.Load<Texture2D>(@"GameOfLife\tiles"), new Point(30,30),new Point(16,16));
Cells = new Tilemap(this, "Cells", EntityGame.Self.Content.Load<Texture2D>(@"GameOfLife\tilesSmall"),
new Point(30, 30), new Point(1, 1));
Cells.Render.Scale = new Vector2(16, 16);
Cells.SetAllTiles(new Tile(DEAD) { Color = Color.Red.ToRGBColor() });
//Position Tilemap to center
Cells.Body.Position = new Vector2(EntityGame.Viewport.Width / 2f - Cells.Width / 2f * Cells.Render.Scale.X, 10);
Cells.TileSelected += OnTileSelected;
_tiles = Cells.CloneTiles();
//GUI
_page.Show();
TextButton startTextButton = new TextButton(_page, "StartButton", new Point(0, 0), new Vector2(Cells.Body.X, 500), Color.White.ToRGBColor());
startTextButton.OnFocusGain();
startTextButton.Text = "Start";
startTextButton.MakeDefault();
startTextButton.OnReleased += control => _manager.Start();
TextButton stopTextButton = new TextButton(_page, "StopLink", new Point(0, 1), new Vector2(Cells.Body.X, startTextButton.Body.Bottom), Color.White.ToRGBColor());
stopTextButton.Text = "Stop";
stopTextButton.OnReleased += control => _manager.Stop();
stopTextButton.MakeDefault();
TextButton resetTextButton = new TextButton(_page, "ResetLink", new Point(0, 2), new Vector2(Cells.Body.X, stopTextButton.Body.Bottom), Color.White.ToRGBColor());
resetTextButton.Text = "ResetTimer";
resetTextButton.OnReleased += control => ResetCells();
resetTextButton.MakeDefault();
LinkLabel downMillisecondsLink = new LinkLabel(_page, "downMillisecondsLink", new Point(1, 0));
downMillisecondsLink.Body.Position = new Vector2(Cells.Body.X + 100, startTextButton.Body.Bottom);
downMillisecondsLink.Text = "<-";
downMillisecondsLink.OnDown += control => _manager.UpdateTimer.Milliseconds -= 50;
_millisecondsText = new Label(_page, "millisecondsText", new Point(2, 0));
_millisecondsText.Body.Position = new Vector2(downMillisecondsLink.Body.Right + 2, startTextButton.Body.Bottom);
_millisecondsText.Text = _manager.UpdateTimer.Milliseconds.ToString();
LinkLabel upMillisecondsLink = new LinkLabel(_page, "upMillisecondsLink", new Point(3, 0));
upMillisecondsLink.Body.Position = new Vector2(_millisecondsText.Body.Right + 25, startTextButton.Body.Bottom);
upMillisecondsLink.Text = "->";
upMillisecondsLink.OnDown += control => _manager.UpdateTimer.Milliseconds += 50;
MakeNextColorButton(Color.Red.ToRGBColor());
MakeNextColorButton(Color.Orange.ToRGBColor());
MakeNextColorButton(Color.Yellow.ToRGBColor());
MakeNextColorButton(Color.Green.ToRGBColor());
MakeNextColorButton(Color.LightBlue.ToRGBColor());
MakeNextColorButton(Color.Blue.ToRGBColor());
MakeNextColorButton(Color.MediumPurple.ToRGBColor());
}
示例8: Initialize
public override void Initialize()
{
base.Initialize();
_currentTest = new CircleTest1(this, "CircleTest1");
_currentTest.Initialize();
_beginTest = new DoubleInput(this, "BeginTest", Keys.Space, Buttons.Start, PlayerIndex.One);
_nextTest = new DoubleInput(this, "NextTest", Keys.Right, Buttons.RightShoulder, PlayerIndex.One);
_lastTest = new DoubleInput(this, "LastTest", Keys.Left, Buttons.LeftShoulder, PlayerIndex.One);
_resetTest = new DoubleInput(this, "ResetLink", Keys.Q, Buttons.X, PlayerIndex.One);
Page p = new Page(this, "Page");
p.Show();
_titleLabel = new Label(p, "TitleLabel", new Point(0, 0));
_titleLabel.Text = _currentTest.Title;
_titleLabel.Body.Position = new Vector2(2, 2);
_descriptionLabel = new Label(p, "DescriptionLabel", new Point(0, 1));
_descriptionLabel.Text = _currentTest.Description;
_descriptionLabel.Body.Position = new Vector2(2, EntityGame.Viewport.Height - _descriptionLabel.Render.Bounds.Y - 2);
//Init tests
_tests.Add(_currentTest);
_tests.Add(new CircleTest2(this, "CircleTest2"));
_tests.Add(new CircleTest3(this, "CircleTest3"));
_tests.Add(new CircleTest4(this, "CircleTest4"));
_tests.Add(new CircleTest5(this, "CirlceTest5"));
_tests.Add(new CircleTest6(this, "CirlceTest6"));
_tests.Add(new CircleTest7(this, "CirlceTest7"));
_tests.Add(new CircleTest8(this, "CirlceTest8"));
_tests.Add(new CircleTest9(this, "CirlceTest9"));
_tests.Add(new CircleTest10(this, "CirlceTest10"));
_tests.Add(new AABBTest1(this, "AABBTest1"));
_tests.Add(new AABBTest2(this, "AABBTest2"));
_tests.Add(new AABBTest3(this, "AABBTest3"));
_tests.Add(new AABBTest4(this, "AABBTest4"));
}
示例9: Initialize
public override void Initialize()
{
base.Initialize();
ControlHandler ch = new ControlHandler(this);
_ptm = new ParticleTestManager(this);
var page = new Page(this, "Page");
page.Show();
_screeninfo = new Label(page, "ScreenInfo", new Point(0, 0));
_screeninfo.Body.Position = Vector2.One * 20;
_strengthText = new Label(page, "StrengthText", new Point(0, 1));
_strengthText.Text = "Strength:";
_strengthText.Body.Position = new Vector2(20, 50);
_strengthDown = new LinkLabel(page, "StrengthDown", new Point(1, 1));
_strengthDown.Text = "<-";
_strengthDown.Body.Position = new Vector2(_strengthText.Body.BoundingRect.Right + 5, 50);
_strengthDown.OnDown += control => _ptm.Spawner.Strength -= STRENGTHSTEP;
_strengthValue = new Label(page, "StrengthValue", new Point(2, 1));
_strengthValue.Text = _ptm.Spawner.Strength.ToString();
_strengthValue.Body.Position = new Vector2(_strengthDown.Body.BoundingRect.Right + 5, 50);
_strengthUp = new LinkLabel(page, "StrengthUp", new Point(3, 1));
_strengthUp.Text = "->";
_strengthUp.Body.Position = new Vector2(_strengthValue.Body.BoundingRect.Right + 5, 50);
_strengthUp.OnDown += control => _ptm.Spawner.Strength += STRENGTHSTEP;
_gravityText = new Label(page, "GravityText", new Point(0, 2));
_gravityText.Text = "Gravity:";
_gravityText.Body.Position = new Vector2(20, 80);
_gravityXDown = new LinkLabel(page, "GravityXDown", new Point(1, 2));
_gravityXDown.Text = "<-";
_gravityXDown.Body.Position = new Vector2(_gravityText.Body.BoundingRect.Right + 5, 80);
_gravityXDown.OnDown += control => _ptm.Spawner.Acceleration.X -= GRAVITYSTEP;
_gravityXValue = new Label(page, "GravityXValue", new Point(2, 2));
_gravityXValue.Text = "X:" + _ptm.Spawner.Acceleration.X.ToString();
_gravityXValue.Body.Position = new Vector2(_gravityXDown.Body.BoundingRect.Right + 5, 80);
_gravityXUp = new LinkLabel(page, "GravityXUp", new Point(3, 2));
_gravityXUp.Text = "->";
_gravityXUp.Body.Position = new Vector2(_gravityXValue.Body.BoundingRect.Right + 5, 80);
_gravityXUp.OnDown += control => _ptm.Spawner.Acceleration.X += GRAVITYSTEP;
_gravityYDown = new LinkLabel(page, "GravityYDown", new Point(1, 3));
_gravityYDown.Text = "<-";
_gravityYDown.Body.Position = new Vector2(_gravityText.Body.BoundingRect.Right + 5, 110);
_gravityYDown.OnDown += control => _ptm.Spawner.Acceleration.Y -= GRAVITYSTEP;
_gravityYValue = new Label(page, "GravityYValue", new Point(2, 3));
_gravityYValue.Text = "Y:" + _ptm.Spawner.Acceleration.Y.ToString();
_gravityYValue.Body.Position = new Vector2(_gravityYDown.Body.BoundingRect.Right + 5, 110);
_gravityYUp = new LinkLabel(page, "GravityYUp", new Point(3, 3));
_gravityYUp.Text = "->";
_gravityYUp.Body.Position = new Vector2(_gravityYValue.Body.BoundingRect.Right + 5, 110);
_gravityYUp.OnDown += control => _ptm.Spawner.Acceleration.Y += GRAVITYSTEP;
}