public TipDialog()
    {
        canvas = GameObject.Find("Canvas");
        if (canvas == null)
        {
            Canvas c = new Canvas();
            canvas = c.gameObject;
        }

        f = () => { Debug.Log("Clicked"); };

        panel = new GameObject("DialogPanel");
        panel.AddComponent <RectTransform> ();
        panel.AddComponent <CanvasRenderer> ();
        panel.AddComponent <Image> ();
        panel.layer = 5;
        panel.transform.SetParent(canvas.transform);

        button = new GameObject("DialogButton");
        button.AddComponent <RectTransform> ();
        button.AddComponent <CanvasRenderer> ();
        button.AddComponent <Image> ();
        button.AddComponent <Button> ();
        button.GetComponent <Button> ().onClick.AddListener(
            () => {
            Hide();
            f();
        });
        button.layer = 5;
        button.transform.SetParent(panel.transform);
        ResetButtonValues();



        text = new GameObject("DialogText");
        text.AddComponent <RectTransform> ();
        text.AddComponent <CanvasRenderer> ();
        text.AddComponent <Text> ();
        text.layer = 5;
        text.transform.SetParent(panel.transform);
        ResetTextValues();

        placePanel();
        placeText();
        placeButton();
    }
 public ChainTextDialog()
 {
     texts = new List <string> ();
     texts.Add("Texto 1");
     texts.Add("Texto 2");
     texts.Add("Texto 3");
     currentTextIndex = 0;
     SetInfoTextText(texts[currentTextIndex]);
     this.f = () => {
         this.Show();
         currentTextIndex++;
         if (currentTextIndex >= texts.Count)
         {
             this.Hide();
             currentTextIndex = 0;
             g();
         }
         this.SetInfoTextText(texts[currentTextIndex]);
     };
     g = () => {
     };
 }
 public void SetOnClickFunction(OnClickOkDialog f)
 {
     this.g = f;
 }