コード例 #1
0
 public void Update(GameTime time, IMouseManager mouse, IKeyboardManager keyboard)
 {
     foreach (var element in _elements)
     {
         element.Update(time, mouse, keyboard);
     }
 }
コード例 #2
0
 internal static void SetObjects(Dictionary <string, object> objects)
 {
     MBAPI._objects                = objects;
     MBAPI.IMBTestRun              = MBAPI.GetObject <IMBTestRun>();
     MBAPI.IMBActionSet            = MBAPI.GetObject <IMBActionSet>();
     MBAPI.IMBAgent                = MBAPI.GetObject <IMBAgent>();
     MBAPI.IMBAnimation            = MBAPI.GetObject <IMBAnimation>();
     MBAPI.IMBDelegate             = MBAPI.GetObject <IMBDelegate>();
     MBAPI.IMBItem                 = MBAPI.GetObject <IMBItem>();
     MBAPI.IMBEditor               = MBAPI.GetObject <IMBEditor>();
     MBAPI.IMBMission              = MBAPI.GetObject <IMBMission>();
     MBAPI.IMBMultiplayerData      = MBAPI.GetObject <IMBMultiplayerData>();
     MBAPI.IMouseManager           = MBAPI.GetObject <IMouseManager>();
     MBAPI.IMBNetwork              = MBAPI.GetObject <IMBNetwork>();
     MBAPI.IMBPeer                 = MBAPI.GetObject <IMBPeer>();
     MBAPI.IMBSkeletonExtensions   = MBAPI.GetObject <IMBSkeletonExtensions>();
     MBAPI.IMBGameEntityExtensions = MBAPI.GetObject <IMBGameEntityExtensions>();
     MBAPI.IMBScreen               = MBAPI.GetObject <IMBScreen>();
     MBAPI.IMBSoundEvent           = MBAPI.GetObject <IMBSoundEvent>();
     MBAPI.IMBVoiceManager         = MBAPI.GetObject <IMBVoiceManager>();
     MBAPI.IMBTeam                 = MBAPI.GetObject <IMBTeam>();
     MBAPI.IMBWorld                = MBAPI.GetObject <IMBWorld>();
     MBAPI.IInput                      = MBAPI.GetObject <IInput>();
     MBAPI.IMBMessageManager           = MBAPI.GetObject <IMBMessageManager>();
     MBAPI.IMBWindowManager            = MBAPI.GetObject <IMBWindowManager>();
     MBAPI.IMBDebugExtensions          = MBAPI.GetObject <IMBDebugExtensions>();
     MBAPI.IMBGame                     = MBAPI.GetObject <IMBGame>();
     MBAPI.IMBFaceGen                  = MBAPI.GetObject <IMBFaceGen>();
     MBAPI.IMBMapScene                 = MBAPI.GetObject <IMBMapScene>();
     MBAPI.IMBBannerlordChecker        = MBAPI.GetObject <IMBBannerlordChecker>();
     MBAPI.IMBAgentVisuals             = MBAPI.GetObject <IMBAgentVisuals>();
     MBAPI.IMBBannerlordTableauManager = MBAPI.GetObject <IMBBannerlordTableauManager>();
     MBAPI.IMBBannerlordConfig         = MBAPI.GetObject <IMBBannerlordConfig>();
 }
コード例 #3
0
        public SanctuaryGame(IContentChest contentChest, IViewManager viewManager, IApplicationFolder applicationFolder,
                             IKeyboardDispatcher keyboardDispatcher, IMouseManager mouseManager, Cursor cursor,
                             IOptionsManager optionsManager)
        {
            _contentChest       = contentChest;
            _viewManager        = viewManager;
            _applicationFolder  = applicationFolder;
            _keyboardDispatcher = keyboardDispatcher;
            _mouseManager       = mouseManager;
            _cursor             = cursor;
            _optionsManager     = optionsManager;

            _graphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth  = 1280,
                PreferredBackBufferHeight = 720
            };

            Window.AllowUserResizing  = true;
            Window.ClientSizeChanged += WindowOnClientSizeChanged;

            IsMouseVisible = false;
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            _viewManager.Graphics = _graphics;
            //InitializeSteam();
        }
コード例 #4
0
        public void Update(GameTime time, IMouseManager mouse, IKeyboardManager keyboard)
        {
            IsHovered = ScreenRect.Contains(mouse.Position);
            if (IsHovered)
            {
                if (mouse.IsScrollWheelUp())
                {
                    OnMouseWheel(mouse.ScrollWheelDelta);
                    if (MouseWheel != null)
                    {
                        MouseWheel(mouse.ScrollWheelDelta);
                    }
                }
                else if (mouse.IsScrollWheelDown())
                {
                    OnMouseWheel(mouse.ScrollWheelDelta);
                    if (MouseWheel != null)
                    {
                        MouseWheel(mouse.ScrollWheelDelta);
                    }
                }

                if (mouse.IsButtonPressed(MouseButton.Left))
                {
                    OnMouseClick(MouseButton.Left);
                    if (Clicked != null)
                    {
                        Clicked();
                    }
                    if (MouseClicked != null)
                    {
                        MouseClicked(MouseButton.Left);
                    }
                }
                if (mouse.IsButtonPressed(MouseButton.Middle))
                {
                    OnMouseClick(MouseButton.Middle);
                    if (MouseClicked != null)
                    {
                        MouseClicked(MouseButton.Middle);
                    }
                }
                if (mouse.IsButtonPressed(MouseButton.Right))
                {
                    OnMouseClick(MouseButton.Right);
                    if (MouseClicked != null)
                    {
                        MouseClicked(MouseButton.Right);
                    }
                }
            }

            OnUpdate(time, mouse, keyboard);
        }
コード例 #5
0
ファイル: MenuViewModel.cs プロジェクト: lulzzz/Overseer-1
        /// <summary>
        /// Initializes a new instance of the <see cref="MenuViewModel" /> class.
        /// </summary>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="mouseManager">The mouse manager.</param>
        /// <param name="connectionsListViewModel">The connections list view model.</param>
        public MenuViewModel(IEventAggregator eventAggregator, IMouseManager mouseManager, ConnectionsListViewModel connectionsListViewModel)
        {
            Ensure.That(eventAggregator).IsNotNull();
            Ensure.That(mouseManager).IsNotNull();
            Ensure.That(connectionsListViewModel).IsNotNull();

            _eventAggregator = eventAggregator;
            _mouseManager    = mouseManager;

            _mouseManager.PreProcessInput += MouseManagerPreProcessMouse;

            ConnectionsList = connectionsListViewModel;
        }
コード例 #6
0
        public void Update(GameTime time, IMouseManager mouse)
        {
            TextMenuItem currentHoveredItem = null;

            var currentPos = Pos;

            foreach (var item in _items)
            {
                currentPos = currentPos.Offset(item.Margin.Left, item.Margin.Top);

                var rect      = item.GetScreenRect(currentPos);
                var isHovered = rect.Contains(mouse.Position);

                item.IsHovered = isHovered;

                if (item.IsHovered)
                {
                    currentHoveredItem = item;

                    if (_lastHoverItem != item)
                    {
                        _lastHoverItem = item;
                        if (ItemHovered != null)
                        {
                            ItemHovered(item);
                        }
                    }
                }

                if (item.IsHovered && mouse.IsButtonPressed(MouseButton.Left) && item.IsEnabled)
                {
                    if (ItemClicked != null)
                    {
                        ItemClicked(item);
                    }

                    item.RaiseClicked();
                }

                currentPos = currentPos.Offset(0f, _font.Data.LineHeight + Padding + item.Margin.Bottom);
            }

            if (currentHoveredItem == null)
            {
                _lastHoverItem = null;
            }
        }
コード例 #7
0
 internal static void SetObjects(Dictionary <string, object> objects)
 {
     EngineApplicationInterface._objects  = objects;
     EngineApplicationInterface.IPath     = EngineApplicationInterface.GetObject <IPath>();
     EngineApplicationInterface.IShader   = EngineApplicationInterface.GetObject <IShader>();
     EngineApplicationInterface.ITexture  = EngineApplicationInterface.GetObject <ITexture>();
     EngineApplicationInterface.IMaterial = EngineApplicationInterface.GetObject <IMaterial>();
     EngineApplicationInterface.IMetaMesh = EngineApplicationInterface.GetObject <IMetaMesh>();
     EngineApplicationInterface.IDecal    = EngineApplicationInterface.GetObject <IDecal>();
     EngineApplicationInterface.IClothSimulatorComponent = EngineApplicationInterface.GetObject <IClothSimulatorComponent>();
     EngineApplicationInterface.ICompositeComponent      = EngineApplicationInterface.GetObject <ICompositeComponent>();
     EngineApplicationInterface.IPhysicsShape            = EngineApplicationInterface.GetObject <IPhysicsShape>();
     EngineApplicationInterface.IBodyPart                  = EngineApplicationInterface.GetObject <IBodyPart>();
     EngineApplicationInterface.IMesh                      = EngineApplicationInterface.GetObject <IMesh>();
     EngineApplicationInterface.IMeshBuilder               = EngineApplicationInterface.GetObject <IMeshBuilder>();
     EngineApplicationInterface.ICamera                    = EngineApplicationInterface.GetObject <ICamera>();
     EngineApplicationInterface.ISkeleton                  = EngineApplicationInterface.GetObject <ISkeleton>();
     EngineApplicationInterface.IGameEntity                = EngineApplicationInterface.GetObject <IGameEntity>();
     EngineApplicationInterface.IGameEntityComponent       = EngineApplicationInterface.GetObject <IGameEntityComponent>();
     EngineApplicationInterface.IScene                     = EngineApplicationInterface.GetObject <IScene>();
     EngineApplicationInterface.IScriptComponent           = EngineApplicationInterface.GetObject <IScriptComponent>();
     EngineApplicationInterface.ILight                     = EngineApplicationInterface.GetObject <ILight>();
     EngineApplicationInterface.IParticleSystem            = EngineApplicationInterface.GetObject <IParticleSystem>();
     EngineApplicationInterface.IPhysicsMaterial           = EngineApplicationInterface.GetObject <IPhysicsMaterial>();
     EngineApplicationInterface.ISceneView                 = EngineApplicationInterface.GetObject <ISceneView>();
     EngineApplicationInterface.IView                      = EngineApplicationInterface.GetObject <IView>();
     EngineApplicationInterface.ITableauView               = EngineApplicationInterface.GetObject <ITableauView>();
     EngineApplicationInterface.ITextureView               = EngineApplicationInterface.GetObject <ITextureView>();
     EngineApplicationInterface.IVideoPlayerView           = EngineApplicationInterface.GetObject <IVideoPlayerView>();
     EngineApplicationInterface.IThumbnailCreatorView      = EngineApplicationInterface.GetObject <IThumbnailCreatorView>();
     EngineApplicationInterface.IDebug                     = EngineApplicationInterface.GetObject <IDebug>();
     EngineApplicationInterface.ITwoDimensionView          = EngineApplicationInterface.GetObject <ITwoDimensionView>();
     EngineApplicationInterface.IUtil                      = EngineApplicationInterface.GetObject <IUtil>();
     EngineApplicationInterface.IEngineSizeChecker         = EngineApplicationInterface.GetObject <IEngineSizeChecker>();
     EngineApplicationInterface.IInput                     = EngineApplicationInterface.GetObject <IInput>();
     EngineApplicationInterface.ITime                      = EngineApplicationInterface.GetObject <ITime>();
     EngineApplicationInterface.IScreen                    = EngineApplicationInterface.GetObject <IScreen>();
     EngineApplicationInterface.IMusic                     = EngineApplicationInterface.GetObject <IMusic>();
     EngineApplicationInterface.IImgui                     = EngineApplicationInterface.GetObject <IImgui>();
     EngineApplicationInterface.IMouseManager              = EngineApplicationInterface.GetObject <IMouseManager>();
     EngineApplicationInterface.IHighlights                = EngineApplicationInterface.GetObject <IHighlights>();
     EngineApplicationInterface.ISoundEvent                = EngineApplicationInterface.GetObject <ISoundEvent>();
     EngineApplicationInterface.ISoundManager              = EngineApplicationInterface.GetObject <ISoundManager>();
     EngineApplicationInterface.IConfig                    = EngineApplicationInterface.GetObject <IConfig>();
     EngineApplicationInterface.IManagedMeshEditOperations = EngineApplicationInterface.GetObject <IManagedMeshEditOperations>();
 }
コード例 #8
0
        public override void LoadContent()
        {
            base.LoadContent();
            AddCancelButton();
            runTimer     = true;
            cardsFlipped = 0;
            font         = ScreenManager.Game.Content.Load <SpriteFont>("myFont");

            screenWidth       = ScreenManager.Game.GraphicsDevice.Viewport.Width;
            screenHeight      = ScreenManager.Game.GraphicsDevice.Viewport.Height;
            backgroundTexture = ScreenManager.Game.Content.Load <Texture2D>("background");



            var mouse = (MouseInputHelper)ScreenManager.Game.Services.GetService(typeof(IInputHandler));

            mouseManager = (IMouseManager)mouse.InputHelper;
            deck         = new Deck(this);

            cards = deck.GetCardsShuffled();

            rectangles = new Rectangle[12] {
                new Rectangle(250, 100, 100, 100),
                new Rectangle(250, 225, 100, 100),
                new Rectangle(250, 350, 100, 100),
                new Rectangle(450, 100, 100, 100),
                new Rectangle(450, 225, 100, 100),
                new Rectangle(450, 350, 100, 100),
                new Rectangle(650, 100, 100, 100),
                new Rectangle(650, 225, 100, 100),
                new Rectangle(650, 350, 100, 100),
                new Rectangle(850, 100, 100, 100),
                new Rectangle(850, 225, 100, 100),
                new Rectangle(850, 350, 100, 100),
            };

            for (int i = 0; i < cards.Count; i++)
            {
                cards[i].Rect = rectangles[i];
            }
        }
コード例 #9
0
ファイル: Cursor.cs プロジェクト: Rixium/ProjectSanctuary
 public Cursor(IContentChest contentChest, IMouseManager mouseManager)
 {
     _contentChest = contentChest;
     _mouseManager = mouseManager;
 }
コード例 #10
0
ファイル: MouseController.cs プロジェクト: modstam/MouseOver
 public MouseController(IMouseManager mouseManager)
 {
     _mouseManager = mouseManager;
 }
コード例 #11
0
 protected virtual void OnUpdate(GameTime time, IMouseManager mouse, IKeyboardManager keyboard)
 {
 }