| | |
| | | public readonly static string USER_ACCOUNT = Application.dataPath + "UserAccount"; |
| | | public readonly static string USER_PASSWORD = Application.dataPath + "UserPassword"; |
| | | |
| | | public string hotVersion = ""; |
| | | |
| | | public bool sdkLogined |
| | | { |
| | | get; |
| | |
| | | } |
| | | } |
| | | |
| | | //logicversion 和assetversion 两个文件 的内容md5全异或取最后两个字母 |
| | | public void RefreshHotVersion() |
| | | { |
| | | try |
| | | { |
| | | string logicVersionMd5 = ""; |
| | | string assetVersionMd5 = ""; |
| | | // 初始化结果字节数组(MD5 是 16 字节) |
| | | byte[] resultBytes = new byte[16]; |
| | | foreach (var item in LocalResManager.Instance.assetVersions) |
| | | { |
| | | // 对每个 MD5 进行异或运算 |
| | | byte[] md5Bytes = HexStringToByteArray(item.Value.md5); |
| | | for (int j = 0; j < 16; j++) |
| | | { |
| | | resultBytes[j] ^= md5Bytes[j]; |
| | | } |
| | | |
| | | } |
| | | //取最后两位 |
| | | logicVersionMd5 = BitConverter.ToString(resultBytes).Replace("-", "").ToLower().Substring(14, 2); |
| | | |
| | | resultBytes = new byte[16]; |
| | | foreach (var item in AssetVersionUtility.assetVersions) |
| | | { |
| | | // 对每个 MD5 进行异或运算 |
| | | byte[] md5Bytes = HexStringToByteArray(item.Value.md5); |
| | | for (int j = 0; j < 16; j++) |
| | | { |
| | | resultBytes[j] ^= md5Bytes[j]; |
| | | } |
| | | |
| | | } |
| | | assetVersionMd5 = BitConverter.ToString(resultBytes).Replace("-", "").ToLower().Substring(14, 2); |
| | | hotVersion = logicVersionMd5 + assetVersionMd5; |
| | | Debug.Log($"RefreshHotVersion {hotVersion}"); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("RefreshHotVersion 错误"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 辅助方法:十六进制字符串转字节数组 |
| | | private byte[] HexStringToByteArray(string hex) |
| | | { |
| | | byte[] bytes = new byte[hex.Length / 2]; |
| | | for (int i = 0; i < hex.Length; i += 2) |
| | | { |
| | | bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16); |
| | | } |
| | | return bytes; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public C0101_tagCPlayerLogin Get0101SendPackage(H0101_tagServerPrepared _serverInfo) |
| | | { |
| | | GameNetSystem.Instance.SetIsWaitLogin(false); |
| | |
| | | send.Extra = ""; |
| | | break; |
| | | case VersionAuthority.Release: |
| | | { |
| | | var deviceInfo = DeviceUtility.GetDeviceModel(); |
| | | deviceInfo.Replace(" ", "").Replace("=", "").Replace("%", "").Replace("-", "").Replace("|", ""); |
| | | var versionStr = StringUtility.Concat(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex.ToString(), "_", deviceInfo); |
| | | |
| | | send.Extra = StringUtility.Concat(VersionConfig.Get().SpID, "|", |
| | | SDKUtils.Instance.Device.uniqueID, "|", |
| | | sdkLoginResult.token, "|", |
| | | sdkLoginResult.qkUserName, "|", |
| | | versionStr.Substring(0, Math.Min(24, versionStr.Length))); |
| | | |
| | | |
| | | Debug.Log("=====> extra: " + send.Extra); |
| | | send.ExtraLen = (ushort)send.Extra.Length; |
| | | |
| | | send.IDType = (byte)SDKUtils.Instance.ChannelPlatform; |
| | | send.Password = sdkLoginResult.token; |
| | | send.AccID = sdkLoginResult.account; |
| | | send.MAC = DeviceUtility.GetMac(); |
| | | send.Version = _serverInfo.Version; |
| | | send.LineNO = 255; |
| | | send.AppID = VersionConfig.Get().appId; |
| | | send.AccountID = (uint)sdkLoginResult.accountID; |
| | | send.TokenExpire = sdkLoginResult.tokenExpire; |
| | | send.Phone = (byte)sdkLoginResult.phone; |
| | | send.ServerID = (uint)ServerListCenter.Instance.currentServer.region_flag; |
| | | if (sdkIDCheckIDAuthentication.type == "1") |
| | | { |
| | | send.Adult = 1; |
| | | var deviceInfo = DeviceUtility.GetDeviceModel(); |
| | | deviceInfo.Replace(" ", "").Replace("=", "").Replace("%", "").Replace("-", "").Replace("|", ""); |
| | | var versionStr = StringUtility.Concat(VersionConfig.Get().version, "_", |
| | | VersionConfig.Get().buildIndex.ToString(), "_", |
| | | hotVersion, "-", deviceInfo); |
| | | |
| | | send.Extra = StringUtility.Concat(VersionConfig.Get().SpID, "|", |
| | | SDKUtils.Instance.Device.uniqueID, "|", |
| | | sdkLoginResult.token, "|", |
| | | sdkLoginResult.qkUserName, "|", |
| | | versionStr.Substring(0, Math.Min(24, versionStr.Length))); |
| | | |
| | | |
| | | Debug.Log("=====> extra: " + send.Extra); |
| | | send.ExtraLen = (ushort)send.Extra.Length; |
| | | |
| | | send.IDType = (byte)SDKUtils.Instance.ChannelPlatform; |
| | | send.Password = sdkLoginResult.token; |
| | | send.AccID = sdkLoginResult.account; |
| | | send.MAC = DeviceUtility.GetMac(); |
| | | send.Version = _serverInfo.Version; |
| | | send.LineNO = 255; |
| | | send.AppID = VersionConfig.Get().appId; |
| | | send.AccountID = (uint)sdkLoginResult.accountID; |
| | | send.TokenExpire = sdkLoginResult.tokenExpire; |
| | | send.Phone = (byte)sdkLoginResult.phone; |
| | | send.ServerID = (uint)ServerListCenter.Instance.currentServer.region_flag; |
| | | if (sdkIDCheckIDAuthentication.type == "1") |
| | | { |
| | | send.Adult = 1; |
| | | } |
| | | else if (sdkIDCheckIDAuthentication.type == "2") |
| | | { |
| | | send.Adult = MathUtility.CheckAdult(sdkIDCheckIDAuthentication.card_id) ? (byte)1 : (byte)0; |
| | | } |
| | | else |
| | | { |
| | | send.Adult = 0; |
| | | } |
| | | break; |
| | | } |
| | | else if (sdkIDCheckIDAuthentication.type == "2") |
| | | { |
| | | send.Adult = MathUtility.CheckAdult(sdkIDCheckIDAuthentication.card_id) ? (byte)1 : (byte)0; |
| | | } |
| | | else |
| | | { |
| | | send.Adult = 0; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return send; |