| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- #if UNITY_IOS
- using System.Runtime.InteropServices;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Runtime.InteropServices;
- public class YouYiSDKiOS : SDKBase
- {
- private YouYiListener m_YouYiListener;
- public YouYiSDKiOS()
- {
- SDKName = "SDKYOUYI_IOS";
- m_YouYiListener = SDKMgr.Instance.gameObject.AddComponent<YouYiListener>();
- YouYi_SetCallbackGoName(SDKMgr.Instance.gameObject.name);
- }
- public override void Init()
- {
- base.Init();
- YouYi_Init();
- }
- public override void OnApplicationFocus(bool focusStatus)
- {
- base.OnApplicationFocus(focusStatus);
- }
- public override void Login()
- {
- YouYi_Login();
- }
- public override void Logout()
- {
- YouYi_Logout();
- }
- public override void SwitchAccount()
- {
- YouYi_SwitchAccount();
- }
- public override void Pay(int goodsId, string goodsName, string goodsDesc, int count, float amount, string cpOrderId, string extrasParams)
- {
- GameRoleInfo gameRoleInfo = SDKMgr.Instance.GetGameRoleInfo();
- if (gameRoleInfo == null || !gameRoleInfo.Valid())
- {
- Debug.LogError("[YISDK][Pay] GameRoleInfo is null or not valid !!!");
- m_YouYiListener.OnPayFailed();
- return;
- }
- YouYi_Pay(cpOrderId, goodsId.ToString(), goodsName, gameRoleInfo.roleId.ToString(), gameRoleInfo.roleName, gameRoleInfo.roleLv.ToString(), gameRoleInfo.serverId.ToString(), gameRoleInfo.serverName, amount.ToString(), extrasParams);
- }
- public override void CreateRole()
- {
- GameRoleInfo gameRoleInfo = SDKMgr.Instance.GetGameRoleInfo();
- if (gameRoleInfo == null || !gameRoleInfo.Valid())
- {
- Debug.LogError("[YISDK][CreateRole] GameRoleInfo is null or not valid !!!");
- return;
- }
- YouYi_CreateRoleReportData(gameRoleInfo.roleId.ToString(), gameRoleInfo.roleName, gameRoleInfo.roleLv.ToString(), gameRoleInfo.serverId.ToString(), gameRoleInfo.serverName);
- }
- public override void EnterGame()
- {
- GameRoleInfo gameRoleInfo = SDKMgr.Instance.GetGameRoleInfo();
- if (gameRoleInfo == null || !gameRoleInfo.Valid())
- {
- Debug.LogError("[YISDK][EnterGame] GameRoleInfo is null or not valid !!!");
- return;
- }
- YouYi_RoleEnterGameReportData(gameRoleInfo.roleId.ToString(), gameRoleInfo.roleName, gameRoleInfo.roleLv.ToString(), gameRoleInfo.serverId.ToString(), gameRoleInfo.serverName);
- }
- public override void UpdateRoleLv()
- {
- GameRoleInfo gameRoleInfo = SDKMgr.Instance.GetGameRoleInfo();
- if (gameRoleInfo == null || !gameRoleInfo.Valid())
- {
- Debug.LogError("[YISDK][UpdateRoleLv] GameRoleInfo is null or not valid !!!");
- return;
- }
- YouYi_RoleUpLevelReportData(gameRoleInfo.roleId.ToString(), gameRoleInfo.roleName, gameRoleInfo.roleLv.ToString(), gameRoleInfo.serverId.ToString(), gameRoleInfo.serverName);
- }
- public override void ExitGame()
- {
- }
- public override bool Exit()
- {
- return false;
- }
- public override bool Quit()
- {
- return false;
- }
- public override void CallInitSuccessCB()
- {
- m_YouYiListener.OnInitSuccess();
- }
- public override void CallLoginSuccessCB()
- {
- m_YouYiListener.StartCheckLogin();
- }
- [DllImport("__Internal")]
- private static extern void YouYi_SetCallbackGoName(string callbackGoName);
- [DllImport("__Internal")]
- private static extern void YouYi_Init();
- [DllImport("__Internal")]
- private static extern void YouYi_Login();
- [DllImport("__Internal")]
- private static extern void YouYi_Logout();
- [DllImport("__Internal")]
- private static extern void YouYi_SwitchAccount();
- [DllImport("__Internal")]
- private static extern void YouYi_Pay(string cpOrderId, string goodsId, string goodsName, string roleId, string roleName, string roleLevel, string serverId, string serverName, string amount, string extrasParams);
- [DllImport("__Internal")]
- private static extern void YouYi_CreateRoleReportData(string roleId, string roleName, string roleLevel, string serverId, string serverName);
- [DllImport("__Internal")]
- private static extern void YouYi_RoleEnterGameReportData(string roleId, string roleName, string roleLevel, string serverId, string serverName);
- [DllImport("__Internal")]
- private static extern void YouYi_RoleUpLevelReportData(string roleId, string roleName, string roleLevel, string serverId, string serverName);
- }
- #endif
|