private void OnDisable() { #if !UNITY_EDITOR try { #endif PlatformHelper.CLoseWebView(); DataModel.PropertyChanged -= propChangeHandler; Binding.RemoveBinding(); #if !UNITY_EDITOR } catch (Exception ex) { Logger.Error(ex.ToString()); } #endif }
private void OnPropertyChangeAnnounce(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "AnnouncementShow") { if (DataModel.AnnouncementShow) { var uiroot = FindObjectOfType <UIRoot>(); var ResoultionRadio = GameUtils.GetResolutionRadio(); var scale = uiroot.activeHeight / (float)Screen.height; var sprWidget = bkTrans.GetComponent <UIWidget>(); var size = sprWidget.localSize; var uicamera = uiroot.GetComponentInChildren <UICamera>(); if (null == uicamera) { Logger.Error("can't find uicamera!!! on show announce!"); return; } var pos = uicamera.camera.WorldToScreenPoint(bkTrans.position); float width = 0; float height = 0; float x = 0; float y = 0; #if UNITY_ANDROID width = Mathf.CeilToInt(size.x / scale); height = Mathf.CeilToInt(size.y / scale); x = pos.x; y = Screen.height - pos.y; #elif UNITY_IOS width = Mathf.CeilToInt(size.x / scale); height = Mathf.CeilToInt(size.y / scale); x = pos.x; y = Screen.height - pos.y; #else #endif PlatformHelper.ShowWebView(UpdateHelper.AnnoucementURL, x / ResoultionRadio, y / ResoultionRadio, width / ResoultionRadio, height / ResoultionRadio); } else { PlatformHelper.CLoseWebView(); } } }
private void OnDisable() { #if !UNITY_EDITOR try { #endif PlatformHelper.CLoseWebView(); if (null != afterClose) { afterClose(); } #if !UNITY_EDITOR } catch (Exception ex) { Logger.Error(ex.ToString()); } #endif }