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

Project1

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

[已经解决] 求教,Theo的地图显示变量脚本怎么变成横向?(已解决)

[复制链接]

Lv5.捕梦者

梦石
18
星屑
13535
在线时间
1709 小时
注册时间
2017-1-12
帖子
1771

开拓者

跳转到指定楼层
1
发表于 2019-6-3 12:33:24 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 火锅深处 于 2019-6-4 11:07 编辑

现有脚本的三种模式是左上、右上、右下。变量是纵向排列。
我想变成在左上角距离顶边100像素左右,变量横向一字排开,具体应该改哪部分呢?
  1. # =============================================================================
  2. # TheoAllen - 简单变量HUD
  3. # Version : 1.2b
  4. # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
  5. # (This script documentation is written in informal indonesian language)
  6. # =============================================================================
  7. ($imported ||= {})[:Theo_VariableHUD] = true
  8. # =============================================================================
  9. # CHANGE LOGS:
  10. # -----------------------------------------------------------------------------
  11. # 2014.03.13 - Fixed hidden glitch when access menu then back to map
  12. # 2014.02.07 - Make sure that variable HUD is always visible
  13. # 2013.08.09 - Add mutiple variable HUD support
  14. # 2013.07.23 - Finished script
  15. # =============================================================================
  16. =begin

  17.   介绍 :
  18.   本脚本可以简单地在地图上显示变量的数值。
  19.   
  20.   使用方法 :
  21.   将本脚本放在插件脚本之下,Main之上
  22.   
  23.   使用脚本:
  24.   show_variable(变量id) >> 显示变量数值
  25.   show_variable(变量id,图标索引) >> 显示变量数值+一个图标
  26.   show_variable(变量id,图标索引,位置) >> 显示变量数值+一个图标+设定显示位置
  27.   
  28.   多重 HUD 的脚本:
  29.   show_variable([变量id,变量id,变量id],[图标索引,图标索引,图标索引],位置)
  30.   
  31.   hide_variable >> 隐藏所有 HUD
  32.   
  33.     使用条款 :
  34.   署名脚本作者, TheoAllen. 你可以自由编辑此脚本,只要你不声明你是脚本的原作者
  35.   如果你想用此脚本于商业游戏,请和我共享收益.别忘了给我一份免费的游戏拷贝.  
  36.   
  37.   Note :
  38.   Karena ini simple, jadi jangan harap ada banyak kustomisasi bebas

  39. =end
  40. # =============================================================================
  41. # 设定
  42. # =============================================================================
  43.   VarHUD_DefaultPos = 1 # Posisi default HUD
  44. # -----------------------------------------------------------------------------
  45. # 1 >> Kiri Atas
  46. # 2 >> Kanan Atas
  47. # 3 >> Kiri Bawah
  48. # 4 >> Kanan Bawah
  49. # -----------------------------------------------------------------------------
  50.   VarHUD_FontSize = 24 # Ukuran Font
  51. # -----------------------------------------------------------------------------
  52.   VarHUD_MaxVar = 4 # Maksimal variable yg dapat ditampilin
  53. # =============================================================================
  54. # 设定结束
  55. # =============================================================================
  56. class Game_Temp
  57.   attr_accessor :refresh_hud
  58.   
  59.   alias theo_varhud_init initialize
  60.   def initialize
  61.     theo_varhud_init
  62.     @refresh_hud = false
  63.   end
  64.   
  65. end

  66. class Game_Variables
  67.   alias theo_varhud_on_change on_change
  68.   def on_change
  69.     theo_varhud_on_change
  70.     $game_temp.refresh_hud = true
  71.   end
  72. end

  73. class Game_System
  74.   class VarHUD
  75.     attr_accessor :position
  76.     attr_accessor :icon
  77.     attr_accessor :id
  78.    
  79.     def initialize
  80.       @position = 0
  81.       @icon = 0
  82.       @id = 0
  83.     end
  84.   end
  85.   attr_accessor :varhud_visible
  86.   attr_accessor :varhud_position
  87.   attr_reader :varhud
  88.   
  89.   alias theo_varhud_init initialize
  90.   def initialize
  91.     theo_varhud_init
  92.     @varhud = Array.new(VarHUD_MaxVar) { VarHUD.new }
  93.   end
  94.   
  95.   def clear_varhud
  96.     @varhud.each do |hud|
  97.       hud.id = 0
  98.     end
  99.   end
  100.   
  101. end

  102. class Game_Interpreter
  103.   
  104.   def show_variable(id = nil,icon = 0,position = VarHUD_DefaultPos)
  105.     $game_system.clear_varhud
  106.     if id.is_a?(Array)
  107.       icon = [icon] unless icon.is_a?(Array)
  108.       id.each_with_index do |i,index|
  109.         return if index-1 > VarHUD_MaxVar
  110.         hud = $game_system.varhud[index]
  111.         hud.id = i
  112.         hud.icon = icon[index]
  113.       end
  114.     elsif id.is_a?(Numeric)
  115.       hud = $game_system.varhud[0]
  116.       hud.icon = icon
  117.       hud.id = id
  118.     end
  119.     $game_system.varhud_position = position
  120.     $game_system.varhud_visible = true
  121.     $game_temp.refresh_hud = true
  122.   end
  123.   
  124.   def hide_variable
  125.     $game_system.varhud_visible = false
  126.   end
  127.   
  128. end

  129. class Window_VarHUD < Window_Base
  130.   
  131.   def initialize
  132.     super(0,0,window_width,window_height)
  133.     contents.font.size = VarHUD_FontSize
  134.     update_hud_position
  135.     update_visibility
  136.     self.opacity = 0
  137.     refresh
  138.   end
  139.   
  140.   def window_width;Graphics.width;end;
  141.   def window_height;fitting_height(VarHUD_MaxVar);end;
  142.   def line_height;VarHUD_FontSize;end;
  143.    
  144.   def update
  145.     super
  146.     update_visibility
  147.     refresh if $game_temp.refresh_hud
  148.   end
  149.   
  150.   def update_visibility
  151.     self.visible = $game_system.varhud_visible
  152.   end
  153.   
  154.   def refresh
  155.     contents.clear
  156.     active_hud.each_with_index do |hud,i|
  157.       update_hud_contents(hud,i)
  158.     end
  159.     update_hud_position
  160.     $game_temp.refresh_hud = false
  161.   end
  162.   
  163.   def update_hud_position
  164.     pos = $game_system.varhud_position
  165.     if pos == 1 || pos == 2
  166.       self.y = 0
  167.     elsif
  168.       self.y = Graphics.height - self.height
  169.       size = active_hud.size - 1
  170.       return if size < 0
  171.       self.y += size * line_height
  172.     end
  173.   end
  174.   
  175.   def update_hud_contents(hud,i)
  176.     var_id = hud.id
  177.     icon = hud.icon.nil? ? 0 : hud.icon
  178.     return if var_id == 0
  179.     rect = Rect.new(0,0,contents.width,line_height)
  180.     rect.y = i * line_height
  181.     case $game_system.varhud_position
  182.     when 1,3
  183.       if icon != 0
  184.         rect.x += 27
  185.         draw_icon(icon,0,icon_y_pos + (i * line_height))
  186.       end
  187.       draw_text(rect,$game_variables[var_id])
  188.     else
  189.       if icon != 0
  190.         rect.x -= 27
  191.         draw_icon(icon,contents.width-24,icon_y_pos + (i * line_height))
  192.       end
  193.       draw_text(rect,$game_variables[var_id],2)
  194.     end
  195.   end
  196.   
  197.   def icon_y_pos
  198.     return 0 if line_height <= 24
  199.     return line_height/2 - 12
  200.   end
  201.   
  202.   def active_hud
  203.     $game_system.varhud.select {|hud| hud.id > 0}
  204.   end
  205.   
  206. end

  207. class Scene_Map < Scene_Base
  208.   
  209.   alias theo_varhud_start start
  210.   def start
  211.     theo_varhud_start
  212.     create_var_hud
  213.   end
  214.   
  215.   def create_var_hud
  216.     @varhud_viewport = Viewport.new
  217.     @varhud_viewport.z = 9999
  218.     @var_hud = Window_VarHUD.new
  219. #~     @var_hud.z -= 100
  220.     @var_hud.viewport = @vahud_viewport
  221.   end
  222.   
  223.   alias theo_varhud_terminate terminate
  224.   def terminate
  225.     theo_varhud_terminate
  226.     @varhud_viewport.dispose
  227.   end
  228.   
  229. end
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-5-10 00:40

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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