Exemplo n.º 1
0
        private void ShowAndroidUpdateDialog(string appUpdateUrl)
        {
            CommonLog.Log(MAuthor.ZX, "Open Android Update Dialog");
            AndroidJavaClass  unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject activity    = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity");

            AndroidAlertDialog alertDialog = new AndroidAlertDialog(activity);

            alertDialog.SetTitle("游戏版本检测");
            alertDialog.SetMessage("检测到有新的游戏版本,是否更新?");
            alertDialog.SetPositiveButton("是", new AlertDialogClickListener((dialog, which) =>
            {
                //跳转App更新界面
                Application.OpenURL(appUpdateUrl);
                //强制退出
                Application.Quit();
            }));
            alertDialog.SetNegativeButton("否", new AlertDialogClickListener((dialog, which) =>
            {
                //强制退出
                Application.Quit();
            }));
            alertDialog.Create();
            alertDialog.Show();
        }
Exemplo n.º 2
0
    /// <summary>
    /// 显示Android升级弹窗
    /// </summary>
    private void ShowAndroidUpdateDialog()
    {
        CommonLog.Log(MAuthor.ZX, "Open Android Update Dialog");
        AndroidJavaClass  unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject activity    = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity");

        AndroidAlertDialog alertDialog = new AndroidAlertDialog(activity);

        alertDialog.SetTitle("游戏版本检测");
        alertDialog.SetMessage("检测到有新的游戏版本,是否更新?");
        alertDialog.SetPositiveButton("是", new AlertDialogClickListener(OnConfirm));
        alertDialog.SetNegativeButton("否", new AlertDialogClickListener(OnCancel));
        alertDialog.Create();
        alertDialog.Show();
    }