Ejemplo n.º 1
0
        private void OnPartRemoved(PartOfProduct part)
        {
            rebuildOnEnter = true;

            part.onFocusEnter -= OnPartFocused;
            partsByLabel[part.label].Remove(part);
        }
Ejemplo n.º 2
0
        private void OnPartFocused(PartOfProduct part, FocusEventData eventData)
        {
            if (!_active)
            {
                return;
            }

            //TODO: On part of product with same name focused, move tooltip
        }
Ejemplo n.º 3
0
        private void OnPartAdded(PartOfProduct part)
        {
            rebuildOnEnter = true;

            part.onFocusEnter += OnPartFocused;

            if (!partsByLabel.ContainsKey(part.label))
            {
                partsByLabel[part.label]      = new List <PartOfProduct>();
                partsSetupByLabel[part.label] = new List <PartOfProduct.PartTooltipSetup>();
            }

            partsByLabel[part.label].Add(part);

            if (part.productTooltipSetups == null)
            {
                part.productTooltipSetups = new List <PartOfProduct.PartTooltipSetup>();
            }
            if (part.productTooltipSetups.Count == 0)
            {
                part.productTooltipSetups.Add(new PartOfProduct.PartTooltipSetup());
            }

            foreach (var setup in part.productTooltipSetups)
            {
                if (setup.tooltipAnchor == null)
                {
                    setup.tooltipAnchor = new GameObject("tooltip_anchor").transform;

                    setup.tooltipAnchor.position = (part.useBoundingBoxCenter ? part.transform.TransformPoint(part.localBoundCenter) : part.transform.position);
                }

                if (setup.tooltipPivot == null)
                {
                    setup.tooltipPivot = new GameObject("tooltip_pivot").transform;

                    setup.tooltipPivot.position = setup.tooltipAnchor.position + (part.transform.up * settings.autoFillEmptyPivotsDistance);
                }
                //TODO: parent to drone prefab root instead
                setup.tooltipAnchor.SetParent(stateMananger.appStateAdjust.boundingBox.transform);
                setup.tooltipPivot.SetParent(stateMananger.appStateAdjust.boundingBox.transform);
                setup.tooltipAnchor.hideFlags = HideFlags.HideInHierarchy;
                setup.tooltipPivot.hideFlags  = HideFlags.HideInHierarchy;
            }
            partsSetupByLabel[part.label].AddRange(part.productTooltipSetups);
        }