设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 597|回复: 0
打印 上一主题 下一主题

[有事请教] 关于菜单界面显示角色HP/MP数值排版的问题

[复制链接]

Lv2.观梦者

梦石
0
星屑
648
在线时间
102 小时
注册时间
2022-8-14
帖子
1
跳转到指定楼层
1
发表于 2026-1-7 14:03:14 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
图一使用了Yanfly的菜单脚本,包括技能、状态等界面在内,角色的HP/MP是以值槽右侧对其来显示的,也不存在如图二所示因为数字位数过长导致字体被严重压缩的情况

图三则是使用了如下所示的 Galv's Menu Themes Engine 菜单主题脚本,当前值/最大值的位置如默认排版一样位于固定位置,因数字位数过长被压缩。

特来请教一下如何在Galv的菜单脚本下实现这种右对齐的排版样式?

另附galv的脚本:

RUBY 代码复制
  1. #------------------------------------------------------------------------------#
  2. #  Galv's Menu Themes Engine
  3. #------------------------------------------------------------------------------#
  4. #  For: RPGMAKER VX ACE
  5. #  Version 1.6
  6. #------------------------------------------------------------------------------#
  7. #  NOTICE: This script is NOT free for commercial use.
  8. #  Contact Galv via PM at one of the following forums:
  9. #  [url]http://www.rpgmakervxace.net/[/url]
  10. #  [url]http://forums.rpgmakerweb.com/[/url]
  11. #------------------------------------------------------------------------------#
  12.  
  13. #------------------------------------------------------------------------------#
  14. #  2013-06-27 - Version 1.6 - compatibility fix for xp rate
  15. #  2013-06-11 - Version 1.5 - bug fixed with help menu text on incorrect menu
  16. #  2013-06-09 - Version 1.4 - bug missed with last fix... now fixed. I hope.
  17. #  2013-06-08 - Version 1.3 - fixed bug with hidden menu items
  18. #                           - made disabled buttons text transparent
  19. #  2013-04-16 - Version 1.2 - fixed a graphic object bug. Also included
  20. #                           - Killozappit's Cache Back script in the demo to
  21. #                           - help with lag on slower computers.
  22. #  2013-04-15 - Version 1.1 - fixed a bug with using items/skills on actors
  23. #  2013-04-15 - Version 1.0 - release
  24. #------------------------------------------------------------------------------#
  25. #  This script replaces the default menu and thus will not be compatible with
  26. #  other scripts that do the same. The new changes to the menu offer a few
  27. #  things such as:
  28. #  - Image controlled menu scenes (including moving backgrounds)
  29. #  - 'Themes' allow you to customize the look of the menu and change it in game
  30. #  - Other scenes can change with theme (eg. item, equip, custom scenes, etc.)
  31. #  - Customisable menu commands (icons, visibility switches, order, vocab)
  32. #  - Animated (sliding) commands
  33. #  - Help window for selected command
  34. #  - Information bar with gold, current location and play time
  35. #  - Modified actor status to include exp and tp (for actors with preserve tp)
  36. #------------------------------------------------------------------------------#
  37.  
  38. #-------------------------------------------------------------------------------
  39. #  SCRIPT CALL
  40. #-------------------------------------------------------------------------------
  41. #
  42. #  theme("Theme_Name")      # Changes your menu theme to use the specified one.
  43. #
  44. #-------------------------------------------------------------------------------
  45.  
  46. ($imported ||= {})["Galv_Menu_Themes"] = true
  47. module GMENU
  48.     COMMAND_LIST = [ # don't touch
  49.  
  50. #-------------------------------------------------------------------------------
  51. #
  52. #  *  MENU - COMMAND SETUP
  53. #
  54. #-------------------------------------------------------------------------------
  55. #  Below list is your in-game menu commands. This replaces the database vocab
  56. #  names and adds more control over customizing your game menu.
  57. #-------------------------------------------------------------------------------
  58.  
  59. # ["Menu Text", :command_type, :Scene, switch1, switch2, help txt, icon]
  60.   ["Items",     :cmd, :Scene_Item,   0, 0, "View or use items from your inventory.",270],
  61.   ["Skills",    :sel, :Scene_Skill,  0, 0, "View or use character skills.",112],
  62.   ["Equip",     :sel, :Scene_Equip,  0, 0, "Equip your characters with weapons and armor.",170],
  63.   ["Status",    :sel, :Scene_Status, 0, 0, "View status of your characters.",117],
  64.   ["Formation", :sel, :Formation,    0, 0, "Change your character order",121],
  65.   ["Save",      :cmd, :Scene_Save,   0, 0, "Record your game progress.",224],
  66.   ["Game End",  :cmd, :Scene_End,    0, 0, "End or restart the game.",6],
  67.  
  68.   ["Example1",:cmd, 1, 0, 0, "Example command - calls common event 1",278],
  69.   ["Example2",:cmd, 1, 0, 0, "Example command - calls common event 1",278],
  70.  
  71.  
  72.  
  73.   # Here are examples of adding functionality via script. The script code for
  74.   # these examples is in the "Example Script Commands" script in the list.
  75.   #["Gold!",  :cmd, :custom1, 0, 0, "Scripted custom symbol example",280],
  76.   #["Levelup!",  :sel, :custom2, 0, 0, "Scripted custom symbol on actor select example",290],
  77.  
  78. #-------------------------------------------------------------------------------
  79.     ] # don't touch
  80. #-------------------------------------------------------------------------------
  81. #  INSTRUCTIONS
  82. #-------------------------------------------------------------------------------
  83. #  "Menu Text"........ the text used for the menu item
  84. #  :command_type...... :cmd - goes to the scene when menu item accessed.
  85. #                      :sel - select actor before going to the scene.
  86. #  scene.............. name of the scene as a symbol. eg. :Scene_Item  (*)
  87. #                      make this a number instead to call a common event.
  88. #  switch1............ if switch is OFF, item is disabled. 0 to not use
  89. #  switch2............ if switch is OFF, item will not appear. 0 to not use
  90. #  help txt........... text that appears at the top of the menu screen
  91. #  icon............... the icon id to use an icon next to your menu command
  92. #-------------------------------------------------------------------------------
  93. #  (*) Scripters can use a custom symbol here to do other functions by aliasing
  94. #  or overwriting methods found on
  95. #-------------------------------------------------------------------------------
  96.  
  97.  
  98. #-------------------------------------------------------------------------------
  99. #
  100. #  *  MENU SETTINGS
  101. #
  102. #-------------------------------------------------------------------------------
  103.  
  104.  
  105.     SHOW_TP = true    # Show TP if actor has 'preserve tp' feature true or false
  106.  
  107.     ACTORS_SHOWN = 4  # Number of actors visible in the menu before scrolling
  108.  
  109.     DEFAULT_THEME = "Theme_Default"  # The theme your game will use to begin.
  110.  
  111.  
  112. #-------------------------------------------------------------------------------
  113. #  THEME SETUP - DEFAULT THEME
  114. #-------------------------------------------------------------------------------
  115.     module Theme_Default
  116.  
  117.       # Gerenal Options
  118.       FONT = "Arial"             # Font used throughout theme.
  119.       FONT_SIZE = 21             # Font size used throughout theme.
  120.       WINDOW_TONE = [22,52,72,0] # Color tone of scenes that use windowskins
  121.  
  122.       # Background
  123.       BACK1_XY = [1,1]           # X,Y movement for background1 (default stars)
  124.       BACK1_OPACITY = 190        # Background opacity
  125.  
  126.       BACK2_XY = [0,0]           # X,Y movement for background2 (default top bar)
  127.       BACK2_OPACITY = 255        # Background opacity
  128.  
  129.       BACK3_XY = [0,0]       # X,Y movement for background2 (default bottom bar)
  130.       BACK3_OPACITY = 255    # Background opacity
  131.  
  132.       SCENE_BACK_OPACITY = 255  # Background opacity for other scene background
  133.  
  134.       # Command Menu
  135.       MENU_FONT = "Arial"        # Different font used for the menu text
  136.       MENU_FONT_SIZE = 21        # Size of menu text
  137.       MENU_TXT_COLOR = Color.new(255, 255, 255, 255)   # Color of menu text
  138.       MENU_TXT_OUT = Color.new(27, 57, 97, 255)     # Color of menu text outline
  139.       MENU_TXT_XY = [0,-2]      # X,Y offset for text in command menu
  140.       MENU_ICON_XY = [35,1]     # X,Y offset for icons in command menu
  141.       SLIDE_ICON = true         # true or false to slide icon with menu text
  142.       SLIDE_SPEED = 5           # Speed the menu buttons slide in and out
  143.       SLIDE_OFF = -30           # X Position of button when cursor not on it
  144.       SLIDE_ON = 0            # X Position of button when cursor is on it
  145.       MENU_Y_OFFSET = 45        # Distance Y from top of screen
  146.       MENU_WIDTH = 170          # Width reserved for the main menu.
  147.  
  148.       # Help Window
  149.       HELP_XY = [44,2]          # X,Y offset for help text
  150.       HELP_TEXT_COLOR = Color.new(200, 235, 255, 255) # Color of help text
  151.  
  152.       # Game Info Window
  153.       INFO_XY = [0,0]          # X,Y offset for info text
  154.       GAME_INFO_TXT_COLOR = Color.new(200, 235, 255, 255) # Game Info text color
  155.       CURRENCY_ICON = 262       # Icon used instead of currency vocab. 0 = vocab
  156.  
  157.       # Actor Status
  158.       STAT_COLOR = Color.new(167, 223, 248, 255) # Color used for lvl,hp,mp
  159.       GAUGEB_COLOR = Color.new(20, 20, 20, 255) # Color of gauge backs
  160.       HP_COLOR1 = Color.new(74, 197, 61, 255) # Color for hp gauge gradient
  161.       HP_COLOR2 = Color.new(169, 206, 89, 255)# Color for hp gauge gradient
  162.       MP_COLOR1 = Color.new(5, 132, 179, 255) # Color for mp gauge gradient
  163.       MP_COLOR2 = Color.new(40, 197, 255, 255)# Color for mp gauge gradient
  164.       XP_COLOR1 = Color.new(88, 147, 174, 255) # Color for xp gauge gradient
  165.       XP_COLOR2 = Color.new(133, 181, 203, 255)# Color for xp gauge gradient
  166.       TP_COLOR1 = Color.new(255, 166, 12, 255) # Color for tp gauge gradient
  167.       TP_COLOR2 = Color.new(255, 126, 12, 255)# Color for tp gauge gradient
  168.       GAUGE_FONT = "VL Gothic Regular"  # Font used for hp/mp and amounts.
  169.     end
  170.  
  171. #-------------------------------------------------------------------------------
  172. #  CUSTOM THEMES
  173. #-------------------------------------------------------------------------------
  174. #  You can make your own custom menu themes and swap between them during the
  175. #  game or make them available for others to use. Each theme has it's own folder
  176. #  in your project located in /Graphics/GMenu/Theme_Name/
  177. #  For example the default theme is:
  178. #  /Graphics/GMenu/Theme_Default/
  179. #
  180. #  HOW TO MAKE A THEME:
  181. #  1. Make a duplicate of the /Theme_Default/ folder and rename it.
  182. #  2. Modify the graphics how you see fit, using the default as templates
  183. #  3. (Optional) You can use the theme_settings.txt file found in the template
  184. #     folder to create new settings for the theme. Copy the script from the
  185. #     file and paste it a new script position below this menu script. Change
  186. #     "Theme_Default" at the top to the name of your theme's folder.
  187. #  4. If you did that right, now in your game, you can use the script call:
  188. #     theme("Theme_Name")
  189. #     To change your menu theme during the game to any theme you have installed.
  190. #
  191. #  If you do not create your own settings script (step 3) for your custom theme,
  192. #  it will use the settings from Theme_Default.
  193. #-------------------------------------------------------------------------------
  194.  
  195. #-------------------------------------------------------------------------------
  196. #  THEME SETUP - INNER SCENES
  197. #-------------------------------------------------------------------------------
  198. #  Inner scenes (such as item, equip, skills etc) can use the same Background
  199. #  (using BACK1 setting) as well as windowskin used in the current theme.
  200. #  List scenes below that you wish for this to occur.
  201. #-------------------------------------------------------------------------------
  202.     SCENE_THEMES = [ # don't touch
  203. #-------------------------------------------------------------------------------
  204.  
  205.       "Scene_Item",
  206.       "Scene_Skill",
  207.       "Scene_Equip",
  208.       "Scene_Status",
  209.       "Scene_Save",
  210.       "Scene_End",
  211.       "Scene_Party",
  212.       "Scene_System",
  213.       "Scene_Load",
  214.  
  215.       #"Scene_File",
  216.       #"Scene_Load",
  217.       #"Scene_Shop",
  218.       #"Scene_Name",
  219.       #"Scene_Gameover",
  220.       #"Scene_Title",
  221.  
  222. #-------------------------------------------------------------------------------
  223.       ] # don't touch
  224. #-------------------------------------------------------------------------------
  225. #  In addition to this, the script will check the theme folder for any images.
  226. #  with the scene name (above) followed by "_Background" and "_Background2".
  227. #  For example if the following file is found in the theme folder:
  228. #  Scene_Item_Background.png (or jpg)
  229. #  It will use that image INSTEAD of Background.jpg for Background1. It will
  230. #  also look for Scene_Item_Background2.png (or jpg) which will appear above
  231. #  the first background. This background is static and does not move.
  232. #-------------------------------------------------------------------------------
  233.  
  234. #-------------------------------------------------------------------------------
  235. #
  236. #  * END SETTINGS
  237. #
  238. #-------------------------------------------------------------------------------
  239.  
  240. end # GMENU
  241.  
  242.  
  243. module Check_Theme
  244.   def mtheme
  245.     Object.const_get("GMENU").const_get($game_system.menu_theme) rescue
  246.       GMENU::Theme_Default
  247.   end
  248. end # Check_Theme
  249.  
  250.  
  251.     #----------------------#
  252. #---|   GAME_INTERPERTER   |----------------------------------------------------
  253.     #----------------------#
  254.  
  255. class Game_Interpreter
  256.   def theme(name)
  257.     $game_system.menu_theme = name
  258.   end
  259. end # Game_Interpreter
  260.  
  261.  
  262.     #-----------#
  263. #---|   CACHE   |---------------------------------------------------------------
  264.     #-----------#
  265.  
  266. module Cache
  267.   def self.gmenu(filename,theme)
  268.     load_bitmap("Graphics/GMenu/" + theme + "/", filename)
  269.   end
  270. end # Cache
  271.  
  272.  
  273.     #-----------------#
  274. #---|   GAME_SYSTEM   |---------------------------------------------------------
  275.     #-----------------#
  276.  
  277. class Game_System
  278.   attr_accessor :menu_theme
  279.  
  280.   alias gmenu_engine_gs_initialize initialize
  281.   def initialize
  282.     @menu_theme = GMENU::DEFAULT_THEME
  283.     gmenu_engine_gs_initialize
  284.   end
  285. end # Game_System
  286.  
  287.  
  288.     #---------------#
  289. #---|   GAME_TEMP   |-----------------------------------------------------------
  290.     #---------------#
  291.  
  292. class Game_Temp
  293.   attr_accessor :themed_scene
  294.   attr_accessor :menuindexes
  295.  
  296.   alias gmenu_engine_gt_initialize initialize
  297.   def initialize
  298.     @themed_scene = false
  299.     gmenu_engine_gt_initialize
  300.   end
  301. end # Game_Temp
  302.  
  303.  
  304.     #----------------#
  305. #---|   GAME_ACTOR   |----------------------------------------------------------
  306.     #----------------#
  307.  
  308. class Game_Actor < Game_Battler
  309.   def xp_rate
  310.     a = (exp.to_f - current_level_exp.to_f)
  311.     b = (next_level_exp.to_f - current_level_exp.to_f)
  312.     if exp > 0 && b > 0
  313.       return a / b
  314.     else
  315.       return 0
  316.     end
  317.   end
  318. end # Game_Actor < Game_Battler
  319.  
  320.  
  321.     #----------------#
  322. #---|   SCENE_MENU   |----------------------------------------------------------
  323.     #----------------#
  324.  
  325. class Scene_Menu < Scene_MenuBase
  326.   attr_accessor :command_window
  327.   include Check_Theme
  328.  
  329.   # OVERWRITE
  330.   def start
  331.     super
  332.     create_graphics
  333.     create_help_window
  334.     create_new_command_window
  335.     create_gameinfo_window
  336.     create_status_window
  337.   end
  338.  
  339. #---|   CREATE WINDOWS   |
  340.  
  341.   def create_help_window
  342.     @help_window = Window_MenuHelp.new
  343.   end
  344.  
  345.   # OVERWRITE
  346.   def create_status_window
  347.     @status_window = Window_MainMenuStatus.new(@command_window.width,
  348.       @help_window.height,Graphics.height - @help_window.height -
  349.       @gameinfo_window.height)
  350.   end
  351.  
  352.   # OVERWRITE
  353.   def create_new_command_window
  354.     @command_window = Window_MenuCommand.new(0,@help_window.height)
  355.     @command_window.help_window = @help_window
  356.     menu_array = Array.new(GMENU::COMMAND_LIST)
  357.     menu_array.each { |cmd|
  358.       handle = cmd[0].delete(' ').downcase.to_sym
  359.       @command_window.set_handler(handle, method(cmd[1]))
  360.     }
  361.     @command_window.set_handler(:cancel, method(:return_scene))
  362.   end
  363.  
  364.   def create_gameinfo_window
  365.     @gameinfo_window = Window_GameInfo.new
  366.     @gameinfo_window.x = 0
  367.     @gameinfo_window.y = Graphics.height - @gameinfo_window.height
  368.   end
  369.  
  370. #---|   CREATE GRAPHICS   |
  371.  
  372.   def create_graphics
  373.     create_background2
  374.     create_background3
  375.   end
  376.  
  377.   def create_background2
  378.     @background2 = Plane.new
  379.     @background2.bitmap = Cache.gmenu("Background2",$game_system.menu_theme)
  380.     @background2.opacity = mtheme::BACK2_OPACITY
  381.   end
  382.  
  383.   def create_background3
  384.     @background3 = Plane.new
  385.     @background3.bitmap = Cache.gmenu("Background3",$game_system.menu_theme)
  386.     @background3.opacity = mtheme::BACK3_OPACITY
  387.     @background3.oy = -Graphics.height
  388.   end
  389.  
  390. #---|   UPDATING   |
  391.  
  392.   def update
  393.     super
  394.     update_background2
  395.     update_background3
  396.     update_gameinfo
  397.   end
  398.  
  399.   def update_background2
  400.     @background2.ox -= mtheme::BACK2_XY[0]
  401.     @background2.oy -= mtheme::BACK2_XY[1]
  402.   end
  403.   def update_background3
  404.     @background3.ox -= mtheme::BACK3_XY[0]
  405.     @background3.oy -= mtheme::BACK3_XY[1]
  406.   end
  407.   def update_gameinfo
  408.     @gameinfo_window.refresh
  409.   end
  410.  
  411. #---|   FUNCTIONALITY   |
  412.  
  413.   alias gmenu_engine_sm_dispose_background dispose_background
  414.   def dispose_background
  415.     gmenu_engine_sm_dispose_background
  416.     if @background2
  417.       @background2.bitmap.dispose
  418.       @background2.dispose
  419.     end
  420.     if @background3
  421.       @background3.bitmap.dispose
  422.       @background3.dispose
  423.     end
  424.   end
  425.  
  426.   def cmd
  427.     cmd = $game_temp.menuindexes[@command_window.index]
  428.     symbol = GMENU::COMMAND_LIST[cmd][2]
  429.     if GMENU::COMMAND_LIST[cmd][2].is_a?(Integer)
  430.       common_event_command(GMENU::COMMAND_LIST[cmd][2])
  431.     elsif custom_symbol(symbol)
  432.       custom_on_command_ok(symbol)
  433.     else
  434.       SceneManager.call(GMENU::COMMAND_LIST[cmd][2])
  435.     end
  436.   end
  437.  
  438.   def common_event_command(id)
  439.     $game_temp.reserve_common_event(id)
  440.     SceneManager.return
  441.   end
  442.  
  443.   def sel
  444.     command_personal
  445.   end
  446.  
  447.   # OVERWRITE
  448.   def command_personal
  449.     @status_window.select_last
  450.     @status_window.activate
  451.     @status_window.set_handler(:ok,     method(:on_personal_ok))
  452.     @status_window.set_handler(:cancel, method(:on_personal_cancel))
  453.   end
  454.  
  455.   # OVERWRITE
  456.   def on_personal_ok
  457.     cmd = $game_temp.menuindexes[@command_window.index]
  458.     symbol = GMENU::COMMAND_LIST[cmd][2]
  459.     if symbol == :Formation
  460.       on_formation_ok
  461.     elsif custom_symbol(symbol)
  462.       custom_on_personal_ok(symbol)
  463.     else
  464.       SceneManager.call(symbol)
  465.     end
  466.   end
  467.  
  468.   def custom_symbol(symbol)
  469.     # Alias/overwrite this method for custom symbols.
  470.     # Make this method return true if symbol equals your custom symbol.
  471.   end
  472.  
  473.   def custom_on_command_ok(symbol)
  474.     # Alias/overwrite this method for custom symbols. (For 'ok' on command)
  475.     # Add your functionality here including if symbol equals your custom symbol.
  476.   end
  477.  
  478.   def custom_on_personal_ok(symbol)
  479.     # Alias/overwrite this method for custom symbols. (For 'ok' on actor)
  480.     # Add your functionality here including if symbol equals your custom symbol.
  481.   end
  482.  
  483.   def custom_on_personal_cancel(symbol)
  484.     # Alias/overwrite this method for custom symbols. (Cancelling on actor)
  485.     # Add your cancel code here including if symbol equals your custom symbol.
  486.   end
  487.  
  488.   # OVERWRITE
  489.   def on_personal_cancel
  490.     cmd = @command_window.index
  491.     symbol = GMENU::COMMAND_LIST[cmd][2]
  492.     if symbol == :Formation
  493.       on_formation_cancel
  494.     elsif custom_symbol(symbol)
  495.       custom_on_personal_cancel(symbol)
  496.     else
  497.       @status_window.unselect
  498.       @command_window.activate
  499.     end
  500.   end
  501. end # Scene_Menu < Scene_MenuBase
  502.  
  503.  
  504.     #------------------------#
  505. #---|   WINDOW_MENUCOMMAND   |--------------------------------------------------
  506.     #------------------------#
  507.  
  508. class Window_MenuCommand < Window_Command
  509.  
  510.   #OVERWRITE
  511.   def initialize(x,y)
  512.     @menu_buttons = []
  513.     super(x, y)
  514.     select_last
  515.     self.opacity = 0
  516.   end
  517.  
  518.   def draw_item(index)
  519.     @menu_buttons << MenuBtn.new(@viewport,index)
  520.   end
  521.  
  522.   def visible_line_number
  523.     item_max
  524.   end
  525.  
  526.   def window_width
  527.     return mtheme::MENU_WIDTH
  528.   end
  529.  
  530.   def update
  531.     super
  532.     @menu_buttons.each { |btn| btn.update(index) }
  533.   end
  534.  
  535.   def dispose
  536.     @menu_buttons.each { |btn| btn.dispose }
  537.     super
  538.   end
  539.  
  540.   def update_cursor
  541.     if @cursor_all
  542.       cursor_rect.empty
  543.       self.top_row = 0
  544.     elsif @index < 0
  545.       cursor_rect.empty
  546.     else
  547.       ensure_cursor_visible
  548.       cursor_rect.empty
  549.     end
  550.   end
  551.  
  552.   def add_new_main_commands
  553.     $game_temp.menuindexes = []
  554.     menu_array = Array.new(GMENU::COMMAND_LIST)
  555.     menu_array.each_with_index { |cmd,i|
  556.       next if cmd[4] > 0 && !$game_switches[cmd[4]]
  557.       $game_temp.menuindexes << i
  558.       text = cmd[0]
  559.       active = get_active(cmd[2],cmd[3])
  560.       handle = cmd[0].delete(' ').downcase.to_sym
  561.       add_command(text, handle, active)
  562.     }
  563.   end
  564.  
  565.   def get_active(symbol,switch)
  566.     return false if switch > 0 && !$game_switches[switch]
  567.     case symbol
  568.     when :Formation
  569.       formation_enabled
  570.     when :Scene_Save
  571.       save_enabled
  572.     else
  573.       main_commands_enabled
  574.     end
  575.   end
  576.  
  577.   def make_command_list
  578.     add_new_main_commands
  579.   end
  580.  
  581. end # Window_MenuCommand < Window_Command
  582.  
  583.  
  584.     #----------------------#
  585. #---|   WINDOW_MENUSTATUS  |----------------------------------------------------
  586.     #----------------------#
  587.  
  588. class Window_MainMenuStatus < Window_MenuStatus
  589.   include Check_Theme
  590.  
  591.   def initialize(x, y, h = 0)
  592.     @height = h
  593.     super(x, y)
  594.     self.opacity = 0
  595.   end
  596.  
  597.   def window_width
  598.     Graphics.width - mtheme::MENU_WIDTH
  599.   end
  600.  
  601.   def standard_padding
  602.     return 6
  603.   end
  604.  
  605.   def window_height
  606.     @height
  607.   end
  608.  
  609.   def item_height
  610.     (@height - 12) / GMENU::ACTORS_SHOWN
  611.   end
  612.  
  613.   def draw_item(index)
  614.     actor = $game_party.members[index]
  615.     enabled = $game_party.battle_members.include?(actor)
  616.     rect = item_rect(index)
  617.     draw_item_background(index)
  618.     draw_back_graphics(index,item_height,item_width,enabled)
  619.     draw_gface(actor.face_name,actor.face_index,rect.x + 1,rect.y + 1,
  620.       item_height - 2,enabled)
  621.     draw_gsimple_status(actor, rect.x + 108, rect.y, item_height)
  622.   end
  623. end
  624.  
  625.  
  626.     #--------------------#
  627. #---|   WINDOW_MENUHELP  |------------------------------------------------------
  628.     #--------------------#
  629.  
  630. class Window_MenuHelp < Window_Help
  631.   include Check_Theme
  632.  
  633.   def initialize
  634.     super(1)
  635.     self.opacity = 0
  636.   end
  637.  
  638.   def standard_padding
  639.     return 6
  640.   end
  641.  
  642.   def clear
  643.     ind = $game_temp.menuindexes[SceneManager.scene.command_window.index]
  644.     set_text(GMENU::COMMAND_LIST[ind][5])
  645.   end
  646.  
  647.   def refresh
  648.     contents.clear
  649.     draw_text_ex(mtheme::HELP_XY[0], mtheme::HELP_XY[1], @text)
  650.   end
  651.  
  652.   def draw_text_ex(x, y, text)
  653.     reset_font_settings
  654.     change_color(mtheme::HELP_TEXT_COLOR)
  655.     self.contents.font.name = mtheme::FONT
  656.     self.contents.font.size = mtheme::FONT_SIZE
  657.     text = convert_escape_characters(text)
  658.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  659.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  660.   end
  661. end
  662.  
  663.  
  664.     #---------------------#
  665. #---|   WINDOW_GAMEINFO   |-----------------------------------------------------
  666.     #---------------------#
  667.  
  668. class Window_GameInfo < Window_Base
  669.   include Check_Theme
  670.  
  671.   def initialize
  672.     super(0, 0, Graphics.width, fitting_height(1))
  673.     self.opacity = 0
  674.     refresh
  675.   end
  676.  
  677.   def standard_padding
  678.     return 6
  679.   end
  680.  
  681.   def refresh
  682.     contents.clear
  683.     self.contents.font.name = mtheme::FONT
  684.     self.contents.font.size = mtheme::FONT_SIZE
  685.     draw_gld
  686.     draw_location
  687.     draw_playtime
  688.   end
  689.  
  690.   def draw_gld
  691.     value = $game_party.gold
  692.     if mtheme::CURRENCY_ICON > 0
  693.       i = draw_icon(mtheme::CURRENCY_ICON, contents.width / 4 - 43, -1, true)
  694.       draw_currency_value(value,i,tx+4,ty,contents.width / 4 - 45)
  695.     else
  696.       draw_currency_value(value,Vocab::currency_unit,tx+4,ty,contents.width / 4 - 18)
  697.     end
  698.   end
  699.  
  700.   def tx
  701.     mtheme::INFO_XY[0]
  702.   end
  703.   def ty
  704.     mtheme::INFO_XY[1]
  705.   end
  706.  
  707.   def draw_location
  708.     change_color(mtheme::GAME_INFO_TXT_COLOR)
  709.     draw_text(tx,ty,Graphics.width,line_height,$game_map.display_name,1)
  710.   end
  711.  
  712.   def draw_playtime
  713.     draw_text(tx,ty,Graphics.width - 20,line_height,time_text,2)
  714.   end
  715.  
  716.   def time_text
  717.     sprintf("%02d:%02d:%02d", (Graphics.frame_count / 60**2) / 60,
  718.       Graphics.frame_count / 60**2 % 60,
  719.       Graphics.frame_count / 60 % 60)
  720.   end
  721.  
  722.   def draw_currency_value(value, unit, x, y, width)
  723.     cx = text_size(unit).width
  724.     change_color(mtheme::GAME_INFO_TXT_COLOR)
  725.     draw_text(x, y, width - cx - 2, line_height, value, 2)
  726.     change_color(system_color)
  727.     draw_text(x, y, width, line_height, unit, 2)
  728.   end
  729.  
  730.   def open
  731.     refresh
  732.     super
  733.   end
  734. end
  735.  
  736.  
  737.     #-----------------#
  738. #---|   WINDOW_BASE   |---------------------------------------------------------
  739.     #-----------------#
  740.  
  741. class Window_Base < Window
  742.   include Check_Theme
  743.  
  744.   alias galv_gmenu_engine_wb_initialize initialize
  745.   def initialize(x, y, width, height)
  746.     galv_gmenu_engine_wb_initialize(x, y, width, height)
  747.     if $game_temp.themed_scene
  748.       self.windowskin = Cache.gmenu("Windowskin",$game_system.menu_theme) rescue
  749.         Cache.system("Window")
  750.         set_theme_tone
  751.     end
  752.   end
  753.  
  754.   alias galv_gmenu_engine_wb_system_color system_color
  755.   def system_color
  756.     if $game_temp.themed_scene
  757.       mtheme::STAT_COLOR
  758.     else
  759.       galv_gmenu_engine_wb_system_color
  760.     end
  761.   end
  762.  
  763.   alias galv_gmenu_engine_wb_gauge_back_color gauge_back_color
  764.   def gauge_back_color
  765.     if $game_temp.themed_scene
  766.       mtheme::GAUGEB_COLOR
  767.     else
  768.       galv_gmenu_engine_wb_gauge_back_color
  769.     end
  770.   end
  771.  
  772.   def set_theme_tone
  773.     a,b,c,d = mtheme::WINDOW_TONE
  774.     self.tone.set(a,b,c,d)
  775.   end
  776.  
  777.   alias galv_gmenu_engine_wb_update_tone update_tone
  778.   def update_tone
  779.     if $game_temp.themed_scene
  780.       set_theme_tone
  781.     else
  782.       galv_gmenu_engine_wb_update_tone
  783.     end
  784.   end
  785.  
  786.   def draw_back_graphics(ind,height,width,enabled = true)
  787.     if enabled
  788.       bitmap = Cache.gmenu("ActorBackground",$game_system.menu_theme)
  789.     else
  790.       bitmap = Cache.gmenu("ActorBackgroundDisabled",$game_system.menu_theme)
  791.     end
  792.     rect = Rect.new(1,0,width - 2,bitmap.height + 2)
  793.     y = (rect.y + height) * ind - (bitmap.height - height) - 2
  794.     contents.blt(rect.x, y, bitmap, rect, 255)
  795.     bitmap.dispose
  796.   end
  797.  
  798.   def draw_gsimple_status(actor, x, y, height)
  799.     contents.font.name = mtheme::FONT
  800.     contents.font.size = mtheme::FONT_SIZE
  801.     draw_actor_name(actor, x, y + height - 30)
  802.     draw_glevel(actor, x, y + height - 30 - line_height * 1)
  803.     draw_gicons(actor, x - 108, y + line_height * 2 + 3)
  804.     draw_gclass(actor, x, y + height - 30)
  805.     contents.font.size = 20
  806.     contents.font.name = mtheme::GAUGE_FONT
  807.     w = contents.width - 260
  808.     h = (height - 80) / 2
  809.     draw_ghp(actor, x + 140, y + h / 2 , w)
  810.     draw_gmp(actor, x + 140, y + line_height - 4 + h,w)
  811.     if actor.preserve_tp? && GMENU::SHOW_TP
  812.       draw_gtp(actor, x + 75, y + line_height - 4 + h,40)
  813.     end
  814.     draw_gxp(actor, x + 6, y + height - 23, contents.width - 120)
  815.   end
  816.  
  817.   def draw_gtp(actor, x, y, width = 124)
  818.     draw_gauge(x, y, width, actor.tp_rate,mtheme::TP_COLOR1,mtheme::TP_COLOR1)
  819.     change_color(system_color)
  820.     draw_text(x - 30, y + 7, 30, line_height, Vocab::tp_a,2)
  821.     change_color(tp_color(actor))
  822.     draw_text(x + width - 42, y + 3, 42, line_height, actor.tp.to_i, 2)
  823.   end
  824.  
  825.   def draw_gxp(actor,x,y,width = 124)
  826.     draw_xpgauge(x, y, width, actor.xp_rate, mtheme::XP_COLOR1, mtheme::XP_COLOR2)
  827.   end
  828.  
  829.   def draw_xpgauge(x, y, width, rate, color1, color2)
  830.     fill_w = (width * rate).to_i
  831.     gauge_y = y + line_height - 8
  832.     contents.fill_rect(x, gauge_y, width, 4, gauge_back_color)
  833.     contents.gradient_fill_rect(x, gauge_y, fill_w, 4, color1, color2)
  834.   end
  835.  
  836.   def draw_ghp(actor, x, y, width = 124)
  837.     draw_gauge(x, y, width, actor.hp_rate, mtheme::HP_COLOR1, mtheme::HP_COLOR2)
  838.     change_color(system_color)
  839.     draw_text(x - 30, y + 7, 30, line_height, Vocab::hp_a,2)
  840.     draw_current_and_max_values(x, y + 3, width, actor.hp, actor.mhp,
  841.       hp_color(actor), normal_color)
  842.   end
  843.  
  844.   def draw_gmp(actor, x, y, width = 124)
  845.     draw_gauge(x, y, width, actor.mp_rate, mtheme::MP_COLOR1, mtheme::MP_COLOR2)
  846.     change_color(system_color)
  847.     draw_text(x - 30, y + 7, 30, line_height, Vocab::mp_a,2)
  848.     draw_current_and_max_values(x, y + 3, width, actor.mp, actor.mmp,
  849.       mp_color(actor), normal_color)
  850.   end
  851.  
  852.   def draw_gicons(actor, x, y, width = 96)
  853.     icons = (actor.state_icons + actor.buff_icons)[0, width / 24]
  854.     icons.each_with_index {|n, i| draw_icon(n, x, y - 16 * i) }
  855.   end
  856.  
  857.   def draw_gface(face_name, face_index, x, y, height, enabled = true)
  858.     bitmap = Cache.face(face_name)
  859.     h = [height,96].min - 1
  860.     y_offset = GMENU::ACTORS_SHOWN > 4 ? 1.25 : 1
  861.     h2 = 96 - h * y_offset
  862.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96 + h2, 96, h)
  863.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  864.     bitmap.dispose
  865.   end
  866.  
  867.   def draw_glevel(actor, x, y)
  868.     wid = Graphics.width - 300
  869.     change_color(system_color)
  870.     draw_text(x, y, wid, line_height, Vocab::level_a + " " + actor.level.to_s, 0)
  871.   end
  872.  
  873.   def draw_gclass(actor, x, y)
  874.     change_color(normal_color)
  875.     draw_text(x, y, Graphics.width - 290, line_height, actor.class.name,2)
  876.   end
  877. end # Window_Base < Window
  878.  
  879.  
  880.     #-----------------#
  881. #---|   SCENEMANAGER  |---------------------------------------------------------
  882.     #-----------------#
  883.  
  884. module SceneManager
  885.   class << self
  886.     alias gmenu_engine_sm_call call
  887.   end
  888.  
  889.   def self.call(scene_class)
  890.     if scene_class.is_a?(Symbol)
  891.       @stack.push(@scene)
  892.       @scene = Kernel.const_get(scene_class).new
  893.     else
  894.       gmenu_engine_sm_call(scene_class)
  895.     end
  896.   end
  897.  
  898.   def self.themed_scene
  899.     array = ["Scene_Menu"] + GMENU::SCENE_THEMES
  900.     return true if array.include?(@scene.name)
  901.     return false
  902.   end
  903. end # SceneManager
  904.  
  905.  
  906. class Scene_MenuBase < Scene_Base
  907.   include Check_Theme
  908.  
  909.   alias gmenu_engine_sb_start start
  910.   def start
  911.     gmenu_engine_sb_start
  912.     if SceneManager.themed_scene
  913.       $game_temp.themed_scene = true
  914.       create_theme_backgrounds
  915.     end
  916.   end
  917.  
  918.   def create_theme_backgrounds
  919.     create_background1
  920.     create_themebg2
  921.   end
  922.  
  923.   def create_background1
  924.     @background1 = Plane.new
  925.     @background1.bitmap = Cache.gmenu(name + "_Background",$game_system.menu_theme) rescue
  926.       Cache.gmenu("Background",$game_system.menu_theme)
  927.     @background1.opacity = mtheme::BACK1_OPACITY
  928.     @background1.z = -1
  929.     @background_sprite.z = -2
  930.   end
  931.  
  932.   def create_themebg2
  933.     @themebg2 = Sprite.new
  934.     if !SceneManager.scene_is?(Scene_Menu)
  935.       @themebg2.bitmap = Cache.gmenu(name + "_Background2",$game_system.menu_theme) rescue
  936.       Cache.gmenu("Scene_Generic_Background2",$game_system.menu_theme) rescue
  937.       nil
  938.     end
  939.     @themebg2.opacity = mtheme::SCENE_BACK_OPACITY
  940.     if @themebg2.bitmap
  941.       @themebg2.x = [(Graphics.width - @themebg2.bitmap.width) / 2,0].max
  942.     end
  943.     @themebg2.z = 0
  944.   end
  945.  
  946.   alias gmenu_engine_sb_update update
  947.   def update
  948.     gmenu_engine_sb_update
  949.     if @background1
  950.       @background1.ox -= mtheme::BACK1_XY[0]
  951.       @background1.oy -= mtheme::BACK1_XY[1]
  952.     end
  953.   end
  954.  
  955.   alias gmenu_engine_sb_terminate terminate
  956.   def terminate
  957.     gmenu_engine_sb_terminate
  958.     $game_temp.themed_scene = false
  959.     @background1.dispose if @background1
  960.     @themebg2.dispose if @themebg2
  961.   end
  962.  
  963.   def name
  964.     if self.to_s =~ /#<(.*):/i
  965.       return $1
  966.     else
  967.       return ""
  968.     end
  969.   end
  970. end # Scene_Base
  971.  
  972.  
  973.     #--------------------#
  974. #---|   SPRITE_MENUBTN   |------------------------------------------------------
  975.     #--------------------#
  976.  
  977. class MenuBtn
  978.   include Check_Theme
  979.  
  980.   def initialize(viewport,index)
  981.     @index1 = index
  982.     @index = 0
  983.     create_bitmap
  984.     create_text
  985.     create_icon
  986.   end
  987.  
  988.   def dispose
  989.     @text.dispose
  990.     @icon.dispose
  991.     @btn.dispose
  992.     @text.bitmap.dispose
  993.     @icon.bitmap.dispose
  994.     @btn.bitmap.dispose
  995.   end
  996.  
  997.   def update(index)
  998.     @index = $game_temp.menuindexes[index]
  999.     update_position
  1000.   end
  1001.  
  1002.   def menuitem
  1003.     GMENU::COMMAND_LIST[$game_temp.menuindexes[@index1]]
  1004.   end
  1005.  
  1006.   def create_bitmap
  1007.     if SceneManager.scene.command_window
  1008.       cmd_index = SceneManager.scene.command_window.index
  1009.     else
  1010.       cmd_index = 0
  1011.     end
  1012.     @btn = Sprite.new
  1013.     @btn.bitmap = Cache.gmenu("MenuButton",$game_system.menu_theme)
  1014.     @btn.y = mtheme::MENU_Y_OFFSET + @index1 * @btn.bitmap.height
  1015.     @btn.x = @index1 == cmd_index ? mtheme::SLIDE_ON : mtheme::SLIDE_OFF
  1016.     @btn.opacity = @index1 == cmd_index ? 255 : 160
  1017.   end
  1018.  
  1019.   def create_icon
  1020.     @icon = Sprite.new
  1021.     @icon.bitmap = Bitmap.new(800,800)
  1022.     @tempicon = Sprite.new
  1023.     @tempicon.bitmap = Cache.system("Iconset")
  1024.     icon_index = menuitem[6]
  1025.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  1026.     @icon.bitmap.blt(mtheme::MENU_ICON_XY[0], mtheme::MENU_ICON_XY[1],
  1027.       @tempicon.bitmap, rect, 255)
  1028.     @tempicon.bitmap.dispose if @tempicon.bitmap
  1029.     @tempicon.dispose
  1030.     @icon.x = @btn.x if mtheme::SLIDE_ICON
  1031.     @icon.y = @btn.y
  1032.     @icon.z = 100
  1033.   end
  1034.  
  1035.   def create_text
  1036.     @text = Sprite.new
  1037.     @text.bitmap = Bitmap.new(180,35)
  1038.     @text.bitmap.font.name = mtheme::MENU_FONT
  1039.     @text.bitmap.font.color = mtheme::MENU_TXT_COLOR
  1040.     @text.bitmap.font.out_color = mtheme::MENU_TXT_OUT
  1041.     @text.bitmap.font.size = mtheme::MENU_FONT_SIZE
  1042.     text = menuitem[0]
  1043.     @text.bitmap.draw_text(mtheme::MENU_TXT_XY[0],
  1044.       mtheme::MENU_TXT_XY[1],150,35, text,2)
  1045.     @text.x = @btn.x
  1046.     @text.y = @btn.y
  1047.     @text.opacity = 100 if menuitem[3] > 0 && !$game_switches[menuitem[3]]
  1048.   end
  1049.  
  1050.   def update_position
  1051.     if $game_temp.menuindexes[@index1] == @index
  1052.       @btn.opacity = 255
  1053.       return if @btn.x >= mtheme::SLIDE_ON
  1054.       @btn.x += mtheme::SLIDE_SPEED
  1055.       @text.x += mtheme::SLIDE_SPEED
  1056.       @icon.x += mtheme::SLIDE_SPEED if mtheme::SLIDE_ICON
  1057.     else
  1058.       @btn.opacity = 160
  1059.       return if @btn.x <= mtheme::SLIDE_OFF
  1060.       @btn.x -= mtheme::SLIDE_SPEED
  1061.       @text.x -= mtheme::SLIDE_SPEED
  1062.       @icon.x -= mtheme::SLIDE_SPEED if mtheme::SLIDE_ICON
  1063.     end
  1064.   end
  1065. end # Sprite_MenuBtn < Sprite_Base

E574AF4F5E47CE99F0B7561EFEDDF0D3.png (48.6 KB, 下载次数: 35)

Yanfly的菜单中数值的样式

Yanfly的菜单中数值的样式

ee76caaffd15a682690f2de45e30b41c.png (130.53 KB, 下载次数: 31)

五位数导致的字体被压缩

五位数导致的字体被压缩

9FA181B74C5D4DAC05E571FF7C643EE3.png (124.64 KB, 下载次数: 32)

Galv的菜单中数值的样式

Galv的菜单中数值的样式
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2026-6-5 00:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表