Example #1
0
        private void DropInNestedSeries(IChainableSeries <IScriptableEntry> newNested)
        {
            Debug.Log($"adding {(newNested as MonoBehaviour)?.name} as nested under {this.name}");
            if (newNested == null || !newNested.GetCanHaveParents())
            {
                throw new Exception("ERROR: invalid nesting. see logs");
            }

            var originalNested = this.nestedSeries;

            this.nestedSeries = newNested;
            newNested.SetParent(this);

            ChainableSeriesUtilities.UpdateOriginalChildAfterSplice(originalNested, newNested);

            this.nestedSeries?.OnParentUpdated(this.GetNestedChildTransform());
            this.OnChildUpdated(this.nestedSeries);
            //var currentTerminator = ChainableSeriesUtilities.GetChainTerminator(this.nestedSeries);
            //if (currentTerminator.GetCanHaveChildren())
            //{
            //    this.pairedNestedBlockTerminator.GetParent()?.AbortChild(this.pairedNestedBlockTerminator);
            //    this.pairedNestedBlockTerminator.SetParent(null);
            //    currentTerminator.SpliceChildIn(this.pairedNestedBlockTerminator);
            //}

            //(newNested as SeriesDragDrop).UpdatePositionRelativeToParent(this.GetNestedChildTransform());
        }
Example #2
0
        public override void OnChildUpdated(IChainableSeries <IScriptableEntry> child)
        {
            if (child == this.nestedSeries)
            {
                var currentTerminator = ChainableSeriesUtilities.GetChainTerminator(this.nestedSeries);
                if (currentTerminator != this.pairedNestedBlockTerminator)
                {
                    this.pairedNestedBlockTerminator.AbortSelf();

                    if (currentTerminator.GetCanHaveChildren())
                    {
                        currentTerminator.SimpleAppendChild(this.pairedNestedBlockTerminator);
                    }
                }
                this.GetChild()?.OnParentUpdated(this.GetChildTransform());
            }
            base.OnChildUpdated(child);
        }
Example #3
0
        protected override Vector3 GetChildTransform()
        {
            if (this.nestedSeries != null)
            {
                var currentPhysicalTerminator = ChainableSeriesUtilities.GetChainTerminator(this.nestedSeries);
                if (currentPhysicalTerminator == this.pairedNestedBlockTerminator)
                {
                    currentPhysicalTerminator = currentPhysicalTerminator.GetParent();
                }
#pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast
                if (currentPhysicalTerminator == this || !(currentPhysicalTerminator is SeriesDragDrop))
#pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast
                {
                    // Debug.Log($"defaulting to base child transform. Current physicalTerminator: {(currentPhysicalTerminator as MonoBehaviour)?.name}");
                    return(base.GetChildTransform());
                }
                //TODO: find the size of the nested block and use that to determine the position
                var draggableTerminator = currentPhysicalTerminator as SeriesDragDrop;
                return(base.GetChildTransform() + (draggableTerminator.transform.position + -this.transform.position + -this.GetNestedOffset()));
            }
            return(base.GetChildTransform());
        }