mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
make countdown code a bit nicer
This commit is contained in:
parent
0a8331f545
commit
992635d24b
@ -80,14 +80,12 @@ namespace MCGalaxy.Games {
|
|||||||
return pl.ColoredName + suffix;
|
return pl.ColoredName + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Start(Player p, string map, int rounds) {
|
protected override string GetStartMap(Player p, string forcedMap) {
|
||||||
map = "countdown";
|
if (!LevelInfo.MapExists("countdown")) {
|
||||||
if (!LevelInfo.MapExists(map)) {
|
|
||||||
p.Message("Countdown level not found, generating..");
|
p.Message("Countdown level not found, generating..");
|
||||||
GenerateMap(p, 32, 32, 32);
|
GenerateMap(p, 32, 32, 32);
|
||||||
}
|
}
|
||||||
|
return "countdown";
|
||||||
base.Start(p, map, rounds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void StartGame() {
|
protected override void StartGame() {
|
||||||
|
@ -40,7 +40,7 @@ namespace MCGalaxy.Games {
|
|||||||
|
|
||||||
protected abstract void StartGame();
|
protected abstract void StartGame();
|
||||||
public virtual void Start(Player p, string map, int rounds) {
|
public virtual void Start(Player p, string map, int rounds) {
|
||||||
map = GetStartMap(this, map);
|
map = GetStartMap(p, map);
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
p.Message("No maps have been setup for {0} yet", GameName); return;
|
p.Message("No maps have been setup for {0} yet", GameName); return;
|
||||||
}
|
}
|
||||||
@ -78,9 +78,9 @@ namespace MCGalaxy.Games {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual string GetStartMap(RoundsGame game, string forcedMap) {
|
protected virtual string GetStartMap(Player p, string forcedMap) {
|
||||||
if (forcedMap.Length > 0) return forcedMap;
|
if (forcedMap.Length > 0) return forcedMap;
|
||||||
List<string> maps = Picker.GetCandidateMaps(game);
|
List<string> maps = Picker.GetCandidateMaps(this);
|
||||||
|
|
||||||
if (maps == null || maps.Count == 0) return null;
|
if (maps == null || maps.Count == 0) return null;
|
||||||
return LevelPicker.GetRandomMap(new Random(), maps);
|
return LevelPicker.GetRandomMap(new Random(), maps);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user