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