public AGSCropChildrenComponent(IGameState state)
 {
     _state             = state;
     _bindings          = new ConcurrentDictionary <string, IComponentBinding[]>();
     EntitiesToSkipCrop = new AGSConcurrentHashSet <string>();
     EntitiesToSkipCrop.OnListChanged.Subscribe(_ => rebuildEntireTree());
 }
Example #2
0
 public AGSBoundingBoxWithChildrenComponent(IGameState state, IGameEvents events)
 {
     _state         = state;
     EntitiesToSkip = new AGSConcurrentHashSet <string>();
     OnBoundingBoxWithChildrenChanged = new AGSEvent();
     events.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);
 }
 public AGSStackLayoutComponent()
 {
     _isPaused        = true;
     OnLayoutChanged  = new AGSEvent();
     EntitiesToIgnore = new AGSConcurrentHashSet <string>();
     _direction       = LayoutDirection.Vertical;
     _relativeSpacing = -1f; //a simple vertical layout top to bottom by default.
 }
Example #4
0
 public AGSAudioSystem(IAudioSettings settings)
 {
     _playingSounds = new AGSConcurrentHashSet <ISound>();
     AudioClips     = new AGSBindingList <IAudioClip>(30);
     AudioClips.OnListChanged.Subscribe(onAudioClipsChanged);
     AudioRules = new AGSBindingList <IAudioRule>(5);
     Settings   = settings;
 }
Example #5
0
 public AGSEntity(string id, Resolver resolver)
 {
     ID                      = id;
     _resolver               = resolver;
     _components             = new ConcurrentDictionary <Type, Lazy <API.IComponent> >();
     _bindings               = new AGSConcurrentHashSet <API.IComponentBinding>();
     OnComponentsInitialized = new AGSEvent();
     OnComponentsChanged     = new AGSEvent <AGSListChangedEventArgs <API.IComponent> >();
 }
Example #6
0
        private int _inUpdate; //For preventing re-entrancy

        public AGSStackLayoutComponent(IGameEvents gameEvents)
        {
            _gameEvents      = gameEvents;
            _isPaused        = true;
            _isDirty         = true;
            OnLayoutChanged  = new AGSEvent();
            EntitiesToIgnore = new AGSConcurrentHashSet <string>();
            _direction       = LayoutDirection.Vertical;
            _relativeSpacing = -1f; //a simple vertical layout top to bottom by default.
            gameEvents.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);
        }
Example #7
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;
 }
Example #8
0
 public ALAudioClip(string id, ISoundData soundData, IAudioSystem system, IAudioErrors errors, IAudioBackend backend)
 {
     _soundData     = soundData;
     _errors        = errors;
     _backend       = backend;
     ID             = id;
     _buffer        = new Lazy <int> (() => generateBuffer());
     _playingSounds = new AGSConcurrentHashSet <ISound>();
     _system        = system;
     Volume         = 1f;
     Pitch          = 1f;
 }
Example #9
0
 public ALAudioClip(string id, ISoundData soundData, IAudioSystem system, IAudioErrors errors, IAudioBackend backend)
 {
     _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>();
     _system        = system;
     Volume         = 1f;
     Pitch          = 1f;
 }
Example #10
0
        public KeyboardMovement(IInput input, IFocusedUI focusedUi)
        {
            _focusedUi = focusedUi;
            Enabled    = true;
            _up        = new AGSConcurrentHashSet <Key> ();
            _down      = new AGSConcurrentHashSet <Key> ();
            _left      = new AGSConcurrentHashSet <Key> ();
            _right     = new AGSConcurrentHashSet <Key> ();
            _keysDown  = new AGSConcurrentHashSet <Key> ();

            input.KeyDown.SubscribeToAsync(onKeyDown);
            input.KeyUp.SubscribeToAsync(onKeyUp);
        }
Example #11
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 #12
0
        public AGSCropChildrenComponent(IGameState state, IGameSettings settings)
        {
            _state         = state;
            _settings      = settings;
            _bindings      = new ConcurrentDictionary <string, IComponentBinding[]>();
            _isCropEnabled = true;

            _onChildrenChangedCallback           = onChildrenChanged;
            _onEntitiesToSkipCropChangedCallback = onEntitiesToSkipCropChanged;
            _onLocationChangedCallback           = onLocationChanged;
            _onVisibleChangedCallback            = onVisibleChanged;

            EntitiesToSkipCrop = new AGSConcurrentHashSet <string>();
            EntitiesToSkipCrop.OnListChanged.Subscribe(_onEntitiesToSkipCropChangedCallback);
        }
Example #13
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;
 }
Example #14
0
        public KeyboardMovement(ICharacter character, IInput input, IFocusedUI focusedUi, KeyboardMovementMode mode)
        {
            _character = character;
            _focusedUi = focusedUi;
            Enabled    = true;
            Mode       = mode;
            _up        = new AGSConcurrentHashSet <Key> ();
            _down      = new AGSConcurrentHashSet <Key> ();
            _left      = new AGSConcurrentHashSet <Key> ();
            _right     = new AGSConcurrentHashSet <Key> ();
            _keysDown  = new AGSConcurrentHashSet <Key> ();

            input.KeyDown.SubscribeToAsync(onKeyDown);
            input.KeyUp.SubscribeToAsync(onKeyUp);
        }
Example #15
0
#pragma warning restore CS0067

        public AGSRoom(string id, IAGSEdges edges, IGameEvents gameEvents,
                       IRoomEvents roomEvents, IGameState state, ICustomProperties properties,
                       IRoomLimitsProvider roomLimitsProvider)
        {
            _state             = state;
            RoomLimitsProvider = roomLimitsProvider;
            _gameEvents        = gameEvents;
            Events             = roomEvents;
            ID         = id;
            Objects    = new AGSConcurrentHashSet <IObject>();
            Areas      = new AGSBindingList <IArea>(5);
            ShowPlayer = true;
            _edges     = edges;
            Properties = properties;
            gameEvents.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);
        }
        private int _inUpdate; //For preventing re-entrancy

        public AGSStackLayoutComponent(IGameEvents gameEvents)
        {
            _gameEvents      = gameEvents;
            _isPaused        = true;
            _isDirty         = true;
            OnLayoutChanged  = new AGSEvent();
            EntitiesToIgnore = new AGSConcurrentHashSet <string>();
            _direction       = LayoutDirection.Vertical;
            _relativeSpacing = -1f; //a simple vertical layout top to bottom by default.

            //Using low callback priority to make sure we only adjust the layout after all bounding box calculations has already happened.
            //Otherwise, this scenario can happen: the entity with the stack layout can subscribe to the bounding box with children event,
            //and adjust the starting point of the layout to start from the new top of the bounding box whenever the size changes.
            //If the stack layout updates in the middle of all the child bounding box calculations, it can trigger an endless loop:
            //layout update -> bounding box with children update -> layout update -> etc,
            //because the box in the bottom of the layout might remain below the bottom of the parent box border and increase the size of the parent each time.
            gameEvents.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute, CallbackPriority.Low);
        }
Example #17
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);
 }
Example #18
0
 public AGSRoom(string id, IViewport viewport, IAGSEdges edges, IGameEvents gameEvents,
                IRoomEvents roomEvents, IGameState state, ICustomProperties properties,
                IRoomLimitsProvider roomLimitsProvider)
 {
     _sorter = new RenderOrderSelector {
         Backwards = true
     };
     _state             = state;
     RoomLimitsProvider = roomLimitsProvider;
     _gameEvents        = gameEvents;
     Viewport           = viewport;
     Events             = roomEvents;
     ID         = id;
     Objects    = new AGSConcurrentHashSet <IObject> ();
     Areas      = new List <IArea> ();
     ShowPlayer = true;
     _edges     = edges;
     Properties = properties;
     gameEvents.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);
 }
Example #19
0
 public AGSSkinComponent(IGameSettings settings)
 {
     Skin     = settings.Defaults.Skin;
     SkinTags = new AGSConcurrentHashSet <string>();
 }
Example #20
0
 public AGSAreaRestriction()
 {
     RestrictionList = new AGSConcurrentHashSet <string>();
 }
Example #21
0
 public AGSFocusedUI()
 {
     ModalWindows    = new ConcurrentStack <IEntity>();
     CannotLoseFocus = new AGSConcurrentHashSet <string>();
 }
Example #22
0
 public AGSSkinComponent()
 {
     Skin     = AGSGameSettings.CurrentSkin;
     SkinTags = new AGSConcurrentHashSet <string>();
 }