package com.unity3d.player;

import android.content.Intent;

import com.tuyoo.gamesdk.api.SDKAPI;

public class TYUnityActivity extends UnityPlayerActivity
{
    private static boolean sdkInited = false;

    public static void setSdkInited() {
        sdkInited = true;
    }

    @Override
    protected void onStart() {
            super.onStart();
            if(sdkInited)
            {
                SDKAPI.getIns().onActivityStart(this);
            }
    }
    
                    
    @Override
    protected void onNewIntent(Intent intent) {
            super.onNewIntent(intent);
            if(sdkInited)
            {
                SDKAPI.getIns().onNewIntent(intent);
            }
    }
    
    @Override
    protected void onRestart() {
            super.onRestart();
            if(sdkInited)
            {
                SDKAPI.getIns().onActivityRestart(this);
            }
    }
    
    @Override
    protected void onResume() {
            super.onResume();
            if(sdkInited)
            {
                SDKAPI.getIns().onActivityResume(this);
            }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            if(sdkInited)
            {
                SDKAPI.getIns().onActivityResult(requestCode, resultCode, data);
            }
    }

    @Override
    protected void onPause() {
            super.onPause();
            if(sdkInited)
            {
                SDKAPI.getIns().onActivityPause(this);
            }
    }
            
    @Override
    protected void onStop() {
            super.onStop();
            if(sdkInited)
            {
                SDKAPI.getIns().onActivityStop(this);
            }
    }

    @Override
    protected void onDestroy() {
            super.onDestroy();
            if(sdkInited)
            {
                SDKAPI.getIns().onActivityDestroy(this);
            }
    }
}
