Ejemplo n.º 1
0
 public AGSCharacter(string id, Resolver resolver, IOutfit outfit) : base(id, resolver)
 {
     _hasRoom               = AddComponent <IHasRoom>();
     _animationContainer    = AddComponent <IAnimationContainer>();
     _inObjectTree          = AddComponent <IInObjectTree>();
     _collider              = AddComponent <ICollider>();
     _visibleComponent      = AddComponent <IVisibleComponent>();
     _enabledComponent      = AddComponent <IEnabledComponent>();
     _customProperties      = AddComponent <ICustomPropertiesComponent>();
     _drawableInfo          = AddComponent <IDrawableInfo>();
     _hotspotComponent      = AddComponent <IHotspotComponent>();
     _shaderComponent       = AddComponent <IShaderComponent>();
     _translateComponent    = AddComponent <ITranslateComponent>();
     _imageComponent        = AddComponent <IImageComponent>();
     _scaleComponent        = AddComponent <IScaleComponent>();
     _rotateComponent       = AddComponent <IRotateComponent>();
     _pixelPerfectComponent = AddComponent <IPixelPerfectComponent>();
     _faceDirectionBehavior = AddComponent <IFaceDirectionBehavior>();
     _hasOutfit             = AddComponent <IHasOutfit>();
     _hasInventory          = AddComponent <IHasInventory>();
     _followBehavior        = AddComponent <IFollowBehavior>();
     _modelMatrixComponent  = AddComponent <IModelMatrixComponent>();
     beforeInitComponents(resolver, outfit);
     InitComponents();
     afterInitComponents(resolver, outfit);
 }
Ejemplo n.º 2
0
        public AGSCheckBox(string id, Resolver resolver) : base(id, resolver)
        {            
            _uIEvents = AddComponent<IUIEvents>();            
            _skinComponent = AddComponent<ISkinComponent>();            
            _hasRoom = AddComponent<IHasRoom>();            
            _animationContainer = AddComponent<IAnimationContainer>();            
            _inObjectTree = AddComponent<IInObjectTree>();            
            _collider = AddComponent<ICollider>();            
            _visibleComponent = AddComponent<IVisibleComponent>();            
            _enabledComponent = AddComponent<IEnabledComponent>();            
            _customProperties = AddComponent<ICustomPropertiesComponent>();            
            _drawableInfo = AddComponent<IDrawableInfo>();            
            _hotspotComponent = AddComponent<IHotspotComponent>();            
            _shaderComponent = AddComponent<IShaderComponent>();            
            _translateComponent = AddComponent<ITranslateComponent>();            
            _imageComponent = AddComponent<IImageComponent>();            
            _scaleComponent = AddComponent<IScaleComponent>();            
            _rotateComponent = AddComponent<IRotateComponent>();            
            _pixelPerfectComponent = AddComponent<IPixelPerfectComponent>();            
            _textComponent = AddComponent<ITextComponent>();            
            _checkboxComponent = AddComponent<ICheckboxComponent>();
			beforeInitComponents(resolver);            
			InitComponents();
            afterInitComponents(resolver);            
        }
Ejemplo n.º 3
0
 public AGSButton(string id, Resolver resolver) : base(id, resolver)
 {
     _uIEvents              = AddComponent <IUIEvents>();
     _skinComponent         = AddComponent <ISkinComponent>();
     _hasRoom               = AddComponent <IHasRoom>();
     _animationContainer    = AddComponent <IAnimationContainer>();
     _inObjectTree          = AddComponent <IInObjectTree>();
     _collider              = AddComponent <ICollider>();
     _visibleComponent      = AddComponent <IVisibleComponent>();
     _enabledComponent      = AddComponent <IEnabledComponent>();
     _customProperties      = AddComponent <ICustomPropertiesComponent>();
     _drawableInfo          = AddComponent <IDrawableInfo>();
     _hotspotComponent      = AddComponent <IHotspotComponent>();
     _shaderComponent       = AddComponent <IShaderComponent>();
     _translateComponent    = AddComponent <ITranslateComponent>();
     _imageComponent        = AddComponent <IImageComponent>();
     _scaleComponent        = AddComponent <IScaleComponent>();
     _rotateComponent       = AddComponent <IRotateComponent>();
     _pixelPerfectComponent = AddComponent <IPixelPerfectComponent>();
     _textComponent         = AddComponent <ITextComponent>();
     _buttonComponent       = AddComponent <IButtonComponent>();
     _modelMatrixComponent  = AddComponent <IModelMatrixComponent>();
     beforeInitComponents(resolver);
     InitComponents();
     afterInitComponents(resolver);
 }
Ejemplo n.º 4
0
        public AGSCharacter(string id, Resolver resolver, IOutfit outfit) : base(id, resolver)
        {            
            _hasRoom = AddComponent<IHasRoom>();            
            _animationContainer = AddComponent<IAnimationContainer>();            
            _inObjectTree = AddComponent<IInObjectTree>();            
            _collider = AddComponent<ICollider>();            
            _visibleComponent = AddComponent<IVisibleComponent>();            
            _enabledComponent = AddComponent<IEnabledComponent>();            
            _customProperties = AddComponent<ICustomPropertiesComponent>();            
            _drawableInfo = AddComponent<IDrawableInfo>();            
            _hotspotComponent = AddComponent<IHotspotComponent>();            
            _shaderComponent = AddComponent<IShaderComponent>();            
            _transformComponent = AddComponent<ITranslateComponent>();            
            _imageComponent = AddComponent<IImageComponent>();            
            _scaleComponent = AddComponent<IScaleComponent>();            
            _rotateComponent = AddComponent<IRotateComponent>();            
            _pixelPerfectComponent = AddComponent<IPixelPerfectComponent>();            
            _faceDirectionBehavior = AddComponent<IFaceDirectionBehavior>();            
            _hasOutfit = AddComponent<IHasOutfit>();            
            _hasInventory = AddComponent<IHasInventory>();            
            _followBehavior = AddComponent<IFollowBehavior>();
			beforeInitComponents(resolver, outfit);            
			InitComponents();
            afterInitComponents(resolver, outfit);            
        }
Ejemplo n.º 5
0
        public override void Init(IEntity entity)
        {
            base.Init(entity);
            _entity = entity;
            entity.Bind <ITextComponent>(c =>
            {
                _textComponent     = c;
                c.PropertyChanged += onTextPropertyChanged;
            }, c =>
            {
                _textComponent     = null;
                c.PropertyChanged -= onTextPropertyChanged;
            });
            entity.Bind <IImageComponent>(c => _imageComponent = c, _ => _imageComponent = null);
            entity.Bind <IUIEvents>(c =>
            {
                _uiEvents = c;
                c.MouseDown.Subscribe(onMouseDown);
                c.LostFocus.Subscribe(onMouseDownOutside);
            }, c =>
            {
                _uiEvents = null;
                c.MouseDown.Unsubscribe(onMouseDown);
                c.LostFocus.Unsubscribe(onMouseDownOutside);
            });
            entity.Bind <IInObjectTreeComponent>(c => _tree        = c, _ => _tree = null);
            entity.Bind <IHasRoomComponent>(c => _room             = c, _ => _room = null);
            entity.Bind <IVisibleComponent>(c => _visibleComponent = c, _ => _visibleComponent = null);

            _game.Events.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);

            _caretFlashCounter = (int)CaretFlashDelay;
            _withCaret         = _game.Factory.UI.GetLabel(entity.ID + " Caret", "|", 1f, 1f, 0f, 0f, config: new AGSTextConfig(autoFit: AutoFit.LabelShouldFitText));
            _withCaret.Pivot   = new PointF(0f, 0f);
            _withCaret.TextBackgroundVisible = false;

            entity.Bind <IAnimationComponent>(c =>
            {
                c.PropertyChanged  += onAnimationPropertyChanged;
                _animationComponent = c;
                updateBorder();
            }, c =>
            {
                c.PropertyChanged  -= onAnimationPropertyChanged;
                _animationComponent = null;
                updateBorder();
            });

            entity.Bind <IDrawableInfoComponent>(c =>
            {
                _drawableComponent = c;
                c.PropertyChanged += onDrawableChanged;
                onRenderLayerChanged();
            }, c =>
            {
                c.PropertyChanged -= onDrawableChanged;
                _drawableComponent = null;
            });
        }
Ejemplo n.º 6
0
		public override void Init(IEntity entity)
		{
			base.Init(entity);
            _entity = entity;
			_enabled = entity.GetComponent<IEnabledComponent>();
			_visible = entity.GetComponent<IVisibleComponent>();
			_gameEvents.OnRepeatedlyExecute.SubscribeToAsync(onRepeatedlyExecute);
		}
Ejemplo n.º 7
0
 public override void Init(IEntity entity)
 {
     base.Init(entity);
     _entity  = entity;
     _enabled = entity.GetComponent <IEnabledComponent>();
     _visible = entity.GetComponent <IVisibleComponent>();
     _gameEvents.OnRepeatedlyExecute.SubscribeToAsync(onRepeatedlyExecute);
 }
Ejemplo n.º 8
0
		public override void Init(IEntity entity)
		{
			base.Init(entity);
			_collider = entity.GetComponent<ICollider>();
			_drawableInfo = entity.GetComponent<IDrawableInfo>();
			_tree = entity.GetComponent<IInObjectTree>();
			_visible = entity.GetComponent<IVisibleComponent>();
			_enabled = entity.GetComponent<IEnabledComponent>();
			_gameEvents.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);
		} 
Ejemplo n.º 9
0
 public override void Init(IEntity entity)
 {
     base.Init(entity);
     _collider     = entity.GetComponent <ICollider>();
     _drawableInfo = entity.GetComponent <IDrawableInfo>();
     _tree         = entity.GetComponent <IInObjectTree>();
     _visible      = entity.GetComponent <IVisibleComponent>();
     _enabled      = entity.GetComponent <IEnabledComponent>();
     _gameEvents.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);
 }
Ejemplo n.º 10
0
 public override void Init()
 {
     base.Init();
     bindGraphics(Graphics);
     Entity.Bind <IDrawableInfoComponent>(c => _drawableInfo = c, _ => _drawableInfo = null);
     Entity.Bind <IInObjectTreeComponent>(c => _tree         = c, _ => _tree = null);
     Entity.Bind <IVisibleComponent>(c => _visible           = c, _ => _visible = null);
     Entity.Bind <IEnabledComponent>(c => _enabled           = c, _ => _enabled = null);
     Entity.Bind <IUIEvents>(c => c.LostFocus.Subscribe(onLostFocus), c => c.LostFocus.Unsubscribe(onLostFocus));
     _gameEvents.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);
 }
Ejemplo n.º 11
0
 public override void Init()
 {
     base.Init();
     Entity.Bind <IImageComponent>(c => _image = c, _ => _image = null);
     Entity.Bind <IScaleComponent>(c => { _scale = c; c.PropertyChanged += onScalePropertyChanged; }, c => { _scale = null; c.PropertyChanged -= onScalePropertyChanged; });
     Entity.Bind <IDrawableInfoComponent>(c => { _drawable = c; c.PropertyChanged += onDrawablePropertyChanged; }, c => { _drawable = null; c.PropertyChanged -= onDrawablePropertyChanged; });
     Entity.Bind <ICropSelfComponent>(c => _cropSelf = c, _ => _cropSelf = null);
     Entity.Bind <IModelMatrixComponent>(c => { _matrix = c; c.OnMatrixChanged.Subscribe(onMatrixChanged); }, c => { _matrix = null; c.OnMatrixChanged.Unsubscribe(onMatrixChanged); });
     Entity.Bind <IVisibleComponent>(c => _visible = c, _ => _visible = null);
     _events.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);
     _pipeline.Subscribe(Entity.ID, this, -10);
 }
Ejemplo n.º 12
0
 public AGSCharacter(string id, Resolver resolver, IOutfit outfit) : base(id, resolver)
 {
     _hasRoomComponent = AddComponent <IHasRoomComponent>();
     Bind <IHasRoomComponent>(c => _hasRoomComponent = c, _ => {});
     _animationComponent = AddComponent <IAnimationComponent>();
     Bind <IAnimationComponent>(c => _animationComponent = c, _ => {});
     _inObjectTreeComponent = AddComponent <IInObjectTreeComponent>();
     Bind <IInObjectTreeComponent>(c => _inObjectTreeComponent = c, _ => {});
     _colliderComponent = AddComponent <IColliderComponent>();
     Bind <IColliderComponent>(c => _colliderComponent = c, _ => {});
     _visibleComponent = AddComponent <IVisibleComponent>();
     Bind <IVisibleComponent>(c => _visibleComponent = c, _ => {});
     _enabledComponent = AddComponent <IEnabledComponent>();
     Bind <IEnabledComponent>(c => _enabledComponent = c, _ => {});
     _customPropertiesComponent = AddComponent <ICustomPropertiesComponent>();
     Bind <ICustomPropertiesComponent>(c => _customPropertiesComponent = c, _ => {});
     _drawableInfoComponent = AddComponent <IDrawableInfoComponent>();
     Bind <IDrawableInfoComponent>(c => _drawableInfoComponent = c, _ => {});
     _shaderComponent = AddComponent <IShaderComponent>();
     Bind <IShaderComponent>(c => _shaderComponent = c, _ => {});
     _translateComponent = AddComponent <ITranslateComponent>();
     Bind <ITranslateComponent>(c => _translateComponent = c, _ => {});
     _imageComponent = AddComponent <IImageComponent>();
     Bind <IImageComponent>(c => _imageComponent = c, _ => {});
     _borderComponent = AddComponent <IBorderComponent>();
     Bind <IBorderComponent>(c => _borderComponent = c, _ => { });
     _scaleComponent = AddComponent <IScaleComponent>();
     Bind <IScaleComponent>(c => _scaleComponent = c, _ => {});
     _rotateComponent = AddComponent <IRotateComponent>();
     Bind <IRotateComponent>(c => _rotateComponent = c, _ => {});
     _pixelPerfectComponent = AddComponent <IPixelPerfectComponent>();
     Bind <IPixelPerfectComponent>(c => _pixelPerfectComponent = c, _ => {});
     _modelMatrixComponent = AddComponent <IModelMatrixComponent>();
     Bind <IModelMatrixComponent>(c => _modelMatrixComponent = c, _ => {});
     _boundingBoxComponent = AddComponent <IBoundingBoxComponent>();
     Bind <IBoundingBoxComponent>(c => _boundingBoxComponent = c, _ => {});
     _worldPositionComponent = AddComponent <IWorldPositionComponent>();
     Bind <IWorldPositionComponent>(c => _worldPositionComponent = c, _ => {});
     _faceDirectionComponent = AddComponent <IFaceDirectionComponent>();
     Bind <IFaceDirectionComponent>(c => _faceDirectionComponent = c, _ => {});
     _outfitComponent = AddComponent <IOutfitComponent>();
     Bind <IOutfitComponent>(c => _outfitComponent = c, _ => {});
     _inventoryComponent = AddComponent <IInventoryComponent>();
     Bind <IInventoryComponent>(c => _inventoryComponent = c, _ => {});
     _followComponent = AddComponent <IFollowComponent>();
     Bind <IFollowComponent>(c => _followComponent = c, _ => {});
     _hotspotComponent = AddComponent <IHotspotComponent>();
     Bind <IHotspotComponent>(c => _hotspotComponent = c, _ => {});
     beforeInitComponents(resolver, outfit);
     InitComponents();
     afterInitComponents(resolver, outfit);
 }
Ejemplo n.º 13
0
            public Subscriber(IEntity entity, Action <bool> setMouseIn, IUIEvents events, IEnabledComponent enabled, IVisibleComponent visible)
            {
                Entity     = entity;
                SetMouseIn = setMouseIn;
                Events     = events;
                Enabled    = enabled;
                Visible    = visible;

                LeftMouseClickTimer        = new Stopwatch();
                RightMouseClickTimer       = new Stopwatch();
                LeftMouseDoubleClickTimer  = new Stopwatch();
                RightMouseDoubleClickTimer = new Stopwatch();
            }
Ejemplo n.º 14
0
 public AGSButton(string id, Resolver resolver) : base(id, resolver)
 {
     _uIEvents = AddComponent <IUIEvents>();
     Bind <IUIEvents>(c => _uIEvents = c, _ => {});
     _skinComponent = AddComponent <ISkinComponent>();
     Bind <ISkinComponent>(c => _skinComponent = c, _ => {});
     _hasRoomComponent = AddComponent <IHasRoomComponent>();
     Bind <IHasRoomComponent>(c => _hasRoomComponent = c, _ => {});
     _animationComponent = AddComponent <IAnimationComponent>();
     Bind <IAnimationComponent>(c => _animationComponent = c, _ => {});
     _inObjectTreeComponent = AddComponent <IInObjectTreeComponent>();
     Bind <IInObjectTreeComponent>(c => _inObjectTreeComponent = c, _ => {});
     _colliderComponent = AddComponent <IColliderComponent>();
     Bind <IColliderComponent>(c => _colliderComponent = c, _ => {});
     _visibleComponent = AddComponent <IVisibleComponent>();
     Bind <IVisibleComponent>(c => _visibleComponent = c, _ => {});
     _enabledComponent = AddComponent <IEnabledComponent>();
     Bind <IEnabledComponent>(c => _enabledComponent = c, _ => {});
     _customPropertiesComponent = AddComponent <ICustomPropertiesComponent>();
     Bind <ICustomPropertiesComponent>(c => _customPropertiesComponent = c, _ => {});
     _drawableInfoComponent = AddComponent <IDrawableInfoComponent>();
     Bind <IDrawableInfoComponent>(c => _drawableInfoComponent = c, _ => {});
     _shaderComponent = AddComponent <IShaderComponent>();
     Bind <IShaderComponent>(c => _shaderComponent = c, _ => {});
     _translateComponent = AddComponent <ITranslateComponent>();
     Bind <ITranslateComponent>(c => _translateComponent = c, _ => {});
     _imageComponent = AddComponent <IImageComponent>();
     Bind <IImageComponent>(c => _imageComponent = c, _ => {});
     _borderComponent = AddComponent <IBorderComponent>();
     Bind <IBorderComponent>(c => _borderComponent = c, _ => { });
     _scaleComponent = AddComponent <IScaleComponent>();
     Bind <IScaleComponent>(c => _scaleComponent = c, _ => {});
     _rotateComponent = AddComponent <IRotateComponent>();
     Bind <IRotateComponent>(c => _rotateComponent = c, _ => {});
     _pixelPerfectComponent = AddComponent <IPixelPerfectComponent>();
     Bind <IPixelPerfectComponent>(c => _pixelPerfectComponent = c, _ => {});
     _modelMatrixComponent = AddComponent <IModelMatrixComponent>();
     Bind <IModelMatrixComponent>(c => _modelMatrixComponent = c, _ => {});
     _boundingBoxComponent = AddComponent <IBoundingBoxComponent>();
     Bind <IBoundingBoxComponent>(c => _boundingBoxComponent = c, _ => {});
     _worldPositionComponent = AddComponent <IWorldPositionComponent>();
     Bind <IWorldPositionComponent>(c => _worldPositionComponent = c, _ => {});
     _textComponent = AddComponent <ITextComponent>();
     Bind <ITextComponent>(c => _textComponent = c, _ => {});
     _buttonComponent = AddComponent <IButtonComponent>();
     Bind <IButtonComponent>(c => _buttonComponent = c, _ => {});
     beforeInitComponents(resolver);
     InitComponents();
     afterInitComponents(resolver);
 }
Ejemplo n.º 15
0
        private void selectArea(ITreeStringNode node)
        {
            var obj = node.Properties.Entities.GetValue(Fields.Entity);

            _inspector.Show(obj);
            var area      = obj.GetComponent <IAreaComponent>();
            var debugMask = area.Mask.DebugDraw;

            if (debugMask != null)
            {
                _lastMaskVisible         = debugMask.Visible;
                _lastSelectedMaskVisible = debugMask;
                debugMask.Visible        = true;
            }
        }
Ejemplo n.º 16
0
 public AGSInventoryWindow(string id, Resolver resolver, IImage image) : base(id, resolver)
 {
     _uIEvents = AddComponent <IUIEvents>();
     Bind <IUIEvents>(c => _uIEvents = c, _ => {});
     _skinComponent = AddComponent <ISkinComponent>();
     Bind <ISkinComponent>(c => _skinComponent = c, _ => {});
     _hasRoom = AddComponent <IHasRoomComponent>();
     Bind <IHasRoomComponent>(c => _hasRoom = c, _ => {});
     _animationComponent = AddComponent <IAnimationComponent>();
     Bind <IAnimationComponent>(c => _animationComponent = c, _ => {});
     _inObjectTree = AddComponent <IInObjectTreeComponent>();
     Bind <IInObjectTreeComponent>(c => _inObjectTree = c, _ => {});
     _collider = AddComponent <IColliderComponent>();
     Bind <IColliderComponent>(c => _collider = c, _ => {});
     _visibleComponent = AddComponent <IVisibleComponent>();
     Bind <IVisibleComponent>(c => _visibleComponent = c, _ => {});
     _enabledComponent = AddComponent <IEnabledComponent>();
     Bind <IEnabledComponent>(c => _enabledComponent = c, _ => {});
     _customPropertiesComponent = AddComponent <ICustomPropertiesComponent>();
     Bind <ICustomPropertiesComponent>(c => _customPropertiesComponent = c, _ => {});
     _drawableInfo = AddComponent <IDrawableInfoComponent>();
     Bind <IDrawableInfoComponent>(c => _drawableInfo = c, _ => {});
     _hotspotComponent = AddComponent <IHotspotComponent>();
     Bind <IHotspotComponent>(c => _hotspotComponent = c, _ => {});
     _shaderComponent = AddComponent <IShaderComponent>();
     Bind <IShaderComponent>(c => _shaderComponent = c, _ => {});
     _translateComponent = AddComponent <ITranslateComponent>();
     Bind <ITranslateComponent>(c => _translateComponent = c, _ => {});
     _imageComponent = AddComponent <IImageComponent>();
     Bind <IImageComponent>(c => _imageComponent = c, _ => {});
     _scaleComponent = AddComponent <IScaleComponent>();
     Bind <IScaleComponent>(c => _scaleComponent = c, _ => {});
     _rotateComponent = AddComponent <IRotateComponent>();
     Bind <IRotateComponent>(c => _rotateComponent = c, _ => {});
     _pixelPerfectComponent = AddComponent <IPixelPerfectComponent>();
     Bind <IPixelPerfectComponent>(c => _pixelPerfectComponent = c, _ => {});
     _modelMatrixComponent = AddComponent <IModelMatrixComponent>();
     Bind <IModelMatrixComponent>(c => _modelMatrixComponent = c, _ => {});
     _boundingBoxComponent = AddComponent <IBoundingBoxComponent>();
     Bind <IBoundingBoxComponent>(c => _boundingBoxComponent = c, _ => {});
     _inventoryWindowComponent = AddComponent <IInventoryWindowComponent>();
     Bind <IInventoryWindowComponent>(c => _inventoryWindowComponent = c, _ => {});
     beforeInitComponents(resolver, image);
     InitComponents();
     afterInitComponents(resolver, image);
 }
Ejemplo n.º 17
0
        private void selectObject(ITreeStringNode node)
        {
            var obj = node.Properties.Entities.GetValue(Fields.Entity);

            _inspector.Show(obj);
            _lastSelectedEntity = obj;
            var host = new AGSComponentHost(_editor.EditorResolver);

            host.Init(obj, typeof(AGSComponentHost));
            TypedParameter uiEventsAggParam = new TypedParameter(typeof(UIEventsAggregator), _editor.UIEventsAggregator);
            var            uiEvents         = _editor.EditorResolver.Container.Resolve <EditorUIEvents>(uiEventsAggParam);

            obj.AddComponent <EditorUIEvents>(uiEvents);
            host.AddComponent <EntityDesigner>();

            var visibleComponent = obj.GetComponent <IVisibleComponent>();
            var image            = obj.GetComponent <IImageComponent>();
            var borderComponent  = obj.GetComponent <IBorderComponent>();
            var enabledComponent = obj.GetComponent <IEnabledComponent>();

            if (enabledComponent != null)
            {
                _lastSelectedEnabled          = enabledComponent;
                _lastEnabled                  = enabledComponent.Enabled;
                _lastClickThrough             = enabledComponent.ClickThrough;
                enabledComponent.Enabled      = true;
                enabledComponent.ClickThrough = false;
            }
            if (image != null)
            {
                if (image.Opacity == 0)
                {
                    _lastOpacity           = image.Opacity;
                    _lastSelectedMaskImage = image;
                    image.Opacity          = 100;
                }
            }
            if (visibleComponent != null)
            {
                _lastMaskVisible         = visibleComponent.Visible;
                _lastSelectedMaskVisible = visibleComponent;
                visibleComponent.Visible = true;
            }
        }
Ejemplo n.º 18
0
        private void selectObject(ITreeStringNode node)
        {
            var obj = node.Properties.Entities.GetValue(Fields.Entity);

            _inspector.Inspector.Show(obj);
            var visibleComponent = obj.GetComponent <IVisibleComponent>();
            var image            = obj.GetComponent <IImageComponent>();
            var borderComponent  = obj.GetComponent <IBorderComponent>();

            if (image != null && borderComponent != null)
            {
                _lastSelectedBorder = borderComponent;
                IBorderStyle border = null;
                border            = borderComponent.Border;
                _lastObjectBorder = border;
                IBorderStyle hoverBorder = AGSBorders.Gradient(new FourCorners <Color>(Colors.Yellow, Colors.Yellow.WithAlpha(150),
                                                                                       Colors.Yellow.WithAlpha(150), Colors.Yellow), 1, true);
                if (border == null)
                {
                    borderComponent.Border = hoverBorder;
                }
                else
                {
                    borderComponent.Border = AGSBorders.Multiple(border, hoverBorder);
                }

                if (image.Opacity == 0)
                {
                    _lastOpacity           = image.Opacity;
                    _lastSelectedMaskImage = image;
                    image.Opacity          = 100;
                }
            }
            if (visibleComponent != null)
            {
                _lastMaskVisible         = visibleComponent.Visible;
                _lastSelectedMaskVisible = visibleComponent;
                visibleComponent.Visible = true;
            }
        }
Ejemplo n.º 19
0
        public override void Init()
        {
            base.Init();
            Entity.Bind <ITextComponent>(c =>
            {
                _textComponent     = c;
                c.PropertyChanged += onTextPropertyChanged;
            }, c =>
            {
                _textComponent     = null;
                c.PropertyChanged -= onTextPropertyChanged;
            });
            Entity.Bind <IUIEvents>(c =>
            {
                c.MouseDown.Subscribe(onMouseDown);
                c.LostFocus.Subscribe(onMouseDownOutside);
            }, c =>
            {
                c.MouseDown.Unsubscribe(onMouseDown);
                c.LostFocus.Unsubscribe(onMouseDownOutside);
            });
            Entity.Bind <IInObjectTreeComponent>(c => _tree        = c, _ => _tree = null);
            Entity.Bind <IHasRoomComponent>(c => _room             = c, _ => _room = null);
            Entity.Bind <IVisibleComponent>(c => _visibleComponent = c, _ => _visibleComponent = null);

            _caretFlashCounter = (int)CaretFlashDelay;
            _withCaret         = new Lazy <ILabel>(() =>
            {
                var label   = _game.Factory.UI.GetLabel(Entity.ID + " Caret", "|", 1f, 1f, 0f, 0f, config: _game.Factory.Fonts.GetTextConfig(autoFit: AutoFit.LabelShouldFitText));
                label.Pivot = new PointF(0f, 0f);
                label.TextBackgroundVisible = false;
                return(label);
            });

            Entity.Bind <IImageComponent>(c => _imageComponent           = c, _ => _imageComponent = null);
            Entity.Bind <IDrawableInfoComponent>(c => _drawableComponent = c, _ => _drawableComponent = null);

            _game.Events.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);
        }
Ejemplo n.º 20
0
 protected override void Given()
 {
     component = new TestComponent <TestEntity, string>().WithRenderingOrder(ComponentPart.Label, ComponentPart.WrapperStartTag, ComponentPart.Component, ComponentPart.ValidationMarker, ComponentPart.ValidationMessage, ComponentPart.HelpText, ComponentPart.WrapperEndTag);
 }
Ejemplo n.º 21
0
 public void Subscribe(IEntity entity, Action <bool> setMouseIn, IUIEvents uiEvents, IEnabledComponent enabled, IVisibleComponent visible)
 {
     _subscribersToAdd.Enqueue(new Subscriber(entity, setMouseIn, uiEvents, enabled, visible));
 }
Ejemplo n.º 22
0
 protected override void Given()
 {
     configuration = new TestFormConfiguration();
     component     = Stub <IVisibleComponent>();
 }
 protected override void Given()
 {
     configuration = new TestFormConfiguration();
     component = Stub<IVisibleComponent>();
 }