From e55e2c63390a5140ac6eae581703ff80b959f6a4 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期五, 07 九月 2018 19:36:19 +0800
Subject: [PATCH] Fixed 猫耳AppID读取错误

---
 Project/app/src/main/java/com/secondworld/univeralsdk/MainActivity.java          |   15 +++++++--------
 ChannelDiff/498mrgame/libs/app-game_498mrgame-release.aar                        |    0 
 Project/app/src/game_498mrgame/java/com/secondworld/univeralsdk/H2EngineSDK.java |   29 +++++++++++++++++++++++------
 3 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/ChannelDiff/498mrgame/libs/app-game_498mrgame-release.aar b/ChannelDiff/498mrgame/libs/app-game_498mrgame-release.aar
index 335b2f7..c6f66ea 100644
--- a/ChannelDiff/498mrgame/libs/app-game_498mrgame-release.aar
+++ b/ChannelDiff/498mrgame/libs/app-game_498mrgame-release.aar
Binary files differ
diff --git a/Project/app/src/game_498mrgame/java/com/secondworld/univeralsdk/H2EngineSDK.java b/Project/app/src/game_498mrgame/java/com/secondworld/univeralsdk/H2EngineSDK.java
index fe9d8c2..5d6a996 100644
--- a/Project/app/src/game_498mrgame/java/com/secondworld/univeralsdk/H2EngineSDK.java
+++ b/Project/app/src/game_498mrgame/java/com/secondworld/univeralsdk/H2EngineSDK.java
@@ -99,9 +99,12 @@
                     MrPlatformUtil.getInstance().logout(_activity);
                     break;
                 case CodeU2A.FreePlatformPay:
+                    String _appID = UniversalUtil.getMetaString(_activity, "Mr_GAME_ID");
+                    _appID = _appID.replace("_", "");
+                    LogUtil.i(TAG, _appID);
+
                     JSONObject _extraData = new JSONObject();
-                    _extraData.put("appid",
-                                   UniversalUtil.getMetaString(_activity, "Mr_ADID") + "_mrgame");
+                    _extraData.put("appid", _appID);
                     _extraData.put("cpinfo", _json.getString("cpInfo"));
                     _extraData.put("cporderid", _json.getString("orderId"));
 
@@ -116,7 +119,6 @@
                                                      _json.getString("notifyurl"));
 
                     MrPlatformUtil.getInstance().payProcessing = true;
-
                     break;
                 case CodeU2A.PayFinished:
                     MrPlatformUtil.getInstance().payProcessing = false;
@@ -343,7 +345,7 @@
 
                 _msgStruct.clear();
                 _msgStruct.put("code", CodeA2U.SdkInitComplete);
-                _msgStruct.put("channelPlatform","mr");
+                _msgStruct.put("channelPlatform", "mr");
                 UniversalUtil.sendMessageToUnity(_msgStruct);
 
                 LogUtil.i(TAG, "鍒濆鍖栨墽琛屽畬姣�");
@@ -356,6 +358,22 @@
     {
         // ------------------------------- 鐚�砈DK -------------------------------
         MrPlatformUtil.getInstance().init(activity);
+    }
+
+    private static boolean m_IsFocus = true;
+
+    public static void onWindowFocusChanged(boolean b)
+    {
+        if (MrPlatformUtil.getInstance().payProcessing)
+        {
+            if (b)
+            {
+                Map<String, Object> _msgStruct = new HashMap<>();
+                _msgStruct.put("code", CodeA2U.FreePlatformPayCancel);
+                UniversalUtil.sendMessageToUnity(_msgStruct);
+                MrPlatformUtil.getInstance().payProcessing = false;
+            }
+        }
     }
 
     public static void onNewIntent(final Activity activity, final Intent intent)
@@ -380,7 +398,6 @@
 
     public static void onStart(final Activity activity)
     {
-
     }
 
     public static void onPause(final Activity activity)
@@ -392,7 +409,7 @@
     {
         CommonMrSdk.getInstance().onResume(activity);
 
-        if(MrPlatformUtil.getInstance().payProcessing)
+        if (MrPlatformUtil.getInstance().payProcessing)
         {
             Map<String, Object> _msgStruct = new HashMap<>();
             _msgStruct.put("code", CodeA2U.FreePlatformPayCancel);
diff --git a/Project/app/src/main/java/com/secondworld/univeralsdk/MainActivity.java b/Project/app/src/main/java/com/secondworld/univeralsdk/MainActivity.java
index 786d5ef..4a19082 100644
--- a/Project/app/src/main/java/com/secondworld/univeralsdk/MainActivity.java
+++ b/Project/app/src/main/java/com/secondworld/univeralsdk/MainActivity.java
@@ -41,11 +41,17 @@
     }
 
     @Override
+    public void onWindowFocusChanged(boolean b)
+    {
+        super.onWindowFocusChanged(b);
+        H2EngineSDK.onWindowFocusChanged(b);
+    }
+
+    @Override
     protected void onNewIntent(Intent intent)
     {
         super.onNewIntent(intent);
         H2EngineSDK.onNewIntent(this, intent);
-        LogUtil.i(TAG, "onNewIntent");
     }
 
     @Override
@@ -61,7 +67,6 @@
         H2EngineSDK.onConfigurationChanged(newConfig);
 
         super.onConfigurationChanged(newConfig);
-        LogUtil.i(TAG, "onConfigurationChanged");
     }
 
     @Override
@@ -70,7 +75,6 @@
         H2EngineSDK.onStart(this);
 
         super.onStart();
-        LogUtil.i(TAG, "onStart");
     }
 
     @Override
@@ -80,7 +84,6 @@
         H2EngineSDK.onStop(this);
 
         super.onStop();
-        LogUtil.i(TAG, "onStop");
     }
 
     @Override
@@ -90,7 +93,6 @@
         H2EngineSDK.onResume(this);
 
         super.onResume();
-        LogUtil.i(TAG, "onResume");
 
         // 妫�娴嬫湰鍦板瓨鍌ㄦ潈闄愭槸鍚︽湁, 娌℃湁鐨勮瘽瑕佹彁绀虹敤鎴�
         if (PermissionChecker.checkPermission(this,
@@ -143,7 +145,6 @@
         H2EngineSDK.onPause(this);
 
         super.onPause();
-        LogUtil.i(TAG, "onPause");
     }
 
     @Override
@@ -152,7 +153,6 @@
         H2EngineSDK.onDestroy(this);
 
         super.onDestroy();
-        LogUtil.i(TAG, "onDestroy");
     }
 
     @Override
@@ -161,7 +161,6 @@
         H2EngineSDK.onRestart(this);
 
         super.onRestart();
-        LogUtil.i(TAG, "onRestart");
     }
 
 }

--
Gitblit v1.8.0