| | |
| | | import android.app.Activity; |
| | | import android.os.Bundle; |
| | | import android.support.annotation.NonNull; |
| | | import android.widget.RelativeLayout; |
| | | |
| | | import com.secondworld.sdk.GTGameApp; |
| | | import com.secondworld.sdk.GameActivityProxy; |
| | | import com.secondworld.sdk.UnityMsgHandler; |
| | | import com.secondworld.sdk.utils.CodeU2A; |
| | | import com.secondworld.sdk.utils.LogUtil; |
| | | import com.secondworld.sdk.utils.WebViewUtil; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_main); |
| | | RelativeLayout webContainer = findViewById(com.secondworld.sdk.R.id.webContainer); |
| | | WebViewUtil.I.init(this, webContainer); |
| | | try { |
| | | if (proxyClass != null) { |
| | | proxy = proxyClass.newInstance(); |
| | |
| | | addEvent(); |
| | | } |
| | | |
| | | private void addEvent() |
| | | { |
| | | private void addEvent() { |
| | | findViewById(R.id.login).setOnClickListener((v -> |
| | | { |
| | | JSONObject json = new JSONObject(); |
| | | try { |
| | | json.put("code", CodeU2A.PlatformLogin); |
| | | json.put("code", CodeU2A.OpenWebView); |
| | | json.put("url", "http://sydownload.secondworld.net.cn/xmzc/notice/noticeweb/notice_bt.html"); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | try { |
| | | json.put("code", CodeU2A.PlatformPay); |
| | | json.put("cpInfo", "com.sanxiagame.zmjgp099"); |
| | | json.put("orderId", System.currentTimeMillis()/1000+""); |
| | | 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("roleID", "test_role"); |
| | | json.put("title", "goods_100"); |
| | | json.put("mount", "0.01"); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | UnityMsgHandler.onUnityMessage(json.toString()); |
| | | })); |
| | | } |
| | | |
| | | @Override |
| | | protected void onStart() { |
| | | super.onStart(); |