Example #1
0
    void Start()
    {
        pc = new PlanetControllerImpl(fc, mapObject, game, baseFleet);
        if (!load)
        {
            UniverseGenerator gen = GetComponent <UniverseGenerator>();

            if (NewGameInit.instance != null)
            {
                game.getGame().setSize(NewGameInit.instance.size);
                game.getGame().setDensity(NewGameInit.instance.density);

                game.getGame().setName(NewGameInit.instance.gameName);

                game.getGame().getPlayers()[0].setRace(NewGameInit.instance.races[0]);
                game.getGame().getPlayers()[1].setRace(NewGameInit.instance.races[1]);
            }
            gen.setUniverseGenerator(game.getGame(), fc, pc, new ShipDesignerImpl(), StaticTechStore.getInstance());

            gen.generate();
        }
        else
        {
            LoadUniverseGenerator loadGen = GetComponent <LoadUniverseGenerator>();

            if (NewGameInit.instance != null)
            {
                game.getGame().setSize(NewGameInit.instance.size);
                game.getGame().setDensity(NewGameInit.instance.density);

                game.getGame().getPlayers()[0].setRace(NewGameInit.instance.races[0]);
                game.getGame().getPlayers()[1].setRace(NewGameInit.instance.races[1]);

                loadGen.setUniverseGenerator(Application.persistentDataPath + "/Game/" + NewGameInit.instance.gameName, game.getGame(), fc, pc, new ShipDesignerImpl(), StaticTechStore.getInstance());
            }
            else
            {
                loadGen.setUniverseGenerator(Application.persistentDataPath + "/Game/Game1/", game.getGame(), fc, pc, new ShipDesignerImpl(), StaticTechStore.getInstance());
            }

            loadGen.generate();
        }
        Settings.instance.playerID = game.getGame().getPlayers()[0].getID();

        layoutManager.LoadLayout();
    }
Example #2
0
    void Start()
    {
        pc = new PlanetControllerImpl(fc, mapObject, game, baseFleet);
        if (!load)
        {
            UniverseGenerator gen = GetComponent <UniverseGenerator>();

            if (NewGameInit.instance != null)
            {
                game.getGame().setSize(NewGameInit.instance.size);
                game.getGame().setDensity(NewGameInit.instance.density);

                game.getGame().setName(NewGameInit.instance.gameName);

                game.getGame().getPlayers()[0].setName(NewGameInit.instance.playerNames[0]);
                game.getGame().getPlayers()[0].getUser().setName(NewGameInit.instance.playerNames[0]);
                game.getGame().getPlayers()[0].setRace(NewGameInit.instance.races[0]);
                game.getGame().getPlayers()[1].setRace(NewGameInit.instance.races[1]);
                game.getGame().getPlayers()[1].setName(NewGameInit.instance.playerNames[1]);
                game.getGame().getPlayers()[1].getUser().setName(NewGameInit.instance.playerNames[1]);

                game.getGame().getPlayers()[0].getUser().setAi(false);
                game.getGame().getPlayers()[1].getUser().setAi(false);
            }
            gen.setUniverseGenerator(game.getGame(), fc, pc, new ShipDesignerImpl(), StaticTechStore.getInstance());

            gen.generate();
        }
        else
        {
            LoadUniverseGenerator loadGen = GetComponent <LoadUniverseGenerator>();

            if (NewGameInit.instance != null)
            {
                game.getGame().setSize(NewGameInit.instance.size);
                game.getGame().setDensity(NewGameInit.instance.density);

                game.getGame().setName(NewGameInit.instance.gameName);

                game.getGame().getPlayers()[0].setName(NewGameInit.instance.playerNames[0]);
                game.getGame().getPlayers()[0].getUser().setName(NewGameInit.instance.playerNames[0]);
                game.getGame().getPlayers()[0].setRace(NewGameInit.instance.races[0]);
                game.getGame().getPlayers()[1].setRace(NewGameInit.instance.races[1]);
                game.getGame().getPlayers()[1].setName(NewGameInit.instance.playerNames[1]);
                game.getGame().getPlayers()[1].getUser().setName(NewGameInit.instance.playerNames[1]);

                game.getGame().getPlayers()[0].getUser().setAi(false);
                game.getGame().getPlayers()[1].getUser().setAi(false);

                loadGen.setUniverseGenerator(Application.persistentDataPath + "/Online/serverFile/", game.getGame(), fc, pc, new ShipDesignerImpl(), StaticTechStore.getInstance());
            }
            else
            {
                loadGen.setUniverseGenerator(Application.persistentDataPath + "/Online/serverFile/", game.getGame(), fc, pc, new ShipDesignerImpl(), StaticTechStore.getInstance());
            }

            loadGen.generate();

            new FileInfo(Application.persistentDataPath + "/Online/serverFile.zip").Delete();
            new DirectoryInfo(Application.persistentDataPath + "/Online/serverFile/").Delete(true);
        }

        messagePanel.playerIndex = researchPanel.playerIndex = planetReport.playerIndex = fleetReport.playerIndex = GameSparksManager.getInstance().getPlayerName() == game.getGame().getPlayers()[0].getName() ? 0 : 1;

        Settings.instance.playerID = GameSparksManager.getInstance().getPlayerName() == game.getGame().getPlayers()[0].getName() ? game.getGame().getPlayers()[0].getID() : game.getGame().getPlayers()[1].getID();

        layoutManager.LoadLayout();
    }