| | |
| | | |
| | | import com.secondworld.sdk.command.CmdInit; |
| | | import com.secondworld.sdk.command.ICommand; |
| | | import com.secondworld.sdk.utils.CodeA2U; |
| | | import com.secondworld.sdk.utils.LogUtil; |
| | | import com.secondworld.sdk.utils.StaticDefine; |
| | | import com.unity3d.player.UnityPlayer; |
| | |
| | | */ |
| | | 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(); |
| | |
| | | } |
| | | |
| | | public static void sendMessageToUnity(int code) { |
| | | Map<String, Object> args = new HashMap<>(); |
| | | args.put("code", code); |
| | | UnityMsgHandler.sendMessageToUnity(args); |
| | | 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; |
| | | } |