Files
JJBB/Assets/XLua/Src/Editor/Report.cs

58 lines
1.7 KiB
C#
Raw Permalink Normal View History

2024-09-04 02:07:48 +08:00
#if UNITY_5_6_OR_NEWER
namespace XLua
{
using UnityEngine;
using UnityEditor;
using System.Net.Sockets;
using System.Text;
using System.Threading;
[InitializeOnLoad]
public class Report
{
private const string PREFS_KEY = "XLuaReport";
private const string DIALOG_MSG_FORMAT = @"<22><><EFBFBD>Ƿdz<C7B7>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˽Ȩ<CBBD><C8A8><EFBFBD><EFBFBD>Ҫ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>±<EFBFBD>Ҫ<EFBFBD><D2AA>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><E1B9A9><EFBFBD>õķ<C3B5><C4B7><EFBFBD><EFBFBD><EFBFBD>
XLua<EFBFBD><EFBFBD><EFBFBD>{0}
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{1}
<EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><EFBFBD>{2}
We attach great importance to your privacy and need to collect the following necessary information to provide better services:
XLua Version: {0}
Unity Version: {1}
Device Identifier: {2}";
static Report()
{
if (EditorPrefs.HasKey(PREFS_KEY) && !EditorPrefs.GetBool(PREFS_KEY))
return;
var version = "2.1.16";
var engine = Application.unityVersion;
var machine = SystemInfo.deviceUniqueIdentifier;
var msg = string.Format("cmd=0&tag=glcoud.xlua.report&version={0}&engine={1}&machine_name={2}", version, engine, machine);
if (!EditorPrefs.HasKey(PREFS_KEY))
{
var dialogMsg = string.Format(DIALOG_MSG_FORMAT, version, engine, machine);
var result = EditorUtility.DisplayDialog(string.Empty, dialogMsg, "<22><><EFBFBD><EFBFBD> Allow", "<22>ܾ<EFBFBD> Deny");
EditorPrefs.SetBool(PREFS_KEY, result);
if (!result)
return;
}
new Thread(() =>
{
var data = Encoding.UTF8.GetBytes(msg);
var client = new UdpClient();
client.Send(data, data.Length, "101.226.141.148", 8080);
client.Close();
}).Start();
}
}
}
#endif