liuxue
2021-07-29 7e2df20ccc7cdfb528d309369460a4f3d66afdf1
SdkProject/library/src/main/java/com/secondworld/sdk/UnityMsgHandler.java
@@ -74,7 +74,7 @@
     */
    public static List<String> getClassName(String packageName) throws IOException {
        List<String> classNameList = new ArrayList<String>();
        DexFile df = new DexFile(GameApp.I.getPackageCodePath());//通过DexFile查找当前的APK中可执行文件
        DexFile df = new DexFile(GameAppProxy.app.getPackageCodePath());//通过DexFile查找当前的APK中可执行文件
        Enumeration<String> enumeration = df.entries();//获取df中的元素  这里包含了所有可执行的类名 该类名包含了包名+类名的方式
        while (enumeration.hasMoreElements()) {//遍历
            String className = (String) enumeration.nextElement();
@@ -85,17 +85,21 @@
        return classNameList;
    }
    public static void sendMessageToUnity(int code) {
        UnityMsgHandler.sendMessageToUnity(code,null);
    }
    /**
     * 发送消息到unity
     *
     * @param jsonMap
     * @param args
     */
    public static void sendMessageToUnity(Map<String, Object> jsonMap) {
        if (jsonMap == null || jsonMap.isEmpty()) {
            return;
        }
        JSONObject jsonObject = new JSONObject(jsonMap);
        if (GameApp.I.isDemo()) {
    public static void sendMessageToUnity(int code, Map<String, Object> args) {
        if (args == null)
            args = new HashMap<>();
        args.put("code", code);
        JSONObject jsonObject = new JSONObject(args);
        if (GameAppProxy.isDemo()) {
            LogUtil.debug("发送消息到unity", jsonObject.toString());
            return;
        }