本文整理汇总了C#中IMediator.Subscribe方法的典型用法代码示例。如果您正苦于以下问题:C# IMediator.Subscribe方法的具体用法?C# IMediator.Subscribe怎么用?C# IMediator.Subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMediator
的用法示例。
在下文中一共展示了IMediator.Subscribe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: return
//.........这里部分代码省略.........
List<HaxxitCom.Command> commands = new List<HaxxitCom.Command>();
commands.Add(new HaxxitTest.DynamicDamageCommand(3, 1, "Pong"));
commands.Add(new HaxxitTest.DynamicDamageCommand(2, 2, "Ping"));
HaxxitTest.DynamicProgramFactory program_factory = new HaxxitTest.DynamicProgramFactory(4, 4, commands);
List<Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>> player1_spawns =
new List<Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>>();
List<Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>> player2_spawns =
new List<Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>>();
player1_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(0, 0), program_factory));
player1_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(1, 0), program_factory));
player2_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(1, 1), program_factory));
return (new HaxxitTest.PlayerMapFactory(2, 2, player1_spawns, player2_spawns)).NewInstance();
}
public HaxxitMap.Map GenerateTinyEnemyMap()
{
List<HaxxitCom.Command> commands = new List<HaxxitCom.Command>();
commands.Add(new HaxxitTest.DynamicDamageCommand(3, 1, "Pong"));
commands.Add(new HaxxitTest.DynamicDamageCommand(2, 2, "Ping"));
HaxxitTest.DynamicProgramFactory program_factory = new HaxxitTest.DynamicProgramFactory(4, 4, commands);
List<Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>> player1_spawns =
new List<Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>>();
List<Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>> player2_spawns =
new List<Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>>();
player1_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(0, 0), program_factory));
player2_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(1, 0), program_factory));
return (new HaxxitTest.WinnableEnemyMapFactory(2, 2, player1_spawns, player2_spawns)).NewInstance();
}
public HaxxitMap.Map GenerateAwesomeMap()
{
List<HaxxitCom.Command> commands = new List<HaxxitCom.Command>();
commands.Add(new HaxxitTest.DynamicDamageCommand(3, 1, "Pong"));
commands.Add(new HaxxitTest.DynamicDamageCommand(2, 2, "Ping"));
HaxxitTest.DynamicProgramFactory program_factory = new HaxxitTest.DynamicProgramFactory(4, 4, commands);
List<Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>> player1_spawns =
new List<Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>>();
List<Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>> player2_spawns =
new List<Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>>();
player1_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(0, 2), program_factory));
player1_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(0, 3), program_factory));
player1_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(0, 6), program_factory));
player1_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(0, 7), program_factory));
player2_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(19, 1), program_factory));
player2_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(19, 2), program_factory));
player2_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(19, 4), program_factory));
player2_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(19, 5), program_factory));
player2_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(19, 7), program_factory));
player2_spawns.Add(new Tuple<HaxxitMap.Point, HaxxitProg.ProgramFactory>(new HaxxitMap.Point(19, 8), program_factory));
Haxxit.Maps.Map Map = (new Haxxit.MonoGame.WinnableEnemyMapFactory(20, 10, player1_spawns, player2_spawns)).NewInstance();
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(3, 3));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(3, 4));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(3, 5));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(3, 6));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(7, 2));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(6, 1));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(5, 0));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(5, 9));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(6, 8));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(7, 7));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(9, 4));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(9, 5));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(10, 4));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(10, 5));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(16, 3));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(16, 4));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(16, 5));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(16, 6));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(12, 2));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(13, 1));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(14, 0));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(12, 7));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(13, 8));
Map.CreateNode(new Haxxit.Maps.UnavailableNodeFactory(), new Haxxit.Maps.Point(14, 9));
return Map;
}*/
public HaxxitEngine()
: base()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
state_stack = new Stack<HaxxitGameState>();
mediator = new SynchronousMediator();
mediator.Subscribe("haxxit.engine.state.change", ChangeStateListener);
mediator.Subscribe("haxxit.engine.state.push", PushStateListener);
mediator.Subscribe("haxxit.engine.state.pop", PopStateListener);
mediator.Subscribe("haxxit.engine.state.clear_all", ClearAllStateListener);
mediator.Subscribe("haxxit.engine.state.clear_change", ClearChangeStateListener);
GlobalAccessors.mGame = this;
GlobalAccessors.mPlayer1 = new Player("Bob");
GlobalAccessors.mPlayer1.AddSilicoins(1400);
PushState(new IntroductionState());
//PushState(new MapSpawnGameState((new SpawnMapFactory()).NewInstance()));
//PushState(new UserMapGameState(GenerateTinyMap())); // For 2x2 testing
//PushState(new UserMapGameState(GenerateTinyEnemyMap())); // For 2x2 testing with enemy
//PushState(new UserMapGameState(GenerateAwesomeMap()));
}