Example #1
0
 public AGSRoomEvents(IBlockingEvent onBeforeFadeIn,
                      IEvent onAfterFadeIn, IBlockingEvent onBeforeFadeOut,
                      IBlockingEvent onAfterFadeOut)
 {
     OnBeforeFadeIn  = onBeforeFadeIn;
     OnAfterFadeIn   = onAfterFadeIn;
     OnBeforeFadeOut = onBeforeFadeOut;
     OnAfterFadeOut  = onAfterFadeOut;
 }
Example #2
0
 public InspectorTreeNodeProvider(ITreeNodeViewProvider provider, IGameEvents gameEvents, IObject inspectorPanel)
 {
     _inspectorPanel    = inspectorPanel;
     _onResize          = new AGSEvent <float>();
     _provider          = provider;
     _gameEvents        = gameEvents;
     _layouts           = new Dictionary <string, ITreeTableLayout>();
     _resizeSubscribers = new Dictionary <ITreeNodeView, ResizeSubscriber>();
 }
Example #3
0
        private void replaceBoundingBox()
        {
            IBlockingEvent          boxChangeEvent = Entity.GetComponent <IBoundingBoxComponent>()?.OnBoundingBoxesChanged ?? new AGSEvent();
            AGSBoundingBoxComponent box            = new AGSBoundingBoxComponent(_settings, _labelBoundingBoxFakeBuilder, _state, _events, boxChangeEvent);

            Entity.RemoveComponent <IBoundingBoxComponent>();
            Entity.AddComponent <IBoundingBoxComponent>(box);
            box.Init(Entity, typeof(IBoundingBoxComponent));
            onBoundingBoxShouldChange();
        }
        public AGSTextBoxComponent(IBlockingEvent <TextBoxKeyPressingEventArgs> onPressingKey,
                                   IInput input, IGame game, IKeyboardState keyboardState, IFocusedUI focusedUi)
        {
            CaretFlashDelay = 10;
            _keyboardState  = keyboardState;
            _focusedUi      = focusedUi;
            OnPressingKey   = onPressingKey;
            _game           = game;

            input.KeyDown.Subscribe(onKeyDown);
            input.KeyUp.Subscribe(onKeyUp);
        }
Example #5
0
 public AGSGameEvents(IBlockingEvent onLoad, IBlockingEvent <IRepeatedlyExecuteEventArgs> onRepeatedlyExecute,
                      IBlockingEvent <IRepeatedlyExecuteEventArgs> onRepeatedlyExecuteAlways,
                      IBlockingEvent onBeforeRender, IBlockingEvent onScreenResize,
                      IBlockingEvent <IGame> onSavedGameLoad, IBlockingEvent onRoomChanging, IDefaultInteractions defaultInteractions)
 {
     OnLoad = onLoad;
     OnRepeatedlyExecute       = onRepeatedlyExecute;
     OnRepeatedlyExecuteAlways = onRepeatedlyExecuteAlways;
     OnBeforeRender            = onBeforeRender;
     OnScreenResize            = onScreenResize;
     OnSavedGameLoad           = onSavedGameLoad;
     OnRoomChanging            = onRoomChanging;
     DefaultInteractions       = defaultInteractions;
 }
Example #6
0
		public AGSGameEvents(IEvent<AGSEventArgs> onLoad, IEvent<AGSEventArgs> onRepeatedlyExecute,
			IBlockingEvent<AGSEventArgs> onBeforeRender, IBlockingEvent<AGSEventArgs> onScreenResize,
			IEvent<AGSEventArgs> onSavedGameLoad, Resolver resolver)
		{
			OnLoad = onLoad;
			OnRepeatedlyExecute = onRepeatedlyExecute;
			OnBeforeRender = onBeforeRender;
			OnScreenResize = onScreenResize;
			OnSavedGameLoad = onSavedGameLoad;

			TypedParameter nullDefaults = new TypedParameter (typeof(IInteractions), null);
			TypedParameter nullObject = new TypedParameter (typeof(IObject), null);
			DefaultInteractions = resolver.Container.Resolve<IInteractions>(nullDefaults, nullObject);
		}
 public AGSBoundingBoxComponent(IRuntimeSettings settings,
                                IBoundingBoxBuilder boundingBoxBuilder, IGameState state, IGameEvents events,
                                IBlockingEvent onBoundingBoxChanged)
 {
     _boundingBoxes = new ConcurrentDictionary <IViewport, ViewportBoundingBoxes>(new IdentityEqualityComparer <IViewport>());
     _boundingBoxes.TryAdd(state.Viewport, new ViewportBoundingBoxes(state.Viewport));
     _settings = settings;
     _state    = state;
     OnBoundingBoxesChanged = onBoundingBoxChanged;
     _boundingBoxBuilder    = boundingBoxBuilder;
     boundingBoxBuilder.OnNewBoxBuildRequired.Subscribe(onHitTextBoxShouldChange);
     events.OnRoomChanging.Subscribe(onHitTextBoxShouldChange);
     onHitTextBoxShouldChange();
 }
Example #8
0
 public AGSEntity(string id, Resolver resolver)
 {
     ID = id;
     if (!_ids.Add(id))
     {
         throw new ArgumentException($"Duplicate entity: {id}");
     }
     _resolver               = resolver;
     _components             = new ConcurrentDictionary <Type, Lazy <API.IComponent> >();
     _bindings               = new AGSConcurrentHashSet <API.IComponentBinding>(200, false);
     OnComponentsInitialized = new AGSEvent();
     OnComponentsChanged     = new AGSEvent <AGSListChangedEventArgs <API.IComponent> >();
     _onDisposed             = new AGSEvent();
 }
Example #9
0
        public AGSGameEvents(IEvent <AGSEventArgs> onLoad, IEvent <AGSEventArgs> onRepeatedlyExecute,
                             IBlockingEvent <AGSEventArgs> onBeforeRender, IBlockingEvent <AGSEventArgs> onScreenResize,
                             IEvent <AGSEventArgs> onSavedGameLoad, Resolver resolver)
        {
            OnLoad = onLoad;
            OnRepeatedlyExecute = onRepeatedlyExecute;
            OnBeforeRender      = onBeforeRender;
            OnScreenResize      = onScreenResize;
            OnSavedGameLoad     = onSavedGameLoad;

            TypedParameter nullDefaults = new TypedParameter(typeof(IInteractions), null);
            TypedParameter nullObject   = new TypedParameter(typeof(IObject), null);

            DefaultInteractions = resolver.Container.Resolve <IInteractions>(nullDefaults, nullObject);
        }
Example #10
0
 public AGSSayComponent(IGameState state, IGameFactory factory, IInput input, ISayLocationProvider location,
                        FastFingerChecker fastFingerChecker, ISayConfig sayConfig,
                        IBlockingEvent <BeforeSayEventArgs> onBeforeSay,
                        ISoundEmitter emitter, ISpeechCache speechCache)
 {
     _state             = state;
     _factory           = factory;
     _input             = input;
     _location          = location;
     _fastFingerChecker = fastFingerChecker;
     _emitter           = emitter;
     _speechCache       = speechCache;
     SpeechConfig       = sayConfig;
     OnBeforeSay        = onBeforeSay;
 }
Example #11
0
		public AGSSayBehavior(IGameState state, IGameFactory factory, IInput input, ISayLocationProvider location,
			                  FastFingerChecker fastFingerChecker, ISayConfig sayConfig, IHasOutfit outfit, 
                              IFaceDirectionBehavior faceDirection, IBlockingEvent<BeforeSayEventArgs> onBeforeSay, 
                              ISoundEmitter emitter, ISpeechCache speechCache)
		{
			_state = state;
			_factory = factory;
			_input = input;
			_location = location;
			_fastFingerChecker = fastFingerChecker;
			_outfit = outfit;
			_faceDirection = faceDirection;
            _emitter = emitter;
            _speechCache = speechCache;
			SpeechConfig = sayConfig;
			OnBeforeSay = onBeforeSay;
		}
Example #12
0
 public ALAudioClip(string id, ISoundData soundData, IALAudioSystem system, IAudioErrors errors, IAudioBackend backend,
                    IBlockingEvent <ISound> onSoundStarted, IBlockingEvent <ISound> onSoundCompleted)
 {
     OnSoundStarted   = onSoundStarted;
     OnSoundCompleted = onSoundCompleted;
     _soundData       = soundData;
     _errors          = errors;
     _backend         = backend;
     ID             = id;
     _buffer        = new Lazy <int> (() => generateBuffer());
     Duration       = getDuration(soundData.DataLength, soundData.Channels, soundData.BitsPerSample, soundData.SampleRate);
     _playingSounds = new AGSConcurrentHashSet <ISound>();
     Tags           = new AGSConcurrentHashSet <string>();
     _system        = system;
     Volume         = 1f;
     Pitch          = 1f;
 }
Example #13
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();
 }
Example #14
0
        public void Prepare(IObject obj, IDrawableInfoComponent drawable, IViewport viewport)
        {
            if (!TextBackgroundVisible && !TextVisible)
            {
                return;
            }

            if (_lastObject != obj)
            {
                IBlockingEvent          boxChangeEvent = obj.GetComponent <IBoundingBoxComponent>()?.OnBoundingBoxesChanged ?? new AGSEvent();
                AGSBoundingBoxComponent box            = new AGSBoundingBoxComponent(_settings, _viewport,
                                                                                     _labelBoundingBoxFakeBuilder, _state, _events, boxChangeEvent);
                obj.RemoveComponent <IBoundingBoxComponent>();
                obj.AddComponent <IBoundingBoxComponent>(box);
                _lastObject = obj;
                foreach (var binding in _bindings)
                {
                    binding?.Unbind();
                }
                var scaleBinding    = obj.Bind <IScaleComponent>(c => c.PropertyChanged += onScalePropertyChanged, c => c.PropertyChanged -= onScalePropertyChanged);
                var matrixBinding   = obj.Bind <IModelMatrixComponent>(c => c.OnMatrixChanged.Subscribe(onMatrixChanged), c => c.OnMatrixChanged.Unsubscribe(onMatrixChanged));
                var drawableBinding = obj.Bind <IDrawableInfoComponent>(c => c.PropertyChanged += onDrawablePropertyChanged, c => c.PropertyChanged -= onDrawablePropertyChanged);
                onBoundingBoxShouldChange();
                _bindings.Clear();
                _bindings.Add(scaleBinding);
                _bindings.Add(matrixBinding);
                _bindings.Add(drawableBinding);
            }
            _glTextHitTest = _glTextHitTest ?? new GLText(_graphics, _messagePump, _fonts, _bitmapPool, false);
            _glTextRender  = _glTextRender ?? new GLText(_graphics, _messagePump, _fonts, _bitmapPool, true);

            updateBoundingBoxes(obj, drawable, viewport);
            if (_usedLabelBoundingBoxes != null)
            {
                _labelBoundingBoxFakeBuilder.BoundingBoxes = _usedLabelBoundingBoxes;
            }
            _bgRenderer.Prepare(obj, drawable, viewport);
            Width  = _usedLabelBoundingBoxes == null ? 1f : _usedLabelBoundingBoxes.RenderBox.Width;
            Height = _usedLabelBoundingBoxes == null ? 1f : _usedLabelBoundingBoxes.RenderBox.Height;
        }
        public AGSBoundingBoxComponent(IRuntimeSettings settings,
                                       IBoundingBoxBuilder boundingBoxBuilder, IGameState state, IGameEvents events,
                                       IBlockingEvent onBoundingBoxChanged)
        {
            _createNewViewportBoundingBoxes = viewport => new ViewportBoundingBoxes(viewport);
            _boundingBoxes             = new ConcurrentDictionary <IViewport, ViewportBoundingBoxes>(new IdentityEqualityComparer <IViewport>());
            _mainViewportBoundingBoxes = new ViewportBoundingBoxes(state.Viewport);
            _settings = settings;
            _events   = events;
            _state    = state;
            OnBoundingBoxesChanged = onBoundingBoxChanged;
            _boundingBoxBuilder    = boundingBoxBuilder;

            _onHitTextBoxShouldChangeCallback = onHitTextBoxShouldChange;
            _onCropShouldChangeCallback       = onCropShouldChange;
            _onImageChangedCallback           = onImageChanged;
            _onDrawableChangedCallback        = onDrawableChanged;
            _onTextureOffsetChangedCallback   = onTextureOffsetChanged;

            boundingBoxBuilder.OnNewBoxBuildRequired.Subscribe(_onHitTextBoxShouldChangeCallback);
            events.OnRoomChanging.Subscribe(_onHitTextBoxShouldChangeCallback);
            onHitTextBoxShouldChange();
        }
 public AGSNumberEditorComponent(IBlockingEvent onValueChanged)
 {
     OnValueChanged = onValueChanged;
     Step           = 1f;
 }
Example #17
0
 public void Unsubscribe(IBlockingEvent <float> resizeEvent)
 {
     resizeEvent.Unsubscribe(_resizeCallback);
 }
Example #18
0
 public override void Dispose()
 {
     base.Dispose();
     OnBeforeCrop?.Dispose();
     OnBeforeCrop = null;
 }
 public void Subscribe(IBlockingEvent <float> resizeEvent)
 {
     resizeEvent.Unsubscribe(Resize);
     resizeEvent.Subscribe(Resize);
 }
Example #20
0
 private void dispose()
 {
     Texture = null;
     OnImageDisposed?.Invoke();
     OnImageDisposed = null;
 }
Example #21
0
 public AGSRoomTransitions(IBlockingEvent onStateChanged)
 {
     OnStateChanged = onStateChanged;
     //starting with preparing transition so that the before fade in event will be called for the first room in the game
     _state = RoomTransitionState.PreparingTransition;
 }