Exemple #1
0
        private void OnBreadcrumbChosen(BreadcrumbData data)
        {
            AssetTree.Node node = CurrentNode.parent;
            while (node != null)
            {
                LevelSelectButtonData buttonData = node.value as LevelSelectButtonData;
                if (buttonData.DisplayName == data.name)
                {
                    CurrentNode = node;
                    break;
                }

                node = node.parent;
            }
        }
        public LevelSelectButton AddButton(LevelSelectButtonData buttonData)
        {
            GameObject        buttonObject = GameObject.Instantiate(buttonPrefab);
            LevelSelectButton button       = buttonObject.GetComponentInChildren <LevelSelectButton>();

            Assert.IsNotNull(button);

            buttonObject.transform.SetParent(buttonLayoutGroup.transform);
            button.Setup(buttonData);
            buttons.Add(button);

            MarkTilesDirty();

            return(button);
        }
        public void Setup(LevelSelectButtonData buttonData)
        {
            Assert.IsNotNull(buttonData);
            data = buttonData;

            if (displayNameText != null)
            {
                displayNameText.text = data.DisplayName;
            }

            if (data.BackgroundSprite != null)
            {
                Image image = GetComponent <Image>();
                image.sprite = data.BackgroundSprite;
            }
        }
        private static void FindMissingScenes(HashSet <string> currentScenes, AssetTree.Node currentNode, HashSet <string> missingScenes)
        {
            LevelSelectButtonData buttonData = currentNode.value as LevelSelectButtonData;

            if (buttonData != null && buttonData.SceneAsset != null)
            {
                string sceneName = AssetDatabase.GetAssetPath(buttonData.SceneAsset);
                if (!currentScenes.Contains(sceneName))
                {
                    missingScenes.Add(sceneName);
                }
            }

            for (int i = 0; i < currentNode.children.Count; i++)
            {
                AssetTree.Node childNode = currentNode.children[i];
                FindMissingScenes(currentScenes, childNode, missingScenes);
            }
        }
Exemple #5
0
        private void OnButtonClicked(LevelSelectButtonData data)
        {
            if (!string.IsNullOrEmpty(data.SceneName))
            {
                return;
            }

            BreadcrumbData breadcrumbData = new BreadcrumbData();

            breadcrumbData.displayName = data.DisplayName;
            breadcrumbData.name        = data.DisplayName;
            breadcrumbTrail.AddBreadcrumb(breadcrumbData);

            foreach (AssetTree.Node node in CurrentNode.children)
            {
                LevelSelectButtonData nodeData = node.value as LevelSelectButtonData;
                if (nodeData == data)
                {
                    CurrentNode = node;
                    break;
                }
            }
        }