예제 #1
0
 void Start()
 {
     if (prefabUIObject != null)
     {
         uiObject = Instantiate(prefabUIObject) as UIObject;
         uiObject.transform.parent        = UIRoot2D.Get().game.transform;
         uiObject.transform.localPosition = transform.position;
         uiObject.transform.localRotation = transform.rotation;
         uiObject.transform.localScale    = Vector3.one;
         buttonController = uiObject.GetComponent <UIButtonController>();
     }
     Start_();
 }
    private void ExecuteUI()
    {
        if (hasactiveUI)
        {
            switch (activeName)
            {
            case "Volume":
                SetGameVolume(activeUI.GetComponent <Slider>().value);
                break;

            case "Speed":
                SetGameSpeed(activeUI.GetComponent <Slider>().value);
                break;

            case "Continue":
                ContinueGame();
                break;

            case "Restart":
                RestartGame();
                break;

            case "Quit":
                QuitGame();
                break;

            case "About":
                EnableAboutScreen(true);
                break;

            case "Back":
                EnableAboutScreen(false);
                break;
            }
            activeUI.EnableAllHighlights(false);
            activeUI.ResetIndex();
            hasactiveUI = false;
        }
    }
예제 #3
0
 public UILayout(UILayout layout)
 {
     UIObject      = BaseLayout();
     RectTransform = UIObject.GetComponent <RectTransform>();
     layout.AddSubview(this);
 }
예제 #4
0
 public UILayout(RectTransform transform)
 {
     UIObject      = BaseLayout();
     RectTransform = UIObject.GetComponent <RectTransform>();
     RectTransform.SetParent(transform);
 }
예제 #5
0
 private UICanvas() : base(Object.FindObjectOfType <Canvas>().gameObject ?? new GameObject("Canvas"))
 {
     Canvas           = UIObject.GetComponent <Canvas>() ?? UIObject.AddComponent <Canvas>();
     CanvasScaler     = UIObject.GetComponent <CanvasScaler>() ?? UIObject.AddComponent <CanvasScaler>();
     GraphicRaycaster = UIObject.GetComponent <GraphicRaycaster>() ?? UIObject.AddComponent <GraphicRaycaster>();
 }