| | |
| | | import android.app.Activity; |
| | | import android.widget.Toast; |
| | | |
| | | import com.appsflyer.AFInAppEventType; |
| | | import com.cy.yyjia.sdk.center.SdkManager; |
| | | import com.cy.yyjia.sdk.listener.ChangePasswordListener; |
| | | import com.cy.yyjia.sdk.listener.ExitGameListener; |
| | | import com.cy.yyjia.sdk.listener.InitListener; |
| | | import com.cy.yyjia.sdk.listener.LoginListener; |
| | | import com.cy.yyjia.sdk.listener.LogoutListener; |
| | | import com.cy.yyjia.sdk.listener.MarketListener; |
| | | import com.cy.yyjia.sdk.listener.PayListener; |
| | | import com.cy.yyjia.sdk.listener.ShareListener; |
| | | import com.secondworld.sdk.utils.CallBackState; |
| | | import com.secondworld.sdk.utils.CodeA2U; |
| | | import com.secondworld.sdk.utils.LogUtil; |
| | | |
| | |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class MySdkMgr extends PlatformSdkMgr { |
| | | |
| | |
| | | } |
| | | }); |
| | | |
| | | //分享回调 |
| | | SdkManager.getInstance().setShareListener(new ShareListener() { |
| | | @Override |
| | | public void onSuccess(String type) { |
| | | Map<String, Object> args = new HashMap<>(); |
| | | args.put("code", CodeA2U.ShareState); |
| | | args.put("state", CallBackState.Success); |
| | | UnityMsgHandler.sendMessageToUnity(args); |
| | | LogUtil.debug("分享回调", "onSuccess:" + type); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(String type, String msg) { |
| | | Map<String, Object> args = new HashMap<>(); |
| | | args.put("code", CodeA2U.ShareState); |
| | | args.put("state", CallBackState.Error); |
| | | UnityMsgHandler.sendMessageToUnity(args); |
| | | LogUtil.debug("分享回调", "type:" + type + ";msg:" + msg); |
| | | } |
| | | |
| | | @Override |
| | | public void onCancel(String type) { |
| | | Map<String, Object> args = new HashMap<>(); |
| | | args.put("code", CodeA2U.ShareState); |
| | | args.put("state", CallBackState.Cancel); |
| | | UnityMsgHandler.sendMessageToUnity(args); |
| | | LogUtil.debug("分享回调", type + ":onCancel"); |
| | | } |
| | | }); |
| | | |
| | | //评分回调 |
| | | SdkManager.getInstance().setMarketListener(new MarketListener() { |
| | | @Override |
| | | public void onSuccess() { |
| | | Map<String, Object> args = new HashMap<>(); |
| | | args.put("code", CodeA2U.ReviewState); |
| | | args.put("state", CallBackState.Success); |
| | | UnityMsgHandler.sendMessageToUnity(args); |
| | | LogUtil.debug("评分回调", "成功"); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(String s) { |
| | | Map<String, Object> args = new HashMap<>(); |
| | | args.put("code", CodeA2U.ReviewState); |
| | | args.put("state", CallBackState.Error); |
| | | UnityMsgHandler.sendMessageToUnity(args); |
| | | LogUtil.debug("评分回调", "失败:" + s); |
| | | } |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | Map<String, Object> args = new HashMap<>(); |
| | | args.put("code", CodeA2U.ReviewState); |
| | | args.put("state", CallBackState.Cancel); |
| | | UnityMsgHandler.sendMessageToUnity(args); |
| | | LogUtil.debug("评分回调", "取消"); |
| | | } |
| | | }); |
| | | |
| | | //设置dubug模式 |
| | | SdkManager.getInstance().setDebug(BuildConfig.DEBUG); |
| | | } |