示例#1
0
 public AGSGameLoop(IGameState gameState, AGS.API.Size virtualResolution,
                    IAGSRoomTransitions roomTransitions, IGameEvents events)
 {
     _gameState         = gameState;
     _events            = events;
     _virtualResolution = virtualResolution;
     _roomTransitions   = roomTransitions;
 }
示例#2
0
 public HasRoomComponent(IGameState state, IAGSRoomTransitions roomTransitions)
 {
     _state           = state;
     _roomTransitions = roomTransitions;
     OnRoomChanged    = new AGSEvent();
     refreshRoom();
     state.Rooms?.OnListChanged?.Subscribe(onRoomsChanged);
 }
示例#3
0
        public AGSInput(GameWindow game, AGS.API.Size virtualResolution, IGameState state, 
                        IAGSRoomTransitions roomTransitions, IGameWindowSize windowSize)
        {
            _windowSize = windowSize;
            this._roomTransitions = roomTransitions;
            this._virtualWidth = virtualResolution.Width;
            this._virtualHeight = virtualResolution.Height;
            this._state = state;
            this._keysDown = new AGSConcurrentHashSet<Key>();

            this._game = game;
            this._originalOSCursor = _game.Cursor;

            MouseDown = new AGSEvent<AGS.API.MouseButtonEventArgs>();
            MouseUp = new AGSEvent<AGS.API.MouseButtonEventArgs>();
            MouseMove = new AGSEvent<MousePositionEventArgs>();
            KeyDown = new AGSEvent<KeyboardEventArgs>();
            KeyUp = new AGSEvent<KeyboardEventArgs>();

            game.MouseDown += async (sender, e) =>
            {
                if (isInputBlocked()) return;
                var button = convert(e.Button);
                if (button == AGS.API.MouseButton.Left) LeftMouseButtonDown = true;
                else if (button == AGS.API.MouseButton.Right) RightMouseButtonDown = true;
                await MouseDown.InvokeAsync(sender, new AGS.API.MouseButtonEventArgs(button, convertX(e.X), convertY(e.Y)));
            };
            game.MouseUp += async (sender, e) =>
            {
                if (isInputBlocked()) return;
                var button = convert(e.Button);
                if (button == AGS.API.MouseButton.Left) LeftMouseButtonDown = false;
                else if (button == AGS.API.MouseButton.Right) RightMouseButtonDown = false;
                await MouseUp.InvokeAsync(sender, new AGS.API.MouseButtonEventArgs(button, convertX(e.X), convertY(e.Y)));
            };
            game.MouseMove += async (sender, e) =>
            {
                if (isInputBlocked()) return;
                await MouseMove.InvokeAsync(sender, new MousePositionEventArgs(convertX(e.X), convertY(e.Y)));
            };
            game.KeyDown += async (sender, e) =>
            {
                Key key = convert(e.Key);
                _keysDown.Add(key);
                if (isInputBlocked()) return;
                await KeyDown.InvokeAsync(sender, new KeyboardEventArgs(key));
            };
            game.KeyUp += async (sender, e) =>
            {
                Key key = convert(e.Key);
                _keysDown.Remove(key);
                if (isInputBlocked()) return;
                await KeyUp.InvokeAsync(sender, new KeyboardEventArgs(key));
            };
        }
示例#4
0
 public AGSGameState(ICustomProperties globalVariables, IAGSRoomTransitions roomTransitions,
                     Resolver resolver, IFocusedUI focusedUi)
 {
     Speed            = 100;
     Rooms            = new AGSBindingList <IRoom>(10);
     UI               = new AGSConcurrentHashSet <IObject> ();
     GlobalVariables  = globalVariables;
     FocusedUI        = focusedUi;
     _cutscene        = new Lazy <ICutscene> (() => resolver.Container.Resolve <ICutscene>());
     _roomTransitions = roomTransitions;
 }
示例#5
0
 public AGSGameLoop(IGameState gameState, AGS.API.Size virtualResolution,
                    IAGSRoomTransitions roomTransitions, IGameEvents events,
                    IDisplayList displayList, IInput input)
 {
     _displayList       = displayList;
     _gameState         = gameState;
     _events            = events;
     _virtualResolution = virtualResolution;
     _roomTransitions   = roomTransitions;
     _input             = input;
 }
示例#6
0
 public AGSRendererLoop(Resolver resolver, IGame game, IImageRenderer renderer, IInput input, AGSWalkBehindsMap walkBehinds,
                        IAGSRoomTransitions roomTransitions, IGLUtils glUtils)
 {
     this._glUtils               = glUtils;
     this._resolver              = resolver;
     this._walkBehinds           = walkBehinds;
     this._game                  = game;
     this._gameState             = game.State;
     this._renderer              = renderer;
     this._input                 = input;
     this._comparer              = new RenderOrderSelector();
     this._roomTransitions       = roomTransitions;
     _roomTransitions.Transition = new RoomTransitionInstant();
 }
示例#7
0
		public AGSRendererLoop (Resolver resolver, IGame game, IImageRenderer renderer, IInput input, AGSWalkBehindsMap walkBehinds,
			IAGSRoomTransitions roomTransitions, IGLUtils glUtils)
		{
            this._glUtils = glUtils;
			this._resolver = resolver;
			this._walkBehinds = walkBehinds;
            this._game = game;
			this._gameState = game.State;
			this._renderer = renderer;
			this._input = input;
			this._comparer = new RenderOrderSelector ();
			this._roomTransitions = roomTransitions;
			_roomTransitions.Transition = new RoomTransitionInstant ();
		}
示例#8
0
 public AGSGameState(ICustomProperties globalVariables, IAGSRoomTransitions roomTransitions,
                     Resolver resolver, IFocusedUI focusedUi, IViewport viewport)
 {
     Speed = 100;
     Rooms = new AGSBindingList <IRoom>(10);
     UI    = new AGSConcurrentHashSet <IObject> ();
     SecondaryViewports     = new AGSBindingList <IViewport>(5);
     viewport.RoomProvider  = this;
     viewport.Camera.Target = () => Player;
     Viewport         = viewport;
     GlobalVariables  = globalVariables;
     FocusedUI        = focusedUi;
     _cutscene        = new Lazy <ICutscene> (() => resolver.Container.Resolve <ICutscene>());
     _roomTransitions = roomTransitions;
 }
示例#9
0
        public AGSDisplayList(IGameState gameState, IInput input,
                              IMatrixUpdater matrixUpdater, IAGSRoomTransitions roomTransitions)
        {
            _matrixUpdater       = matrixUpdater;
            _roomTransitions     = roomTransitions;
            _gameState           = gameState;
            _input               = input;
            _cache               = new ConcurrentDictionary <IViewport, ViewportDisplayList>();
            _viewportSubscribers = new ConcurrentDictionary <IViewport, ViewportSubscriber>();
            _entitySubscribers   = new ConcurrentDictionary <string, EntitySubscriber>();
            _comparer            = new RenderOrderSelector();

            gameState.UI.OnListChanged.Subscribe(onUiChanged);
            subscribeObjects(gameState.UI);
            subscribeRoom();
            onSomethingChanged();
        }
示例#10
0
 public AGSRendererLoop(Resolver resolver, IGame game,
                        IAGSRoomTransitions roomTransitions, IGLUtils glUtils, IGameWindow gameWindow,
                        IAGSRenderPipeline pipeline, IDisplayList displayList,
                        IInput input, IMatrixUpdater matrixUpdater)
 {
     _pipeline                   = pipeline;
     _input                      = input;
     _displayList                = displayList;
     _glUtils                    = glUtils;
     _gameWindow                 = gameWindow;
     _resolver                   = resolver;
     _game                       = game;
     _gameState                  = game.State;
     _noAspectRatioSettings      = new AGSGameSettings(game.Settings.Title, game.Settings.VirtualResolution, preserveAspectRatio: false);
     _roomTransitions            = roomTransitions;
     _matrixUpdater              = matrixUpdater;
     _roomTransitions.Transition = new RoomTransitionInstant();
 }
示例#11
0
        public AGSDisplayList(IGameState gameState, IInput input, AGSWalkBehindsMap walkBehinds,
                              IImageRenderer renderer, IGameEvents events, IAGSRoomTransitions roomTransitions)
        {
            _roomTransitions     = roomTransitions;
            _gameState           = gameState;
            _input               = input;
            _renderer            = renderer;
            _walkBehinds         = walkBehinds;
            _cache               = new ConcurrentDictionary <IViewport, List <IObject> >();
            _viewportSubscribers = new ConcurrentDictionary <IViewport, ViewportSubscriber>();
            _bindings            = new ConcurrentDictionary <string, List <API.IComponentBinding> >();
            _comparer            = new RenderOrderSelector();
            events.OnRepeatedlyExecute?.Subscribe(onRepeatedlyExecute);

            gameState.UI.OnListChanged.Subscribe(onUiChanged);
            subscribeObjects(gameState.UI);
            subscribeRoom();
            onSomethingChanged();
        }
示例#12
0
 public AGSRendererLoop(Resolver resolver, IGame game, IImageRenderer renderer,
                        IAGSRoomTransitions roomTransitions, IGLUtils glUtils, IGameWindow gameWindow,
                        IBlockingEvent <DisplayListEventArgs> onBeforeRenderingDisplayList, IDisplayList displayList,
                        IInput input, IMatrixUpdater matrixUpdater)
 {
     _input                       = input;
     _displayList                 = displayList;
     _glUtils                     = glUtils;
     _gameWindow                  = gameWindow;
     _resolver                    = resolver;
     _game                        = game;
     _gameState                   = game.State;
     _renderer                    = renderer;
     _roomTransitions             = roomTransitions;
     _displayListEventArgs        = new DisplayListEventArgs(null);
     _matrixUpdater               = matrixUpdater;
     OnBeforeRenderingDisplayList = onBeforeRenderingDisplayList;
     _roomTransitions.Transition  = new RoomTransitionInstant();
 }
示例#13
0
 public HasRoomBehavior(IGameState state, IAGSRoomTransitions roomTransitions)
 {
     _state           = state;
     _roomTransitions = roomTransitions;
     refreshRoom();
 }
示例#14
0
		public HasRoomBehavior(IGameState state, IAGSRoomTransitions roomTransitions)
		{
			_state = state;
			_roomTransitions = roomTransitions;
			refreshRoom();
		}
示例#15
0
		public AGSGameLoop (IGameState gameState, AGS.API.Size virtualResolution, IAGSRoomTransitions roomTransitions)
		{
			this._gameState = gameState;
			this._virtualResolution = virtualResolution;
			this._roomTransitions = roomTransitions;
		}
示例#16
0
 public AGSGameLoop(IGameState gameState, AGS.API.Size virtualResolution, IAGSRoomTransitions roomTransitions)
 {
     this._gameState         = gameState;
     this._virtualResolution = virtualResolution;
     this._roomTransitions   = roomTransitions;
 }