| | |
| | | try { |
| | | for (String name : classesName) { |
| | | Class<?> aClass = Class.forName(name); |
| | | if (!aClass.isInterface()) |
| | | addCommand((ICommand) aClass.newInstance()); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | |
| | | /** |
| | | * unity 发来的消息 |
| | | * |
| | | * @param json |
| | | */ |
| | | public static void HandleUnityMessage(String json) { |
| | | try { |
| | | LogUtil.debug("HandleUnityMessage", json); |
| | | JSONObject _json = new JSONObject(json); |
| | | int code = _json.getInt("code"); |
| | | ICommand command = allCommand.get(code); |
| | | if (command == null) { |
| | | Log.e("H2EngineSDK", "未知命令"); |
| | | |
| | | return; |
| | | } |
| | | command.process(json); |
| | |
| | | |
| | | /** |
| | | * 通过反射读取指定包名下的所有类名 |
| | | * |
| | | * @param packageName |
| | | * @return |
| | | */ |