Ejemplo n.º 1
0
        private int _inUpdate; //For preventing re-entrancy

        public AGSInput(IGameEvents events, IShouldBlockInput shouldBlockInput, IAGSCursor cursor, IAGSHitTest hitTest,
                        IEvent <API.MouseButtonEventArgs> mouseDown,
                        IEvent <API.MouseButtonEventArgs> mouseUp, IEvent <MousePositionEventArgs> mouseMove,
                        IEvent <KeyboardEventArgs> keyDown, IEvent <KeyboardEventArgs> keyUp, ICoordinates coordinates)
        {
            _cursor           = cursor;
            _events           = events;
            _hitTest          = hitTest;
            _actions          = new ConcurrentQueue <Func <Task> >();
            _coordinates      = coordinates;
            _shouldBlockInput = shouldBlockInput;
            _keysDown         = new AGSConcurrentHashSet <API.Key>();

            MouseDown = mouseDown;
            MouseUp   = mouseUp;
            MouseMove = mouseMove;
            KeyDown   = keyDown;
            KeyUp     = keyUp;

            if (AGSGameWindow.GameWindow != null)
            {
                init(AGSGameWindow.GameWindow);
            }
            else
            {
                AGSGameWindow.OnInit = () => init(AGSGameWindow.GameWindow);
            }
        }
Ejemplo n.º 2
0
 public AGSGameState(ICustomProperties globalVariables, IRoomTransitions roomTransitions,
                     Resolver resolver, IFocusedUI focusedUi, IViewport viewport,
                     IEvent <RoomTransitionEventArgs> onRoomChangeRequired, IAGSCursor cursor)
 {
     Speed                  = 100;
     _cursor                = cursor;
     Rooms                  = new AGSBindingList <IRoom>(10);
     UI                     = new AGSConcurrentHashSet <IObject> ();
     SecondaryViewports     = new AGSBindingList <IViewport>(5);
     RoomTransitions        = roomTransitions;
     viewport.RoomProvider  = this;
     viewport.Camera.Target = () => Player;
     Viewport               = viewport;
     GlobalVariables        = globalVariables;
     FocusedUI              = focusedUi;
     _cutscene              = new Lazy <ICutscene> (() => resolver.Container.Resolve <ICutscene>());
     OnRoomChangeRequired   = onRoomChangeRequired;
     _viewports             = new ViewportCollection(this);
 }