// 打开客服界面 public static void ShowCallCenter() { #if UNITY_WP8 && !UNITY_EDITOR WPSDKHelperScript.Instance().WPReqShowCallCenter(); #elif UNITY_ANDROID && !UNITY_EDITOR LoginData.ServerListData lastServerData = LoginData.GetServerListDataByID(PlayerPreferenceData.LastServer); LoginData.PlayerRoleData lastRoleData = LoginData.GetPlayerRoleData(PlayerPreferenceData.LastRoleGUID); Obj_MainPlayer mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer; if (null != lastServerData && null != lastRoleData && null != mainPlayer) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); JsonWriter writer = new JsonWriter(sb); writer.WriteObjectStart(); writer.WritePropertyName("serverName"); writer.Write(lastServerData.m_name); writer.WritePropertyName("serverId"); writer.Write(lastServerData.m_id.ToString()); writer.WritePropertyName("roleName"); writer.Write(lastRoleData.name); writer.WritePropertyName("roleId"); writer.Write(string.Format("{0:X16}", lastRoleData.guid)); writer.WritePropertyName("roleGrade"); writer.Write(mainPlayer.BaseAttr.Level.ToString()); writer.WritePropertyName("vipGrade"); writer.Write(VipData.GetVipLv().ToString()); writer.WritePropertyName("version"); writer.Write(GCGame.Utils.GetVersionString()); writer.WriteObjectEnd(); AndroidHelper.doSdk("showCallCenter", sb.ToString()); } #elif UNITY_IPHONE && !UNITY_EDITOR IOSHelper.SDK_ShowCallCenter(); #else #endif }
private void Delete_Click(int position) { var letter = GetLetterAtPosition(position); if (letter == null) { _logger.Error($"Unable to delete letter. Could not retrive letter at position {position}."); _fragment.ShowToast(AndroidHelper.GetString(Resource.String.unableToDeleteLetter)); return; } if (_fragment.GetBaseApp().LetterManager.DeleteLetterById(letter.Id.ToString())) { //Position is not zero based _letters.RemoveAt(position); NotifyItemRemoved(position); _fragment.ShowToast(AndroidHelper.GetString(Resource.String.letterDeleted)); DeleteLetterSucceeded?.Invoke(this, position); } else { _fragment.ShowToast(AndroidHelper.GetString(Resource.String.unableToDeleteLetter)); } }
/// <summary> /// Start is called on the frame when a script is enabled. /// </summary> public void Start() { m_tangoApplication = FindObjectOfType <TangoApplication>(); m_tangoARScreen = GetComponent <TangoARScreen>(); if (m_tangoApplication != null) { if (AndroidHelper.IsTangoCorePresent()) { // Request Tango permissions m_tangoApplication.Register(this); m_tangoApplication.RequestPermissions(); } else { // If no Tango Core is present let's tell the user to install it! StartCoroutine(_InformUserNoTangoCore()); } } else { Debug.Log("No Tango Manager found in scene."); } }
// Update is called once per frame void Update() { if (!tinfo.PoseOk) { return; } if (Input.GetMouseButtonDown(0)) { Vector3 cpos = Input.mousePosition; RaycastHit hitInfo; if (Physics.Raycast(Camera.main.ScreenPointToRay(cpos), out hitInfo, Mathf.Infinity, 1 << LayerMask.NameToLayer("TangoMesh"))) { this.transform.position = hitInfo.point + new Vector3(0, 1, 0); ap.p = this.transform.position; udp.SendPose(ap); } else { AndroidHelper.ShowAndroidToastMessage("Not Recognized Area", AndroidHelper.ToastLength.SHORT); } } }
/// <summary> /// Use this for initialization. /// </summary> public void Start() { #if UNITY_EDITOR // We must initialize this on the main Unity thread, since the value // is sometimes used within a separate saving thread. AreaDescription.GenerateEmulatedSavePath(); #endif m_tangoApplication = FindObjectOfType <TangoApplication>(); if (m_tangoApplication != null) { m_tangoApplication.Register(this); if (AndroidHelper.IsTangoCorePresent()) { m_tangoApplication.RequestPermissions(); } } else { Debug.Log("No Tango Manager found in scene."); } }
/// <summary> /// Awake is called when the script instance is being loaded. /// </summary> public void Awake() { TangoState tangoState; #if UNITY_EDITOR tangoState = m_editorPlayModeState; #else if (!AndroidHelper.IsTangoCorePresent()) { tangoState = TangoState.NotPresent; } else if (!AndroidHelper.IsTangoCoreUpToDate()) { tangoState = TangoState.OutOfDate; } else { tangoState = TangoState.Present; } #endif foreach (GameObject obj in m_enableIfTangoPresent) { obj.SetActive(tangoState == TangoState.Present); } foreach (GameObject obj in m_enableIfTangoOutOfDate) { obj.SetActive(tangoState == TangoState.OutOfDate); } foreach (GameObject obj in m_disableIfTangoPresent) { obj.SetActive(tangoState == TangoState.NotPresent); } }
/// <summary> /// Updates UI and handles player input. /// </summary> public void Update() { m_currentTime += Time.deltaTime; ++m_framesSinceUpdate; m_accumulation += Time.timeScale / Time.deltaTime; if (m_currentTime >= FPS_UPDATE_FREQUENCY) { m_currentFPS = (int)(m_accumulation / m_framesSinceUpdate); m_currentTime = 0.0f; m_framesSinceUpdate = 0; m_accumulation = 0.0f; m_fpsText = "FPS: " + m_currentFPS; } _UpdateLocationMarker(); if (Input.GetKey(KeyCode.Escape)) { // This is a fix for a lifecycle issue where calling // Application.Quit() here, and restarting the application // immediately results in a deadlocked app. AndroidHelper.AndroidQuit(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.actv_WriteLetter); SetupToolbar(Resource.Id.writeLetterActv_toolbar);//, AndroidHelper.GetString(Resource.String.writeNewLetterTitle)); SetupNavigationMenu(Resource.Id.writeLetterActv_navigationDrawer); _writeLetterFragment = SupportFragmentManager.FindFragmentByTag(TagsType.WriteLetterFragment) as WriteLetterFragment; if (_writeLetterFragment == null) { var senderKind = GetSenderKindFromIntent(); _writeLetterFragment = new WriteLetterFragment(); if (_writeLetterFragment.Arguments == null) { _writeLetterFragment.Arguments = new Bundle(); } switch (senderKind) { case BundleSenderKind.LegislatorViewer: var legislator = AppHelper.GetLegislatorFromIntent(Intent); _writeLetterFragment.Arguments.PutString(BundleType.Legislator, legislator.SerializeToJson()); break; case BundleSenderKind.ViewLettersAdapter: var letter = GetLetterFromIntent(); _writeLetterFragment.Arguments.PutString(BundleType.Letter, letter.SerializeToJson()); break; } AndroidHelper.AddSupportFragment(SupportFragmentManager, _writeLetterFragment, Resource.Id.writeLetterActv_fragmentContainer, TagsType.WriteLetterFragment); } }
private void Start() { m_tangoApplication = FindObjectOfType <TangoApplication>(); if (m_tangoApplication != null) { if (AndroidHelper.IsTangoCorePresent()) { // Request Tango permissions m_tangoApplication.RegisterPermissionsCallback(_OnTangoApplicationPermissionsEvent); m_tangoApplication.RequestNecessaryPermissions(); m_tangoServiceVersionName = TangoApplication.GetTangoServiceVersion(); } else { // If no Tango Core is present let's tell the user to install it! StartCoroutine(_InformUserNoTangoCore()); } } else { Debug.Log("No Tango Manager found in scene."); } }
/// <summary> /// Start is called on the frame when a script is enabled just before any of the Update methods is called the first time. /// </summary> public void Start() { m_meshSavePath = Application.persistentDataPath + "/meshes"; Directory.CreateDirectory(m_meshSavePath); m_arPoseController = FindObjectOfType <TangoARPoseController>(); m_tangoDynamicMesh = FindObjectOfType <TangoDynamicMesh>(); m_areaDescriptionLoaderPanel.SetActive(true); m_meshBuildPanel.SetActive(false); m_meshInteractionPanel.SetActive(false); m_relocalizeImage.gameObject.SetActive(false); // Initialize tango application. m_tangoApplication = FindObjectOfType <TangoApplication>(); if (m_tangoApplication != null) { m_tangoApplication.Register(this); if (AndroidHelper.IsTangoCorePresent()) { m_tangoApplication.RequestPermissions(); } } }
/// <summary> /// Initializes a new instance of the <see cref="AndroidAppManagerBase"/> class. /// </summary> /// <param name="pluginExecutionData"></param> /// <param name="activityData"></param> public AndroidAppManagerBase(PluginExecutionData pluginExecutionData, HpRoamActivityData activityData) { try { _executionData = pluginExecutionData; _activityData = activityData; _controller = SESLib.Create(_activityData.MobileEquipmentId); _controller.Connect(false, true); _androidHelper = new AndroidHelper(_controller); _controller.PressKey(KeyCode.KEYCODE_WAKEUP); //Power Button _controller.PressKey(KeyCode.KEYCODE_HOME); if (_androidHelper.ExistResourceId("com.android.systemui:id/keyguard_indication_area")) { _controller.Swipe(SESLib.To.Up); } } catch (NullReferenceException ex) { throw new DeviceWorkflowException($"Unable to connect to the android phone using the connection ID {_activityData.MobileEquipmentId}.", ex); } }
public void ShowAndDispose() { AndroidHelper.RunOnUIThread(Show_Inner); }
/// <summary> /// Start exceptions listener. /// </summary> /// <returns>The start exceptions listener.</returns> private IEnumerator _StartExceptionsListener() { AndroidHelper.ShowStandardTangoExceptionsUI(m_drawDefaultUXExceptions); AndroidHelper.SetTangoExceptionsListener(); yield return(0); }
/// <summary> /// Gets the get tango API version code. /// </summary> /// <returns>The get tango API version code.</returns> private static int _GetTangoAPIVersion() { return(AndroidHelper.GetVersionCode("com.projecttango.tango")); }
/// <summary> /// Awake this instance. /// </summary> private void Awake() { AndroidHelper.RegisterPauseEvent(_androidOnPause); AndroidHelper.RegisterResumeEvent(_androidOnResume); AndroidHelper.RegisterOnActivityResultEvent(_androidOnActivityResult); }
/// <summary> /// AreaDescriptionEventListener constructor. /// /// The activity result callback is registered when the listener is initialized. /// </summary> public AreaDescriptionEventListener() { AndroidHelper.RegisterOnActivityResultEvent(_androidOnActivityResult); }
/// <summary> /// Display Tango Service out-of-date notification. /// </summary> public void ShowTangoOutOfDate() { AndroidHelper.ShowTangoOutOfDate(); }
/// <summary> /// Sets the recommended way to hold the device. /// </summary> /// <param name="holdPostureType">Hold posture type.</param> public void SetHoldPosture(TangoUxEnums.UxHoldPostureType holdPostureType) { AndroidHelper.SetHoldPosture((int)holdPostureType); }
static SharedInstance() { #if UNITY_ANDROID && !UNITY_EDITOR AndroidHelper.SetupNetwork(); #endif }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.OfferView); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); var obj = JsonConvert.DeserializeObject <Offer>(Intent.GetStringExtra("OfferActivity")); ImageViewAsync imageViewOffer2 = FindViewById <ImageViewAsync>(Resource.Id.imageViewNews2); TextView textViewHeadline2 = FindViewById <TextView>(Resource.Id.textViewHeadline2); TextView textViewDescription2 = FindViewById <TextView>(Resource.Id.textViewDescription2); TextView textViewDutyText2 = FindViewById <TextView>(Resource.Id.textViewDutyText2); TextView textViewValidDate2 = FindViewById <TextView>(Resource.Id.textViewValidDate2); TextView textViewOfferValue2 = FindViewById <TextView>(Resource.Id.textViewOfferValue2); ImageView imageViewNewsQRCode = FindViewById <ImageView>(Resource.Id.imageViewNewsQRCode); Typeface tf = Typeface.CreateFromAsset(Assets, Joyces.Helpers.Settings.MainFont); textViewHeadline2.SetTypeface(tf, Android.Graphics.TypefaceStyle.Normal); textViewDescription2.SetTypeface(tf, Android.Graphics.TypefaceStyle.Normal); textViewDutyText2.SetTypeface(tf, Android.Graphics.TypefaceStyle.Normal); textViewValidDate2.SetTypeface(tf, Android.Graphics.TypefaceStyle.Normal); textViewOfferValue2.SetTypeface(tf, Android.Graphics.TypefaceStyle.Normal); if (!string.IsNullOrEmpty(obj.imageUrl)) { ImageService.Instance.LoadUrl(obj.imageUrl).Into(imageViewOffer2); } if (!string.IsNullOrEmpty(obj.imageUrl)) { textViewHeadline2.Text = obj.name; ActionBar.Title = obj.name; } else { textViewHeadline2.Text = string.Empty; } if (!string.IsNullOrEmpty(obj.note)) { textViewDescription2.Text = obj.note; } else { textViewDescription2.Text = string.Empty; } if (!string.IsNullOrEmpty(obj.dutyText)) { textViewDutyText2.Text = obj.dutyText; } else { textViewDutyText2.Text = string.Empty; } textViewValidDate2.Text = "Valid until " + ObjectRepository.ParseDateTimeToCulture(obj.validityDate); textViewOfferValue2.Text = ObjectRepository.parseOfferValue(obj); if (!string.IsNullOrEmpty(obj.code)) { imageViewNewsQRCode.SetImageBitmap(AndroidHelper.GetQrCode(obj.code, 300, 300, 0)); } else { imageViewNewsQRCode.SetImageBitmap(AndroidHelper.GetQrCode("0000", 300, 300, 0)); } imageViewNewsQRCode.Visibility = ViewStates.Gone; ActionBar.SetBackgroundDrawable(new ColorDrawable(Android.Graphics.Color.ParseColor(GeneralSettings.AndroidActionBarColor))); }
/// <summary> /// Apply any needed changes to the pose. /// </summary> private void Update() { #if UNITY_ANDROID && !UNITY_EDITOR if (m_shouldInitTango) { m_tangoApplication.InitApplication(); if (m_useADF) { // Query the full adf list. PoseProvider.RefreshADFList(); // loading last recorded ADF string uuid = PoseProvider.GetLatestADFUUID().GetStringDataUUID(); m_tangoApplication.InitProviders(uuid); } else { m_tangoApplication.InitProviders(string.Empty); } // Query extrinsics constant tranformations. TangoPoseData poseData = new TangoPoseData(); double timestamp = 0.0; TangoCoordinateFramePair pair; pair.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_IMU; pair.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_DEVICE; PoseProvider.GetPoseAtTime(poseData, timestamp, pair); Vector3 position = new Vector3((float)poseData.translation[0], (float)poseData.translation[1], (float)poseData.translation[2]); Quaternion quat = new Quaternion((float)poseData.orientation[0], (float)poseData.orientation[1], (float)poseData.orientation[2], (float)poseData.orientation[3]); m_deviceToIMUMatrix = Matrix4x4.TRS(position, quat, new Vector3(1.0f, 1.0f, 1.0f)); pair.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_IMU; pair.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_CAMERA_COLOR; PoseProvider.GetPoseAtTime(poseData, timestamp, pair); position = new Vector3((float)poseData.translation[0], (float)poseData.translation[1], (float)poseData.translation[2]); quat = new Quaternion((float)poseData.orientation[0], (float)poseData.orientation[1], (float)poseData.orientation[2], (float)poseData.orientation[3]); m_cameraToIMUMatrix = Matrix4x4.TRS(position, quat, new Vector3(1.0f, 1.0f, 1.0f)); m_alreadyInitialized = true; m_shouldInitTango = false; m_tangoApplication.ConnectToService(); } if (m_isDirty) { // This rotation needs to be put into Unity coordinate space. Quaternion rotationFix = Quaternion.Euler(90.0f, 0.0f, 0.0f); if (!m_isRelocalized) { Quaternion axisFix = Quaternion.Euler(-m_tangoRotation[0].eulerAngles.x, -m_tangoRotation[0].eulerAngles.z, m_tangoRotation[0].eulerAngles.y); transform.rotation = m_startingRotation * (rotationFix * axisFix); transform.position = (m_startingRotation * (m_tangoPosition[0] * m_movementScale)) + m_startingOffset; } else { Quaternion axisFix = Quaternion.Euler(-m_tangoRotation[1].eulerAngles.x, -m_tangoRotation[1].eulerAngles.z, m_tangoRotation[1].eulerAngles.y); transform.rotation = m_startingRotation * (rotationFix * axisFix); transform.position = (m_startingRotation * (m_tangoPosition[1] * m_movementScale)) + m_startingOffset; } m_isDirty = false; } if (Input.GetKeyDown(KeyCode.Escape)) { if (m_tangoApplication != null) { m_tangoApplication.Shutdown(); } // This is a temporary fix for a lifecycle issue where calling // Application.Quit() here, and restarting the application immediately, // results in a hard crash. AndroidHelper.AndroidQuit(); } #else Vector3 tempPosition = transform.position; Quaternion tempRotation = transform.rotation; PoseProvider.GetMouseEmulation(ref tempPosition, ref tempRotation); transform.rotation = tempRotation; transform.position = tempPosition; #endif }
/// <summary> /// Update AR screen rendering and attached Camera's projection matrix. /// </summary> /// <param name="displayRotation">Activity (screen) rotation.</param> /// <param name="colorCameraRotation">Color camera sensor rotation.</param> private void _SetRenderAndCamera(OrientationManager.Rotation displayRotation, OrientationManager.Rotation colorCameraRotation) { float cameraWidth = (float)Screen.width; float cameraHeight = (float)Screen.height; #pragma warning disable 0219 // Here we are computing if current display orientation is landscape or portrait. // AndroidHelper.GetAndroidDefaultOrientation() returns 1 if device default orientation is in portrait, // returns 2 if device default orientation is landscape. Adding device default orientation with // how much the display is rotated from default orientation will get us the result of current display // orientation. (landscape vs. portrait) bool isLandscape = (AndroidHelper.GetDefaultOrientation() + (int)displayRotation) % 2 == 0; bool needToFlipCameraRatio = false; float cameraRatio = (float)Screen.width / (float)Screen.height; #pragma warning restore 0219 #if !UNITY_EDITOR // In most cases, we don't need to flip the camera width and height. However, in some cases Unity camera // only updates a couple of frames after the display changed callback from Android; thus, we need to flip the width // and height in this case. // // This does not happen in the editor, because the emulated device does not ever rotate. needToFlipCameraRatio = (!isLandscape & (cameraRatio > 1.0f)) || (isLandscape & (cameraRatio < 1.0f)); if (needToFlipCameraRatio) { cameraRatio = 1.0f / cameraRatio; float tmp = cameraWidth; cameraWidth = cameraHeight; cameraHeight = tmp; } #endif TangoCameraIntrinsics alignedIntrinsics = new TangoCameraIntrinsics(); TangoCameraIntrinsics intrinsics = new TangoCameraIntrinsics(); VideoOverlayProvider.GetDeviceOrientationAlignedIntrinsics(TangoEnums.TangoCameraId.TANGO_CAMERA_COLOR, alignedIntrinsics); VideoOverlayProvider.GetIntrinsics(TangoEnums.TangoCameraId.TANGO_CAMERA_COLOR, intrinsics); if (alignedIntrinsics.width != 0 && alignedIntrinsics.height != 0) { // The camera to which this script is attached is an Augmented Reality camera. The color camera // image must fill that camera's viewport. That means we must clip the color camera image to make // its ratio the same as the Unity camera. If we don't do this the color camera image will be // stretched non-uniformly, making a circle into an ellipse. float widthRatio = (float)cameraWidth / (float)alignedIntrinsics.width; float heightRatio = (float)cameraHeight / (float)alignedIntrinsics.height; if (widthRatio >= heightRatio) { m_uOffset = 0; m_vOffset = (1 - (heightRatio / widthRatio)) / 2; } else { m_uOffset = (1 - (widthRatio / heightRatio)) / 2; m_vOffset = 0; } // Note that here we are passing in non-inverted intrinsics, because the YUV conversion is still operating // on native buffer layout. OrientationManager.Rotation rotation = TangoSupport.RotateFromAToB(displayRotation, colorCameraRotation); _MaterialUpdateForIntrinsics(m_uOffset, m_vOffset, rotation); _CameraUpdateForIntrinsics(m_camera, alignedIntrinsics, m_uOffset, m_vOffset); if (m_arCameraPostProcess != null) { m_arCameraPostProcess.SetupIntrinsic(intrinsics); } } else { Debug.LogError("AR Camera intrinsic is not valid."); } }
// Update is called once per frame void Update() { //TangoSupport.TangoSupportEdge[] edges; //int num_edges; //Vector2 guiPosition = new Vector2(Input.GetTouch(0).position.x, Screen.height - Input.GetTouch(0).position.y); // RaycastHit hit = new RaycastHit(); //for (int i = 0; i < Input.touchCount; ++i) if (Input.GetMouseButtonDown(0)) { StartCoroutine(_WaitForDepth(Input.mousePosition)); } if (Input.GetKey(KeyCode.Escape)) { // This is a fix for a lifecycle issue where calling // Application.Quit() here, and restarting the application // immediately results in a deadlocked app. AndroidHelper.AndroidQuit(); } /* * if (Input.touchCount > 0) * { * Touch t = Input.GetTouch(0); * Vector2 guiPosition = Vector2.zero; * if (t.phase == TouchPhase.Began) * { * guiPosition = new Vector2(t.position.x, Screen.height - t.position.y); * * m_camera = Camera.main; * * if (!FindObjectOfType<TangoPointCloud>()) * { * Debug.Log("<<<<<<<<<<<<<<<< need point cloud to find the edges"); * } * else * { * m_pointCloud = FindObjectOfType<TangoPointCloud>(); * } * * if (m_pointCloud != null) * { * Vector3 touch_world = m_camera.ScreenToWorldPoint(t.position); * Vector2 n_touch = new Vector2(touch_world.x, touch_world.y); * bool edgeResult = m_pointCloud.FindEdges(m_imagebuffer, m_camera, t.position, * out edges, out num_edges); * if (edgeResult == true) * { * * Debug.Log("Touch Points : x " + touch_world.x + " y " + touch_world.y); * m_edgeCount = num_edges; * m_startPoint = new Vector3[num_edges]; * m_endPoint = new Vector3[num_edges]; * m_nearestPoint = new Vector3[num_edges]; * for(int i = 0; i < num_edges; i++) * { * m_startPoint[i] = new Vector3(edges[i].end_points_x1, * edges[i].end_points_y1, * edges[i].end_points_z1); * Debug.Log(m_startPoint[i]); * m_endPoint[i] = new Vector3(edges[i].end_points_x2, * edges[i].end_points_y2, * edges[i].end_points_z2); * Debug.Log(m_endPoint[i]); * m_nearestPoint[i] = new Vector3(edges[i].closest_point_on_edge_x, * edges[i].closest_point_on_edge_y, * edges[i].closest_point_on_edge_z); * Debug.Log(m_nearestPoint[i]); * } * _RenderLine(); * } * } * } * } */ }
public void TabChangeTableauEx(string str) { if (m_bSystemTableau == false) { return; } if (str == "Tab_High") { PlayerPreferenceData.SystemTableau = 1; // m_Music.value = true; //打开 音乐 //m_SoundEffect.value = true; //打开 音效 m_NameEdition.value = true; //打开 名字板 m_ScreenMove.value = true; //打开 屏幕移动 m_NewPlayerGuide.value = true; //打开 新手指引 m_DeathPushEnable.value = true; //打开 死亡推送 m_KillNpcExp.value = true; //打开 杀怪经验 m_SkillEffect.value = true; //打开 技能特效 m_DamageBoard.value = true; //打开 伤害板 m_WallVision.value = true; //打开 透明遮挡 m_Floodlight.value = true; //打开 全屏泛光 m_SliderHideOtherPlayer.value = (float)30 / (float)m_ShowPlayerNumMax; //玩家数量 30 OnNameEdition(); OnMusic(); OnSoundEffect(); OnFloodlight(); OnScreenMove(); OnNewPlayerGuideClose(); OnDeathPushClick(); OnIsKillNpcExp(); OnSkillEffect(); OnDamageBoard(); OnWallVision(); } else if (str == "Tab_Centre") { PlayerPreferenceData.SystemTableau = 2; // m_Music.value = true; //打开 音乐 // m_SoundEffect.value = true; //打开 音效 #if UNITY_ANDROID && !UNITY_EDITOR string ret = AndroidHelper.platformHelper("shouldShowWarnning"); if (ret.EndsWith("1") || ret.EndsWith("2")) { m_NameEdition.value = false; } else { m_NameEdition.value = true; //打开 名字板 } #else m_NameEdition.value = true; //打开 名字板 #endif m_ScreenMove.value = true; //打开 屏幕移动 m_NewPlayerGuide.value = true; //打开 新手指引 m_DeathPushEnable.value = true; //打开 死亡推送 m_KillNpcExp.value = true; //打开 杀怪经验 m_SkillEffect.value = true; //打开 技能特效 m_DamageBoard.value = true; //打开 伤害板 m_WallVision.value = false; //关闭 透明遮挡 m_Floodlight.value = false; //关闭 全屏泛光 m_SliderHideOtherPlayer.value = (float)15 / (float)m_ShowPlayerNumMax; //玩家数量 15 OnNameEdition(); OnMusic(); OnSoundEffect(); OnFloodlight(); OnScreenMove(); OnNewPlayerGuideClose(); OnDeathPushClick(); OnIsKillNpcExp(); OnSkillEffect(); OnDamageBoard(); OnWallVision(); } else if (str == "Tab_Low") { PlayerPreferenceData.SystemTableau = 3; // m_Music.value = false; //关闭 音乐 //m_SoundEffect.value = false; //关闭 音效 m_NameEdition.value = false; //关闭 名字板 m_ScreenMove.value = true; //打开 屏幕移动 m_NewPlayerGuide.value = true; //打开 新手指引 m_DeathPushEnable.value = true; // 打开 死亡推送 m_KillNpcExp.value = true; //打开 杀怪经验 m_SkillEffect.value = true; //打开 技能特效 m_DamageBoard.value = false; //关闭 伤害板 m_WallVision.value = false; //关闭 透明遮挡 m_Floodlight.value = false; //关闭 全屏泛光 m_SliderHideOtherPlayer.value = (float)4 / (float)m_ShowPlayerNumMax; //玩家数量 1 OnNameEdition(); OnMusic(); OnSoundEffect(); OnFloodlight(); OnScreenMove(); OnNewPlayerGuideClose(); OnDeathPushClick(); OnIsKillNpcExp(); OnSkillEffect(); OnDamageBoard(); OnWallVision(); } }
/// <summary> /// Exports the constructed mesh to an OBJ file format. The file will include info /// based on the enabled options in TangoApplication. /// </summary> /// <param name="filepath">File path to output the OBJ.</param> public void ExportMeshToObj(string filepath) { AndroidHelper.ShowAndroidToastMessage("Exporting mesh..."); StringBuilder sb = new StringBuilder(); int startVertex = 0; foreach (TangoSingleDynamicMesh tmesh in m_meshes.Values) { Mesh mesh = tmesh.m_mesh; int meshVertices = 0; sb.Append(string.Format("g {0}\n", tmesh.name)); // Vertices. for (int i = 0; i < mesh.vertices.Length; i++) { meshVertices++; Vector3 v = tmesh.transform.TransformPoint(mesh.vertices[i]); // Include vertex colors as part of vertex point for applications that support it. if (mesh.colors32.Length > 0) { float r = mesh.colors32[i].r / 255.0f; float g = mesh.colors32[i].g / 255.0f; float b = mesh.colors32[i].b / 255.0f; sb.Append(string.Format("v {0} {1} {2} {3} {4} {5} 1.0\n", v.x, v.y, -v.z, r, g, b)); } else { sb.Append(string.Format("v {0} {1} {2} 1.0\n", v.x, v.y, -v.z)); } } sb.Append("\n"); // Normals. if (mesh.normals.Length > 0) { foreach (Vector3 n in mesh.normals) { sb.Append(string.Format("vn {0} {1} {2}\n", n.x, n.y, -n.z)); } sb.Append("\n"); } // Texture coordinates. if (mesh.uv.Length > 0) { foreach (Vector3 uv in mesh.uv) { sb.Append(string.Format("vt {0} {1}\n", uv.x, uv.y)); } sb.Append("\n"); } // Faces. int[] triangles = mesh.triangles; for (int j = 0; j < triangles.Length; j += 3) { sb.Append(string.Format("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\n", triangles[j + 2] + 1 + startVertex, triangles[j + 1] + 1 + startVertex, triangles[j] + 1 + startVertex)); } sb.Append("\n"); startVertex += meshVertices; } StreamWriter sw = new StreamWriter(filepath); sw.AutoFlush = true; sw.Write(sb.ToString()); AndroidHelper.ShowAndroidToastMessage(string.Format("Exported: {0}", filepath)); }
public TelemetryProxy() : base(new AndroidJavaObject("org.ekstep.genieservices.sdks.Telemetry", AndroidHelper.GetCurrentActivity())) { }
protected void SetLoadingUi() { emptyText.Text = AndroidHelper.GetString(Resource.String.loading); ShowEmptyview(); }
/// <summary> /// Called when a JoinRoom() call failed. The parameter provides ErrorCode and message (as array). /// </summary> /// <remarks> /// Most likely error is that the room does not exist or the room is full (some other client was faster than you). /// PUN logs some info if the PhotonNetwork.logLevel is >= PhotonLogLevel.Informational. /// </remarks> /// <param name="codeAndMsg">CodeAndMsg[0] is short ErrorCode. codeAndMsg[1] is string debug msg.</param> public override void OnPhotonJoinRoomFailed(object[] codeAndMsg) { AndroidHelper.ShowAndroidToastMessage("Join room failed"); Debug.Log("Join room failed" + Environment.StackTrace); _QuitGame(); }
/// <summary> /// Fits a plane to a point cloud near a user-specified location. This /// occurs in two passes. First, all points in cloud within /// certain pixel distance to <c>uvCoordinates</c> after projection are kept. Then a /// plane is fit to the subset cloud using RANSAC. After the initial fit /// all inliers from the original cloud are used to refine the plane /// model. /// </summary> /// <returns> /// <c>true</c>, if plane is found successfully, <c>false</c> otherwise. /// </returns> /// <param name="pointCloud"> /// The point cloud. Cannot be null and must have at least three points. /// </param> /// <param name="colorCameraTimestamp"> /// Color camera's timestamp when UV is captured. /// </param> /// <param name="uvCoordinates"> /// The UV coordinates for the user selection. This is expected to be /// in Unity viewport space. The bottom-left of the camera is (0,0); /// the top-right is (1,1). /// </param> /// <param name="intersectionPoint"> /// The output point in depth camera coordinates that the user selected. /// </param> /// <param name="planeModel"> /// The four parameters a, b, c, d for the general plane /// equation ax + by + cz + d = 0 of the plane fit. The first three /// components are a unit vector. The output is in the coordinate system of /// the requested output frame. Cannot be NULL. /// </param> public static bool FitPlaneModelNearClick( TangoPointCloudData pointCloud, double colorCameraTimestamp, Vector2 uvCoordinates, out Vector3 intersectionPoint, out DVector4 planeModel) { TangoPoseData depth_T_colorCameraPose = new TangoPoseData(); int returnValue = TangoSupportAPI.TangoSupport_calculateRelativePose( pointCloud.m_timestamp, TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_CAMERA_DEPTH, colorCameraTimestamp, TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_CAMERA_COLOR, depth_T_colorCameraPose); if (returnValue != Common.ErrorType.TANGO_SUCCESS) { Debug.LogError("TangoSupport_calculateRelativePose error. " + Environment.StackTrace); intersectionPoint = new Vector3(0.0f, 0.0f, 0.0f); planeModel = new DVector4(); return(false); } GCHandle pointCloudHandle = GCHandle.Alloc(pointCloud.m_points, GCHandleType.Pinned); TangoPointCloudIntPtr tangoPointCloudIntPtr = new TangoPointCloudIntPtr(); tangoPointCloudIntPtr.m_points = pointCloudHandle.AddrOfPinnedObject(); tangoPointCloudIntPtr.m_timestamp = pointCloud.m_timestamp; tangoPointCloudIntPtr.m_numPoints = pointCloud.m_numPoints; // Unity viewport space is: the bottom-left of the camera is (0,0); // the top-right is (1,1). // Tango (Android) defined UV space is: the top-left of the camera is (0,0); // the bottom-right is (1,1). Vector2 uvCoordinatesTango = new Vector2(uvCoordinates.x, 1.0f - uvCoordinates.y); DVector3 doubleIntersectionPoint = new DVector3(); DVector4 pointCloudRotation = DVector4.IdentityQuaternion; DVector3 pointCloudTranslation = DVector3.Zero; returnValue = TangoSupportAPI.TangoSupport_fitPlaneModelNearPoint( ref tangoPointCloudIntPtr, ref pointCloudTranslation, ref pointCloudRotation, ref uvCoordinatesTango, AndroidHelper.GetDisplayRotation(), ref depth_T_colorCameraPose.translation, ref depth_T_colorCameraPose.orientation, out doubleIntersectionPoint, out planeModel); pointCloudHandle.Free(); if (returnValue != Common.ErrorType.TANGO_SUCCESS) { Debug.LogError("TangoSupport_fitPlaneModelNearPoint error. " + Environment.StackTrace); intersectionPoint = new Vector3(0.0f, 0.0f, 0.0f); planeModel = new DVector4(); return(false); } else { intersectionPoint = doubleIntersectionPoint.ToVector3(); } return(true); }
public AlertDialogBuilder() : base(new AndroidJavaObject("android.app.AlertDialog$Builder", AndroidHelper.GetCurrentActivity())) { SetCancelable(false); }