|  |  |  | 
|---|
|  |  |  | // GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN | 
|---|
|  |  |  | package com.secondworld.sdk; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import android.app.Activity; | 
|---|
|  |  |  | 
|---|
|  |  |  | import android.view.Window; | 
|---|
|  |  |  | import android.view.WindowManager; | 
|---|
|  |  |  | import android.os.Process; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.unity3d.player.IUnityPlayerLifecycleEvents; | 
|---|
|  |  |  | import com.unity3d.player.UnityPlayer; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class UnityPlayerActivity extends Activity implements IUnityPlayerLifecycleEvents | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | moveTaskToBack(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // When Unity player quited kill process | 
|---|
|  |  |  | // Callback before Unity player process is killed | 
|---|
|  |  |  | @Override public void onUnityPlayerQuitted() { | 
|---|
|  |  |  | Process.killProcess(Process.myPid()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override protected void onNewIntent(Intent intent) | 
|---|
|  |  |  | 
|---|
|  |  |  | @Override protected void onStop() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | super.onStop(); | 
|---|
|  |  |  | mUnityPlayer.pause(); | 
|---|
|  |  |  | mUnityPlayer.onStop(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override protected void onStart() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | super.onStart(); | 
|---|
|  |  |  | mUnityPlayer.resume(); | 
|---|
|  |  |  | mUnityPlayer.onStart(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // Pause Unity | 
|---|
|  |  |  | @Override protected void onPause() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | super.onPause(); | 
|---|
|  |  |  | mUnityPlayer.pause(); | 
|---|
|  |  |  | mUnityPlayer.onPause(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // Resume Unity | 
|---|
|  |  |  | @Override protected void onResume() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | super.onResume(); | 
|---|
|  |  |  | mUnityPlayer.resume(); | 
|---|
|  |  |  | mUnityPlayer.onResume(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // Low Memory Unity | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // Pass any events not handled by (unfocused) views straight to UnityPlayer | 
|---|
|  |  |  | @Override public boolean onKeyUp(int keyCode, KeyEvent event)     { return mUnityPlayer.injectEvent(event); } | 
|---|
|  |  |  | @Override public boolean onKeyDown(int keyCode, KeyEvent event)   { return mUnityPlayer.injectEvent(event); } | 
|---|
|  |  |  | @Override public boolean onTouchEvent(MotionEvent event)          { return mUnityPlayer.injectEvent(event); } | 
|---|
|  |  |  | /*API12*/ public boolean onGenericMotionEvent(MotionEvent event)  { return mUnityPlayer.injectEvent(event); } | 
|---|
|  |  |  | @Override public boolean onKeyUp(int keyCode, KeyEvent event)     { return mUnityPlayer.onKeyUp(keyCode, event); } | 
|---|
|  |  |  | @Override public boolean onKeyDown(int keyCode, KeyEvent event)   { return mUnityPlayer.onKeyDown(keyCode, event); } | 
|---|
|  |  |  | @Override public boolean onTouchEvent(MotionEvent event)          { return mUnityPlayer.onTouchEvent(event); } | 
|---|
|  |  |  | @Override public boolean onGenericMotionEvent(MotionEvent event)  { return mUnityPlayer.onGenericMotionEvent(event); } | 
|---|
|  |  |  | } | 
|---|