Ejemplo n.º 1
0
 /// <summary>
 /// Creates a custom dialog that can be modified or stored before showing.
 /// </summary>
 /// <typeparam name="T">The type of dialog to show, must inherit from <see cref="MaterialDialogCompat"/>.</typeparam>
 /// <param name="dialogPrefabPath">The path to the dialog prefab.</param>
 /// <returns>The instance of the created dialog.</returns>
 public void CreateCustomDialogAsync <T>(string dialogPrefabPath, System.Action <string, T> callback) where T : MaterialDialogCompat
 {
     System.Action <string, GameObject> internalcallback = (path, dialog) =>
     {
         T assetComponent = null;
         if (dialog != null)
         {
             assetComponent = dialog.GetComponent <T>();
             DialogManager.CreateActivity(assetComponent, dialog.transform.parent);
         }
         callback(path, assetComponent);
     };
     PrefabManager.InstantiateGameObjectAsync(dialogPrefabPath, GetContentTransform(), internalcallback);
 }
Ejemplo n.º 2
0
        public static void CreateCustomScreenAsync <T>(string screenPrefabPath, ScreenView screenView, System.Action <string, T> callback) where T : MaterialScreen
        {
            System.Action <string, GameObject> internalCallback = (path, screen) =>
            {
                if (screen != null)
                {
                    screen.name = screenPrefabPath;
                    screen.gameObject.SetActive(false);
                }

                T assetComponent = null;
                if (screen != null)
                {
                    assetComponent = screen.GetComponent <T>();
                }
                callback(path, assetComponent);
            };
            PrefabManager.InstantiateGameObjectAsync(screenPrefabPath, screenView != null ? screenView.transform : Instance.transform, internalCallback);
        }