Example #1
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);
 }
Example #2
0
        private Position getTarget(Direction direction, ITranslateComponent translate)
        {
            (var x, var y, _) = translate.Position;
            switch (direction)
            {
            case Direction.Down:
            case Direction.DownLeft:
            case Direction.DownRight:
                y = float.MinValue;
                break;

            case Direction.Up:
            case Direction.UpLeft:
            case Direction.UpRight:
                y = float.MaxValue;
                break;
            }
            switch (direction)
            {
            case Direction.Left:
            case Direction.DownLeft:
            case Direction.UpLeft:
                x = float.MinValue;
                break;

            case Direction.Right:
            case Direction.DownRight:
            case Direction.UpRight:
                x = float.MaxValue;
                break;
            }
            return(x, y);
        }
        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);            
        }
        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);            
        }
 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);
 }
        public override void AfterInit()
        {
            _entity.Bind <IAnimationComponent>(
                c => { _animationComponent = c; _animationComponent.PropertyChanged += onAnimationChanged; onSomethingChanged(); },
                c => { _animationComponent = null; _animationComponent.PropertyChanged -= onAnimationChanged; onSomethingChanged(); });
            _entity.Bind <IHasRoomComponent>(
                c => { _room = c; refreshAreaScaling(); subscribeRoom(); onSomethingChanged(); },
                c => { unsubscribeRoom(c); _room = null; refreshAreaScaling(); onSomethingChanged(); });

            _entity.Bind <IScaleComponent>(
                c => { _scale = c; c.PropertyChanged += onScaleChanged; onSomethingChanged(); },
                c => { c.PropertyChanged -= onScaleChanged; _scale = null; onSomethingChanged(); });
            _entity.Bind <ITranslateComponent>(
                c => { _translate = c; c.PropertyChanged += onTranslateChanged; onSomethingChanged(); },
                c => { c.PropertyChanged -= onTranslateChanged; _translate = null; onSomethingChanged(); }
                );
            _entity.Bind <IJumpOffsetComponent>(
                c => { _jump = c; c.PropertyChanged += onJumpOffsetChanged; onSomethingChanged(); },
                c => { c.PropertyChanged -= onJumpOffsetChanged; _jump = null; onSomethingChanged(); }
                );
            _entity.Bind <IRotateComponent>(
                c => { _rotate = c; c.PropertyChanged += onRotateChanged; onSomethingChanged(); },
                c => { c.PropertyChanged -= onRotateChanged; _rotate = null; onSomethingChanged(); }
                );
            _entity.Bind <IImageComponent>(
                c => { _image = c; subscribeLabelRenderer(); c.PropertyChanged += onImageChanged; onSomethingChanged(); },
                c => { c.PropertyChanged -= onImageChanged; _image = null; onSomethingChanged(); }
                );

            _entity.Bind <IDrawableInfoComponent>(
                c =>
            {
                _drawable          = c;
                c.PropertyChanged += onDrawableChanged;
                onSomethingChanged();
            }, c =>
            {
                c.PropertyChanged -= onDrawableChanged;
                _drawable          = null;
                onSomethingChanged();
            });

            _entity.Bind <IInObjectTreeComponent>(
                c =>
            {
                _tree   = c;
                _parent = _tree.TreeNode.Parent;
                _tree.TreeNode.OnParentChanged.Subscribe(onParentChanged);
                _parent?.OnMatrixChanged.Subscribe(onSomethingChanged);
                onSomethingChanged();
            }, c =>
            {
                c.TreeNode.OnParentChanged.Unsubscribe(onParentChanged);
                c.TreeNode.Parent?.OnMatrixChanged.Unsubscribe(onSomethingChanged);
                _tree   = null;
                _parent = null;
                onSomethingChanged();
            });
        }
Example #7
0
 public override void Init()
 {
     base.Init();
     Entity.Bind <ITranslateComponent>(
         c => { _translate = c; c.PropertyChanged += onLocationChanged; },
         c => { _translate = null; c.PropertyChanged -= onLocationChanged; });
     Entity.Bind <IRotateComponent>(
         c => { _rotate = c; c.PropertyChanged += onAngleChanged; },
         c => { _rotate = null; c.PropertyChanged -= onAngleChanged; });
 }
Example #8
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);
 }
Example #9
0
 public MovePivotAction(string entityName, IImageComponent image, ITranslateComponent translate,
                        float toPivotX, float toPivotY, float toX, float toY, StateModel model)
 {
     _model             = model;
     _timestamp         = DateTime.Now;
     _translate         = translate;
     _image             = image;
     _toPivotX          = toPivotX;
     _toPivotY          = toPivotY;
     _toX               = toX;
     _toY               = toY;
     _actionDisplayName = $"{entityName ?? "Null"}.Pivot = ({toPivotX},{toPivotY})";
 }
 public override void Init(IEntity entity)
 {
     base.Init(entity);
     _entity    = entity;
     _animation = entity.GetComponent <IAnimationContainer>();
     _tree      = entity.GetComponent <IInObjectTree>();
     _scale     = entity.GetComponent <IScaleComponent>();
     _translate = entity.GetComponent <ITranslateComponent>();
     _rotate    = entity.GetComponent <IRotateComponent>();
     _image     = entity.GetComponent <IImageComponent>();
     _room      = entity.GetComponent <IHasRoom>();
     _drawable  = entity.GetComponent <IDrawableInfo>();
 }
Example #11
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);
 }
 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);
 }
        private async void animate(IObject parent, ITranslateComponent areaTranslate, IRotateComponent areaRotate)
        {
            if (!_shouldAnimate)
            {
                return;
            }

            if (_stopped)
            {
                parent.X             = 200f;
                parent.Y             = 100f;
                parent.Angle         = 0f;
                areaTranslate.X      = 0f;
                areaTranslate.Y      = 0f;
                areaRotate.Angle     = 0f;
                _rotationStage       = 0;
                _game.State.Player.X = 50f;
                _game.State.Player.Y = 30f;
                _stopped             = false;
            }

            if (_shouldBindAreaToCharacter)
            {
                _label.Text = "Try Walking! (Moving character and area together)";
                if (await tween(() => parent.TweenY(200f, 2f)))
                {
                    if (await tween(() => parent.TweenX(300f, 2f)))
                    {
                        if (await tween(() => parent.TweenY(100f, 2f)))
                        {
                            await tween(() => parent.TweenX(200f, 2f));
                        }
                    }
                }
            }
            else
            {
                _label.Text = "Try Walking! (Moving area only)";
                if (await tween(() => areaTranslate.TweenY(100f, 2f)))
                {
                    if (await tween(() => areaTranslate.TweenX(100f, 2f)))
                    {
                        if (await tween(() => areaTranslate.TweenY(0f, 2f)))
                        {
                            await tween(() => areaTranslate.TweenX(0f, 2f));
                        }
                    }
                }
            }

            if (!_stopped)
            {
                var toRotate = _shouldBindAreaToCharacter ? parent : areaRotate;
                _label.Text = _shouldBindAreaToCharacter ? "Try Walking! (Rotating character and area together)" : "Try Walking! (Rotating area only)";
                switch (_rotationStage)
                {
                case 0:
                    await tween(() => toRotate.TweenAngle(45f, 2f));

                    break;

                case 1:
                    await tween(() => toRotate.TweenAngle(0f, 2f));

                    break;
                }
                _rotationStage = (_rotationStage + 1) % 2;
            }

            animate(parent, areaTranslate, areaRotate);
        }
Example #14
0
        public override void AfterInit()
        {
            Entity.Bind <IDrawableInfoComponent>(
                c =>
            {
                _drawable          = c;
                c.PropertyChanged += _onDrawbaleChangedCallback;
                onSomethingChanged();
            }, c =>
            {
                c.PropertyChanged -= _onDrawbaleChangedCallback;
                _drawable          = null;
                onSomethingChanged();
            });
            Entity.Bind <IHasRoomComponent>(
                c => { _room = c; refreshAreaScaling(); subscribeRoom(); onSomethingChanged(); },
                c => { unsubscribeRoom(c); _room = null; refreshAreaScaling(); onSomethingChanged(); });
            Entity.Bind <IScaleComponent>(
                c => { _scale = c; c.PropertyChanged += _onScaleChangedCallback; onSomethingChanged(); },
                c => { c.PropertyChanged -= _onScaleChangedCallback; _scale = null; onSomethingChanged(); });
            Entity.Bind <ITranslateComponent>(
                c => { _translate = c; c.PropertyChanged += _onTranslateChangedCallback; onSomethingChanged(); },
                c => { c.PropertyChanged -= _onTranslateChangedCallback; _translate = null; onSomethingChanged(); }
                );
            Entity.Bind <IWorldPositionComponent>(
                c => { _worldPosition = c; c.PropertyChanged += _onWorldPositionChangedCallback; onSomethingChanged(); },
                c => { c.PropertyChanged -= _onWorldPositionChangedCallback; _translate = null; onSomethingChanged(); }
                );
            Entity.Bind <IJumpOffsetComponent>(
                c => { _jump = c; c.PropertyChanged += _onJumpOffsetChangedCallback; onSomethingChanged(); },
                c => { c.PropertyChanged -= _onJumpOffsetChangedCallback; _jump = null; onSomethingChanged(); }
                );
            Entity.Bind <IRotateComponent>(
                c => { _rotate = c; c.PropertyChanged += _onRotateChangedCallback; onSomethingChanged(); },
                c => { c.PropertyChanged -= _onRotateChangedCallback; _rotate = null; onSomethingChanged(); }
                );
            Entity.Bind <IImageComponent>(
                c => { _image = c; c.PropertyChanged += _onImageChangedCallback; onSomethingChanged(); },
                c => { c.PropertyChanged -= _onImageChangedCallback; _image = null; onSomethingChanged(); }
                );
            Entity.Bind <ITextComponent>(
                c => { _text = c; subscribeTextComponent(); },
                _ => { unsubscribeTextComponent(); _text = null; }
                );

            Entity.Bind <IInObjectTreeComponent>(
                c =>
            {
                _tree   = c;
                _parent = _tree.TreeNode.Parent;
                _tree.TreeNode.OnParentChanged.Subscribe(_onParentChangedCallback);
                _parent?.OnMatrixChanged.Subscribe(_onSomethingChangedCallback);
                onSomethingChanged();
            }, c =>
            {
                c.TreeNode.OnParentChanged.Unsubscribe(_onParentChangedCallback);
                c.TreeNode.Parent?.OnMatrixChanged.Unsubscribe(_onSomethingChangedCallback);
                _tree   = null;
                _parent = null;
                onSomethingChanged();
            });
        }
Example #15
0
 public void SetTranslate(ITranslateComponent translate)
 {
     _translate = translate;
     setVisible();
 }
Example #16
0
 public override void Init()
 {
     base.Init();
     Entity.Bind <IWalkComponent>(c => _walk           = c, _ => _walk = null);
     Entity.Bind <ITranslateComponent>(c => _translate = c, _ => _translate = null);
 }
Example #17
0
 private void setTranslate(ITranslateComponent translate)
 {
     _pivotHandle?.SetTranslate(translate);
     _dragHandle?.SetTranslate(translate);
 }