package library.core.mainAI; import library.core.debug.CoreLog; import library.core.music.CoreBgmPlayer; import library.core.music.CoreSePlayer; import library.core.system.CoreImagePool; import android.app.Application; import android.content.Context; import android.content.res.Configuration; public class RiverCrossingAI extends Application{ private static CoreImagePool imagePool; private static CoreSePlayer sePlayer; private static CoreBgmPlayer bgmPlayer; public static boolean screenLoad; private static boolean isCanTouch=true; private static Context context; /** *アプリケーション作成時 */ @Override public void onCreate(){ CoreLog.debug("create Application"); /*imagePool=new CoreImagePool(getApplicationContext()); sePlayer=new CoreSePlayer(getApplicationContext()); bgmPlayer=new CoreBgmPlayer(getApplicationContext());*/ //CoreApplication.context=getApplicationContext(); screenLoad=false; } public static void setContext(Context context){ RiverCrossingAI.context=context; } /** * アプリケーション終了時 */ @Override public void onTerminate(){ CoreLog.debug("delete Application"); if(sePlayer!=null){ sePlayer.release(); } } /** * メモリー低下時 */ @Override public void onLowMemory(){ CoreLog.debug("low memory"); if(imagePool!=null){ imagePool.cleanDatas(); } } /** * オリエンテーションの変更など */ @Override public void onConfigurationChanged(Configuration newConfig) { CoreLog.debug("configuration Change"); } /** * アクティビティーの変更時に呼ぶ */ public static void changeActivity(){ if(sePlayer!=null){ sePlayer.release(); } if(imagePool!=null){ imagePool.cleanDatas(); } screenLoad=false; } /** * タッチイベントが有効かどうか * @return */ public static boolean isCanTouch() { return isCanTouch; } /** * タッチイベントの有効設定 * @param is */ public static void setCanTouch(boolean is) { isCanTouch = is; } public static CoreImagePool getImagePool() { if(imagePool==null){ imagePool=new CoreImagePool(context); } return imagePool; } public static CoreSePlayer getSePlayer() { if(sePlayer==null){ sePlayer=new CoreSePlayer(context); } return sePlayer; } public static CoreBgmPlayer getBgmPlayer() { if(bgmPlayer==null){ bgmPlayer=new CoreBgmPlayer(context); } return bgmPlayer; } }