本文整理汇总了C#中IMessageBus.OfType方法的典型用法代码示例。如果您正苦于以下问题:C# IMessageBus.OfType方法的具体用法?C# IMessageBus.OfType怎么用?C# IMessageBus.OfType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMessageBus
的用法示例。
在下文中一共展示了IMessageBus.OfType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameObjectFactory
public GameObjectFactory(IMessageBus bus,IObjectCreator creator)
{
_creator = creator;
GameObjects = new ConcurrentDictionary<Guid, IGameObject>();
Bus = bus;
Bus.OfType<GameObjectRequest>().Subscribe(CreateGameObject);
// Bus.OfType<DestroyGameObject>().Subscribe(DestroyGameObject);
}
示例2: Game
public Game(ITimer timer, IGraphics graphics, IMessageBus bus, IGameObjectFactory factory)
{
Timer = timer;
Timer.SubSample(5).Subscribe(t => Bus.SendAll());
Graphics = graphics;
Bus = bus;
Factory = factory;
Timer.Subscribe(Update);
Bus.OfType<RequestCloseMessage>().Subscribe(m => Stop());
}
示例3: GameEngine
public GameEngine(IObservableTimer timer, IMessageBus bus, IGameObjectFactory factory, IGraphicsEngine graphics,
IAudioEngine audio, IPhysicsEngine physics)
{
Timer = timer;
Bus = bus;
Graphics = graphics;
Audio = audio;
Physics = physics;
Factory = factory;
Bus.Add(new DebugMessage(Timer.LastTickTime, "Initialising Engines"));
Bus.OfType<ExitGameRequest>().Subscribe(m => Stop());
Timer.Subscribe(Update);
Timer.SubSample(5).Subscribe(t => bus.SendAll());
Running = false;
}
示例4: GraphicsWindow
public GraphicsWindow(IMessageBus bus, IObservableTimer timer)
: base(1280, 720, new GraphicsMode(32, 0, 0, 4), "Sharp Engine")
{
Views = new ConcurrentDictionary<int, IGameObjectView>();
_assets = new AssetManager
{
Shaders = new ShaderProvider(),
VBO = new VBOProvider(),
Textures = new TextureProvider()
};
_timer = timer;
Bus = bus;
_gui = new GUIManager(_assets);
Mouse.ButtonDown += MouseButtonDown;
Bus.OfType<GameObjectCreated>().Subscribe(OnGameObjectCreated);
}