client_Hale
2018-10-12 1a9012be7aff5b5cf1d03795fcfa1740c6a6f9cf
Project/sp_sdk/src/game_spxjgame/java/com/secondworld/univeralsdk/H2EngineSDK.java
@@ -33,6 +33,8 @@
    private static final String TAG = "H2EngineSDK";
    private static String APP_ID = "";
    private static boolean PushEnable = true;
    public static void HandleUnityMessage(String json)
    {
        LogUtil.i(TAG, "收到Unity发来的信息: " + json);
@@ -110,9 +112,13 @@
                    SpPlatformUtil.getInstance().createRole(_json.getString("sid"),
                                                            _json.getString("serverName"),
                                                            _json.getString("roleID"),
                                                            _json.getString("roleName").trim().replace(" ",""),
                                                            _json.getString(
                                                                    "roleName").trim().replace(" ",
                                                                                               ""),
                                                            _json.getString("level"),
                                                            _json.getString("familyName").trim().replace(" ",""),
                                                            _json.getString(
                                                                    "familyName").trim().replace(
                                                                    " ", ""),
                                                            _json.getString("gameName"),
                                                            _json.getString("job"),
                                                            _json.getString("vipLevel"),
@@ -122,9 +128,13 @@
                    SpPlatformUtil.getInstance().enterWorld(_json.getString("sid"),
                                                            _json.getString("serverName"),
                                                            _json.getString("roleID"),
                                                            _json.getString("roleName").trim().replace(" ",""),
                                                            _json.getString(
                                                                    "roleName").trim().replace(" ",
                                                                                               ""),
                                                            _json.getString("level"),
                                                            _json.getString("familyName").trim().replace(" ",""),
                                                            _json.getString(
                                                                    "familyName").trim().replace(
                                                                    " ", ""),
                                                            _json.getString("gameName"),
                                                            _json.getString("job"),
                                                            _json.getString("vipLevel"),
@@ -134,9 +144,12 @@
                    SpPlatformUtil.getInstance().levelUp(_json.getString("sid"),
                                                         _json.getString("serverName"),
                                                         _json.getString("roleID"),
                                                         _json.getString("roleName").trim().replace(" ",""),
                                                         _json.getString("roleName").trim().replace(
                                                                 " ", ""),
                                                         _json.getString("level"),
                                                         _json.getString("familyName").trim().replace(" ",""),
                                                         _json.getString(
                                                                 "familyName").trim().replace(" ",
                                                                                              ""),
                                                         _json.getString("gameName"),
                                                         _json.getString("job"),
                                                         _json.getString("vipLevel"),
@@ -166,6 +179,8 @@
    public static void addLocalNotification(Activity activity, int id, String title, String content,
                                            long fireTime)
    {
        if (PushEnable)
        {
        try
        {
            JPushLocalNotification ln = new JPushLocalNotification();
@@ -181,10 +196,14 @@
            e.printStackTrace();
        }
    }
    }
    public static void removeNotification(Activity activity, int id)
    {
        if (PushEnable)
        {
        JPushInterface.removeLocalNotification(activity, id);
        }
    }
    public static void GetExternalStorage()
@@ -296,6 +315,8 @@
            return;
        }
        PushEnable = activity.getPackageName().equals("com.xjaz.sp");
        new Thread(new Runnable()
        {
            @Override
@@ -319,6 +340,9 @@
                UniversalUtil.sendMessageToUnity(_msgStruct);
                // ------------------------------- 极光推送 -------------------------------
                String _registrationID = "0";
                if (PushEnable)
                {
                JPushInterface.setDebugMode(true);
                JPushInterface.init(activity);
@@ -329,6 +353,7 @@
                    // 等待获取极光registrationID
                    if (!JPushInterface.getRegistrationID(activity).equals(""))
                    {
                            _registrationID = JPushInterface.getRegistrationID(activity);
                        break;
                    }
@@ -340,10 +365,11 @@
                        break;
                    }
                }
                }
                _msgStruct.clear();
                _msgStruct.put("code", CodeA2U.PushClientID);
                _msgStruct.put("clientID", JPushInterface.getRegistrationID(activity));
                _msgStruct.put("clientID", _registrationID);
                UniversalUtil.sendMessageToUnity(_msgStruct);
                _msgStruct.clear();