/// <summary>
 /// Shows the given Zapic page
 /// </summary>
 /// <param name="page">Page to show.</param>
 public void ShowPage(ZapicPages page)
 {
     zpc_show(page.ToString().ToLower());
 }
Beispiel #2
0
 public void ShowPage(ZapicPages page)
 {
     using (var unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
         using (var gameActivityObject = unityPlayerClass.GetStatic <AndroidJavaObject>("currentActivity"))
             using (var pageObject = new AndroidJavaObject("java.lang.String", page.ToString().ToLower()))
                 using (var zapicClass = new AndroidJavaClass("com.zapic.sdk.android.Zapic"))
                 {
                     var methodId = AndroidJNI.GetStaticMethodID(
                         zapicClass.GetRawClass(),
                         "showPage",
                         "(Landroid/app/Activity;Ljava/lang/String;)V");
                     var objectArray = new object[2];
                     var argArray    = AndroidJNIHelper.CreateJNIArgArray(objectArray);
                     try
                     {
                         argArray[0].l = gameActivityObject.GetRawObject();
                         argArray[1].l = pageObject.GetRawObject();
                         AndroidJNI.CallStaticVoidMethod(zapicClass.GetRawClass(), methodId, argArray);
                     }
                     finally
                     {
                         AndroidJNIHelper.DeleteJNIArgArray(objectArray, argArray);
                     }
                 }
 }