| | |
| | | ChargingFull = 3,
|
| | | }
|
| | |
|
| | | public enum E_ChannelPlatform
|
| | | {
|
| | | Free,
|
| | | Mr,
|
| | | }
|
| | |
|
| | | public E_ChannelPlatform ChannelPlatform { get; private set; }
|
| | |
|
| | | /// <summary>
|
| | | /// sdk初始化是否完成标识
|
| | | /// 客户端一般需要等待这个值为true才继续逻辑
|
| | |
| | | {
|
| | | RegistrationID = string.Empty;
|
| | | AssetCopyFinished = false;
|
| | | ChannelPlatform = E_ChannelPlatform.Free;
|
| | |
|
| | | #if !UNITY_EDITOR
|
| | | if (InitFinished)
|
| | | {
|
| | |
| | | var _code = (int)_json["code"];
|
| | | switch (_code)
|
| | | {
|
| | | case CodeA2U.DeviceInfo:
|
| | | case CodeA2U.DeviceInfo:
|
| | |
|
| | | Device = new DeviceInfo ();
|
| | | Device.uniqueID = _json ["unique_id"].ToString ();
|
| | | Device.androidID = _json ["android_id"].ToString ();// ios平台下为idfa
|
| | | Device.userAgent = _json ["userAgent"].ToString ();
|
| | | Device = new DeviceInfo();
|
| | | Device.uniqueID = _json["unique_id"].ToString();
|
| | | Device.androidID = _json["android_id"].ToString();// ios平台下为idfa
|
| | | Device.userAgent = _json["userAgent"].ToString();
|
| | | #if UNITY_ANDROID
|
| | | Device.macAddress = _json ["mac"].ToString ();
|
| | | Device.imei = _json ["imei"].ToString ();
|
| | | Device.totalMemory = (int)_json ["memoryTotal"];
|
| | | Device.macAddress = _json["mac"].ToString();
|
| | | Device.imei = _json["imei"].ToString();
|
| | | Device.totalMemory = (int)_json["memoryTotal"];
|
| | | #endif
|
| | | if (OnDeviceInfoChanged != null)
|
| | | {
|
| | |
| | | break;
|
| | | case CodeA2U.SdkInitComplete:
|
| | | InitFinished = true;
|
| | | var _dict = _json as IDictionary;
|
| | | if (_dict != null && _dict.Contains("channelPlatform"))
|
| | | {
|
| | | var _channelPlatform = _json["channelPlatform"].ToString();
|
| | | if (!string.IsNullOrEmpty(_channelPlatform))
|
| | | {
|
| | | if (_channelPlatform.Equals("mr"))
|
| | | {
|
| | | ChannelPlatform = E_ChannelPlatform.Mr;
|
| | | Debug.Log("当前渠道平台为猫耳渠道");
|
| | | }
|
| | | }
|
| | | }
|
| | | break;
|
| | | case CodeA2U.PushClientID:
|
| | | RegistrationID = _json["clientID"].ToString();
|
| | |
| | | public const int FreePlatformSwitchAccount = 103;
|
| | | public const int FreePlatformPay = 104;
|
| | | public const int PayFinished = 105;
|
| | | public const int CreateRole = 106;
|
| | | public const int RoleLogin = 107;
|
| | | /**
|
| | | * 极光推送
|
| | | * */
|
| | |
| | | public string platfromId = "1000";
|
| | | public UnityAction<FP_CheckIDAuthentication> onFreePlatfromCheckIDOK;
|
| | | public UnityAction<FP_DoIDAuthentication> onFreePlatfromDoIDAuthenticationOk;
|
| | |
|
| | |
|
| | | public void FreePlatformInit()
|
| | | {
|
| | |
| | | m_PaymentTable["OrderTitle"] = title;
|
| | | m_PaymentTable["OrderInfo"] = cpInfo;
|
| | | m_PaymentTable["AppID"] = VersionConfig.Get().appId;
|
| | | if (ChannelPlatform == E_ChannelPlatform.Mr)
|
| | | {
|
| | | m_PaymentTable["RechargeChannel"] = "1";
|
| | | }
|
| | |
|
| | | var _stringBuilder = new System.Text.StringBuilder();
|
| | | var _md5Body = _stringBuilder.Append(m_PaymentTable["AppID"]).
|
| | |
| | | {
|
| | | if (result)
|
| | | {
|
| | | Debug.Log(" ------------------ : " + message);
|
| | | JsonData _json = JsonMapper.ToObject(message);
|
| | |
|
| | | int _callbackResult = (int)_json["result"];
|
| | |
| | | m_Json["mount"] = money;
|
| | | m_Json["cpInfo"] = cpInfo;
|
| | | m_Json["title"] = title;
|
| | | m_Json["notifyurl"] = _json["notifyurl"];
|
| | |
|
| | | if (ChannelPlatform == E_ChannelPlatform.Mr)
|
| | | {
|
| | | m_Json["roleID"] = PlayerDatas.Instance.baseData.PlayerID;
|
| | | m_Json["roleName"] = PlayerDatas.Instance.baseData.PlayerName;
|
| | | m_Json["level"] = PlayerDatas.Instance.baseData.LV.ToString();
|
| | | m_Json["sid"] = "s" + ServerListCenter.Instance.currentServer.region_flag;
|
| | | }
|
| | | #if UNITY_IOS
|
| | | m_Json["identifier"] = VersionConfig.Get().bundleIdentifier;
|
| | | #endif
|
| | |
| | | if (_iDict.Contains("token"))
|
| | | {
|
| | | FreePlatformInfo.token = json["token"].ToString();
|
| | | Debug.Log("token: " + FreePlatformInfo.token);
|
| | | }
|
| | | if (_iDict.Contains("token_expire"))
|
| | | {
|
| | | FreePlatformInfo.tokenExpire = json["token_expire"].ToString();
|
| | | }
|
| | | else
|
| | | {
|
| | | FreePlatformInfo.tokenExpire = "";
|
| | | }
|
| | | if (_iDict.Contains("account"))
|
| | | {
|
| | | FreePlatformInfo.account = json["account"].ToString();
|
| | | Debug.Log("account: " + FreePlatformInfo.account);
|
| | | }
|
| | | if (_iDict.Contains("account_id"))
|
| | | {
|
| | | int.TryParse(json["account_id"].ToString(), out FreePlatformInfo.accountID);
|
| | | Debug.Log("account_id: " + FreePlatformInfo.accountID);
|
| | | }
|
| | |
|
| | | FreePlatformInfo.phone = 0;
|
| | |
| | | m_Json["money"] = (float)coin / 100;
|
| | | SendMessageToSDK(m_Json);
|
| | | }
|
| | |
|
| | | public void CreateRoleOk(string roleID, string roleName)
|
| | | {
|
| | | m_Json.Clear();
|
| | | m_Json["code"] = CodeU2A.CreateRole;
|
| | | m_Json["roleID"] = roleID;
|
| | | m_Json["roleName"] = roleName;
|
| | | m_Json["sid"] = "s" + ServerListCenter.Instance.currentServer.region_flag;
|
| | | SendMessageToSDK(m_Json);
|
| | | }
|
| | |
|
| | | public void RoleLogin(string roleID, string roleName, string lv, string vipLV)
|
| | | {
|
| | | m_Json.Clear();
|
| | | m_Json["code"] = CodeU2A.RoleLogin;
|
| | | m_Json["roleID"] = roleID;
|
| | | m_Json["roleName"] = roleName;
|
| | | m_Json["sid"] = "s" + ServerListCenter.Instance.currentServer.region_flag;
|
| | | m_Json["level"] = lv;
|
| | | m_Json["vipLevel"] = vipLV;
|
| | | SendMessageToSDK(m_Json);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region 极光推送相关
|