Exemple #1
0
 public void saveShip() {
   if (myTutorialManager != null) return;
   HullConfig hull;
   float money;
   ArrayList<SolItem> items;
   if (myHero != null) {
     hull = myHero.getHull().config;
     money = myHero.getMoney();
     items = new ArrayList<SolItem>();
     for (List<SolItem> group : myHero.getItemContainer()) {
       for (SolItem i : group) {
         items.add(0, i);
       }
     }
   } else if (myTranscendentHero != null) {
     FarShip farH = myTranscendentHero.getShip();
     hull = farH.getHullConfig();
     money = farH.getMoney();
     items = new ArrayList<SolItem>();
     for (List<SolItem> group : farH.getIc()) {
       for (SolItem i : group) {
         items.add(0, i);
       }
     }
   } else {
     hull = myRespawnHull;
     money = myRespawnMoney;
     items = myRespawnItems;
   }
   SaveManager.writeShip(hull, money, items, this);
 }
Exemple #2
0
  public SolGame(
      SolApplication cmp,
      boolean usePrevShip,
      TextureManager textureManager,
      boolean tut,
      CommonDrawer commonDrawer) {
    myCmp = cmp;
    GameDrawer drawer = new GameDrawer(textureManager, commonDrawer);
    gameColors = new GameColors();
    mySoundManager = new SoundManager();
    mySpecialSounds = new SpecialSounds(mySoundManager);
    myDraMan = new DraMan(drawer);
    myCam = new SolCam(drawer.r);
    myScreens = new GameScreens(drawer.r, cmp);
    myTutorialManager =
        tut
            ? new TutorialManager(commonDrawer.r, myScreens, cmp.isMobile(), cmp.getOptions())
            : null;
    myTextureManager = textureManager;
    myFarBackgroundManagerOld = new FarBackgroundManagerOld(myTextureManager);
    myShipBuilder = new ShipBuilder();
    myEffectTypes = new EffectTypes();
    mySpecialEffects = new SpecialEffects(myEffectTypes, myTextureManager, gameColors);
    myItemManager = new ItemManager(myTextureManager, mySoundManager, myEffectTypes, gameColors);
    myAbilityCommonConfigs =
        new AbilityCommonConfigs(myEffectTypes, myTextureManager, gameColors, mySoundManager);
    hullConfigManager =
        new HullConfigManager(
            myShipBuilder,
            FileManager.getInstance(),
            textureManager,
            myItemManager,
            myAbilityCommonConfigs,
            mySoundManager);
    myNames = new SolNames();
    myPlanetManager =
        new PlanetManager(myTextureManager, hullConfigManager, gameColors, myItemManager);
    SolContactListener contactListener = new SolContactListener(this);
    myFractionMan = new FractionMan(myTextureManager);
    myObjectManager = new ObjectManager(contactListener, myFractionMan);
    myGridDrawer = new GridDrawer(textureManager);
    myChunkManager = new ChunkManager(myTextureManager);
    myPartMan = new PartMan();
    myAsteroidBuilder = new AsteroidBuilder(myTextureManager);
    myLootBuilder = new LootBuilder();
    myFarBgMan = new FarBgMan();
    myMapDrawer = new MapDrawer(myTextureManager, commonDrawer.h);
    myShardBuilder = new ShardBuilder(myTextureManager);
    myGalaxyFiller = new GalaxyFiller();
    myStarPortBuilder = new StarPort.Builder();
    myPlayerSpawnConfig = PlayerSpawnConfig.load(hullConfigManager, myItemManager);
    myDraDebugger = new DraDebugger();
    myBeaconHandler = new BeaconHandler(textureManager);
    myMountDetectDrawer = new MountDetectDrawer(textureManager);
    myRespawnItems = new ArrayList<SolItem>();
    myTimeFactor = 1;

    // from this point we're ready!
    myPlanetManager.fill(myNames);
    myGalaxyFiller.fill(this);
    ShipConfig startingShip =
        usePrevShip ? SaveManager.readShip(hullConfigManager, myItemManager) : null;
    createPlayer(startingShip);
    SolMath.checkVectorsTaken(null);
  }