From 352babe80b284339d9b5cc6739fe9ce723c61a39 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 29 四月 2025 16:36:33 +0800
Subject: [PATCH] 0312 越南新官网包

---
 SdkProject/channel/GTGame/java/com/secondworld/sdk/MySdkMgr.java |   98 ++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 72 insertions(+), 26 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..558171b 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 {
 
@@ -34,7 +37,7 @@
             case UNKNOWN: {
                 if (GTGameMain.I.activity != null)
                     init(GTGameMain.I.activity);
-                Toast.makeText(GameApp.I, "姝e湪鍒濆鍖栦腑锛岃绋嶇瓑", Toast.LENGTH_LONG).show();
+                Toast.makeText(GameAppProxy.app, "姝e湪鍒濆鍖栦腑锛岃绋嶇瓑", Toast.LENGTH_LONG).show();
                 break;
             }
             case SUCCEED: {
@@ -42,32 +45,27 @@
                 break;
             }
             case LOADING: {
-                Toast.makeText(GameApp.I, "姝e湪鍒濆鍖栦腑锛岃绋嶇瓑", Toast.LENGTH_LONG).show();
+                Toast.makeText(GameAppProxy.app, "姝e湪鍒濆鍖栦腑锛岃绋嶇瓑", Toast.LENGTH_LONG).show();
                 break;
             }
         }
     }
 
     public void setListener() {
-        args = new HashMap<>();
         // 鍒濆鍖栫洃鍚�
         SdkManager.getInstance().setInitListener(new InitListener() {
             @Override
             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);
             }
         });
 
@@ -80,12 +78,10 @@
                     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("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 +91,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);
             }
         });
 
@@ -123,16 +114,19 @@
             @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);
             }
         });
 
@@ -143,9 +137,7 @@
             @Override
             public void onSuccess() {
                 //娉ㄩ攢鎴愬姛,闇�瑕佹妸娓告垙鍒囨崲鍥炵櫥闄嗗墠鐨勫満鏅�,骞堕噸鏂板脊鍑虹櫥褰曟绛夋搷浣�
-                args.clear();
-                args.put("code", CodeA2U.PlatformLogoutOk);
-                UnityMsgHandler.sendMessageToUnity(args);
+                UnityMsgHandler.sendMessageToUnity(CodeA2U.PlatformLogoutOk);
             }
 
             @Override
@@ -181,6 +173,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