|  |  |  | 
|---|
|  |  |  | case UNKNOWN: { | 
|---|
|  |  |  | if (GTGameMain.I.activity != null) | 
|---|
|  |  |  | init(GTGameMain.I.activity); | 
|---|
|  |  |  | Toast.makeText(GameApp.I, "正在初始化中,请稍等", Toast.LENGTH_LONG).show(); | 
|---|
|  |  |  | Toast.makeText(GameAppProxy.app, "正在初始化中,请稍等", Toast.LENGTH_LONG).show(); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | case SUCCEED: { | 
|---|
|  |  |  | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | case LOADING: { | 
|---|
|  |  |  | Toast.makeText(GameApp.I, "正在初始化中,请稍等", Toast.LENGTH_LONG).show(); | 
|---|
|  |  |  | Toast.makeText(GameAppProxy.app, "正在初始化中,请稍等", Toast.LENGTH_LONG).show(); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setListener() { | 
|---|
|  |  |  | args = new HashMap<>(); | 
|---|
|  |  |  | // 初始化监听 | 
|---|
|  |  |  | SdkManager.getInstance().setInitListener(new InitListener() { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | args.clear(); | 
|---|
|  |  |  | JSONObject info = new JSONObject(); | 
|---|
|  |  |  | info.put("account", SdkManager.getInstance().getUid()); | 
|---|
|  |  |  | info.put("game_id", SdkManager.getInstance().getGameId()); | 
|---|
|  |  |  | info.put("game_id", SdkManager.getInstance().getGameId()+""); | 
|---|
|  |  |  | info.put("session_id", SdkManager.getInstance().getSessionId()); | 
|---|
|  |  |  | args.put("info", info); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformLoginOk,args); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformLoginOk, args); | 
|---|
|  |  |  | } catch (JSONException e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | LogUtil.e("SdkManager 登录成功", e); | 
|---|
|  |  |  | 
|---|
|  |  |  | LogUtil.e("SdkManager", "注册成功" + " isNewReg:" + isNewReg + "  type:" + reg_type); | 
|---|
|  |  |  | args.clear(); | 
|---|
|  |  |  | args.put("reg_type", reg_type); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformRegisterOk,args); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformRegisterOk, args); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void onSuccess(String status, String orderId) { | 
|---|
|  |  |  | LogUtil.debug("SdkManager", "onSuccess status:" + status + ",orderId:" + orderId); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformPayOk); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void onError() { | 
|---|
|  |  |  | LogUtil.e("SdkManager", "onError"); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformPayFail); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void onCancel() { | 
|---|
|  |  |  | LogUtil.debug("SdkManager", "onCancel"); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformPayCancel); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public void onSuccess(String type) { | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<>(); | 
|---|
|  |  |  | args.put("state", CallBackState.Success); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.ShareState,args); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.ShareState, args); | 
|---|
|  |  |  | LogUtil.debug("分享回调", "onSuccess:" + type); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public void onError(String type, String msg) { | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<>(); | 
|---|
|  |  |  | args.put("state", CallBackState.Error); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.ShareState,args); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.ShareState, args); | 
|---|
|  |  |  | LogUtil.debug("分享回调", "type:" + type + ";msg:" + msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public void onCancel(String type) { | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<>(); | 
|---|
|  |  |  | args.put("state", CallBackState.Cancel); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity( CodeA2U.ShareState,args); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.ShareState, args); | 
|---|
|  |  |  | LogUtil.debug("分享回调", type + ":onCancel"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | 
|---|
|  |  |  | public void onSuccess() { | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<>(); | 
|---|
|  |  |  | args.put("state", CallBackState.Success); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.ReviewState,args); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.ReviewState, args); | 
|---|
|  |  |  | LogUtil.debug("评分回调", "成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public void onError(String s) { | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<>(); | 
|---|
|  |  |  | args.put("state", CallBackState.Error); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.ReviewState,args); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.ReviewState, args); | 
|---|
|  |  |  | LogUtil.debug("评分回调", "失败:" + s); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public void onCancel() { | 
|---|
|  |  |  | Map<String, Object> args = new HashMap<>(); | 
|---|
|  |  |  | args.put("state", CallBackState.Cancel); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.ReviewState,args); | 
|---|
|  |  |  | UnityMsgHandler.sendMessageToUnity(CodeA2U.ReviewState, args); | 
|---|
|  |  |  | LogUtil.debug("评分回调", "取消"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|