using Cute; using UnityEngine; using UnityEngine.Networking; using Wizard; public class DialogSupport : MonoBehaviour { private enum Info { UserId, AppVersion, OsVersion, Device } [SerializeField] private UITable _table; private GameObject[] _items; private const string CHECK_ON = "btn_check_on"; private const string CHECK_OFF = "btn_check_off"; private const string USERID = "&userid="; private const string APPVERSION = "&appver="; private const string OSVERSION = "&osver="; private const string DEVICE = "&device="; private const string ERRORCODE = "&errorcode="; private const string COUNTRY = "&country="; private const string CITY = "&city="; 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; } public void Start() { string[] array = new string[4] { "Contact_Dialog_002", "Contact_Dialog_003", "Contact_Dialog_004", "Contact_Dialog_001_dmm" }; int childCount = _table.transform.childCount; _items = new GameObject[childCount]; for (int i = 0; i < childCount; i++) { _items[i] = _table.transform.GetChild(i).gameObject; UIButton bt = _items[i].GetComponentInChildren(); UISprite sp = _items[i].GetComponentInChildren(); _items[i].GetComponentInChildren().text = Data.SystemText.Get(array[i]); bt.onClick.Add(new EventDelegate(delegate { if (sp.spriteName == "btn_check_off") { bt.normalSprite = "btn_check_on"; bt.pressedSprite = "btn_check_off"; GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); } else { bt.normalSprite = "btn_check_off"; bt.pressedSprite = "btn_check_on"; GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_OFF); } })); } } 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); if (IsChecked(Info.UserId) && PlayerStaticData.UserViewerID != 0) { text = text + "&userid=" + PlayerStaticData.UserViewerID; } 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; } }