Пример #1
0
        protected override void InitializeComponent(IUIContext context, bool isPlaying)
        {
            base.InitializeComponent(context, isPlaying);

            if (!isPlaying)
            {
                return;
            }

            _tracker = new InteractionHandler <DraggableHeader>(
                this,
                new PointerPresenceTracker <DraggableHeader>(this),
                new PointerDragTracker <DraggableHeader>(this));

            _tracker.Initialize();

            _interactable
            .Subscribe(v => _tracker.Interactable = v, Debug.LogError)
            .AddTo(this);
        }
Пример #2
0
        protected override void InitializeComponent(IUIContext context, bool isPlaying)
        {
            base.InitializeComponent(context, isPlaying);

            if (!isPlaying)
            {
                return;
            }

            var layout = this.GetOrAddComponent <LayoutElement>();

            layout.ignoreLayout = true;

            var image = this.GetOrAddComponent <Image>();

            image.color = Color.clear;

            UpdatePosition(RectTransform);

            _cursor.Value = Cursor;

            _tracker = new InteractionHandler <ResizeHandle>(
                this,
                new PointerPresenceTracker <ResizeHandle>(this),
                new PointerDragTracker <ResizeHandle>(this));

            _tracker.Initialize();

            _interactable
            .Subscribe(v => _tracker.Interactable = v, Debug.LogError)
            .AddTo(this);

            OnDrag
            .Where(_ => Target != null)
            .Subscribe(Resize, Debug.LogError)
            .AddTo(this);
        }
Пример #3
0
        protected override void InitializeComponent(IUIContext context, bool isPlaying)
        {
            base.InitializeComponent(context, isPlaying);

            if (!isPlaying)
            {
                return;
            }

            PeerSelectable.transition = Selectable.Transition.None;

            _tracker = new InteractionHandler <THotspot>(this, CreateHighlightTracker(), CreateInterationTracker());
            _tracker.Initialize();

            _interactable
            .Subscribe(v => _tracker.Interactable = v, Debug.LogError)
            .AddTo(this);

            _tracker.OnStateChange
            .Select(_ => Style)
            .Where(v => v != null)
            .Subscribe(_ => OnStyleChanged(Style), Debug.LogError)
            .AddTo(this);
        }