// Use this for initialization void Start() { #if UNITY_EDITOR if (Application.isPlaying) { return; } else #endif { if (pmInstance != null) { Log.d(LOG_TAG, "isPermissionGranted(com.htc.vr.core.server.VRDataWrite) = " + pmInstance.isPermissionGranted("com.htc.vr.core.server.VRDataWrite")); Log.d(LOG_TAG, "isPermissionGranted(com.htc.vr.core.server.VRDataRead) = " + pmInstance.isPermissionGranted("com.htc.vr.core.server.VRDataRead")); Log.d(LOG_TAG, "isPermissionGranted(com.htc.vr.core.server.VRDataProvider) = " + pmInstance.isPermissionGranted("com.htc.vr.core.server.VRDataProvider")); } AndroidJavaClass ajc = new AndroidJavaClass(CONTENT_PROVIDER_CLASSNAME); if (ajc == null) { Log.e(LOG_TAG, "virtualWallForceOn() " + CONTENT_PROVIDER_CLASSNAME + " is null"); return; } contentProvider = ajc.CallStatic <AndroidJavaObject>("getInstance"); if (contentProvider != null) { readValue = readVirtualWall_value(); int value = System.Convert.ToInt32(readValue); _virtualWallinit = value; } else { Log.e(LOG_TAG, "virtualWallstart() could NOT get instance of " + CONTENT_PROVIDER_CLASSNAME); } _areaVisible = Interop.WVR_GetArenaVisible(); _areaVisibleinit = _areaVisible; arenavisibleStatus = _areaVisible.ToString(); } Log.d(LOG_TAG, "virtualWallinit " + CONTENT_PROVIDER_CLASSNAME + _virtualWallinit); }
public void virtualWallForceOn() { #if UNITY_EDITOR if (Application.isEditor) { return; } else #endif { _areaVisible = Interop.WVR_GetArenaVisible(); Log.d(LOG_TAG, "virtualWall status change to Force On : " + _areaVisible.ToString()); if (_areaVisible.ToString() != "WVR_ArenaVisible_ForceOn") { if (pmInstance != null) { Log.d(LOG_TAG, "isPermissionGranted(com.htc.vr.core.server.VRDataWrite) = " + pmInstance.isPermissionGranted("com.htc.vr.core.server.VRDataWrite")); Log.d(LOG_TAG, "isPermissionGranted(com.htc.vr.core.server.VRDataRead) = " + pmInstance.isPermissionGranted("com.htc.vr.core.server.VRDataRead")); Log.d(LOG_TAG, "isPermissionGranted(com.htc.vr.core.server.VRDataProvider) = " + pmInstance.isPermissionGranted("com.htc.vr.core.server.VRDataProvider")); } AndroidJavaClass ajc = new AndroidJavaClass(CONTENT_PROVIDER_CLASSNAME); if (ajc == null) { Log.e(LOG_TAG, "virtualWallForceOn() " + CONTENT_PROVIDER_CLASSNAME + " is null"); return; } contentProvider = ajc.CallStatic <AndroidJavaObject>("getInstance"); if (contentProvider != null) { readValue = readVirtualWall_value(); int value = System.Convert.ToInt32(readValue); Log.d(LOG_TAG, "ForceOn , readVirtualWallValue() " + readValue); _virtualWallstatus = value; Log.d(LOG_TAG, "ForceOn , _virtualWallstatus " + _virtualWallstatus); byte[] virtualWallstatus_byte = System.BitConverter.GetBytes(_virtualWallstatus); BitArray virtualWallstatus_bit = new BitArray(virtualWallstatus_byte); int mask_and = 0xfb; int mask_or = 0x02; Log.d(LOG_TAG, "virtualWallForceOn , virtualWallstatus_bit 0 = " + virtualWallstatus_bit.Get(0)); if (virtualWallstatus_bit.Get(0) == false) { _virtualWallstatus = 0x71; _virtualWallstatus = (_virtualWallstatus & mask_and) | mask_or; } else { _virtualWallstatus = (_virtualWallstatus & mask_and) | mask_or; } Log.d(LOG_TAG, "virtualWallForceOn() got instance of " + CONTENT_PROVIDER_CLASSNAME + ", change virtual wall status to " + _virtualWallstatus); contentProvider.Call("writeVirtualWallValue", _virtualWallstatus); _virtualWallstatus = 0; } else { Log.e(LOG_TAG, "virtualWallForceOn() could NOT get instance of " + CONTENT_PROVIDER_CLASSNAME); } } else { Log.d(LOG_TAG, "virtualWall status has already Force On"); } } }