Android Open Source - shapemergency Game Config






From Project

Back to project page shapemergency.

License

The source code is released under:

GNU General Public License

If you think the Android project shapemergency listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.adsg0186.shapemergency.testgame1.config;
//from w w  w .  j  av  a  2 s  .  c o m
import java.util.EnumMap;

import com.adsg0186.shapemergency.testgame1.config.GameConfigIF.Difficulty;

public class GameConfig {
    // exhausting to type this
    protected static EnumMap<GameConfigIF.Difficulty, GameConfigIF> configs = 
            new EnumMap<Difficulty, GameConfigIF>(GameConfigIF.Difficulty.class);
    
    protected static GameConfigIF instance;
    
    public static void set(GameConfigIF.Difficulty which) {
        instance = getConfig(which);
    }
    
    public static GameConfigIF get() { return instance; }

    protected static GameConfigIF getConfig(GameConfigIF.Difficulty which) {
        GameConfigIF config = configs.get(which);
        // must clobber this and create a new one every time getConfig is called.
        // otherwise on resume the old gameconfig instance is hanging around
        // and contains references to previous world/renderer
        // TODO: add destroyInstance() method which can be called
        // in game.stop() or something.
        config = null;
        if (config == null) {
            /// init config and put it in the map
            switch (which) {
                case easy:
                    config = new EasyGameConfig();
                    break;
                case insane:
                    config = new InsaneGameConfig();
                    break;
                case normal:
                default:
                    config = new BaseGameConfig();
                    break;
            }
           configs.put(which, config);
        }
        return config;
    }
}




Java Source Code List

com.adsg0186.shapemergency.GameActivity.java
com.adsg0186.shapemergency.GameScreen.java
com.adsg0186.shapemergency.HelpView.java
com.adsg0186.shapemergency.HighScoreView.java
com.adsg0186.shapemergency.MainActivity.java
com.adsg0186.shapemergency.SettingsView.java
com.adsg0186.shapemergency.testgame1.AngryTargetMissileSource.java
com.adsg0186.shapemergency.testgame1.BonusFactory.java
com.adsg0186.shapemergency.testgame1.BossTargetMissileSource.java
com.adsg0186.shapemergency.testgame1.CreateEnemyTrigger.java
com.adsg0186.shapemergency.testgame1.DefenderCollisionTrigger.java
com.adsg0186.shapemergency.testgame1.FiringGameTest.java
com.adsg0186.shapemergency.testgame1.GameSound.java
com.adsg0186.shapemergency.testgame1.MissileBlobSource.java
com.adsg0186.shapemergency.testgame1.MissileCollisionTrigger.java
com.adsg0186.shapemergency.testgame1.ShieldCollisionTrigger.java
com.adsg0186.shapemergency.testgame1.TargetMissileSource.java
com.adsg0186.shapemergency.testgame1.TargetUtils.java
com.adsg0186.shapemergency.testgame1.Vibrate.java
com.adsg0186.shapemergency.testgame1.blobs.BonusDropper.java
com.adsg0186.shapemergency.testgame1.blobs.BonusIF.java
com.adsg0186.shapemergency.testgame1.blobs.BossEnemy.java
com.adsg0186.shapemergency.testgame1.blobs.DamagableIF.java
com.adsg0186.shapemergency.testgame1.blobs.DamagerIF.java
com.adsg0186.shapemergency.testgame1.blobs.DefaultEnemy.java
com.adsg0186.shapemergency.testgame1.blobs.EnemyBomb.java
com.adsg0186.shapemergency.testgame1.blobs.EnemyFactory.java
com.adsg0186.shapemergency.testgame1.blobs.EnemyIF.java
com.adsg0186.shapemergency.testgame1.blobs.FiringBlobDecorator.java
com.adsg0186.shapemergency.testgame1.blobs.FlashMessage.java
com.adsg0186.shapemergency.testgame1.blobs.HitpointBonusDecorator.java
com.adsg0186.shapemergency.testgame1.blobs.ScoreTextDisplay.java
com.adsg0186.shapemergency.testgame1.blobs.ShieldRing.java
com.adsg0186.shapemergency.testgame1.config.BaseGameConfig.java
com.adsg0186.shapemergency.testgame1.config.EasyGameConfig.java
com.adsg0186.shapemergency.testgame1.config.GameConfigIF.java
com.adsg0186.shapemergency.testgame1.config.GameConfig.java
com.adsg0186.shapemergency.testgame1.config.GamePreferences.java
com.adsg0186.shapemergency.testgame1.config.InsaneGameConfig.java
com.adsg0186.shapemergency.testgame1.config.SavedGame.java