| | |
| | | import android.os.Bundle; |
| | | import android.support.annotation.NonNull; |
| | | |
| | | import com.secondworld.sdk.GTGameApp; |
| | | import com.secondworld.sdk.GameActivityProxy; |
| | | import com.secondworld.sdk.UnityMsgHandler; |
| | | import com.secondworld.sdk.utils.CodeU2A; |
| | |
| | | e.printStackTrace(); |
| | | LogUtil.e("GameActivity", e); |
| | | } |
| | | findViewById(R.id.btnInit).setOnClickListener((v -> |
| | | addEvent(); |
| | | } |
| | | |
| | | private void addEvent() |
| | | { |
| | | findViewById(R.id.login).setOnClickListener((v -> |
| | | { |
| | | JSONObject json = new JSONObject(); |
| | | try { |
| | |
| | | } |
| | | UnityMsgHandler.onUnityMessage(json.toString()); |
| | | })); |
| | | } |
| | | |
| | | findViewById(R.id.pay).setOnClickListener((v -> { |
| | | JSONObject json = new JSONObject(); |
| | | try { |
| | | json.put("code", CodeU2A.PlatformPay); |
| | | json.put("cpInfo", 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"); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | UnityMsgHandler.onUnityMessage(json.toString()); |
| | | })); |
| | | } |
| | | @Override |
| | | protected void onStart() { |
| | | super.onStart(); |