Esempio n. 1
0
    private void Start()
    {
        winScreen     = transform.Find("WinScreen").gameObject;
        winText       = transform.Find("WinScreen/WinMessage").GetComponent <Text>();
        restartButton = transform.Find("WinScreen/RestartButton").GetComponent <Button>();
        quitButton    = transform.Find("WinScreen/QuitButton").GetComponent <Button>();

        messageBox = transform.Find("MessageBox").GetComponent <UIMessageBox>();
        messageBox.Init();


        countDown = transform.Find("CountDown").GetComponent <CountDownControl>();
        countDown.Init(this);
        winScreen.SetActive(false);

        helpTextBox   = transform.Find("HelpText").gameObject;
        helpTextLabel = transform.Find("HelpText/Label").GetComponent <Text>();
        ClearHelpText();

        restartButton.onClick.AddListener(RestartButtonPressed);
        quitButton.onClick.AddListener(QuitButtonPressed);

        progress    = transform.Find("Progress").GetComponent <ProgressControl>();
        tipsDisplay = transform.Find("Tips").GetComponent <UITipsDisplay>();

        lobby = transform.Find("LobbyUI").GetComponent <UILobby>();

        audioSource = Camera.main.gameObject.AddComponent <AudioSource>();
    }
Esempio n. 2
0
    public static UIMessageBox MessageBox(Transform parent, string title, string msg, UIMessageBoxAction[] actions)
    {
        GameObject go = new GameObject("UIMessageBox ");

        go.transform.SetParent(parent, worldPositionStays: false);
        UIMessageBox dlg = go.AddComponent <UIMessageBox>();

        dlg.Init(title, msg, actions);
        return(dlg);
    }
    public static UIMessageBox Show(string message, string title = "", MessageBoxType type = MessageBoxType.Information, string btnOk = "", string btnCancel = "")
    {
        if (Cacheobject == null)
        {
            Cacheobject = Resloader.Load <Object>("UI/UIMessageBox");
        }

        GameObject   go     = (GameObject)GameObject.Instantiate(Cacheobject);
        UIMessageBox msgbox = go.GetComponent <UIMessageBox>();

        msgbox.Init(title, message, type, btnOk, btnCancel);
        return(msgbox);
    }