-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from lanedirt/97-add-fleet-send-error-handlin…
…g-in-frontend Add fleet send error handling in frontend Add colonisation mission
- Loading branch information
Showing
35 changed files
with
2,345 additions
and
812 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace OGame\Factories; | ||
|
||
use Illuminate\Contracts\Container\BindingResolutionException; | ||
use OGame\GameMissions\Abstracts\GameMission; | ||
use OGame\GameMissions\ColonisationMission; | ||
use OGame\GameMissions\DeploymentMission; | ||
use OGame\GameMissions\TransportMission; | ||
|
||
class GameMissionFactory | ||
{ | ||
/** | ||
* @return array<GameMission> | ||
* @throws BindingResolutionException | ||
*/ | ||
public static function getAllMissions(): array | ||
{ | ||
/* | ||
{ | ||
"1": "Attack", | ||
"2": "ACS Attack", | ||
"3": "Transport", | ||
"4": "Deployment", | ||
"5": "ACS Defend", | ||
"6": "Espionage", | ||
"7": "Colonisation", | ||
"8": "Recycle Debris Field", | ||
"9": "Moon Destruction", | ||
"15": "Expedition" | ||
} | ||
*/ | ||
return [ | ||
3 => app()->make(TransportMission::class), | ||
4 => app()->make(DeploymentMission::class), | ||
7 => app()->make(ColonisationMission::class), | ||
]; | ||
} | ||
|
||
/** | ||
* @param int $missionId | ||
* @param array<string,mixed> $dependencies | ||
* | ||
* @return GameMission | ||
* @throws BindingResolutionException | ||
*/ | ||
public static function getMissionById(int $missionId, array $dependencies): GameMission | ||
{ | ||
switch ($missionId) { | ||
case 3: | ||
return app()->make(TransportMission::class, $dependencies); | ||
case 4: | ||
return app()->make(DeploymentMission::class, $dependencies); | ||
case 7: | ||
return app()->make(ColonisationMission::class, $dependencies); | ||
} | ||
$missions = self::getAllMissions(); | ||
return $missions[$missionId]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.