Esempio n. 1
0
 public void HideDialog()
 {
     // HideDialog might get called when there is no dialog present, so check for existence.
     if (dialog)
     {
         // Destroy the old dialog
         Destroy(dialog.gameObject);
         // Reset reference to null
         dialog = null;
     }
 }
Esempio n. 2
0
        public void ShowDialog(BaseTile obj, string title, params TileActionButton[] buttons)
        {
            // Show the tile popup dialog with the specified options on the specified tile
            // Hide the old dialog first, if it exists.
            if (dialog)
            {
                HideDialog();
            }

            // Create the new dialog as a child of the main canvas
            dialog = Instantiate(dialogPrefab, canvas.transform, false);

            // If the tile was set, build the dialog up with this tile and with the buttons provided as parameters
            if (obj)
            {
                dialog.ShowDialog(obj, title ?? "Choose action", buttons);
            }
        }