hch
5 天以前 e8d63e91d80cc59d7947ad026149c2b752ce9364
SdkProject/app/src/main/java/com/secondworld/demo/MainActivity.java
@@ -5,8 +5,9 @@
import android.support.annotation.NonNull;
import android.widget.RelativeLayout;
import com.secondworld.sdk.GTGameApp;
import com.secondworld.sdk.BtGameMain;
import com.secondworld.sdk.GameActivityProxy;
import com.secondworld.sdk.GameAppProxy;
import com.secondworld.sdk.UnityMsgHandler;
import com.secondworld.sdk.utils.CodeU2A;
import com.secondworld.sdk.utils.LogUtil;
@@ -17,7 +18,7 @@
public class MainActivity extends Activity {
    private static Class<? extends GameActivityProxy> proxyClass;
    private static Class<? extends GameActivityProxy> proxyClass= BtGameMain.class;
    GameActivityProxy proxy;
@@ -29,6 +30,7 @@
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        GameAppProxy.isDemo=true;
        setContentView(R.layout.activity_main);
        RelativeLayout webContainer = findViewById(com.secondworld.sdk.R.id.webContainer);
        WebViewUtil.I.init(this, webContainer);
@@ -50,8 +52,7 @@
        {
            JSONObject json = new JSONObject();
            try {
                json.put("code", CodeU2A.OpenWebView);
                json.put("url", "http://sydownload.secondworld.net.cn/xmzc/notice/noticeweb/notice_bt.html");
                json.put("code", CodeU2A.PlatformLogin);
            } catch (JSONException e) {
                e.printStackTrace();
            }
@@ -61,18 +62,69 @@
        findViewById(R.id.pay).setOnClickListener((v -> {
            JSONObject json = new JSONObject();
            try {
                json.put("sid","10");
                json.put("serverName","bt2server");
                json.put("roleName","hahaha");
                json.put("roleID","123");
                json.put("money","110");
                json.put("vipLevel","5");
                json.put("level","10");
                json.put("familyName","hengha");
                json.put("createTime","");
                json.put("code", CodeU2A.PlatformPay);
                json.put("cpInfo", "com.sanxiagame.zmjgp099");
                json.put("orderId", System.currentTimeMillis() / 1000 + "");
                json.put("sid", "1");
                json.put("roleID", "test_role");
                json.put("title", "goods_100");
                json.put("mount", "0.01");
                json.put("mount", "0.009999999776482582");
            } catch (JSONException e) {
                e.printStackTrace();
            }
            UnityMsgHandler.onUnityMessage(json.toString());
        }));
        findViewById(R.id.btnA).setOnClickListener(v -> {
            JSONObject json = new JSONObject();
//            try {
//                json.put("code", CodeU2A.RequestPermission);
//                json.put("permission", "android.permission.RECORD_AUDIO");
//            } catch (JSONException e) {
//                e.printStackTrace();
//            }
            UnityMsgHandler.onUnityMessage(json.toString());
        });
        findViewById(R.id.btnB).setOnClickListener(v -> {
            JSONObject json = new JSONObject();
            try {
                json.put("sid","bt2");
                json.put("serverName","bt2server");
                json.put("roleName","hahaha");
                json.put("roleID","123");
                json.put("money","110");
                json.put("vipLevel","5");
                json.put("level","10");
                json.put("familyName","hengha");
                json.put("createTime","");
                json.put("code", CodeU2A.CreateRole);
            } catch (JSONException e) {
                e.printStackTrace();
            }
            UnityMsgHandler.onUnityMessage(json.toString());
        });
    }
    private void unityMessage(int code) {
        JSONObject json = new JSONObject();
        try {
            json.put("code", code);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        UnityMsgHandler.onUnityMessage(json.toString());
    }
    @Override