示例#1
0
        public void ConfigureCell(CachedTransform cached, int cellIndex)
        {
            if (cached == null)
            {
                ExplorerCore.LogWarning("Setting TransformTree cell but the CachedTransform is null!");
                return;
            }

            if (!Enabled)
            {
                Enable();
            }

            _cellIndex      = cellIndex;
            cachedTransform = cached;

            spacer.minWidth = cached.Depth * 15;

            if (cached.Value)
            {
                NameButton.ButtonText.text  = cached.Value.name;
                NameButton.ButtonText.color = cached.Value.gameObject.activeSelf ? Color.white : Color.grey;

                int childCount = cached.Value.childCount;
                if (childCount > 0)
                {
                    NameButton.ButtonText.text = $"<color=grey>[{childCount}]</color> {NameButton.ButtonText.text}";

                    ExpandButton.Component.interactable = true;
                    ExpandButton.ButtonText.text        = cached.Expanded ? "▼" : "►";
                    ExpandButton.ButtonText.color       = cached.Expanded ? new Color(0.5f, 0.5f, 0.5f) : new Color(0.3f, 0.3f, 0.3f);
                }
                else
                {
                    ExpandButton.Component.interactable = false;
                    ExpandButton.ButtonText.text        = "▪";
                    ExpandButton.ButtonText.color       = new Color(0.3f, 0.3f, 0.3f);
                }
            }
            else
            {
                NameButton.ButtonText.text  = $"[Destroyed]";
                NameButton.ButtonText.color = Color.red;
            }
        }
示例#2
0
        public void ConfigureCell(CachedTransform cached, int cellIndex)
        {
            if (cached == null)
            {
                ExplorerCore.LogWarning("Setting TransformTree cell but the CachedTransform is null!");
                return;
            }

            if (!Enabled)
            {
                Enable();
            }

            this.cellIndex  = cellIndex;
            cachedTransform = cached;

            spacer.minWidth = cached.Depth * 15;

            if (cached.Value)
            {
                string name = cached.Value.name?.Trim();
                if (string.IsNullOrEmpty(name))
                {
                    name = "<i><color=grey>untitled</color></i>";
                }
                NameButton.ButtonText.text  = name;
                NameButton.ButtonText.color = cached.Value.gameObject.activeSelf ? Color.white : Color.grey;

                EnabledToggle.Set(cached.Value.gameObject.activeSelf, false);

                if (!cached.Value.parent)
                {
                    SiblingIndex.GameObject.SetActive(false);
                }
                else
                {
                    SiblingIndex.GameObject.SetActive(true);
                    if (!SiblingIndex.Component.isFocused)
                    {
                        SiblingIndex.Text = cached.Value.GetSiblingIndex().ToString();
                    }
                }

                int childCount = cached.Value.childCount;
                if (childCount > 0)
                {
                    NameButton.ButtonText.text = $"<color=grey>[{childCount}]</color> {NameButton.ButtonText.text}";

                    ExpandButton.Component.interactable = true;
                    ExpandButton.ButtonText.text        = cached.Expanded ? "▼" : "►";
                    ExpandButton.ButtonText.color       = cached.Expanded ? new Color(0.5f, 0.5f, 0.5f) : new Color(0.3f, 0.3f, 0.3f);
                }
                else
                {
                    ExpandButton.Component.interactable = false;
                    ExpandButton.ButtonText.text        = "▪";
                    ExpandButton.ButtonText.color       = new Color(0.3f, 0.3f, 0.3f);
                }
            }
            else
            {
                NameButton.ButtonText.text  = $"[Destroyed]";
                NameButton.ButtonText.color = Color.red;

                SiblingIndex.GameObject.SetActive(false);
            }
        }