From 066f80e377408a94635d5f044c66418d0dc07f26 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期五, 07 九月 2018 15:07:37 +0800
Subject: [PATCH] update 猫耳sdk
---
Core/SDK/SDKUtility.cs | 86 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 77 insertions(+), 9 deletions(-)
diff --git a/Core/SDK/SDKUtility.cs b/Core/SDK/SDKUtility.cs
index 906e78b..bb5c1ee 100644
--- a/Core/SDK/SDKUtility.cs
+++ b/Core/SDK/SDKUtility.cs
@@ -16,6 +16,14 @@
ChargingFull = 3,
}
+ public enum E_ChannelPlatform
+ {
+ Free,
+ Mr,
+ }
+
+ public E_ChannelPlatform ChannelPlatform { get; private set; }
+
/// <summary>
/// sdk鍒濆鍖栨槸鍚﹀畬鎴愭爣璇�
/// 瀹㈡埛绔竴鑸渶瑕佺瓑寰呰繖涓�间负true鎵嶇户缁�昏緫
@@ -86,6 +94,8 @@
{
RegistrationID = string.Empty;
AssetCopyFinished = false;
+ ChannelPlatform = E_ChannelPlatform.Free;
+
#if !UNITY_EDITOR
if (InitFinished)
{
@@ -254,16 +264,16 @@
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)
{
@@ -294,6 +304,19 @@
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();
@@ -473,6 +496,8 @@
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;
/**
* 鏋佸厜鎺ㄩ��
* */
@@ -543,7 +568,6 @@
public string platfromId = "1000";
public UnityAction<FP_CheckIDAuthentication> onFreePlatfromCheckIDOK;
public UnityAction<FP_DoIDAuthentication> onFreePlatfromDoIDAuthenticationOk;
-
public void FreePlatformInit()
{
@@ -619,6 +643,10 @@
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"]).
@@ -647,6 +675,7 @@
{
if (result)
{
+ Debug.Log(" ------------------ : " + message);
JsonData _json = JsonMapper.ToObject(message);
int _callbackResult = (int)_json["result"];
@@ -660,6 +689,15 @@
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
@@ -750,18 +788,25 @@
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;
@@ -799,6 +844,29 @@
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 鏋佸厜鎺ㄩ�佺浉鍏�
--
Gitblit v1.8.0