Adding CustomEnding
This commit is contained in:
parent
0bd276c16a
commit
ffb75a7832
@ -3,7 +3,6 @@ package nautilus.game.arcade.gametutorial;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.visibility.VisibilityManager;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.gametutorial.events.GameTutorialEndEvent;
|
||||
@ -36,9 +35,11 @@ public abstract class GameTutorial
|
||||
public boolean RunTasksSync = true;
|
||||
public boolean PlayTutorialSounds = false;
|
||||
public boolean ShowPrepareTimer = false;
|
||||
public boolean CustomEnding = false;
|
||||
|
||||
public long TimeBetweenPhase = 0;
|
||||
public long StartAfterTutorial = 5000;
|
||||
public long CustomEndingTime = 5000;
|
||||
|
||||
public GameTutorial(ArcadeManager manager, TutorialPhase[] phases)
|
||||
{
|
||||
@ -80,25 +81,31 @@ public abstract class GameTutorial
|
||||
|
||||
if(_currentPhase == null)
|
||||
{
|
||||
onEnd();
|
||||
_hasEnded = true;
|
||||
endTutorial();
|
||||
final GameTutorial tutorial = this;
|
||||
Manager.runSyncLater(new Runnable()
|
||||
if(!CustomEnding)
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
onEnd();
|
||||
_hasEnded = true;
|
||||
endTutorial();
|
||||
final GameTutorial tutorial = this;
|
||||
Manager.runSyncLater(new Runnable()
|
||||
{
|
||||
Manager.getPluginManager().callEvent(new GameTutorialEndEvent(tutorial));
|
||||
}
|
||||
}, 5);
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Manager.getPluginManager().callEvent(new GameTutorialEndEvent(tutorial));
|
||||
}
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Manager.GetChat().Silence(70000, false);
|
||||
onPhaseChange(_currentPhase);
|
||||
Manager.getPluginManager().callEvent(new GameTutorialPhaseEvent(this, from, _currentPhase));
|
||||
_currentPhase.start(phaseOne);
|
||||
if(!_hasEnded)
|
||||
{
|
||||
Manager.GetChat().Silence(70000, false);
|
||||
onPhaseChange(_currentPhase);
|
||||
Manager.getPluginManager().callEvent(new GameTutorialPhaseEvent(this, from, _currentPhase));
|
||||
_currentPhase.start(phaseOne);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,6 +213,33 @@ public abstract class GameTutorial
|
||||
return _team;
|
||||
}
|
||||
|
||||
public void end()
|
||||
{
|
||||
if(CustomEnding)
|
||||
{
|
||||
onEnd();
|
||||
_hasEnded = true;
|
||||
Thread thread = _currentPhase.getThread();
|
||||
if(thread.isAlive())
|
||||
thread.destroy();
|
||||
|
||||
endTutorial();
|
||||
final GameTutorial tutorial = this;
|
||||
Manager.runSyncLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Manager.getPluginManager().callEvent(new GameTutorialEndEvent(tutorial));
|
||||
}
|
||||
}, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Only allowed while Custom Ending is enabled");
|
||||
}
|
||||
}
|
||||
|
||||
public void onTick(int tick){}
|
||||
|
||||
public void onStart(){}
|
||||
|
@ -18,6 +18,8 @@ public abstract class TutorialPhase
|
||||
private Location _target;
|
||||
private boolean _hasEnded;
|
||||
|
||||
private Thread _thread;
|
||||
|
||||
private long _started;
|
||||
|
||||
private TutorialText _currentText;
|
||||
@ -99,7 +101,7 @@ public abstract class TutorialPhase
|
||||
|
||||
public void displayText()
|
||||
{
|
||||
new Thread(new Runnable()
|
||||
_thread = new Thread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
@ -148,7 +150,8 @@ public abstract class TutorialPhase
|
||||
}
|
||||
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
_thread.start();
|
||||
}
|
||||
|
||||
private void displayMessage(final TutorialText text)
|
||||
@ -228,6 +231,11 @@ public abstract class TutorialPhase
|
||||
return _started;
|
||||
}
|
||||
|
||||
public Thread getThread()
|
||||
{
|
||||
return _thread;
|
||||
}
|
||||
|
||||
public void onStart(){}
|
||||
|
||||
public void onMessageDisplay(TutorialText text){}
|
||||
|
@ -161,6 +161,9 @@ public class GameManager implements Listener
|
||||
team.getTutorial().start();
|
||||
timeUsage = team.getTutorial().StartAfterTutorial;
|
||||
timeUsage = timeUsage + (team.getTutorial().TimeBetweenPhase * team.getTutorial().getPhases().length);
|
||||
if(team.getTutorial().CustomEnding)
|
||||
timeUsage = timeUsage + team.getTutorial().CustomEndingTime;
|
||||
|
||||
for(TutorialPhase phase : team.getTutorial().getPhases())
|
||||
{
|
||||
for(TutorialText text : phase.getText())
|
||||
@ -175,9 +178,9 @@ public class GameManager implements Listener
|
||||
if(checkForTimer)
|
||||
{
|
||||
if(team.getTutorial().ShowPrepareTimer)
|
||||
finished = false;
|
||||
else
|
||||
finished = true;
|
||||
else
|
||||
finished = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user