public static FreestarAndroidListener GetInstance()
        {
            if (instance == null)
            {
                instance = new FreestarAndroidListener();
            }

            return(instance);
        }
コード例 #2
0
        private static AndroidJavaObject CreateAndroidPluginInstance()
        {
            using (var pluginClass = new AndroidJavaClass("com.freestar.android.unity.FreestarPlugin"))
            {
                FreestarPlugin = pluginClass.CallStatic <AndroidJavaObject>("GetInstance");
            }

            if (FreestarPlugin != null)
            {
                AndroidJavaClass  javaClass       = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                AndroidJavaObject currentActivity = javaClass.GetStatic <AndroidJavaObject>("currentActivity");

                FreestarPlugin.Call("SetActivity", currentActivity);
                FreestarPlugin.Call("SetUnityAdListener", FreestarAndroidListener.GetInstance());
                FreestarAndroidListener.GetInstance().FreestarAdDelegateEventHandler += onFreestarEventReceiver;
            }
            else
            {
                Debug.Log("Unable to Initialize FreestarPlugin...");
            }
            return(FreestarPlugin);
        }