Tanoda
pb_ToolSelectorButton.cs
Go to the documentation of this file.
1using UnityEngine;
2using System.Collections;
3using System.Runtime.InteropServices;
4using System.Text;
5using GILES.Interface;
6using NaughtyAttributes;
8using UnityEngine.UI;
9
10namespace GILES
11{
12 public class pb_ToolSelectorButton : MonoBehaviour
13 {
16 public UnityEvent<GameObject> OnSelected = new UnityEvent<GameObject>();
17
18 private void Awake()
19 {
20 instance = this;
21 }
22
23 [Button]
24 public void SelectToolWindow(string selected = "")
25 {
26 var dlog = GameObject.Instantiate(dialogPrefab);
27 dlog.UpdateDirectoryContents(selected);
28 //dlog.SetDirectory("");
29 dlog.AddOnSaveListener(onSelected);
30
31 pb_ModalWindow.SetContent(dlog.gameObject);
32 pb_ModalWindow.SetTitle("SELECT_TOOL");
34
35 StartCoroutine(LateSelect(dlog));
36 }
37
38 private IEnumerator LateSelect(pb_ToolDialog dlog)
39 {
40 yield return null;
41 dlog.selectedLine.GetComponent<Button>().Select();
42
43 }
44
45 private void onSelected(GameObject go)
46 {
47 OnSelected.Invoke(go);
48 }
49 }
50}
UnityEngine.UI.Button Button
Definition: Pointer.cs:7
static void SetTitle(string title)
static void SetContent(GameObject prefab)
UnityEvent< GameObject > OnSelected
static pb_ToolSelectorButton instance
void SelectToolWindow(string selected="")