From 3f0aaf6578c6a657ec67978d0c7d5bf1509a94de Mon Sep 17 00:00:00 2001
From: lwb <q3213421wrwqr>
Date: 星期三, 24 二月 2021 16:18:32 +0800
Subject: [PATCH] 提包

---
 SdkProject/channel/GTGame/java/com/secondworld/sdk/MySdkMgr.java |   88 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 66 insertions(+), 22 deletions(-)

diff --git a/SdkProject/channel/GTGame/java/com/secondworld/sdk/MySdkMgr.java b/SdkProject/channel/GTGame/java/com/secondworld/sdk/MySdkMgr.java
index 6f86217..991d060 100644
--- a/SdkProject/channel/GTGame/java/com/secondworld/sdk/MySdkMgr.java
+++ b/SdkProject/channel/GTGame/java/com/secondworld/sdk/MySdkMgr.java
@@ -3,14 +3,16 @@
 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;
 
@@ -18,6 +20,7 @@
 import org.json.JSONObject;
 
 import java.util.HashMap;
+import java.util.Map;
 
 public class MySdkMgr extends PlatformSdkMgr {
 
@@ -56,18 +59,14 @@
             public void onSuccess() {
                 sdkInitState = SdkInitState.SUCCEED;
                 LogUtil.debug("SdkManager", "鍒濆鍖栨垚鍔�");
-                args.clear();
-                args.put("code", CodeA2U.PlatformInitOk);
-                UnityMsgHandler.sendMessageToUnity(args);
+                UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformInitOk);
             }
 
             @Override
             public void onError(String msg) {
                 sdkInitState = SdkInitState.FAILED;
                 LogUtil.e("SdkManager", "鍒濆鍖栧け璐ワ細" + msg);
-                args.clear();
-                args.put("code", CodeA2U.PlatformInitFail);
-                UnityMsgHandler.sendMessageToUnity(args);
+                UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformInitFail);
             }
         });
 
@@ -82,10 +81,8 @@
                     info.put("account", SdkManager.getInstance().getUid());
                     info.put("game_id", SdkManager.getInstance().getGameId());
                     info.put("session_id", SdkManager.getInstance().getSessionId());
-
-                    args.put("code", CodeA2U.PlatformLoginOk);
                     args.put("info", info);
-                    UnityMsgHandler.sendMessageToUnity(args);
+                    UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformLoginOk,args);
                 } catch (JSONException e) {
                     e.printStackTrace();
                     LogUtil.e("SdkManager 鐧诲綍鎴愬姛", e);
@@ -95,26 +92,21 @@
             //娉ㄥ唽鎴愬姛
             @Override
             public void onSuccess(Boolean isNewReg, String reg_type) {
-                LogUtil.e("SdkManager", "娉ㄥ唽鎴愬姛"+" isNewReg锛�"+isNewReg+"  type锛�"+reg_type);
+                LogUtil.e("SdkManager", "娉ㄥ唽鎴愬姛" + " isNewReg锛�" + isNewReg + "  type锛�" + reg_type);
                 args.clear();
-                args.put("code", CodeA2U.PlatformRegisterOk);
                 args.put("reg_type", reg_type);
-                UnityMsgHandler.sendMessageToUnity(args);
+                UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformRegisterOk,args);
             }
 
             @Override
             public void onError(String s) {
                 LogUtil.e("SdkManager", "鐧诲綍澶辫触锛�" + s);
-                args.clear();
-                args.put("code", CodeA2U.PlatformLoginFail);
-                UnityMsgHandler.sendMessageToUnity(args);
+                UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformLoginFail);
             }
 
             @Override
             public void onCancel() {
-                args.clear();
-                args.put("code", CodeA2U.PlatformLoginFail);
-                UnityMsgHandler.sendMessageToUnity(args);
+                UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformLoginFail);
             }
         });
 
@@ -143,9 +135,7 @@
             @Override
             public void onSuccess() {
                 //娉ㄩ攢鎴愬姛,闇�瑕佹妸娓告垙鍒囨崲鍥炵櫥闄嗗墠鐨勫満鏅�,骞堕噸鏂板脊鍑虹櫥褰曟绛夋搷浣�
-                args.clear();
-                args.put("code", CodeA2U.PlatformLogoutOk);
-                UnityMsgHandler.sendMessageToUnity(args);
+                UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformLogoutOk);
             }
 
             @Override
@@ -181,6 +171,60 @@
             }
         });
 
+        //鍒嗕韩鍥炶皟
+        SdkManager.getInstance().setShareListener(new ShareListener() {
+            @Override
+            public void onSuccess(String type) {
+                Map<String, Object> args = new HashMap<>();
+                args.put("state", CallBackState.Success);
+                UnityMsgHandler.sendMessageToUnity(CodeA2U.ShareState,args);
+                LogUtil.debug("鍒嗕韩鍥炶皟", "onSuccess锛�" + type);
+            }
+
+            @Override
+            public void onError(String type, String msg) {
+                Map<String, Object> args = new HashMap<>();
+                args.put("state", CallBackState.Error);
+                UnityMsgHandler.sendMessageToUnity(CodeA2U.ShareState,args);
+                LogUtil.debug("鍒嗕韩鍥炶皟", "type锛�" + type + ";msg锛�" + msg);
+            }
+
+            @Override
+            public void onCancel(String type) {
+                Map<String, Object> args = new HashMap<>();
+                args.put("state", CallBackState.Cancel);
+                UnityMsgHandler.sendMessageToUnity( CodeA2U.ShareState,args);
+                LogUtil.debug("鍒嗕韩鍥炶皟", type + "锛歰nCancel");
+            }
+        });
+
+        //璇勫垎鍥炶皟
+        SdkManager.getInstance().setMarketListener(new MarketListener() {
+            @Override
+            public void onSuccess() {
+                Map<String, Object> args = new HashMap<>();
+                args.put("state", CallBackState.Success);
+                UnityMsgHandler.sendMessageToUnity(CodeA2U.ReviewState,args);
+                LogUtil.debug("璇勫垎鍥炶皟", "鎴愬姛");
+            }
+
+            @Override
+            public void onError(String s) {
+                Map<String, Object> args = new HashMap<>();
+                args.put("state", CallBackState.Error);
+                UnityMsgHandler.sendMessageToUnity(CodeA2U.ReviewState,args);
+                LogUtil.debug("璇勫垎鍥炶皟", "澶辫触锛�" + s);
+            }
+
+            @Override
+            public void onCancel() {
+                Map<String, Object> args = new HashMap<>();
+                args.put("state", CallBackState.Cancel);
+                UnityMsgHandler.sendMessageToUnity(CodeA2U.ReviewState,args);
+                LogUtil.debug("璇勫垎鍥炶皟", "鍙栨秷");
+            }
+        });
+
         //璁剧疆dubug妯″紡
         SdkManager.getInstance().setDebug(BuildConfig.DEBUG);
     }

--
Gitblit v1.8.0