api: getRSGameState and setRSGameState functions (#2816)

* api: getRSGameState and setRSGameState functions

* api: blue wanted this
This commit is contained in:
Thomas Cylke
2020-10-20 04:48:33 -04:00
committed by GitHub
parent 96a428d0b0
commit b0fddd32d1
3 changed files with 20 additions and 1 deletions

View File

@@ -135,6 +135,13 @@ public interface Client extends GameShell
*/ */
GameState getGameState(); GameState getGameState();
/**
* Gets the current game state as an int
*
* @return the game state
*/
int getRSGameState();
/** /**
* Sets the current game state * Sets the current game state
* *
@@ -142,6 +149,15 @@ public interface Client extends GameShell
*/ */
void setGameState(GameState gameState); void setGameState(GameState gameState);
/**
* Sets the current game state
* This takes an int instead of a {@link GameState} so it can
* can handle states that aren't in the enum yet
*
* @param gameState
*/
void setGameState(int gameState);
/** /**
* Causes the client to shutdown. It is faster than * Causes the client to shutdown. It is faster than
* {@link java.applet.Applet#stop()} because it doesn't wait for 4000ms. * {@link java.applet.Applet#stop()} because it doesn't wait for 4000ms.
@@ -2053,7 +2069,7 @@ public interface Client extends GameShell
* Sets the status of client mirror * Sets the status of client mirror
*/ */
void setMirrored(boolean isMirrored); void setMirrored(boolean isMirrored);
/** /**
* Sets the image to be used for the login screen, provided as SpritePixels * Sets the image to be used for the login screen, provided as SpritePixels
* If the image is larger than half the width of fixed mode, * If the image is larger than half the width of fixed mode,
@@ -2073,6 +2089,7 @@ public interface Client extends GameShell
/** /**
* Test if a key is pressed * Test if a key is pressed
*
* @param keycode the keycode * @param keycode the keycode
* @return * @return
* @see KeyCode * @see KeyCode

View File

@@ -525,6 +525,7 @@ public abstract class RSClientMixin implements RSClient
} }
@Inject @Inject
@Override
public void setGameState(int state) public void setGameState(int state)
{ {
assert this.isClientThread() : "setGameState must be called on client thread"; assert this.isClientThread() : "setGameState must be called on client thread";

View File

@@ -138,6 +138,7 @@ public interface RSClient extends RSGameShell, Client
void setChangedSkillsCount(int i); void setChangedSkillsCount(int i);
@Import("gameState") @Import("gameState")
@Override
int getRSGameState(); int getRSGameState();
@Import("updateGameState") @Import("updateGameState")