some more descriptions for Tutorials
This commit is contained in:
parent
09e5aed6e7
commit
a92361f2fe
@ -255,14 +255,6 @@ public abstract class GameTutorial
|
||||
System.out.println("Only allowed while Custom Ending is enabled");
|
||||
}
|
||||
}
|
||||
|
||||
public void onTick(int tick){}
|
||||
|
||||
public void onStart(){}
|
||||
|
||||
public void onPhaseChange(TutorialPhase phase){}
|
||||
|
||||
public void onEnd(){}
|
||||
|
||||
public int tick()
|
||||
{
|
||||
@ -300,4 +292,17 @@ public abstract class GameTutorial
|
||||
{
|
||||
return _currentPhase.getPhaseTime();
|
||||
}
|
||||
|
||||
/*
|
||||
* some overrideable methods that can be used to synchronize the tutorial events
|
||||
*/
|
||||
|
||||
public void onTick(int tick){}
|
||||
|
||||
public void onStart(){}
|
||||
|
||||
public void onPhaseChange(TutorialPhase phase){}
|
||||
|
||||
public void onEnd(){}
|
||||
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ public abstract class TutorialPhase
|
||||
_text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* start the Phase (never use this as well)
|
||||
*/
|
||||
final public void start(boolean phaseOne)
|
||||
{
|
||||
_hasEnded = false;
|
||||
@ -41,6 +44,9 @@ public abstract class TutorialPhase
|
||||
displayText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Teleporting Players and keeping them if SetTutorialPositions == true
|
||||
*/
|
||||
final public void teleport()
|
||||
{
|
||||
if(!getTutorial().SetTutorialPositions)
|
||||
@ -53,6 +59,9 @@ public abstract class TutorialPhase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* preparing Pitch/Yaw of the location
|
||||
*/
|
||||
private void prepareLocations()
|
||||
{
|
||||
Vector vector = new Vector(_target.getBlockX() - _location.getBlockX(), _target.getBlockY() - _location.getBlockY(), _target.getBlockZ() - _location.getBlockZ());
|
||||
@ -62,6 +71,9 @@ public abstract class TutorialPhase
|
||||
_location.setYaw(yaw);
|
||||
}
|
||||
|
||||
/**
|
||||
* teleporting players until Phase ends
|
||||
*/
|
||||
private void updatePlayers()
|
||||
{
|
||||
new Thread(new Runnable()
|
||||
@ -76,6 +88,7 @@ public abstract class TutorialPhase
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
// teleport Players Sync
|
||||
if(!_hasEnded && !getTutorial().hasEnded())
|
||||
{
|
||||
for(Player player : _tutorial.getPlayers().keySet())
|
||||
@ -89,6 +102,7 @@ public abstract class TutorialPhase
|
||||
});
|
||||
try
|
||||
{
|
||||
// sleep for 1 tick
|
||||
Thread.sleep(50);
|
||||
} catch (InterruptedException e)
|
||||
{
|
||||
@ -99,6 +113,10 @@ public abstract class TutorialPhase
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* displays all messages set in the constructor
|
||||
* will end Phase if no more messages are available or Tutorial has already ended
|
||||
*/
|
||||
public void displayText()
|
||||
{
|
||||
_thread = new Thread(new Runnable()
|
||||
@ -111,6 +129,7 @@ public abstract class TutorialPhase
|
||||
TutorialText text = getNextMessage();
|
||||
if(text == null)
|
||||
{
|
||||
// ending Phase
|
||||
_tutorial.Manager.runSyncLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
@ -125,6 +144,7 @@ public abstract class TutorialPhase
|
||||
}
|
||||
else
|
||||
{
|
||||
// displaying next message
|
||||
Player[] players = new Player[_tutorial.getPlayers().keySet().size()];
|
||||
int i = 0;
|
||||
for(Player player : _tutorial.getPlayers().keySet())
|
||||
@ -154,6 +174,9 @@ public abstract class TutorialPhase
|
||||
_thread.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* firing abstract method Sync/Async depending on the RunTasksSync Flag
|
||||
*/
|
||||
private void displayMessage(final TutorialText text)
|
||||
{
|
||||
if(_tutorial.RunTasksSync)
|
||||
@ -173,6 +196,9 @@ public abstract class TutorialPhase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getting next message
|
||||
*/
|
||||
protected TutorialText getNextMessage()
|
||||
{
|
||||
for(TutorialText text : _text)
|
||||
@ -236,6 +262,10 @@ public abstract class TutorialPhase
|
||||
return _thread;
|
||||
}
|
||||
|
||||
/*
|
||||
* some overrideable methods that can be used to synchronize the tutorial events
|
||||
*/
|
||||
|
||||
public void onStart(){}
|
||||
|
||||
public void onMessageDisplay(TutorialText text){}
|
||||
|
Loading…
Reference in New Issue
Block a user