peacestorm

screenChangeHook

Aug 7th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var ScreenType = {
  2.     start_screen: "start_screen",
  3.     hud: "hud_screen",
  4.     ingame: "in_game_play_screen",
  5.     survival_inv: "survival_inventory_screen",
  6.     creative_inv: "creative_inventory_screen",
  7.     pause_screen: "pause_screen",
  8.     options_screen: "options_screen"
  9. };
  10.  
  11. var currentScreen;
  12.  
  13. function screenChangeHook(screenName) {
  14.     ctx.runOnUiThread(new java.lang.Runnable({
  15.         run: function() {
  16.             currentScreen = screenName;
  17.             if(screenName == ScreenType.start_screen) {
  18.                 //show your button now
  19.             } else {
  20.                 if(yourButtonGUI != null) {
  21.                     if(yourButtonGUI.isShowing()) {
  22.                         //hide your button now
  23.                     }
  24.                 }
  25.             }
  26.         }
  27.     }));
  28. }
Advertisement
Add Comment
Please, Sign In to add comment