| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- using System;
- using System.Runtime.InteropServices;
- using UnityEngine;
- namespace qsdk
- {
- public class SDKOrderExtraInfo
- {
- public int serverId;
- public string platform;
- public string subPlatform;
- public string orderNo;
- }
- public class SdkPayOderInfo
- {
- public string extends_info_data;
- public string game_area;
- public string game_level;
- public string game_orderid;
- public string game_currency;
- public string game_price;
- public string game_role_id;
- public string game_role_name;
- public string game_guid;
- public string notify_id;
- public string subject;
- public string game_sign;
- public string game_access_version;
-
- }
- public class QSdkMgr
- {
- public static QKSDKInitState InitState = QKSDKInitState.None;
- public static void SetListener(string listener)
- {
- #if UNITY_IOS
- QSDK_SetListener(listener);
- #endif
- }
- public static void Init()
- {
- #if UNITY_IOS
- QSDK_Init();
- #endif
- }
- public static void Login()
- {
- #if UNITY_IOS
- QSDK_login();
- #endif
- }
- public static void Pay(string productId, string productName, string amount, string orderNo,
- string callBackUrl, string extrasParams,
- string gameName, string serverName, string productDesc, string serverID, string accountID, string roleID, string roleLv)
- {
- #if UNITY_IOS
- object infoObj =JsonUtility.FromJson(callBackUrl, typeof(SdkPayOderInfo));
- if (infoObj != null)
- {
- SdkPayOderInfo info = (SdkPayOderInfo)infoObj;
- QSDK_Pay_x7( info.extends_info_data,
- info. game_area,
- info. game_level,
- info. game_orderid,
- info. game_currency,
- info. game_price,
- info. game_role_id,
- info. game_role_name,
- info. game_guid,
- info. notify_id,
- info. subject,
- info. game_sign,
- info. game_access_version);
- }
- else
- {
- QSDK_Pay( productId, productName, amount, orderNo,
- callBackUrl, extrasParams,
- gameName, serverName, productDesc,
- serverID,accountID,roleID,roleLv);
- }
-
- #endif
- }
- public static void Logout()
- {
- #if UNITY_IOS
- QSDK_logout();
- #endif
- }
- public static void UpdateRoleInfo(int type,GameRoleInfo roleInfo,string extra)
- {
- #if UNITY_IOS
- QSDK_UpdateRoleInfo_X7(type,
- roleInfo.openId,
- roleInfo.serverName,
- roleInfo.serverId.ToString() ,
- roleInfo.roleId,
- roleInfo.roleName,
- roleInfo.roleLv.ToString() ,
- roleInfo.fightPower.ToString(),
- "-1",
- "-1",
- string.IsNullOrEmpty(roleInfo.guildName)?"-1": roleInfo.guildName,
- roleInfo.guildId.ToString(),extra);
- #endif
- }
- #if UNITY_IOS
- [DllImport("__Internal")]
- private static extern void QSDK_SetListener(string callbackGoName);
- [DllImport("__Internal")]
- private static extern void QSDK_Init();
- [DllImport("__Internal")]
- private static extern void QSDK_login();
- [DllImport("__Internal")]
- private static extern void QSDK_Pay(string productId, string productName, string amount, string orderNo,
- string callBackUrl, string extrasParams,
- string gameName, string serverName, string productDesc,
- string serverID, string accountID, string roleID, string roleLv);
- [DllImport("__Internal")]
- private static extern void QSDK_Pay_x7( string extends_info_data,
- string game_area,
- string game_level,
- string game_orderid,
- string game_currency,
- string game_price,
- string game_role_id,
- string game_role_name,
- string game_guid,
- string notify_id,
- string subject,
- string game_sign,
- string game_access_version);
- [DllImport("__Internal")]
- private static extern void QSDK_logout();
- //[DllImport("__Internal")]
- //private static extern void QSDK_UpdateRoleInfo(int type,string roleName,string roleId,string roleLv, string serverName,string serverId,string extra);
- [DllImport("__Internal")]
- private static extern void QSDK_UpdateRoleInfo_X7(int type,
- string game_guid,
- string game_area,
- string game_area_id ,
- string game_role_id ,
- string game_role_name ,
- string roleLevel ,
- string roleCE,
- string roleStage,
- string roleRechargeAmount ,
- string roleGuild ,
- string roleGuildId,
- string extra);
- #endif
- }
- }
|