Advertisement
TechSkylander1518

Options in center screen

Dec 6th, 2021 (edited)
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.79 KB | None | 0 0
  1. module ImportantChoices
  2.   LIST =
  3.   [
  4.   [_INTL("Yes"),_INTL("No")],
  5.   [_INTL("Longer Option 1"),_INTL("Longer Option 2")],
  6.   [_INTL("No"),_INTL("Yes")]
  7.   ]
  8.  
  9. end
  10.  
  11.  
  12. def pbShowCommands(msgwindow,commands=nil,cmdIfCancel=0,defaultCmd=0)
  13.   return 0 if !commands
  14.   cmdwindow=Window_CommandPokemonEx.new(commands)
  15.   cmdwindow.z=99999
  16.   cmdwindow.visible=true
  17.   if ImportantChoices::LIST.include?(commands)
  18.     cmdwindow.width = Graphics.width/2
  19.     cmdwindow.x = (Graphics.width/2) - cmdwindow.width/2
  20.     cmdwindow.y = (Graphics.height/2) - cmdwindow.height/2
  21.  else
  22.     cmdwindow.resizeToFit(cmdwindow.commands)
  23.     pbPositionNearMsgWindow(cmdwindow,msgwindow,:right)
  24.   end
  25.   cmdwindow.index=defaultCmd
  26.   command=0
  27.   loop do
  28.     Graphics.update
  29.     Input.update
  30.     cmdwindow.update
  31.     msgwindow.update if msgwindow
  32.     yield if block_given?
  33.     if Input.trigger?(Input::BACK)
  34.       if cmdIfCancel>0
  35.         command=cmdIfCancel-1
  36.         break
  37.       elsif cmdIfCancel<0
  38.         command=cmdIfCancel
  39.         break
  40.       end
  41.     end
  42.     if Input.trigger?(Input::USE)
  43.       command=cmdwindow.index
  44.       break
  45.     end
  46.     pbUpdateSceneMap
  47.   end
  48.   ret=command
  49.   cmdwindow.dispose
  50.   Input.update
  51.   return ret
  52. end
  53.  
  54. class Window_CommandPokemon < Window_DrawableCommand
  55.  
  56.   def drawItem(index,_count,rect)
  57.     pbSetSystemFont(self.contents) if @starting
  58.     rect=drawCursor(index,rect)
  59.     pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,
  60.        @commands[index],self.baseColor,self.shadowColor,align=1)
  61.   end
  62. end
  63.  
  64. def pbChangeChoiceFrame(filename)
  65.     MessageConfig.pbSetSystemFrame("Graphics/Windowskins/" + filename)
  66. end
  67.  
  68. def pbRestoreChoiceFrame
  69.     MessageConfig.pbSetSystemFrame("Graphics/Windowskins/" + Settings::MENU_WINDOWSKINS[$PokemonSystem.frame])
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement