using Cute; using UnityEngine; using UnityEngine.Networking; using Wizard; public class DialogSupport : MonoBehaviour { private enum Info { AppVersion, OsVersion, Device } private GameObject[] _items; private const string DEVICE = "&device="; public string ErrorCode { get; set; } public static DialogBase Create(string errorCode = null) { DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); dialogBase.SetSize(DialogBase.Size.XL); SystemText systemText = Data.SystemText; dialogBase.SetTitleLabel(systemText.Get("Contact_Dialog_001_Header")); dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); dialogBase.SetButtonText(systemText.Get("Contact_Dialog_001_Button")); GameObject gameObject = Object.Instantiate(UIManager.GetInstance().SupportDialogPrefab); dialogBase.SetObj(gameObject); DialogSupport ds = gameObject.GetComponent(); ds.ErrorCode = errorCode; dialogBase.onPushButton1 = delegate { string url = ds.GetUrl(); UIManager.GetInstance().WebViewHelper.PrepareOpenUrl(delegate { LocalLog.SendAllClientTraceLog(delegate { BrowserURL.Open(url); }); }); }; return dialogBase; } private bool IsChecked(Info info) { if ((int)info >= _items.Length) { return false; } return _items[(int)info].GetComponentInChildren().normalSprite == "btn_check_on"; } public string GetUrl() { string key = "URL_0013_steam"; string text = Data.SystemText.Get(key); // PlayerStaticData.UserViewerID read stripped in Phase-1 UI cull. GetUrl runs from a // client-side report dialog; headless never invokes it. if (IsChecked(Info.AppVersion)) { text = text + "&appver=" + Toolbox.DeviceManager.GetAppVersionName(); } if (IsChecked(Info.OsVersion)) { string osVersion = Toolbox.DeviceManager.GetOsVersion(); text = text + "&osver=" + UnityWebRequest.EscapeURL(osVersion); } if (IsChecked(Info.Device)) { text = text + "&device=" + UnityWebRequest.EscapeURL(Toolbox.DeviceManager.GetDeviceName()); text += UnityWebRequest.EscapeURL("/" + Toolbox.DeviceManager.GetGraphicsDeviceName()); } if (ErrorCode != null) { text = text + "&errorcode=" + ErrorCode; } return text; } }