Exemplo n.º 1
0
 public static UIManagerFactory getInstance()
 {
     if (instance == null)
     {
         instance = FindObjectOfType <UIManagerFactory>();
         if (instance == null)
         {
             instance = new GameObject("UIManagerFactory").AddComponent <UIManagerFactory>();
         }
     }
     return(instance);
 }
Exemplo n.º 2
0
        private void AddButtons(MonoBehaviour uiManager)
        {
            Transform menuShortcut = uiManager.transform.Find("MenuShortcut");
            Button    nButton      = UIManagerFactory.getInstance().CreateTap();

            nButton.name = "NTap";
            nButton.GetComponentInChildren <Text>().text = "[N]";
            Button rButton = UIManagerFactory.getInstance().CreateTap();

            rButton.name = "RTap";
            rButton.GetComponentInChildren <Text>().text = "[R]";
            Button pButton = UIManagerFactory.getInstance().CreateTap();

            pButton.name = "PTap";
            pButton.GetComponentInChildren <Text>().text = "[P]";
            nButton.transform.SetParent(menuShortcut.transform, false);
            rButton.transform.SetParent(menuShortcut.transform, false);
            pButton.transform.SetParent(menuShortcut.transform, false);
            nButton.onClick.AddListener(() => OnTapClick(nButton));
            rButton.onClick.AddListener(() => OnTapClick(rButton));
            pButton.onClick.AddListener(() => OnTapClick(pButton));
        }