本文整理汇总了C#中World.Deliver方法的典型用法代码示例。如果您正苦于以下问题:C# World.Deliver方法的具体用法?C# World.Deliver怎么用?C# World.Deliver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.Deliver方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Deliver
public void Test_Deliver()
{
var node1 = new Node ("Node1");
var node2 = new Node ("Node2");
var mbox1 = new MailBox ("All");
var mbox2 = new MailBox ("All");
node1.Attach (mbox1);
node2.Attach (mbox2);
var received1 = false;
var received2 = false;
mbox1.Action += (from, to, args) => {
received1 = true;
};
mbox2.Action += (from, to, args) => {
received2 = true;
};
var wld = new World ();
wld.AddChild (node1);
wld.AddChild (node2);
wld.PostOffice.Post (node1, "Node2", null);
wld.PostOffice.Post (node2, "Node1", null);
wld.Deliver ();
Assert.AreEqual (true, received1);
Assert.AreEqual (true, received2);
}
示例2: Main
public static void Main(string[] args)
{
var g2d = DD.Graphics2D.GetInstance ();
g2d.CreateWindow (800, 600, "こんにちは、世界");
// ----------------------------------------
var wld = new World ();
var node1 = MySender.Create ("Recver1", new Vector3 (100, 250, 0));
var node2 = MyRecver.Create ("Recver1", new Vector3 (600, 150, 0));
var node3 = MyRecver.Create ("Recver2", new Vector3 (600, 250, 0));
var node4 = MyRecver.Create ("Recver3", new Vector3 (600, 350, 0));
var node5 = MyRecver.Create ("All", new Vector3 (600, 500, 0));
var node6 = MyButton.Create ("1", "Recver1", new Vector3 (50, 350, 0));
var node7 = MyButton.Create ("2", "Recver2", new Vector3 (100, 350, 0));
var node8 = MyButton.Create ("3", "Recver3", new Vector3 (150, 350, 0));
var node9 = MyButton.Create ("All", "All", new Vector3 (200, 350, 0));
wld.AddChild (node1);
wld.AddChild (node2);
wld.AddChild (node3);
wld.AddChild (node4);
wld.AddChild (node5);
wld.AddChild (node6);
wld.AddChild (node7);
wld.AddChild (node8);
wld.AddChild (node9);
// ----------------------------------------
var active = true;
g2d.OnClosed += delegate (object sender, EventArgs eventArgs) {
active = false;
};
Console.WriteLine ("Start of Main Loop");
g2d.SetFrameRateLimit (60);
var watch = new Stopwatch ();
watch.Start ();
while (active) {
var msec = watch.ElapsedMilliseconds;
g2d.Dispatch (wld);
wld.Animate (msec, 33);
wld.CollisionUpdate ();
wld.Update (msec);
wld.Deliver ();
g2d.Draw (wld);
}
Console.WriteLine ("End of Game");
}
示例3: Main
public static void Main(string[] args)
{
var g2d = DD.Graphics2D.GetInstance ();
g2d.CreateWindow (800, 600, "こんにちは、世界");
Resource.SetTextureDirectory ("DatabaseSample/Textures/");
// ----------------------------------------
var node1 = MyCharacterHolder.Create ();
var node2 = MyCharacterViewer.Create (new Vector3 (0, 0, 0));
var node3 = MyCharacterSelector.Create (new Vector3 (0,0,0));
var wld = new World ();
wld.AddChild (node1);
wld.AddChild (node2);
wld.AddChild (node3);
// ----------------------------------------
var active = true;
g2d.OnClosed += delegate (object sender, EventArgs eventArgs) {
active = false;
};
Console.WriteLine ("Start of Main Loop");
g2d.SetFrameRateLimit (60);
var watch = new Stopwatch ();
watch.Start ();
while (active) {
var msec = watch.ElapsedMilliseconds;
g2d.Dispatch (wld);
wld.Animate (msec, 33);
wld.Deliver ();
wld.CollisionUpdate ();
wld.Update (msec);
wld.Purge ();
g2d.Draw (wld);
}
Console.WriteLine ("End of Game");
wld.Destroy ();
}
示例4: Test_Deliverable
public void Test_Deliverable()
{
var node = new Node ("Node");
var mbox = new MailBox ("Node");
node.Attach (mbox);
var wld = new World ();
wld.AddChild (node);
var recved = false;
mbox.Action += (from, address, letter) => {
recved = true;
};
node.Deliverable = true;
wld.PostOffice.Post (node, "Node", "Hello World");
wld.Deliver ();
Assert.AreEqual (true, recved);
recved = false;
node.Deliverable = false;
wld.PostOffice.Post (node, "Node", "Hello World");
wld.Deliver ();
Assert.AreEqual (false, recved);
}