本文整理汇总了C#中UnityEngine.AndroidJavaClass.GetRawClass方法的典型用法代码示例。如果您正苦于以下问题:C# AndroidJavaClass.GetRawClass方法的具体用法?C# AndroidJavaClass.GetRawClass怎么用?C# AndroidJavaClass.GetRawClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.AndroidJavaClass
的用法示例。
在下文中一共展示了AndroidJavaClass.GetRawClass方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AGSAchievementsClient
static AGSAchievementsClient(){
#if UNITY_ANDROID && !UNITY_EDITOR
JavaObject = new AmazonJavaWrapper();
using( var PluginClass = new AndroidJavaClass( PROXY_CLASS_NAME ) ){
if (PluginClass.GetRawClass() == IntPtr.Zero)
{
AGSClient.LogGameCircleWarning(string.Format("No java class {0} present, can't use AGSAchievementsClient",PROXY_CLASS_NAME ));
return;
}
JavaObject.setAndroidJavaObject(PluginClass.CallStatic<AndroidJavaObject>( "getInstance" ));
}
#endif
}
示例2: AGSPlayerClient
static AGSPlayerClient(){
#if UNITY_ANDROID && !UNITY_EDITOR
// find the plugin instance
JavaObject = new AmazonJavaWrapper();
using( var PluginClass = new AndroidJavaClass( PROXY_CLASS_NAME ) ){
if (PluginClass.GetRawClass() == IntPtr.Zero)
{
AGSClient.LogGameCircleWarning("No java class " + PROXY_CLASS_NAME + " present, can't use AGSPlayerClient" );
return;
}
JavaObject.setAndroidJavaObject(PluginClass.CallStatic<AndroidJavaObject>( "getInstance" ));
}
#endif
}
示例3: Awake
//.........这里部分代码省略.........
gameObject.AddComponent<OVRDistortionCamera>();
}
}
//// -- UnityAndroid
#endif
// Get the cameras
OVRCamera[] ovrcameras = gameObject.GetComponentsInChildren<OVRCamera>( true );
for (int i = 0; i < ovrcameras.Length; i++)
{
// assign the right and left cameras, check the camera name for outdated prefabs
if(ovrcameras[i].RightEye || ( string.Compare( ovrcameras[i].name, "cameraright", true ) == 0 ) )
{
ovrcameras[i].RightEye = true;
SetCameras(CameraLeft, ovrcameras[i].camera);
}
else
{
SetCameras(ovrcameras[i].camera, CameraRight);
}
if ( ( ovrcameras[i].camera.clearFlags == CameraClearFlags.Skybox ) && ( ( ovrcameras[i].gameObject.GetComponent<Skybox>() != null ) || ( RenderSettings.skybox != null ) ) )
{
HasSkybox = true;
Debug.Log ( "Skybox Clear Required" );
}
}
if ((CameraLeft == null) || (CameraRight == null))
Debug.LogWarning("WARNING: Unity Cameras in OVRCameraController not found!");
#if (UNITY_ANDROID && !UNITY_EDITOR)
// Disable screen dimming
Screen.sleepTimeout = SleepTimeout.NeverSleep;
Application.targetFrameRate = 60;
// don't allow the app to run in the background
Application.runInBackground = false;
// don't enable gyro, it is not used and triggers expensive display calls
if ( Input.gyro.enabled )
{
Debug.LogError( "*** Auto-disabling Gyroscope ***" );
Input.gyro.enabled = false;
}
// don't enable antiAliasing on the main window display, it may cause
// bad behavior with various tiling controls.
if ( QualitySettings.antiAliasing > 1 )
{
Debug.LogError( "*** Main Display should have 0 samples ***" );
}
// Only perform this check when the CameraController is enabled
// to allow for toggling stereo / non-stero camers for testing.
if ( this.enabled )
{
// Make sure there isn't an OVRDistortion camera on Android
// this is done primarly to clean up old camera controller prefabs
Camera[] cameras = gameObject.GetComponentsInChildren<Camera>();
for (int i = 0; i < cameras.Length; i++)
{
if ( (cameras[i] != CameraLeft) && ( cameras[i] != CameraRight ) )
{
Debug.LogWarning("WARNING: Extra camera on OVRCameraController found!");
cameras[i].cullingMask = 0; // cull everything
cameras[i].clearFlags = CameraClearFlags.Nothing;
Destroy( cameras[i] );
}
}
}
CameraLeft.depth = (int)RenderEventType.LeftEyeEndFrame;
CameraRight.depth = (int)RenderEventType.RightEyeEndFrame;
// When rendering monoscopic, we will use the left camera render
// for both eyes.
if ( Monoscopic )
{
//CameraRight.enabled = false;
CameraRight.cullingMask = 0; // cull everything
CameraRight.clearFlags = CameraClearFlags.Nothing;
}
if ( !androidJavaInit )
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
javaVrActivityClass = new AndroidJavaClass("com.oculusvr.vrlib.VrActivity");
// Prepare for the RenderThreadInit()
OVR_SetInitVariables( activity.GetRawObject(), javaVrActivityClass.GetRawClass() );
androidJavaInit = true;
}
InitVolumeController();
#endif
}
示例4: LaunchBridgeIntent
// Must be launched from the game thread (otherwise the classloader cannot locate the unity
// java classes we require).
private void LaunchBridgeIntent(IntPtr bridgedIntent) {
object[] objectArray = new object[2];
jvalue[] jArgs = AndroidJNIHelper.CreateJNIArgArray(objectArray);
try {
using (var bridgeClass = new AndroidJavaClass(BridgeActivityClass)) {
using (var currentActivity = GetActivity()) {
// Unity no longer supports constructing an AndroidJavaObject using an IntPtr,
// so I have to manually munge with JNI here.
IntPtr methodId = AndroidJNI.GetStaticMethodID(bridgeClass.GetRawClass(),
LaunchBridgeMethod,
LaunchBridgeSignature);
jArgs[0].l = currentActivity.GetRawObject();
jArgs[1].l = bridgedIntent;
AndroidJNI.CallStaticVoidMethod(bridgeClass.GetRawClass(), methodId, jArgs);
}
}
} finally {
AndroidJNIHelper.DeleteJNIArgArray(objectArray, jArgs);
}
}
示例5: IsAndroidJavaClassNull
private static bool IsAndroidJavaClassNull(AndroidJavaClass androidJavaClass) {
return androidJavaClass == null ||
androidJavaClass.GetRawClass().ToInt32() == 0;
}
示例6: Awake
private void Awake()
{
// Only allow one instance at runtime.
if (instance != null)
{
enabled = false;
DestroyImmediate(this);
return;
}
instance = this;
#if !UNITY_ANDROID || UNITY_EDITOR
if (!ovrIsInitialized)
{
OVR_Initialize();
OVRPluginEvent.Issue(RenderEventType.Initialize);
ovrIsInitialized = true;
}
var netVersion = new System.Version(Ovr.Hmd.OVR_VERSION_STRING);
var ovrVersion = new System.Version(Ovr.Hmd.GetVersionString());
if (netVersion > ovrVersion)
Debug.LogWarning("Using an older version of LibOVR.");
#endif
// Detect whether this platform is a supported platform
RuntimePlatform currPlatform = Application.platform;
isSupportedPlatform |= currPlatform == RuntimePlatform.Android;
isSupportedPlatform |= currPlatform == RuntimePlatform.LinuxPlayer;
isSupportedPlatform |= currPlatform == RuntimePlatform.OSXEditor;
isSupportedPlatform |= currPlatform == RuntimePlatform.OSXPlayer;
isSupportedPlatform |= currPlatform == RuntimePlatform.WindowsEditor;
isSupportedPlatform |= currPlatform == RuntimePlatform.WindowsPlayer;
if (!isSupportedPlatform)
{
Debug.LogWarning("This platform is unsupported");
return;
}
#if UNITY_ANDROID && !UNITY_EDITOR
// don't allow the application to run if orientation is not landscape left.
if (Screen.orientation != ScreenOrientation.LandscapeLeft)
{
Debug.LogError("********************************************************************************\n");
Debug.LogError("***** Default screen orientation must be set to landscape left for VR.\n" +
"***** Stopping application.\n");
Debug.LogError("********************************************************************************\n");
Debug.Break();
Application.Quit();
}
// don't enable gyro, it is not used and triggers expensive display calls
if (Input.gyro.enabled)
{
Debug.LogError("*** Auto-disabling Gyroscope ***");
Input.gyro.enabled = false;
}
// NOTE: On Adreno Lollipop, it is an error to have antiAliasing set on the
// main window surface with front buffer rendering enabled. The view will
// render black.
// On Adreno KitKat, some tiling control modes will cause the view to render
// black.
if (QualitySettings.antiAliasing > 1)
{
Debug.LogError("*** Antialiasing must be disabled for Gear VR ***");
}
// we sync in the TimeWarp, so we don't want unity
// syncing elsewhere
QualitySettings.vSyncCount = 0;
// try to render at 60fps
Application.targetFrameRate = 60;
// don't allow the app to run in the background
Application.runInBackground = false;
// Disable screen dimming
Screen.sleepTimeout = SleepTimeout.NeverSleep;
if (!androidJavaInit)
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
javaVrActivityClass = new AndroidJavaClass("com.oculusvr.vrlib.VrActivity");
// Prepare for the RenderThreadInit()
SetInitVariables(activity.GetRawObject(), javaVrActivityClass.GetRawClass());
#if !INHIBIT_ENTITLEMENT_CHECK
AndroidJavaObject entitlementChecker = new AndroidJavaObject("com.oculus.svclib.OVREntitlementChecker");
entitlementChecker.CallStatic("doAutomatedCheck", activity);
#else
Debug.Log( "Inhibiting Entitlement Check!" );
#endif
androidJavaInit = true;
}
//.........这里部分代码省略.........
示例7: Awake
private void Awake()
{
// Only allow one instance at runtime.
if (instance != null)
{
enabled = false;
DestroyImmediate(this);
return;
}
instance = this;
#if !UNITY_ANDROID || UNITY_EDITOR
var netVersion = new System.Version(Ovr.Hmd.OVR_VERSION_STRING);
var ovrVersion = new System.Version(Ovr.Hmd.GetVersionString());
if (netVersion > ovrVersion)
Debug.LogWarning("Using an older version of LibOVR.");
#endif
// Detect whether this platform is a supported platform
RuntimePlatform currPlatform = Application.platform;
isSupportedPlatform |= currPlatform == RuntimePlatform.Android;
isSupportedPlatform |= currPlatform == RuntimePlatform.LinuxPlayer;
isSupportedPlatform |= currPlatform == RuntimePlatform.OSXEditor;
isSupportedPlatform |= currPlatform == RuntimePlatform.OSXPlayer;
isSupportedPlatform |= currPlatform == RuntimePlatform.WindowsEditor;
isSupportedPlatform |= currPlatform == RuntimePlatform.WindowsPlayer;
if (!isSupportedPlatform)
{
Debug.LogWarning("This platform is unsupported");
return;
}
#if UNITY_ANDROID && !UNITY_EDITOR
Application.targetFrameRate = 60;
// don't allow the app to run in the background
Application.runInBackground = false;
// Disable screen dimming
Screen.sleepTimeout = SleepTimeout.NeverSleep;
if (!androidJavaInit)
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
javaVrActivityClass = new AndroidJavaClass("com.oculusvr.vrlib.VrActivity");
// Prepare for the RenderThreadInit()
SetInitVariables(activity.GetRawObject(), javaVrActivityClass.GetRawClass());
androidJavaInit = true;
}
// We want to set up our touchpad messaging system
OVRTouchpad.Create();
// This will trigger the init on the render thread
InitRenderThread();
#else
SetEditorPlay(Application.isEditor);
#endif
if (display == null)
display = new OVRDisplay();
if (tracker == null)
tracker = new OVRTracker();
tracker.isEnabled = false;
usePositionTracking = false;
if (resetTrackerOnLoad)
display.RecenterPose();
// Except for D3D9, SDK rendering forces vsync unless you pass ovrHmdCap_NoVSync to Hmd.SetEnabledCaps().
if (timeWarp)
{
bool useUnityVSync = SystemInfo.graphicsDeviceVersion.Contains("Direct3D 9");
QualitySettings.vSyncCount = useUnityVSync ? 1 : 0;
}
#if (UNITY_STANDALONE_WIN && (UNITY_4_6 || UNITY_4_5))
bool unity_4_6 = false;
bool unity_4_5_2 = false;
bool unity_4_5_3 = false;
bool unity_4_5_4 = false;
bool unity_4_5_5 = false;
#if (UNITY_4_6)
unity_4_6 = true;
#elif (UNITY_4_5_2)
unity_4_5_2 = true;
#elif (UNITY_4_5_3)
unity_4_5_3 = true;
#elif (UNITY_4_5_4)
unity_4_5_4 = true;
#elif (UNITY_4_5_5)
unity_4_5_5 = true;
#endif
// Detect correct Unity releases which contain the fix for D3D11 exclusive mode.
string version = Application.unityVersion;
int releaseNumber;
//.........这里部分代码省略.........
示例8: Awake
//.........这里部分代码省略.........
Debug.Break();
Application.Quit();
}
// don't enable gyro, it is not used and triggers expensive display calls
if (Input.gyro.enabled)
{
Debug.LogError("*** Auto-disabling Gyroscope ***");
Input.gyro.enabled = false;
}
// NOTE: On Adreno Lollipop, it is an error to have antiAliasing set on the
// main window surface with front buffer rendering enabled. The view will
// render black.
// On Adreno KitKat, some tiling control modes will cause the view to render
// black.
if (QualitySettings.antiAliasing > 1)
{
Debug.LogError("*** Antialiasing must be disabled for Gear VR ***");
}
// we sync in the TimeWarp, so we don't want unity
// syncing elsewhere
QualitySettings.vSyncCount = 0;
// try to render at 60fps
Application.targetFrameRate = 60;
// don't allow the app to run in the background
Application.runInBackground = false;
// Disable screen dimming
Screen.sleepTimeout = SleepTimeout.NeverSleep;
if (!androidJavaInit)
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
javaVrActivityClass = new AndroidJavaClass("com.oculusvr.vrlib.VrActivity");
// Prepare for the RenderThreadInit()
SetInitVariables(activity.GetRawObject(), javaVrActivityClass.GetRawClass());
#if USE_ENTITLEMENT_CHECK
AndroidJavaObject entitlementChecker = new AndroidJavaObject("com.oculus.svclib.OVREntitlementChecker");
entitlementChecker.CallStatic("doAutomatedCheck", activity);
#else
Debug.Log( "Inhibiting Entitlement Check!" );
#endif
androidJavaInit = true;
}
// We want to set up our touchpad messaging system
OVRTouchpad.Create();
InitVolumeController();
#else
SetEditorPlay(Application.isEditor);
#endif
prevEyeTextureAntiAliasing = OVRManager.instance.eyeTextureAntiAliasing;
prevEyeTextureDepth = OVRManager.instance.eyeTextureDepth;
prevEyeTextureFormat = OVRManager.instance.eyeTextureFormat;
prevNativeTextureScale = OVRManager.instance.nativeTextureScale;
prevVirtualTextureScale = OVRManager.instance.virtualTextureScale;
prevMonoscopic = OVRManager.instance.monoscopic;
prevHdr = OVRManager.instance.hdr;
if (display == null)
display = new OVRDisplay();
if (tracker == null)
tracker = new OVRTracker();
if (resetTrackerOnLoad)
display.RecenterPose();
#if !UNITY_ANDROID || UNITY_EDITOR
// Except for D3D9, SDK rendering forces vsync unless you pass ovrHmdCap_NoVSync to Hmd.SetEnabledCaps().
if (timeWarp)
{
bool useUnityVSync = SystemInfo.graphicsDeviceVersion.Contains("Direct3D 9");
QualitySettings.vSyncCount = useUnityVSync ? 1 : 0;
}
#endif
#if UNITY_STANDALONE_WIN
if (!OVRUnityVersionChecker.hasD3D9ExclusiveModeSupport && !display.isDirectMode && SystemInfo.graphicsDeviceVersion.Contains("Direct3D 9"))
{
MessageBox(0, "Direct3D 9 extended mode is not supported in this configuration. "
+ "Please use direct display mode, a different graphics API, or rebuild the application with a newer Unity version."
, "VR Configuration Warning", 0);
}
if (!OVRUnityVersionChecker.hasD3D11ExclusiveModeSupport && !display.isDirectMode && SystemInfo.graphicsDeviceVersion.Contains("Direct3D 11"))
{
MessageBox(0, "Direct3D 11 extended mode is not supported in this configuration. "
+ "Please use direct display mode, a different graphics API, or rebuild the application with a newer Unity version."
, "VR Configuration Warning", 0);
}
#endif
}
示例9: PlatformAndroid
public PlatformAndroid(string version, int capacity, int trim, string gesture)
{
pluginClass = new AndroidJavaClass(PluginClassName);
pluginClassRaw = pluginClass.GetRawClass();
IntPtr methodInit = GetStaticMethod(pluginClassRaw, "init", "(Ljava.lang.String;IILjava.lang.String;)V");
CallStaticVoidMethod(methodInit, new jvalue[] { jval(version), jval(capacity), jval(trim), jval(gesture) });
methodLogMessage = GetStaticMethod(pluginClassRaw, "logMessage", "(Ljava.lang.String;Ljava.lang.String;I)V");
methodShowConsole = GetStaticMethod(pluginClassRaw, "show", "()V");
methodHideConsole = GetStaticMethod(pluginClassRaw, "hide", "()V");
}
示例10: LaunchBridgeIntent
// Must be launched from the game thread (otherwise the classloader cannot locate the unity
// java classes we require).
private static void LaunchBridgeIntent(IntPtr bridgedIntent)
{
object[] objectArray = new object[2];
jvalue[] jArgs = AndroidJNIHelper.CreateJNIArgArray(objectArray);
try
{
using (var bridgeClass = new AndroidJavaClass(BridgeActivityClass))
{
using (var currentActivity = AndroidTokenClient.GetActivity())
{
// Unity no longer supports constructing an AndroidJavaObject using an IntPtr,
// so I have to manually munge with JNI here.
IntPtr methodId = AndroidJNI.GetStaticMethodID(bridgeClass.GetRawClass(),
LaunchBridgeMethod,
LaunchBridgeSignature);
jArgs[0].l = currentActivity.GetRawObject();
jArgs[1].l = bridgedIntent;
AndroidJNI.CallStaticVoidMethod(bridgeClass.GetRawClass(), methodId, jArgs);
}
}
}
catch (Exception e)
{
GooglePlayGames.OurUtils.Logger.e("Exception launching bridge intent: " + e.Message);
GooglePlayGames.OurUtils.Logger.e(e.ToString());
}
finally
{
AndroidJNIHelper.DeleteJNIArgArray(objectArray, jArgs);
}
}
示例11: Awake
private void Awake()
{
// Only allow one instance at runtime.
if (instance != null)
{
enabled = false;
DestroyImmediate(this);
return;
}
instance = this;
#if !UNITY_ANDROID || UNITY_EDITOR
var netVersion = new System.Version(Ovr.Hmd.OVR_VERSION_STRING);
var ovrVersion = new System.Version(Ovr.Hmd.GetVersionString());
if (netVersion > ovrVersion)
Debug.LogWarning("Using an older version of LibOVR.");
#endif
// Detect whether this platform is a supported platform
RuntimePlatform currPlatform = Application.platform;
isSupportedPlatform |= currPlatform == RuntimePlatform.Android;
isSupportedPlatform |= currPlatform == RuntimePlatform.LinuxPlayer;
isSupportedPlatform |= currPlatform == RuntimePlatform.OSXEditor;
isSupportedPlatform |= currPlatform == RuntimePlatform.OSXPlayer;
isSupportedPlatform |= currPlatform == RuntimePlatform.WindowsEditor;
isSupportedPlatform |= currPlatform == RuntimePlatform.WindowsPlayer;
if (!isSupportedPlatform)
{
Debug.LogWarning("This platform is unsupported");
return;
}
#if UNITY_ANDROID && !UNITY_EDITOR
Application.targetFrameRate = 60;
// don't allow the app to run in the background
Application.runInBackground = false;
// Disable screen dimming
Screen.sleepTimeout = SleepTimeout.NeverSleep;
if (!androidJavaInit)
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
javaVrActivityClass = new AndroidJavaClass("com.oculusvr.vrlib.VrActivity");
// Prepare for the RenderThreadInit()
SetInitVariables(activity.GetRawObject(), javaVrActivityClass.GetRawClass());
androidJavaInit = true;
}
// We want to set up our touchpad messaging system
OVRTouchpad.Create();
// This will trigger the init on the render thread
InitRenderThread();
#else
SetEditorPlay(Application.isEditor);
#endif
display = new OVRDisplay();
tracker = new OVRTracker();
// Except for D3D9, SDK rendering forces vsync unless you pass ovrHmdCap_NoVSync to Hmd.SetEnabledCaps().
if (timeWarp)
{
bool useUnityVSync = SystemInfo.graphicsDeviceVersion.Contains("Direct3D 9");
QualitySettings.vSyncCount = useUnityVSync ? 1 : 0;
}
}