void OpenBreadcrump(HistoryElement history)
        {
            //Destroy all breadcrumps after the one clicked
            GMButton button = breadcrumps.FirstOrDefault(b => b.Value == history).Key;

            if (button != null)
            {
                int childIndex = button.transform.GetSiblingIndex();

                for (int i = transform.childCount - 1; i >= childIndex; --i)
                {
                    Transform breadcrump = transform.GetChild(i);
                    GMButton  _button    = breadcrump.GetComponent <GMButton>();

                    if (_button != null)
                    {
                        breadcrumps.Remove(_button);
                        Destroy(_button.gameObject);
                    }
                }
            }

            this.Publish(new Service.DevUIService.Events.NewDataTable()
            {
                // since this is a single object and the DataBrowser is meant for lists, wrap the object in a list
                objectList = history.objectList,
                tableTitle = history.historyTitle,
            });
        }
        void SpawnBreadcrump(HistoryElement historyElement)
        {
            GMButton breadcrump = Instantiate(breadcrumpTemplate);

            breadcrump.transform.SetParent(transform, false);
            if (!breadcrump.gameObject.activeSelf)
            {
                breadcrump.gameObject.SetActive(true);
            }
            breadcrump.GetComponentInChildren <Text>().text = historyElement.historyTitle;
            breadcrump.onClick.AddListener(
                () => OpenBreadcrump(historyElement)
                );

            breadcrumps.Add(breadcrump, historyElement);
        }
示例#3
0
 private void Awake()
 {
     button = gameObject.GetComponent <GMButton>();
     button.onClick.AddListener(OnClick);
 }