lwb
2020-11-02 9ce09cfd79d8ea00c58a182cfd5ec6eb8d54ee6b
SdkProject/library/src/main/java/com/secondworld/universalsdk/H2EngineSDK.java
@@ -1,4 +1,36 @@
package com.secondworld.universalsdk;
import com.secondworld.universalsdk.command.ICommand;
import org.json.JSONObject;
import java.util.HashMap;
public class H2EngineSDK {
    public static HashMap<Integer, ICommand> allCommand = new HashMap();
    public static void init() {
    }
    private static void AddCommand(ICommand command) {
        allCommand.put(command.getCode(), command);
    }
    //unity 发来的消息
    public static void HandleUnityMessage(String json) {
        try {
            JSONObject _json = new JSONObject(json);
            int code = _json.getInt("code");
            ICommand command = allCommand.get(code);
            if (command == null) {
                return;
            }
            command.process(json);
        } catch (Exception e) {
        }
    }
}