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

Project1

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

[已经解决] 请问如何修改选择项的光标位置

[复制链接]

Lv1.梦旅人

梦石
0
星屑
115
在线时间
65 小时
注册时间
2013-1-18
帖子
15
跳转到指定楼层
1
发表于 2013-10-13 21:33:06 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
如图,怎样将光标位置对齐选择项
查看过其他帖子,但实在是不知道怎么修改
def update_cursor_rect有好几个,改了也没有什么用
下面附上使用的菜单

RUBY 代码复制
  1. #==============================================================================
  2. #本脚本来自[url]www.66rpg.com[/url],转载和使用请保留此信息 。
  3. #默认游戏系统大修改 2.0
  4. #  爆焰    于: 1-30-2012 整合与发布
  5. #QQ:459974518
  6. #此脚本是本人一时兴起修改默认的脚本所制作完成。
  7. #如发现有bug请与作者联系或上66rpg发贴提意见。
  8. #==============================================================================
  9.  
  10. #==============================================================================
  11. # ■ Window_Base
  12. #------------------------------------------------------------------------------
  13. #  游戏中全部窗口的超级类。
  14. #==============================================================================
  15.  
  16. class Window_Base < Window
  17.   #--------------------------------------------------------------------------
  18.   # ● 初始化对像
  19.   #     x      : 窗口的 X 坐标
  20.   #     y      : 窗口的 Y 坐标
  21.   #     width  : 窗口的宽
  22.   #     height : 窗口的宽
  23.   #--------------------------------------------------------------------------
  24.   def initialize(x, y, width, height)
  25.     super()
  26.     @windowskin_name = $game_system.windowskin_name
  27.     self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  28.     self.x = x
  29.     self.y = y
  30.     self.width = width
  31.     self.height = height
  32.     self.z = 100
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 释放
  36.   #--------------------------------------------------------------------------
  37.   def dispose
  38.     # 如果窗口的内容已经被设置就被释放
  39.     if self.contents != nil
  40.       self.contents.dispose
  41.     end
  42.     super
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 获取文字色
  46.   #     n : 文字色编号 (0~7)
  47.   #--------------------------------------------------------------------------
  48.   def text_color(n)
  49.     case n
  50.     when 0
  51.       return Color.new(255, 255, 255, 255)
  52.     when 1
  53.       return Color.new(128, 128, 255, 255)
  54.     when 2
  55.       return Color.new(255, 128, 128, 255)
  56.     when 3
  57.       return Color.new(128, 255, 128, 255)
  58.     when 4
  59.       return Color.new(128, 255, 255, 255)
  60.     when 5
  61.       return Color.new(255, 128, 255, 255)
  62.     when 6
  63.       return Color.new(255, 255, 128, 255)
  64.     when 7
  65.       return Color.new(192, 192, 192, 255)
  66.     else
  67.       normal_color
  68.     end
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 获取普通文字色
  72.   #--------------------------------------------------------------------------
  73.   def normal_color
  74.     return Color.new(255, 255, 255, 255)
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 获取无效文字色
  78.   #--------------------------------------------------------------------------
  79.   def disabled_color
  80.     return Color.new(255, 255, 255, 128)
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 获取系统文字色
  84.   #--------------------------------------------------------------------------
  85.   def system_color
  86.     return Color.new(192, 224, 255, 255)
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 获取危机文字色
  90.   #--------------------------------------------------------------------------
  91.   def crisis_color
  92.     return Color.new(255, 255, 64, 255)
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 获取战斗不能文字色
  96.   #--------------------------------------------------------------------------
  97.   def knockout_color
  98.     return Color.new(255, 64, 0)
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● 刷新画面
  102.   #--------------------------------------------------------------------------
  103.   def update
  104.     super
  105.     # 如果窗口的外关被变更了、再设置
  106.     if $game_system.windowskin_name != @windowskin_name
  107.       @windowskin_name = $game_system.windowskin_name
  108.       self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  109.     end
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # ● 图形的描绘
  113.   #     actor : 角色
  114.   #     x     : 描画目标 X 坐标
  115.   #     y     : 描画目标 Y 坐标
  116.   #--------------------------------------------------------------------------
  117.   def draw_actor_graphic(actor, x, y)
  118.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  119.     cw = bitmap.width / 4
  120.     ch = bitmap.height / 4
  121.     src_rect = Rect.new(0, 0, cw, ch)
  122.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 名称的描绘
  126.   #     actor : 角色
  127.   #     x     : 描画目标 X 坐标
  128.   #     y     : 描画目标 Y 坐标
  129.   #--------------------------------------------------------------------------
  130.   def draw_actor_name(actor, x, y)
  131.     self.contents.font.color = normal_color
  132.     self.contents.draw_text(x, y, 120, 32, actor.name)
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ● 职业的描绘
  136.   #     actor : 角色
  137.   #     x     : 描画目标 X 坐标
  138.   #     y     : 描画目标 Y 坐标
  139.   #--------------------------------------------------------------------------
  140.   def draw_actor_class(actor, x, y)
  141.     self.contents.font.color = normal_color
  142.     self.contents.draw_text(x, y, 236, 32, actor.class_name)
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # ● 水平的描画
  146.   #     actor : 角色
  147.   #     x     : 描画目标 X 坐标
  148.   #     y     : 描画目标 Y 坐标
  149.   #--------------------------------------------------------------------------
  150.   def draw_actor_level(actor, x, y)
  151.     self.contents.font.color = system_color
  152.     self.contents.draw_text(x, y, 32, 32, "Lv")
  153.     self.contents.font.color = normal_color
  154.     self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ● 生辰成描绘用状态字符串
  158.   #     actor       : 角色
  159.   #     width       : 描画目标的宽度
  160.   #     need_normal : [正常] 是否为必须 (true / false)
  161.   #--------------------------------------------------------------------------
  162.   def make_battler_state_text(battler, width, need_normal)
  163.     # 获取括号的宽
  164.     brackets_width = self.contents.text_size("[]").width
  165.     # 生成状态名字符串
  166.     text = ""
  167.     for i in battler.states
  168.       if $data_states[i].rating >= 1
  169.         if text == ""
  170.           text = $data_states[i].name
  171.         else
  172.           new_text = text + "/" + $data_states[i].name
  173.           text_width = self.contents.text_size(new_text).width
  174.           if text_width > width - brackets_width
  175.             break
  176.           end
  177.           text = new_text
  178.         end
  179.       end
  180.     end
  181.     # 状态名空的字符串是 "[正常]" 的情况下
  182.     if text == ""
  183.       if need_normal
  184.         text = "[正常]"
  185.       end
  186.     else
  187.       # 加上括号
  188.       text = "[" + text + "]"
  189.     end
  190.     # 返回完成后的文字类
  191.     return text
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ● 描绘状态
  195.   #     actor : 角色
  196.   #     x     : 描画目标 X 坐标
  197.   #     y     : 描画目标 Y 坐标
  198.   #     width : 描画目标的宽
  199.   #--------------------------------------------------------------------------
  200.   def draw_actor_state(actor, x, y, width = 120)
  201.     text = make_battler_state_text(actor, width, true)
  202.     self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
  203.     self.contents.draw_text(x, y, width, 32, text)
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● 描画 EXP
  207.   #     actor : 角色
  208.   #     x     : 描画目标 X 坐标
  209.   #     y     : 描画目标 Y 坐标
  210.   #--------------------------------------------------------------------------
  211.   def draw_actor_exp(actor, x, y)
  212.     self.contents.font.color = system_color
  213.     self.contents.draw_text(x, y, 24, 32, "E")
  214.     self.contents.font.color = normal_color
  215.     self.contents.draw_text(x + 45, y, 84, 32, actor.exp_s, 2)
  216.     #self.contents.draw_text(x + 48, y, 12, 32, "/", 1)
  217.     #self.contents.draw_text(x + 60, y, 84, 32, actor.next_exp_s)
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● 描绘 HP
  221.   #     actor : 角色
  222.   #     x     : 描画目标 X 坐标
  223.   #     y     : 描画目标 Y 坐标
  224.   #     width : 描画目标的宽
  225.   #--------------------------------------------------------------------------
  226.   def draw_actor_hp(actor, x, y, width = 144)
  227.     # 描绘字符串 "HP"
  228.     self.contents.font.color = system_color
  229.     self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
  230.     # 计算描绘 MaxHP 所需的空间
  231.     if width - 32 >= 108
  232.       hp_x = x + width - 108
  233.       flag = true
  234.     elsif width - 32 >= 48
  235.       hp_x = x + width - 48
  236.       flag = false
  237.     end
  238.     # 描绘 HP
  239.     self.contents.font.color = actor.hp == 0 ? knockout_color :
  240.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  241.     self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
  242.     # 描绘 MaxHP
  243.     if flag
  244.       self.contents.font.color = normal_color
  245.       self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  246.       self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
  247.     end
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ● 描绘 SP
  251.   #     actor : 角色
  252.   #     x     : 描画目标 X 坐标
  253.   #     y     : 描画目标 Y 坐标
  254.   #     width : 描画目标的宽
  255.   #--------------------------------------------------------------------------
  256.   def draw_actor_sp(actor, x, y, width = 144)
  257.     # 描绘字符串 "SP"
  258.     self.contents.font.color = system_color
  259.     self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
  260.     # 计算描绘 MaxSP 所需的空间
  261.     if width - 32 >= 108
  262.       sp_x = x + width - 108
  263.       flag = true
  264.     elsif width - 32 >= 48
  265.       sp_x = x + width - 48
  266.       flag = false
  267.     end
  268.     # 描绘 SP
  269.     self.contents.font.color = actor.sp == 0 ? knockout_color :
  270.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  271.     self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
  272.     # 描绘 MaxSP
  273.     if flag
  274.       self.contents.font.color = normal_color
  275.       self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
  276.       self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
  277.     end
  278.   end
  279.   #--------------------------------------------------------------------------
  280.   # ● 描绘能力值
  281.   #     actor : 角色
  282.   #     x     : 描画目标 X 坐标
  283.   #     y     : 描画目标 Y 坐标
  284.   #     type  : 能力值种类 (0~6)
  285.   #--------------------------------------------------------------------------
  286.   def draw_actor_parameter(actor, x, y, type)
  287.     case type
  288.     when 0
  289.       parameter_name = $data_system.words.atk
  290.       parameter_value = actor.atk
  291.     when 1
  292.       parameter_name = $data_system.words.pdef
  293.       parameter_value = actor.pdef
  294.     when 2
  295.       parameter_name = $data_system.words.mdef
  296.       parameter_value = actor.mdef
  297.     when 3
  298.       parameter_name = $data_system.words.str
  299.       parameter_value = actor.str
  300.     when 4
  301.       parameter_name = $data_system.words.dex
  302.       parameter_value = actor.dex
  303.     when 5
  304.       parameter_name = $data_system.words.agi
  305.       parameter_value = actor.agi
  306.     when 6
  307.       parameter_name = $data_system.words.int
  308.       parameter_value = actor.int
  309.        ################################################   
  310.    when 7
  311.       parameter_name = "回避"
  312.       parameter_value = actor.eva
  313.       ##################################################
  314.     end
  315.     self.contents.font.color = system_color
  316.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  317.     self.contents.font.color = normal_color
  318.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ● 描绘物品名
  322.   #     item : 物品
  323.   #     x    : 描画目标 X 坐标
  324.   #     y    : 描画目标 Y 坐标
  325.   #--------------------------------------------------------------------------
  326.   def draw_item_name(item, x, y)
  327.     if item == nil
  328.       return
  329.     end
  330.     bitmap = RPG::Cache.icon(item.icon_name)
  331.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  332.     self.contents.font.color = normal_color
  333.     self.contents.draw_text(x + 28, y, 212, 32, item.name)
  334.   end
  335. end
  336. #==============================================================================
  337. # ■ Window_Help
  338. #------------------------------------------------------------------------------
  339. #  特技及物品的说明、角色的状态显示的窗口。
  340. #==============================================================================
  341.  
  342. class Window_Help < Window_Base
  343.   #--------------------------------------------------------------------------
  344.   # ● 初始化对像
  345.   #--------------------------------------------------------------------------
  346.   def initialize
  347.     super(0, 0, 640, 64)
  348.     self.z = 998
  349.     self.contents = Bitmap.new(width - 32, height - 32)
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # ● 设置文本
  353.   #     text  : 窗口显示的字符串
  354.   #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  355.   #--------------------------------------------------------------------------
  356.   def set_text(text, align = 0)
  357.     # 如果文本和对齐方式的至少一方与上次的不同
  358.     if text != @text or align != @align
  359.       # 再描绘文本
  360.       self.contents.clear
  361.       self.contents.font.color = normal_color
  362.       self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  363.       @text = text
  364.       @align = align
  365.       [url=home.php?mod=space&uid=95897]@actor[/url] = nil
  366.     end
  367.     self.visible = true
  368.   end
  369.   #--------------------------------------------------------------------------
  370.   # ● 设置角色
  371.   #     actor : 要显示状态的角色
  372.   #--------------------------------------------------------------------------
  373.   def set_actor(actor)
  374.     if actor != @actor
  375.       self.contents.clear
  376.       draw_actor_name(actor, 4, 0)
  377.       draw_actor_state(actor, 140, 0)
  378.       draw_actor_hp(actor, 284, 0)
  379.       draw_actor_sp(actor, 460, 0)
  380.       @actor = actor
  381.       @text = nil
  382.       self.visible = true
  383.     end
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # ● 设置敌人
  387.   #     enemy : 要显示名字和状态的敌人
  388.   #--------------------------------------------------------------------------
  389.   def set_enemy(enemy)
  390.     text = enemy.name
  391.     state_text = make_battler_state_text(enemy, 112, false)
  392.     if state_text != ""
  393.       text += "  " + state_text
  394.     end
  395.     set_text(text, 1)
  396.   end
  397. end
  398. #==============================================================================
  399. # ■ Window_Gold
  400. #------------------------------------------------------------------------------
  401. #  显示金钱的窗口。
  402. #==============================================================================
  403.  
  404. class Window_Gold < Window_Base
  405.   #--------------------------------------------------------------------------
  406.   # ● 初始化窗口
  407.   #--------------------------------------------------------------------------
  408.   def initialize
  409.     super(0, 0, 160, 96)
  410.     self.contents = Bitmap.new(width - 32, height - 32)
  411.     refresh
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # ● 刷新
  415.   #--------------------------------------------------------------------------
  416.   def refresh
  417.     self.contents.clear
  418.     cx = contents.text_size($data_system.words.gold).width
  419.     self.contents.font.color = normal_color
  420.     self.contents.draw_text(4, 32, 120, 32, $game_party.gold.to_s, 2)
  421.     self.contents.font.color = system_color
  422.     self.contents.draw_text(4, 0, 120, 32, "金币")
  423.   end
  424. end
  425. #==============================================================================
  426. # ■ Window_PlayTime
  427. #------------------------------------------------------------------------------
  428. #  菜单画面显示游戏时间的窗口。
  429. #==============================================================================
  430.  
  431. class Window_PlayTime < Window_Base
  432.   #--------------------------------------------------------------------------
  433.   # ● 初始化对像
  434.   #--------------------------------------------------------------------------
  435.   def initialize
  436.     super(0, 0, 160, 96)
  437.     self.contents = Bitmap.new(width - 32, height - 32)
  438.     refresh
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● 刷新
  442.   #--------------------------------------------------------------------------
  443.   def refresh
  444.     self.contents.clear
  445.     self.contents.font.color = system_color
  446.     self.contents.draw_text(4, 0, 120, 32, "游戏时间")
  447.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  448.     hour = @total_sec / 60 / 60
  449.     min = @total_sec / 60 % 60
  450.     sec = @total_sec % 60
  451.     text = sprintf("%02d:%02d:%02d", hour, min, sec)
  452.     self.contents.font.color = normal_color
  453.     self.contents.draw_text(4, 32, 120, 32, text, 2)
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # ● 刷新画面
  457.   #--------------------------------------------------------------------------
  458.   def update
  459.     super
  460.     if Graphics.frame_count / Graphics.frame_rate != @total_sec
  461.       refresh
  462.     end
  463.   end
  464. end
  465. #==============================================================================
  466. # ■ Window_Steps
  467. #------------------------------------------------------------------------------
  468. #  菜单画面显示步数的窗口。
  469. #==============================================================================
  470.  
  471. class Window_Steps < Window_Base
  472.   #--------------------------------------------------------------------------
  473.   # ● 初始化对像
  474.   #--------------------------------------------------------------------------
  475.   def initialize
  476.     super(0, 0, 160, 96)
  477.     self.contents = Bitmap.new(width - 32, height - 32)
  478.     refresh
  479.   end
  480.   #--------------------------------------------------------------------------
  481.   # ● 刷新
  482.   #--------------------------------------------------------------------------
  483.   def refresh
  484.     self.contents.clear
  485.     self.contents.font.color = system_color
  486.     self.contents.draw_text(4, 0, 120, 32, "步数")
  487.     self.contents.font.color = normal_color
  488.     self.contents.draw_text(4, 32, 120, 32, $game_party.steps.to_s, 2)
  489.   end
  490. end
  491. #==============================================================================
  492. # ■ Window_MenuStatus
  493. #------------------------------------------------------------------------------
  494. #  显示菜单画面和同伴状态的窗口。
  495. #==============================================================================
  496.  
  497. class Window_MenuStatus < Window_Selectable
  498.   #--------------------------------------------------------------------------
  499.   # ● 初始化目标
  500.   #--------------------------------------------------------------------------
  501.   def initialize
  502.     super(0, 0, 640, 320)
  503.     @column_max = 4
  504.     self.contents = Bitmap.new(width - 32, height - 32)
  505.     self.opacity = 0
  506.     refresh
  507.     self.active = false
  508.     self.index = -1
  509.   end
  510. def draw_actor_face(actor,x,y)
  511. bitmap = RPG::Cache.battler(actor.name + "" , actor.battler_hue)
  512. self.contents.blt(x,y,bitmap,Rect.new(0,0,bitmap.width,bitmap.height ))
  513. end
  514.  
  515.  
  516.   #--------------------------------------------------------------------------
  517.   # ● 刷新
  518.   #--------------------------------------------------------------------------
  519.   def refresh
  520.     self.contents.clear
  521.     @item_max = $game_party.actors.size
  522.     for i in 0...$game_party.actors.size
  523.       #x = 64
  524.       #y = i * 116
  525.       x = i*158
  526.       y = 64  
  527.       actor = $game_party.actors[i]
  528.       draw_actor_face(actor, x+10, y-70)   
  529. #      draw_actor_hp_meter_line(actor, x+35,y+240,100,12)
  530.      # draw_actor_sp_meter_line(actor, x+35,y+270,100,12)
  531.    #   EXP(actor, x+30,y+300)
  532.       draw_actor_hp(actor, x , y + 110)
  533.       draw_actor_sp(actor, x , y +140)
  534.      # draw_actor_graphic(actor, x + 60, y + 80)
  535.      # draw_actor_graphic(actor, x - 40, y + 80)
  536.       draw_actor_name(actor, x, y+30)
  537.       draw_actor_class(actor, x , y+60)
  538.      # draw_actor_level(actor, x, y + 32)
  539.      draw_actor_level(actor, x, y+85)
  540.      draw_actor_state(actor, x , y + 195)
  541.      draw_actor_exp(actor, x, y + 170)
  542.     end
  543.   end
  544.   #--------------------------------------------------------------------------
  545.   # ● 刷新光标矩形
  546.   #--------------------------------------------------------------------------
  547.   def update_cursor_rect
  548.     if [url=home.php?mod=space&uid=370741]@Index[/url] < 0
  549.       self.cursor_rect.empty
  550.     else
  551.      #self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
  552.      self.cursor_rect.set(@index * 158, 0, 130, 290)
  553.     end
  554.   end
  555. end
  556. #==============================================================================
  557. # ■ Window_Item
  558. #------------------------------------------------------------------------------
  559. #  物品画面、战斗画面、显示浏览物品的窗口。
  560. #==============================================================================
  561.  
  562. class Window_Item < Window_Selectable
  563.   #--------------------------------------------------------------------------
  564.   # ● 初始化对像
  565.   #--------------------------------------------------------------------------
  566.   def initialize
  567.     super(80, 128, 480, 320)
  568.     @column_max = 2
  569.     self.z = 998
  570.     refresh
  571.     self.index = 0
  572.     # 战斗中的情况下将窗口移至中央并将其半透明化
  573.     if $game_temp.in_battle
  574.       self.y = 64
  575.       self.height = 256
  576.       self.back_opacity = 160
  577.     end
  578.   end
  579.   #--------------------------------------------------------------------------
  580.   # ● 获取物品
  581.   #--------------------------------------------------------------------------
  582.   def item
  583.     return @data[self.index]
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # ● 刷新
  587.   #--------------------------------------------------------------------------
  588.   def refresh
  589.     if self.contents != nil
  590.       self.contents.dispose
  591.       self.contents = nil
  592.     end
  593.     @data = []
  594.     # 添加报务
  595.     for i in 1...$data_items.size
  596.       if $game_party.item_number(i) > 0
  597.         @data.push($data_items[i])
  598.       end
  599.     end
  600.     # 在战斗中以外添加武器、防具
  601.     unless $game_temp.in_battle
  602.       for i in 1...$data_weapons.size
  603.         if $game_party.weapon_number(i) > 0
  604.           @data.push($data_weapons[i])
  605.         end
  606.       end
  607.       for i in 1...$data_armors.size
  608.         if $game_party.armor_number(i) > 0
  609.           @data.push($data_armors[i])
  610.         end
  611.       end
  612.     end
  613.     # 如果项目数不是 0 就生成位图、重新描绘全部项目
  614.     @item_max = @data.size
  615.     if @item_max > 0
  616.       self.contents = Bitmap.new(width - 32, row_max * 32)
  617.       for i in 0...@item_max
  618.         draw_item(i)
  619.       end
  620.     end
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # ● 描绘项目
  624.   #     index : 项目编号
  625.   #--------------------------------------------------------------------------
  626.   def draw_item(index)
  627.     item = @data[index]
  628.     case item
  629.     when RPG::Item
  630.       number = $game_party.item_number(item.id)
  631.     when RPG::Weapon
  632.       number = $game_party.weapon_number(item.id)
  633.     when RPG::Armor
  634.       number = $game_party.armor_number(item.id)
  635.     end
  636.     if item.is_a?(RPG::Item) and
  637.        $game_party.item_can_use?(item.id)
  638.       self.contents.font.color = normal_color
  639.     else
  640.       self.contents.font.color = disabled_color
  641.     end
  642.     x = 4 + index % 2 * (210 + 32)
  643.     y = index / 2 * 32
  644.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  645.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  646.     bitmap = RPG::Cache.icon(item.icon_name)
  647.     opacity = self.contents.font.color == normal_color ? 255 : 128
  648.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  649.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  650.     self.contents.draw_text(x + 150, y, 16, 32, ":", 1)
  651.     self.contents.draw_text(x + 170, y, 24, 32, number.to_s, 2)
  652.   end
  653.   #--------------------------------------------------------------------------
  654.   # ● 刷新帮助文本
  655.   #--------------------------------------------------------------------------
  656.   def update_help
  657.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  658.   end
  659. end
  660. #==============================================================================
  661. # ■ Window_Skill
  662. #------------------------------------------------------------------------------
  663. #  特技画面、战斗画面、显示可以使用的特技浏览的窗口。
  664. #==============================================================================
  665.  
  666. class Window_Skill < Window_Selectable
  667.   #--------------------------------------------------------------------------
  668.   # ● 初始化对像
  669.   #     actor : 角色
  670.   #--------------------------------------------------------------------------
  671.   def initialize(actor)
  672.     super(80, 128, 480, 320)
  673.     self.z = 998
  674.     @actor = actor
  675.     @column_max = 2
  676.     refresh
  677.     self.index = 0
  678.     # 战斗中的情况下将窗口移至中央并将其半透明化
  679.     if $game_temp.in_battle
  680.       self.y = 64
  681.       self.height = 256
  682.       self.back_opacity = 160
  683.     end
  684.   end
  685.   #--------------------------------------------------------------------------
  686.   # ● 获取特技
  687.   #--------------------------------------------------------------------------
  688.   def skill
  689.     return @data[self.index]
  690.   end
  691.   #--------------------------------------------------------------------------
  692.   # ● 刷新
  693.   #--------------------------------------------------------------------------
  694.   def refresh
  695.     if self.contents != nil
  696.       self.contents.dispose
  697.       self.contents = nil
  698.     end
  699.     @data = []
  700.     for i in [email]0...@actor.skills.size[/email]
  701.       skill = $data_skills[@actor.skills[i]]
  702.       if skill != nil
  703.         @data.push(skill)
  704.       end
  705.     end
  706.     # 如果项目数不是 0 就生成位图、重新描绘全部项目
  707.     @item_max = @data.size
  708.     if @item_max > 0
  709.       self.contents = Bitmap.new(width - 32, row_max * 32)
  710.       for i in 0...@item_max
  711.         draw_item(i)
  712.       end
  713.     end
  714.   end
  715.   #--------------------------------------------------------------------------
  716.   # ● 描绘项目
  717.   #     index : 项目编号
  718.   #--------------------------------------------------------------------------
  719.   def draw_item(index)
  720.     skill = @data[index]
  721.     if @actor.skill_can_use?(skill.id)
  722.       self.contents.font.color = normal_color
  723.     else
  724.       self.contents.font.color = disabled_color
  725.     end
  726.     x = 4 + index % 2 * (210 + 32)
  727.     y = index / 2 * 32
  728.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  729.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  730.     bitmap = RPG::Cache.icon(skill.icon_name)
  731.     opacity = self.contents.font.color == normal_color ? 255 : 128
  732.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  733.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  734.     self.contents.draw_text(x + 150, y, 48, 32, skill.sp_cost.to_s, 2)
  735.   end
  736.   #--------------------------------------------------------------------------
  737.   # ● 刷新帮助文本
  738.   #--------------------------------------------------------------------------
  739.   def update_help
  740.     @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  741.   end
  742. end
  743. #==============================================================================
  744. # ■ Window_SkillStatus
  745. #------------------------------------------------------------------------------
  746. #  显示特技画面、特技使用者的窗口。
  747. #==============================================================================
  748.  
  749. class Window_SkillStatus < Window_Base
  750.   #--------------------------------------------------------------------------
  751.   # ● 初始化对像
  752.   #     actor : 角色
  753.   #--------------------------------------------------------------------------
  754.   def initialize(actor)
  755.     super(0, 64, 640, 64)
  756.     self.z = 998
  757.     self.opacity = 0
  758.     self.contents = Bitmap.new(width - 32, height - 32)
  759.     @actor = actor
  760.     refresh
  761.   end
  762.   #--------------------------------------------------------------------------
  763.   # ● 刷新
  764.   #--------------------------------------------------------------------------
  765.   def refresh
  766.     self.contents.clear
  767.     draw_actor_name(@actor, 4, 0)
  768.     draw_actor_state(@actor, 140, 0)
  769.     draw_actor_hp(@actor, 284, 0)
  770.     draw_actor_sp(@actor, 460, 0)
  771.   end
  772. end
  773. #==============================================================================
  774. # ■ Window_Target
  775. #------------------------------------------------------------------------------
  776. #  物品画面与特技画面的、使用对像角色选择窗口。
  777. #==============================================================================
  778.  
  779. class Window_Target < Window_Selectable
  780.   #--------------------------------------------------------------------------
  781.   # ● 初始化对像
  782.   #--------------------------------------------------------------------------
  783.   def initialize
  784.     super(0, 0, 336, 480)
  785.     self.contents = Bitmap.new(width - 32, height - 32)
  786.     self.z = 9999
  787.     @item_max = $game_party.actors.size
  788.     refresh
  789.   end
  790.   #--------------------------------------------------------------------------
  791.   # ● 刷新
  792.   #--------------------------------------------------------------------------
  793.   def refresh
  794.     self.contents.clear
  795.     for i in 0...$game_party.actors.size
  796.       x = 4
  797.       y = i * 116
  798.       actor = $game_party.actors[i]
  799.       draw_actor_name(actor, x, y)
  800.       draw_actor_class(actor, x + 144, y)
  801.       draw_actor_level(actor, x + 8, y + 32)
  802.       draw_actor_state(actor, x + 8, y + 64)
  803.       draw_actor_hp(actor, x + 152, y + 32)
  804.       draw_actor_sp(actor, x + 152, y + 64)
  805.     end
  806.   end
  807.   #--------------------------------------------------------------------------
  808.   # ● 刷新光标矩形
  809.   #--------------------------------------------------------------------------
  810.   def update_cursor_rect
  811.     # 光标位置 -1 为全选、-2 以下为单独选择 (使用者自身)
  812.     if @index <= -2
  813.       self.cursor_rect.set(0, (@index + 10) * 116, self.width - 32, 96)
  814.     elsif @index == -1
  815.       self.cursor_rect.set(0, 0, self.width - 32, @item_max * 116 - 20)
  816.     else
  817.       self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
  818.     end
  819.   end
  820. end
  821. #==============================================================================
  822. # ■ Window_EquipLeft
  823. #------------------------------------------------------------------------------
  824. #  装备画面的、显示角色能力值变化的窗口。
  825. #==============================================================================
  826.  
  827. class Window_EquipLeft < Window_Base
  828.   #--------------------------------------------------------------------------
  829.   # ● 初始化对像
  830.   #     actor : 角色
  831.   #--------------------------------------------------------------------------
  832.   def initialize(actor)
  833.     super(0, 64, 272, 416)
  834.     self.contents = Bitmap.new(width - 32, height - 32)
  835.     @actor = actor
  836.     refresh
  837.   end
  838.  
  839.   def draw_actor_face(actor,x,y)
  840. bitmap = RPG::Cache.battler(actor.name + "_A" , actor.battler_hue)
  841. self.contents.blt(x,y,bitmap,Rect.new(0,0,bitmap.width,bitmap.height ))
  842. end
  843.   #--------------------------------------------------------------------------
  844.   # ● 刷新
  845.   #--------------------------------------------------------------------------
  846.   def refresh
  847.     self.contents.clear
  848.     draw_actor_face(@actor,x-20,y-70)
  849.     draw_actor_name(@actor, 4, 0)
  850.     draw_actor_level(@actor, 4, 32)
  851.     draw_actor_parameter(@actor, 4, 128, 0)
  852.     draw_actor_parameter(@actor, 4, 160, 1)
  853.     draw_actor_parameter(@actor, 4, 192, 2)
  854.     draw_actor_parameter(@actor, 4, 224, 3)
  855.     draw_actor_parameter(@actor, 4, 256, 4)
  856.     draw_actor_parameter(@actor, 4, 288, 7)
  857.     draw_actor_parameter(@actor, 4, 320, 5)
  858.     draw_actor_parameter(@actor, 4, 352, 6)
  859.     if @new_atk != nil
  860.       self.contents.font.color = system_color
  861.       self.contents.draw_text(160, 128, 40, 32, "→", 1)
  862.       self.contents.font.color = Color.new(0, 255, 0, 255)
  863.       self.contents.draw_text(200, 128, 36, 32, @new_atk.to_s, 2)
  864.     end
  865.     if @new_pdef != nil
  866.       self.contents.font.color = system_color
  867.       self.contents.draw_text(160, 160, 40, 32, "→", 1)
  868.       self.contents.font.color = Color.new(0, 255, 0, 255)
  869.       self.contents.draw_text(200, 160, 36, 32, @new_pdef.to_s, 2)
  870.     end
  871.     if @new_mdef != nil
  872.       self.contents.font.color = system_color
  873.       self.contents.draw_text(160, 192, 40, 32, "→", 1)
  874.       self.contents.font.color = Color.new(0, 255, 0, 255)
  875.       self.contents.draw_text(200, 192, 36, 32, @new_mdef.to_s, 2)
  876.     end
  877.  
  878.     if @new_str != nil
  879.       self.contents.font.color = system_color
  880.       self.contents.draw_text(160, 224, 40, 32, "→", 1)
  881.       self.contents.font.color = Color.new(0, 255, 0, 255)
  882.       self.contents.draw_text(200, 224, 36, 32, @new_str.to_s, 2)
  883.     end
  884.     if @new_dex != nil
  885.       self.contents.font.color = system_color
  886.       self.contents.draw_text(160, 256, 40, 32, "→", 1)
  887.       self.contents.font.color = Color.new(0, 255, 0, 255)
  888.       self.contents.draw_text(200, 256, 36, 32, @new_dex.to_s, 2)
  889.     end
  890.      if @new_eva != nil
  891.       self.contents.font.color = system_color
  892.       self.contents.draw_text(160, 288, 40, 32, "→", 1)
  893.       self.contents.font.color = Color.new(0, 255, 0, 255)
  894.       self.contents.draw_text(200, 288, 36, 32, @new_eva.to_s, 2)
  895.     end
  896.     if @new_agi != nil
  897.      self.contents.font.color = system_color
  898.     self.contents.draw_text(160, 320, 40, 32, "→", 1)
  899.       self.contents.font.color = Color.new(0, 255, 0, 255)
  900.       self.contents.draw_text(200, 320, 36, 32, @new_agi.to_s, 2)
  901.     end
  902.     if @new_int != nil
  903.       self.contents.font.color = system_color
  904.       self.contents.draw_text(160, 352, 40, 32, "→", 1)
  905.       self.contents.font.color = Color.new(0, 255, 0, 255)
  906.       self.contents.draw_text(200, 352, 36, 32, @new_int.to_s, 2)
  907.     end
  908.   end
  909.   #--------------------------------------------------------------------------
  910.   # ● 变更装备后的能力值设置
  911.   #     new_atk  : 变更装备后的攻击力
  912.   #     new_pdef : 变更装备后的物理防御
  913.   #     new_mdef : 变更装备后的魔法防御
  914.   #--------------------------------------------------------------------------
  915.   def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_eva, new_agi, new_int)
  916.     if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_str != new_str or @new_dex != new_dex or @new_eva != new_eva or @new_agi != new_agi or @new_int != new_int
  917.       @new_atk = new_atk
  918.       @new_pdef = new_pdef
  919.       @new_mdef = new_mdef
  920.       @new_str = new_str
  921.       @new_dex = new_dex
  922.       @new_eva = new_eva
  923.       @new_agi = new_agi
  924.       @new_int = new_int
  925.       refresh
  926.     end
  927.   end
  928. end
  929. #==============================================================================
  930. # ■ Window_EquipItem
  931. #------------------------------------------------------------------------------
  932. #  装备画面、显示浏览变更装备的候补物品的窗口。
  933. #==============================================================================
  934.  
  935. class Window_EquipItem < Window_Selectable
  936.   #--------------------------------------------------------------------------
  937.   # ● 初始化对像
  938.   #     actor      : 角色
  939.   #     equip_type : 装备部位 (0~3)
  940.   #--------------------------------------------------------------------------
  941.   def initialize(actor, equip_type)
  942.     super(272, 256, 368, 224)
  943.     @actor = actor
  944.     @equip_type = equip_type
  945.     @column_max = 1
  946.     refresh
  947.     self.active = false
  948.     self.index = -1
  949.   end
  950.   #--------------------------------------------------------------------------
  951.   # ● 获取物品
  952.   #--------------------------------------------------------------------------
  953.   def item
  954.     return @data[self.index]
  955.   end
  956.   #--------------------------------------------------------------------------
  957.   # ● 刷新
  958.   #--------------------------------------------------------------------------
  959.   def refresh
  960.     if self.contents != nil
  961.       self.contents.dispose
  962.       self.contents = nil
  963.     end
  964.     @data = []
  965.     # 添加可以装备的武器
  966.     if @equip_type == 0
  967.       weapon_set = $data_classes[@actor.class_id].weapon_set
  968.       for i in 1...$data_weapons.size
  969.         if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  970.           @data.push($data_weapons[i])
  971.         end
  972.       end
  973.     end
  974.     # 添加可以装备的防具
  975.     if @equip_type != 0
  976.       armor_set = $data_classes[@actor.class_id].armor_set
  977.       for i in 1...$data_armors.size
  978.         if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  979.           if $data_armors[i].kind == @equip_type-1
  980.             @data.push($data_armors[i])
  981.           end
  982.         end
  983.       end
  984.     end
  985.     # 添加空白
  986.     @data.push(nil)
  987.     # 生成位图、描绘全部项目
  988.     @item_max = @data.size
  989.     self.contents = Bitmap.new(width - 32, row_max * 32)
  990.     for i in 0...@item_max-1
  991.       draw_item(i)
  992.     end
  993.   end
  994.   #--------------------------------------------------------------------------
  995.   # ● 项目的描绘
  996.   #     index : 项目符号
  997.   #--------------------------------------------------------------------------
  998.   def draw_item(index)
  999.     item = @data[index]
  1000.     x = 4 + index % 1 * (90 + 32)
  1001.     y = index / 1 * 32
  1002.     case item
  1003.     when RPG::Weapon
  1004.       number = $game_party.weapon_number(item.id)
  1005.     when RPG::Armor
  1006.       number = $game_party.armor_number(item.id)
  1007.     end
  1008.     bitmap = RPG::Cache.icon(item.icon_name)
  1009.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  1010.     self.contents.font.color = normal_color
  1011.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  1012.     self.contents.draw_text(x + 280, y, 16, 32, ":", 1)
  1013.     self.contents.draw_text(x + 300, y, 24, 32, number.to_s, 2)
  1014.   end
  1015.   #--------------------------------------------------------------------------
  1016.   # ● 刷新帮助文本
  1017.   #--------------------------------------------------------------------------
  1018.   def update_help
  1019.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  1020.   end
  1021. end
  1022. class Window_Status < Window_Base
  1023.   #--------------------------------------------------------------------------
  1024.   # ● 初始化对像
  1025.   #     actor : 角色
  1026.   #--------------------------------------------------------------------------
  1027.   def initialize(actor)
  1028.     super(80, 60, 480, 360)
  1029.     self.z = 998
  1030.     self.contents = Bitmap.new(width - 32, height - 32)
  1031.     @actor = actor
  1032.     refresh
  1033.   end
  1034.   #--------------------------------------------------------------------------
  1035.   # ● 刷新
  1036.   #--------------------------------------------------------------------------
  1037.   def refresh
  1038.     self.contents.clear
  1039.     self.contents.font.size = 16
  1040.     #draw_actor_graphic(@actor, 40, 112)
  1041.     draw_actor_name(@actor, 4, 0)
  1042.     draw_actor_class(@actor, 4 + 144, 0)
  1043.     draw_actor_level(@actor, 70, 0)
  1044.     draw_actor_state(@actor, 0, 60)
  1045.     draw_actor_hp(@actor, 4, 20, 172)
  1046.     draw_actor_sp(@actor, 4, 40, 172)
  1047.     draw_actor_parameter(@actor, 0, 90, 0)#攻击力
  1048.     draw_actor_parameter(@actor, 0, 120, 1)#物防
  1049.     draw_actor_parameter(@actor, 0, 150, 2)#魔防
  1050.     draw_actor_parameter(@actor, 0, 180, 3)#力量
  1051.     draw_actor_parameter(@actor, 0, 210, 4)#灵巧
  1052.     draw_actor_parameter(@actor, 0, 270, 5)#速度
  1053.     draw_actor_parameter(@actor, 0, 300, 6)#魔力
  1054. ###########################################################   
  1055.     draw_actor_parameter(@actor, 0, 240, 7)#回避
  1056.  
  1057. ###########################################################
  1058.     self.contents.font.color = system_color
  1059.     self.contents.draw_text(230, 0, 80, 32, "经验")
  1060.     self.contents.draw_text(230, 40, 80, 32, "下一级")
  1061.     self.contents.font.color = normal_color
  1062.     self.contents.draw_text(230 + 80, 0, 84, 32, @actor.exp_s, 2)
  1063.     self.contents.draw_text(230 + 80, 40, 84, 32, @actor.next_rest_exp_s, 2)
  1064.     self.contents.font.color = system_color
  1065.     self.contents.draw_text(230, 90, 96, 32, "当前装备")
  1066.     draw_item_name($data_weapons[@actor.weapon_id], 230 + 16, 124)
  1067.     draw_item_name($data_armors[@actor.armor1_id], 230  + 16, 168)
  1068.     draw_item_name($data_armors[@actor.armor2_id], 230 + 16, 212)
  1069.     draw_item_name($data_armors[@actor.armor3_id], 230 + 16, 256)
  1070.     draw_item_name($data_armors[@actor.armor4_id], 230 + 16, 300)
  1071.   end
  1072. end
  1073. #==============================================================================
  1074. # ■ Window_ShopCommand
  1075. #------------------------------------------------------------------------------
  1076. #  商店画面、选择要做的事的窗口
  1077. #==============================================================================
  1078.  
  1079. class Window_ShopCommand < Window_Selectable
  1080.   #--------------------------------------------------------------------------
  1081.   # ● 初始化对像
  1082.   #--------------------------------------------------------------------------
  1083.   def initialize
  1084.     super(0, 64, 480, 64)
  1085.     self.contents = Bitmap.new(width - 32, height - 32)
  1086.     #self.z = 998
  1087.     @item_max = 3
  1088.     @column_max = 3
  1089.     @commands = ["买", "卖", "离开"]
  1090.     refresh
  1091.     self.index = 0
  1092.   end
  1093.   #--------------------------------------------------------------------------
  1094.   # ● 刷新
  1095.   #--------------------------------------------------------------------------
  1096.   def refresh
  1097.     self.contents.clear
  1098.     for i in 0...@item_max
  1099.       draw_item(i)
  1100.     end
  1101.   end
  1102.   #--------------------------------------------------------------------------
  1103.   # ● 描绘项目
  1104.   #     index : 项目编号
  1105.   #--------------------------------------------------------------------------
  1106.   def draw_item(index)
  1107.     x = 4 + index * 160
  1108.     self.contents.draw_text(x, 0, 128, 32, @commands[index])
  1109.   end
  1110. end
  1111. #==============================================================================
  1112. # ■ Window_ShopBuy
  1113. #------------------------------------------------------------------------------
  1114. #  商店画面、浏览显示可以购买的商品的窗口。
  1115. #==============================================================================
  1116.  
  1117. class Window_ShopBuy < Window_Selectable
  1118.   #--------------------------------------------------------------------------
  1119.   # ● 初始化对像
  1120.   #     shop_goods : 商品
  1121.   #--------------------------------------------------------------------------
  1122.   def initialize(shop_goods)
  1123.     super(70, 128, 250, 352)
  1124.     @shop_goods = shop_goods
  1125.     refresh
  1126.     self.index = 0
  1127.   end
  1128.   #--------------------------------------------------------------------------
  1129.   # ● 获取物品
  1130.   #--------------------------------------------------------------------------
  1131.   def item
  1132.     return @data[self.index]
  1133.   end
  1134.   #--------------------------------------------------------------------------
  1135.   # ● 刷新
  1136.   #--------------------------------------------------------------------------
  1137.   def refresh
  1138.     if self.contents != nil
  1139.       self.contents.dispose
  1140.       self.contents = nil
  1141.     end
  1142.     @data = []
  1143.     for goods_item in @shop_goods
  1144.       case goods_item[0]
  1145.       when 0
  1146.         item = $data_items[goods_item[1]]
  1147.       when 1
  1148.         item = $data_weapons[goods_item[1]]
  1149.       when 2
  1150.         item = $data_armors[goods_item[1]]
  1151.       end
  1152.       if item != nil
  1153.         @data.push(item)
  1154.       end
  1155.     end
  1156.     # 如果项目数不是 0 就生成位图、描绘全部项目
  1157.     @item_max = @data.size
  1158.     if @item_max > 0
  1159.       self.contents = Bitmap.new(width - 32, row_max * 32)
  1160.       for i in 0...@item_max
  1161.         draw_item(i)
  1162.       end
  1163.     end
  1164.   end
  1165.   #--------------------------------------------------------------------------
  1166.   # ● 描绘羡慕
  1167.   #     index : 项目编号
  1168.   #--------------------------------------------------------------------------
  1169.   def draw_item(index)
  1170.     item = @data[index]
  1171.     # 获取物品所持数
  1172.     case item
  1173.     when RPG::Item
  1174.       number = $game_party.item_number(item.id)
  1175.     when RPG::Weapon
  1176.       number = $game_party.weapon_number(item.id)
  1177.     when RPG::Armor
  1178.       number = $game_party.armor_number(item.id)
  1179.     end
  1180.     # 价格在所持金以下、并且所持数不是 99 的情况下为普通文字颜色
  1181.     # 除此之外的情况设置为无效文字色
  1182.     if item.price <= $game_party.gold and number < 99
  1183.       self.contents.font.color = normal_color
  1184.     else
  1185.       self.contents.font.color = disabled_color
  1186.     end
  1187.     x = 4
  1188.     y = index * 32
  1189.     rect = Rect.new(x, y, self.width - 32, 32)
  1190.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1191.     bitmap = RPG::Cache.icon(item.icon_name)
  1192.     opacity = self.contents.font.color == normal_color ? 255 : 128
  1193.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1194.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  1195.     self.contents.draw_text(x + 120, y, 88, 32, item.price.to_s, 2)
  1196.   end
  1197.   #--------------------------------------------------------------------------
  1198.   # ● 刷新帮助文本
  1199.   #--------------------------------------------------------------------------
  1200.   def update_help
  1201.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  1202.   end
  1203. end
  1204. #==============================================================================
  1205. # ■ Window_ShopSell
  1206. #------------------------------------------------------------------------------
  1207. #  商店画面、浏览显示可以卖掉的商品的窗口。
  1208. #==============================================================================
  1209.  
  1210. class Window_ShopSell < Window_Selectable
  1211.   #--------------------------------------------------------------------------
  1212.   # ● 初始化对像
  1213.   #--------------------------------------------------------------------------
  1214.   def initialize
  1215.     super(160, 128, 320, 352)
  1216.     @column_max = 1
  1217.     refresh
  1218.     self.index = 0
  1219.   end
  1220.   #--------------------------------------------------------------------------
  1221.   # ● 获取物品
  1222.   #--------------------------------------------------------------------------
  1223.   def item
  1224.     return @data[self.index]
  1225.   end
  1226.   #--------------------------------------------------------------------------
  1227.   # ● 刷新
  1228.   #--------------------------------------------------------------------------
  1229.   def refresh
  1230.     if self.contents != nil
  1231.       self.contents.dispose
  1232.       self.contents = nil
  1233.     end
  1234.     @data = []
  1235.     for i in 1...$data_items.size
  1236.       if $game_party.item_number(i) > 0
  1237.         @data.push($data_items[i])
  1238.       end
  1239.     end
  1240.     for i in 1...$data_weapons.size
  1241.       if $game_party.weapon_number(i) > 0
  1242.         @data.push($data_weapons[i])
  1243.       end
  1244.     end
  1245.     for i in 1...$data_armors.size
  1246.       if $game_party.armor_number(i) > 0
  1247.         @data.push($data_armors[i])
  1248.       end
  1249.     end
  1250.     # 如果项目数不是 0 就生成位图、描绘全部项目
  1251.     @item_max = @data.size
  1252.     if @item_max > 0
  1253.       self.contents = Bitmap.new(width - 32, row_max * 32)
  1254.       for i in 0...@item_max
  1255.         draw_item(i)
  1256.       end
  1257.     end
  1258.   end
  1259.   #--------------------------------------------------------------------------
  1260.   # ● 描绘项目
  1261.   #     index : 项目标号
  1262.   #--------------------------------------------------------------------------
  1263.   def draw_item(index)
  1264.     item = @data[index]
  1265.     case item
  1266.     when RPG::Item
  1267.       number = $game_party.item_number(item.id)
  1268.     when RPG::Weapon
  1269.       number = $game_party.weapon_number(item.id)
  1270.     when RPG::Armor
  1271.       number = $game_party.armor_number(item.id)
  1272.     end
  1273.     # 可以卖掉的显示为普通文字颜色、除此之外设置成无效文字颜色
  1274.     if item.price > 0
  1275.       self.contents.font.color = normal_color
  1276.     else
  1277.       self.contents.font.color = disabled_color
  1278.     end
  1279.     x = 4 + index % 1 * (90 + 32)
  1280.     y = index / 1 * 32
  1281.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  1282.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1283.     bitmap = RPG::Cache.icon(item.icon_name)
  1284.     opacity = self.contents.font.color == normal_color ? 255 : 128
  1285.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1286.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  1287.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  1288.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  1289.   end
  1290.   #--------------------------------------------------------------------------
  1291.   # ● 刷新帮助文本
  1292.   #--------------------------------------------------------------------------
  1293.   def update_help
  1294.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  1295.   end
  1296. end
  1297. #==============================================================================
  1298. # ■ Window_ShopNumber
  1299. #------------------------------------------------------------------------------
  1300. #  商店画面、输入买卖数量的窗口。
  1301. #==============================================================================
  1302.  
  1303. class Window_ShopNumber < Window_Base
  1304.   #--------------------------------------------------------------------------
  1305.   # ● 初始化对像
  1306.   #--------------------------------------------------------------------------
  1307.   def initialize
  1308.     super(70, 128, 250, 352)
  1309.     self.contents = Bitmap.new(width - 32, height - 32)
  1310.     @item = nil
  1311.     [url=home.php?mod=space&uid=25307]@Max[/url] = 1
  1312.     @price = 0
  1313.     [url=home.php?mod=space&uid=27178]@Number[/url] = 1
  1314.   end
  1315.   #--------------------------------------------------------------------------
  1316.   # ● 设置物品、最大个数、价格
  1317.   #--------------------------------------------------------------------------
  1318.   def set(item, max, price)
  1319.     @item = item
  1320.     @max = max
  1321.     @price = price
  1322.     @number = 1
  1323.     refresh
  1324.   end
  1325.   #--------------------------------------------------------------------------
  1326.   # ● 被输入的件数设置
  1327.   #--------------------------------------------------------------------------
  1328.   def number
  1329.     return @number
  1330.   end
  1331.   #--------------------------------------------------------------------------
  1332.   # ● 刷新
  1333.   #--------------------------------------------------------------------------
  1334.   def refresh
  1335.     self.contents.clear
  1336.     draw_item_name(@item, 4, 96)
  1337.     self.contents.font.color = normal_color
  1338.     self.contents.draw_text(140, 130, 32, 32, "×")
  1339.     self.contents.draw_text(180, 130, 24, 32, @number.to_s, 2)
  1340.     self.cursor_rect.set(178, 130, 32, 32)
  1341.     # 描绘合计价格和货币单位
  1342.     domination = $data_system.words.gold
  1343.     cx = contents.text_size(domination).width
  1344.     total_price = @price * @number
  1345.     self.contents.font.color = normal_color
  1346.     self.contents.draw_text(4, 160, 200-cx-2, 32, total_price.to_s, 2)
  1347.     self.contents.font.color = system_color
  1348.     self.contents.draw_text(204-cx, 160, cx, 32, domination, 2)
  1349.   end
  1350.   #--------------------------------------------------------------------------
  1351.   # ● 刷新画面
  1352.   #--------------------------------------------------------------------------
  1353.   def update
  1354.     super
  1355.     if self.active
  1356.       # 光标右 (+1)
  1357.       if Input.repeat?(Input::RIGHT) and @number < @max
  1358.         $game_system.se_play($data_system.cursor_se)
  1359.         @number += 1
  1360.         refresh
  1361.       end
  1362.       # 光标左 (-1)
  1363.       if Input.repeat?(Input::LEFT) and @number > 1
  1364.         $game_system.se_play($data_system.cursor_se)
  1365.         @number -= 1
  1366.         refresh
  1367.       end
  1368.       # 光标上 (+10)
  1369.       if Input.repeat?(Input::UP) and @number < @max
  1370.         $game_system.se_play($data_system.cursor_se)
  1371.         @number = [@number + 10, @max].min
  1372.         refresh
  1373.       end
  1374.       # 光标下 (-10)
  1375.       if Input.repeat?(Input::DOWN) and @number > 1
  1376.         $game_system.se_play($data_system.cursor_se)
  1377.         @number = [@number - 10, 1].max
  1378.         refresh
  1379.       end
  1380.     end
  1381.   end
  1382. end
  1383. #==============================================================================
  1384. # ■ Window_ShopStatus
  1385. #------------------------------------------------------------------------------
  1386. #  商店画面、显示物品所持数与角色装备的窗口。
  1387. #==============================================================================
  1388.  
  1389. class Window_ShopStatus < Window_Base
  1390.   #--------------------------------------------------------------------------
  1391.   # ● 初始化对像
  1392.   #--------------------------------------------------------------------------
  1393.   def initialize
  1394.     super(320, 128, 250, 352)
  1395.     self.contents = Bitmap.new(width - 32, height - 32)
  1396.     @item = nil
  1397.     refresh
  1398.   end
  1399.   #--------------------------------------------------------------------------
  1400.   # ● 刷新
  1401.   #--------------------------------------------------------------------------
  1402.   def refresh
  1403.     self.contents.clear
  1404.     if @item == nil
  1405.       return
  1406.     end
  1407.     case @item
  1408.     when RPG::Item
  1409.       number = $game_party.item_number(@item.id)
  1410.     when RPG::Weapon
  1411.       number = $game_party.weapon_number(@item.id)
  1412.     when RPG::Armor
  1413.       number = $game_party.armor_number(@item.id)
  1414.     end
  1415.     self.contents.font.color = system_color
  1416.     self.contents.draw_text(4, 0, 200, 32, "所持数")
  1417.     self.contents.font.color = normal_color
  1418.     self.contents.draw_text(180, 0, 32, 32, number.to_s, 2)
  1419.     if @item.is_a?(RPG::Item)
  1420.       return
  1421.     end
  1422.  
  1423.     # 添加装备品信息
  1424.     for i in 0...$game_party.actors.size
  1425.       # 获取角色
  1426.       actor = $game_party.actors[i]
  1427.       # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
  1428.       if actor.equippable?(@item)
  1429.         self.contents.font.color = normal_color
  1430.       else
  1431.         self.contents.font.color = disabled_color
  1432.       end
  1433.  
  1434.       # 描绘角色名字
  1435.       self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
  1436.       # 获取当前的装备品
  1437.       if @item.is_a?(RPG::Weapon)
  1438.         item1 = $data_weapons[actor.weapon_id]
  1439.       elsif @item.kind == 0
  1440.         item1 = $data_armors[actor.armor1_id]
  1441.       elsif @item.kind == 1
  1442.         item1 = $data_armors[actor.armor2_id]
  1443.       elsif @item.kind == 2
  1444.         item1 = $data_armors[actor.armor3_id]
  1445.       else
  1446.         item1 = $data_armors[actor.armor4_id]
  1447.       end
  1448.       # 可以装备的情况
  1449.       if actor.equippable?(@item)
  1450.         # 武器的情况
  1451.         if @item.is_a?(RPG::Weapon)
  1452.           atk1 = item1 != nil ? item1.atk : 0
  1453.           atk2 = @item != nil ? @item.atk : 0
  1454.           change = atk2 - atk1
  1455.         end
  1456.         # 防具的情况
  1457.         if @item.is_a?(RPG::Armor)
  1458.           pdef1 = item1 != nil ? item1.pdef : 0
  1459.           mdef1 = item1 != nil ? item1.mdef : 0
  1460.           pdef2 = @item != nil ? @item.pdef : 0
  1461.           mdef2 = @item != nil ? @item.mdef : 0
  1462.           change = pdef2 - pdef1 + mdef2 - mdef1
  1463.         end
  1464.         # 描绘能力值变化
  1465.         self.contents.draw_text(100, 64 + 64 * i, 112, 32,
  1466.           sprintf("%+d", change), 2)
  1467.       end
  1468.       # 描绘物品
  1469.       if item1 != nil
  1470.         x = 4
  1471.         y = 64 + 64 * i + 32
  1472.         bitmap = RPG::Cache.icon(item1.icon_name)
  1473.         opacity = self.contents.font.color == normal_color ? 255 : 128
  1474.         self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1475.         self.contents.draw_text(x + 28, y, 212, 32, item1.name)
  1476.       end
  1477.     end
  1478.   end
  1479.   #--------------------------------------------------------------------------
  1480.   # ● 设置物品
  1481.   #     item : 新的物品
  1482.   #--------------------------------------------------------------------------
  1483.   def item=(item)
  1484.     if @item != item
  1485.       @item = item
  1486.       refresh
  1487.     end
  1488.   end
  1489. end
  1490. #==============================================================================
  1491. # ■ Scene_Menu
  1492. #------------------------------------------------------------------------------
  1493. #  处理菜单画面的类。
  1494. #==============================================================================
  1495.  
  1496. class Scene_Menu
  1497.   #--------------------------------------------------------------------------
  1498.   # ● 初始化对像
  1499.   #     menu_index : 命令光标的初期位置
  1500.   #--------------------------------------------------------------------------
  1501.   def initialize(menu_index = 0)
  1502.     @menu_index = menu_index
  1503.   end
  1504.   #--------------------------------------------------------------------------
  1505.   # ● 主处理
  1506.   #--------------------------------------------------------------------------
  1507.   def main
  1508.     # 生成命令窗口
  1509.     s1 = $data_system.words.item
  1510.     s2 = $data_system.words.skill
  1511.     s3 = $data_system.words.equip
  1512.     s4 = "状态"
  1513.     s5 = "存档"
  1514.     s6 = "结束"
  1515.     @command_window = Window_Command1.new(640, [s1, s2, s3, s4,"任务", s5, s6])
  1516.     @command_window.index = @menu_index
  1517.     # 同伴人数为 0 的情况下
  1518.     if $game_party.actors.size == 0
  1519.       # 物品、特技、装备、状态无效化
  1520.       @command_window.disable_item(0)
  1521.       @command_window.disable_item(1)
  1522.       @command_window.disable_item(2)
  1523.       @command_window.disable_item(3)
  1524.     end
  1525.     # 禁止存档的情况下
  1526.     if $game_system.save_disabled
  1527.       # 存档无效
  1528.       @command_window.disable_item(4)
  1529.     end
  1530.     # 生成游戏时间窗口
  1531.     @playtime_window = Window_PlayTime.new
  1532.     @playtime_window.x = 320
  1533.     @playtime_window.y = 385
  1534.     # 生成步数窗口
  1535.     @steps_window = Window_Steps.new
  1536.     @steps_window.x = 160
  1537.     @steps_window.y = 385
  1538.     # 生成金钱窗口
  1539.     @gold_window = Window_Gold.new
  1540.     @gold_window.x = 480
  1541.     @gold_window.y = 385
  1542.     # 生成状态窗口
  1543.     @status_window = Window_MenuStatus.new
  1544.     @status_window.x = 0
  1545.     @status_window.y = 64
  1546.  
  1547.  
  1548.     @map_window = Window_Map.new
  1549.     @map_window.x = 0
  1550.     @map_window.y = 385
  1551.  
  1552.     @A_window = Window_A.new
  1553.     @A_window.x = 0
  1554.     @A_window.y = 64
  1555.  
  1556.      @B_window = Window_B.new
  1557.     @B_window.x = 160
  1558.     @B_window.y = 64
  1559.  
  1560.      @C_window = Window_C.new
  1561.     @C_window.x = 320
  1562.     @C_window.y = 64
  1563.  
  1564.      @D_window = Window_D.new
  1565.     @D_window.x = 480
  1566.     @D_window.y = 64
  1567.     # 执行过渡
  1568.     Graphics.transition
  1569.     # 主循环
  1570.     loop do
  1571.       # 刷新游戏画面
  1572.       Graphics.update
  1573.       # 刷新输入信息
  1574.       Input.update
  1575.       # 刷新画面
  1576.       update
  1577.       # 如果切换画面就中断循环
  1578.       if $scene != self
  1579.         break
  1580.       end
  1581.     end
  1582.     # 准备过渡
  1583.     Graphics.freeze
  1584.     # 释放窗口
  1585.     @command_window.dispose
  1586.     @playtime_window.dispose
  1587.     @steps_window.dispose
  1588.     @gold_window.dispose
  1589.     @status_window.dispose
  1590.     @map_window.dispose
  1591.     @A_window.dispose
  1592.      @B_window.dispose
  1593.       @C_window.dispose
  1594.        @D_window.dispose
  1595.   end
  1596.   #--------------------------------------------------------------------------
  1597.   # ● 刷新画面
  1598.   #--------------------------------------------------------------------------
  1599.   def update
  1600.     # 刷新窗口
  1601.     @command_window.update
  1602.     @playtime_window.update
  1603.     @steps_window.update
  1604.     @gold_window.update
  1605.     @status_window.update
  1606.     @map_window.update
  1607.     @A_window.update
  1608.      @B_window.update
  1609.      @C_window.update
  1610.      @D_window.update
  1611.     # 命令窗口被激活的情况下: 调用 update_command
  1612.     if @command_window.active
  1613.       update_command
  1614.       return
  1615.     end
  1616.     # 状态窗口被激活的情况下: 调用 update_status
  1617.     if @status_window.active
  1618.       update_status
  1619.       return
  1620.     end
  1621.   end
  1622.   #--------------------------------------------------------------------------
  1623.   # ● 刷新画面 (命令窗口被激活的情况下)
  1624.   #--------------------------------------------------------------------------
  1625.   def update_command
  1626.     # 按下 B 键的情况下
  1627.     if Input.trigger?(Input::B)
  1628.       # 演奏取消 SE
  1629.       $game_system.se_play($data_system.cancel_se)
  1630.       # 切换的地图画面
  1631.       $scene = Scene_Map.new
  1632.       return
  1633.     end
  1634.     # 按下 C 键的情况下
  1635.     if Input.trigger?(Input::C)
  1636.       # 同伴人数为 0、存档、游戏结束以外的场合
  1637.       if $game_party.actors.size == 0 and @command_window.index < 4
  1638.         # 演奏冻结 SE
  1639.         $game_system.se_play($data_system.buzzer_se)
  1640.         return
  1641.       end
  1642.       # 命令窗口的光标位置分支
  1643.       case @command_window.index
  1644.       when 0  # 物品
  1645.         # 演奏确定 SE
  1646.         $game_system.se_play($data_system.decision_se)
  1647.         # 切换到物品画面
  1648.         $scene = Scene_Item.new
  1649.       when 1  # 特技
  1650.         # 演奏确定 SE
  1651.         $game_system.se_play($data_system.decision_se)
  1652.         # 激活状态窗口
  1653.         @command_window.active = false
  1654.         @status_window.active = true
  1655.         @status_window.index = 0
  1656.       when 2  # 装备
  1657.         # 演奏确定 SE
  1658.         $game_system.se_play($data_system.decision_se)
  1659.         # 激活状态窗口
  1660.         @command_window.active = false
  1661.         @status_window.active = true
  1662.         @status_window.index = 0
  1663.       when 3  # 状态
  1664.         # 演奏确定 SE
  1665.         $game_system.se_play($data_system.decision_se)
  1666.         # 激活状态窗口
  1667.         @command_window.active = false
  1668.         @status_window.active = true
  1669.         @status_window.index = 0
  1670.  
  1671.       when 4  # 任务
  1672.         # 演奏确定 SE
  1673.         $game_system.se_play($data_system.decision_se)
  1674.         # 激活状态窗口
  1675.         $scene = Scene_Mission.new
  1676.  
  1677.  
  1678.       when 5  # 存档
  1679.         # 禁止存档的情况下
  1680.         if $game_system.save_disabled
  1681.           # 演奏冻结 SE
  1682.           $game_system.se_play($data_system.buzzer_se)
  1683.           return
  1684.         end
  1685.         # 演奏确定 SE
  1686.         $game_system.se_play($data_system.decision_se)
  1687.         # 切换到存档画面
  1688.         $scene = Scene_Save.new
  1689.       when 6  # 游戏结束
  1690.         # 演奏确定 SE
  1691.         $game_system.se_play($data_system.decision_se)
  1692.         # 切换到游戏结束画面
  1693.         $scene = Scene_End.new
  1694.       end
  1695.       return
  1696.     end
  1697.   end
  1698.   #--------------------------------------------------------------------------
  1699.   # ● 刷新画面 (状态窗口被激活的情况下)
  1700.   #--------------------------------------------------------------------------
  1701.   def update_status
  1702.     # 按下 B 键的情况下
  1703.     if Input.trigger?(Input::B)
  1704.       # 演奏取消 SE
  1705.       $game_system.se_play($data_system.cancel_se)
  1706.       # 激活命令窗口
  1707.       @command_window.active = true
  1708.       @status_window.active = false
  1709.       @status_window.index = -1
  1710.       return
  1711.     end
  1712.     # 按下 C 键的情况下
  1713.     if Input.trigger?(Input::C)
  1714.       # 命令窗口的光标位置分支
  1715.       case @command_window.index
  1716.       when 1  # 特技
  1717.         # 本角色的行动限制在 2 以上的情况下
  1718.         if $game_party.actors[@status_window.index].restriction >= 2
  1719.           # 演奏冻结 SE
  1720.           $game_system.se_play($data_system.buzzer_se)
  1721.           return
  1722.         end
  1723.         # 演奏确定 SE
  1724.         $game_system.se_play($data_system.decision_se)
  1725.         # 切换到特技画面
  1726.         $scene = Scene_Skill.new(@status_window.index)
  1727.       when 2  # 装备
  1728.         # 演奏确定 SE
  1729.         $game_system.se_play($data_system.decision_se)
  1730.         # 切换的装备画面
  1731.         $scene = Scene_Equip.new(@status_window.index)
  1732.       when 3  # 状态
  1733.         # 演奏确定 SE
  1734.         $game_system.se_play($data_system.decision_se)
  1735.         # 切换到状态画面
  1736.         $scene = Scene_Status.new(@status_window.index)
  1737.       end
  1738.       return
  1739.     end
  1740.   end
  1741. end
  1742. #==============================================================================
  1743. # ■ Scene_Item
  1744. #------------------------------------------------------------------------------
  1745. #  处理物品画面的类。
  1746. #==============================================================================
  1747.  
  1748. class Scene_Item
  1749.   #--------------------------------------------------------------------------
  1750.   # ● 主处理
  1751.   #--------------------------------------------------------------------------
  1752.   def main
  1753.     # 生成帮助窗口、物品窗口
  1754.     @help_window = Window_Help.new
  1755.     @item_window = Window_Item.new
  1756.     @Q_window = Window_Q.new
  1757.     # 关联帮助窗口
  1758.     @item_window.help_window = @help_window
  1759.     # 生成目标窗口 (设置为不可见・不活动)
  1760.     @target_window = Window_Target.new
  1761.     @target_window.visible = false
  1762.     @target_window.active = false
  1763.     # 执行过度
  1764.     Graphics.transition
  1765.     # 主循环
  1766.     loop do
  1767.       # 刷新游戏画面
  1768.       Graphics.update
  1769.       # 刷新输入信息
  1770.       Input.update
  1771.       # 刷新画面
  1772.       update
  1773.       # 如果画面切换就中断循环
  1774.       if $scene != self
  1775.         break
  1776.       end
  1777.     end
  1778.     # 装备过渡
  1779.     Graphics.freeze
  1780.     # 释放窗口
  1781.     @help_window.dispose
  1782.     @item_window.dispose
  1783.     @target_window.dispose
  1784.     @Q_window.dispose
  1785.   end
  1786.   #--------------------------------------------------------------------------
  1787.   # ● 刷新画面
  1788.   #--------------------------------------------------------------------------
  1789.   def update
  1790.     # 刷新窗口
  1791.     @help_window.update
  1792.     @item_window.update
  1793.     @target_window.update
  1794.     @Q_window.update
  1795.     # 物品窗口被激活的情况下: 调用 update_item
  1796.     if @item_window.active
  1797.       update_item
  1798.       return
  1799.     end
  1800.     # 目标窗口被激活的情况下: 调用 update_target
  1801.     if @target_window.active
  1802.       update_target
  1803.       return
  1804.     end
  1805.   end
  1806.   #--------------------------------------------------------------------------
  1807.   # ● 刷新画面 (物品窗口被激活的情况下)
  1808.   #--------------------------------------------------------------------------
  1809.   def update_item
  1810.     # 按下 B 键的情况下
  1811.     if Input.trigger?(Input::B)
  1812.       # 演奏取消 SE
  1813.       $game_system.se_play($data_system.cancel_se)
  1814.       # 切换到菜单画面
  1815.       $scene = Scene_Menu.new(0)
  1816.       return
  1817.     end
  1818.     # 按下 C 键的情况下
  1819.     if Input.trigger?(Input::C)
  1820.       # 获取物品窗口当前选中的物品数据
  1821.       @item = @item_window.item
  1822.       # 不使用物品的情况下
  1823.       unless @item.is_a?(RPG::Item)
  1824.         # 演奏冻结 SE
  1825.         $game_system.se_play($data_system.buzzer_se)
  1826.         return
  1827.       end
  1828.       # 不能使用的情况下
  1829.       unless $game_party.item_can_use?(@item.id)
  1830.         # 演奏冻结 SE
  1831.         $game_system.se_play($data_system.buzzer_se)
  1832.         return
  1833.       end
  1834.       # 演奏确定 SE
  1835.       $game_system.se_play($data_system.decision_se)
  1836.       # 效果范围是我方的情况下
  1837.       if @item.scope >= 3
  1838.         # 激活目标窗口
  1839.         @item_window.active = false
  1840.         @target_window.x = (@item_window.index + 1) % 2 * 304
  1841.         @target_window.visible = true
  1842.         @target_window.active = true
  1843.         # 设置效果范围 (单体/全体) 的对应光标位置
  1844.         if @item.scope == 4 || @item.scope == 6
  1845.           @target_window.index = -1
  1846.         else
  1847.           @target_window.index = 0
  1848.         end
  1849.       # 效果在我方以外的情况下
  1850.       else
  1851.         # 公共事件 ID 有效的情况下
  1852.         if @item.common_event_id > 0
  1853.           # 预约调用公共事件
  1854.           $game_temp.common_event_id = @item.common_event_id
  1855.           # 演奏物品使用时的 SE
  1856.           $game_system.se_play(@item.menu_se)
  1857.           # 消耗品的情况下
  1858.           if @item.consumable
  1859.             # 使用的物品数减 1
  1860.             $game_party.lose_item(@item.id, 1)
  1861.             # 再描绘物品窗口的项目
  1862.             @item_window.draw_item(@item_window.index)
  1863.           end
  1864.           # 切换到地图画面
  1865.           $scene = Scene_Map.new
  1866.           return
  1867.         end
  1868.       end
  1869.       return
  1870.     end
  1871.   end
  1872.   #--------------------------------------------------------------------------
  1873.   # ● 刷新画面 (目标窗口被激活的情况下)
  1874.   #--------------------------------------------------------------------------
  1875.   def update_target
  1876.     # 按下 B 键的情况下
  1877.     if Input.trigger?(Input::B)
  1878.       # 演奏取消 SE
  1879.       $game_system.se_play($data_system.cancel_se)
  1880.       # 由于物品用完而不能使用的场合
  1881.       unless $game_party.item_can_use?(@item.id)
  1882.         # 再次生成物品窗口的内容
  1883.         @item_window.refresh
  1884.       end
  1885.       # 删除目标窗口
  1886.       @item_window.active = true
  1887.       @target_window.visible = false
  1888.       @target_window.active = false
  1889.       return
  1890.     end
  1891.     # 按下 C 键的情况下
  1892.     if Input.trigger?(Input::C)
  1893.       # 如果物品用完的情况下
  1894.       if $game_party.item_number(@item.id) == 0
  1895.         # 演奏冻结 SE
  1896.         $game_system.se_play($data_system.buzzer_se)
  1897.         return
  1898.       end
  1899.       # 目标是全体的情况下
  1900.       if @target_window.index == -1
  1901.         # 对同伴全体应用物品使用效果
  1902.         used = false
  1903.         for i in $game_party.actors
  1904.           used |= i.item_effect(@item)
  1905.         end
  1906.       end
  1907.       # 目标是单体的情况下
  1908.       if @target_window.index >= 0
  1909.         # 对目标角色应用物品的使用效果
  1910.         target = $game_party.actors[@target_window.index]
  1911.         used = target.item_effect(@item)
  1912.       end
  1913.       # 使用物品的情况下
  1914.       if used
  1915.         # 演奏物品使用时的 SE
  1916.         $game_system.se_play(@item.menu_se)
  1917.         # 消耗品的情况下
  1918.         if @item.consumable
  1919.           # 使用的物品数减 1
  1920.           $game_party.lose_item(@item.id, 1)
  1921.           # 再描绘物品窗口的项目
  1922.           @item_window.draw_item(@item_window.index)
  1923.         end
  1924.         # 再生成目标窗口的内容
  1925.         @target_window.refresh
  1926.         # 全灭的情况下
  1927.         if $game_party.all_dead?
  1928.           # 切换到游戏结束画面
  1929.           $scene = Scene_Gameover.new
  1930.           return
  1931.         end
  1932.         # 公共事件 ID 有效的情况下
  1933.         if @item.common_event_id > 0
  1934.           # 预约调用公共事件
  1935.           $game_temp.common_event_id = @item.common_event_id
  1936.           # 切换到地图画面
  1937.           $scene = Scene_Map.new
  1938.           return
  1939.         end
  1940.       end
  1941.       # 无法使用物品的情况下
  1942.       unless used
  1943.         # 演奏冻结 SE
  1944.         $game_system.se_play($data_system.buzzer_se)
  1945.       end
  1946.       return
  1947.     end
  1948.   end
  1949. end
  1950. #==============================================================================
  1951. # ■ Scene_Skill
  1952. #------------------------------------------------------------------------------
  1953. #  处理特技画面的类。
  1954. #==============================================================================
  1955.  
  1956. class Scene_Skill
  1957.   #--------------------------------------------------------------------------
  1958.   # ● 初始化对像
  1959.   #     actor_index : 角色索引
  1960.   #--------------------------------------------------------------------------
  1961.   def initialize(actor_index = 0, equip_index = 0)
  1962.     @actor_index = actor_index
  1963.   end
  1964.   #--------------------------------------------------------------------------
  1965.   # ● 主处理
  1966.   #--------------------------------------------------------------------------
  1967.   def main
  1968.     # 获取角色
  1969.     @actor = $game_party.actors[@actor_index]
  1970.     # 生成帮助窗口、状态窗口、特技窗口
  1971.     @help_window = Window_Help.new
  1972.     @Q_window = Window_Q.new
  1973.     @status_window = Window_SkillStatus.new(@actor)
  1974.     @skill_window = Window_Skill.new(@actor)
  1975.     # 关联帮助窗口
  1976.     @skill_window.help_window = @help_window
  1977.     # 生成目标窗口 (设置为不可见・不活动)
  1978.     @target_window = Window_Target.new
  1979.     @target_window.visible = false
  1980.     @target_window.active = false
  1981.     # 执行过渡
  1982.     Graphics.transition
  1983.     # 主循环
  1984.     loop do
  1985.       # 刷新游戏画面
  1986.       Graphics.update
  1987.       # 刷新输入信息
  1988.       Input.update
  1989.       # 刷新画面
  1990.       update
  1991.       # 如果画面切换的话就中断循环
  1992.       if $scene != self
  1993.         break
  1994.       end
  1995.     end
  1996.     # 准备过渡
  1997.     Graphics.freeze
  1998.     # 释放窗口
  1999.     @help_window.dispose
  2000.     @status_window.dispose
  2001.     @skill_window.dispose
  2002.     @target_window.dispose
  2003.      @Q_window.dispose
  2004.   end
  2005.   #--------------------------------------------------------------------------
  2006.   # ● 刷新画面
  2007.   #--------------------------------------------------------------------------
  2008.   def update
  2009.     # 刷新窗口
  2010.     @help_window.update
  2011.     @status_window.update
  2012.     @skill_window.update
  2013.     @target_window.update
  2014.      @Q_window.update
  2015.     # 特技窗口被激活的情况下: 调用 update_skill
  2016.     if @skill_window.active
  2017.       update_skill
  2018.       return
  2019.     end
  2020.     # 目标窗口被激活的情况下: 调用 update_target
  2021.     if @target_window.active
  2022.       update_target
  2023.       return
  2024.     end
  2025.   end
  2026.   #--------------------------------------------------------------------------
  2027.   # ● 刷新画面 (特技窗口被激活的情况下)
  2028.   #--------------------------------------------------------------------------
  2029.   def update_skill
  2030.     # 按下 B 键的情况下
  2031.     if Input.trigger?(Input::B)
  2032.       # 演奏取消 SE
  2033.       $game_system.se_play($data_system.cancel_se)
  2034.       # 切换到菜单画面
  2035.       $scene = Scene_Menu.new(1)
  2036.       return
  2037.     end
  2038.     # 按下 C 键的情况下
  2039.     if Input.trigger?(Input::C)
  2040.       # 获取特技窗口现在选择的特技的数据
  2041.       @skill = @skill_window.skill
  2042.       # 不能使用的情况下
  2043.       if @skill == nil or not @actor.skill_can_use?(@skill.id)
  2044.         # 演奏冻结 SE
  2045.         $game_system.se_play($data_system.buzzer_se)
  2046.         return
  2047.       end
  2048.       # 演奏确定 SE
  2049.       $game_system.se_play($data_system.decision_se)
  2050.       # 效果范围是我方的情况下
  2051.       if @skill.scope >= 3
  2052.         # 激活目标窗口
  2053.         @skill_window.active = false
  2054.         @target_window.x = (@skill_window.index + 1) % 2 * 304
  2055.         @target_window.visible = true
  2056.         @target_window.active = true
  2057.         # 设置效果范围 (单体/全体) 的对应光标位置
  2058.         if @skill.scope == 4 || @skill.scope == 6
  2059.           @target_window.index = -1
  2060.         elsif @skill.scope == 7
  2061.           @target_window.index = @actor_index - 10
  2062.         else
  2063.           @target_window.index = 0
  2064.         end
  2065.       # 效果在我方以外的情况下
  2066.       else
  2067.         # 公共事件 ID 有效的情况下
  2068.         if @skill.common_event_id > 0
  2069.           # 预约调用公共事件
  2070.           $game_temp.common_event_id = @skill.common_event_id
  2071.           # 演奏特技使用时的 SE
  2072.           $game_system.se_play(@skill.menu_se)
  2073.           # 消耗 SP
  2074.           @actor.sp -= @skill.sp_cost
  2075.           # 再生成各窗口的内容
  2076.           @status_window.refresh
  2077.           @skill_window.refresh
  2078.           @target_window.refresh
  2079.           # 切换到地图画面
  2080.           $scene = Scene_Map.new
  2081.           return
  2082.         end
  2083.       end
  2084.       return
  2085.     end
  2086.     # 按下 R 键的情况下
  2087.     if Input.trigger?(Input::R)
  2088.       # 演奏光标 SE
  2089.       $game_system.se_play($data_system.cursor_se)
  2090.       # 移至下一位角色
  2091.       @actor_index += 1
  2092.       @actor_index %= $game_party.actors.size
  2093.       # 切换到别的特技画面
  2094.       $scene = Scene_Skill.new(@actor_index)
  2095.       return
  2096.     end
  2097.     # 按下 L 键的情况下
  2098.     if Input.trigger?(Input::L)
  2099.       # 演奏光标 SE
  2100.       $game_system.se_play($data_system.cursor_se)
  2101.       # 移至上一位角色
  2102.       @actor_index += $game_party.actors.size - 1
  2103.       @actor_index %= $game_party.actors.size
  2104.       # 切换到别的特技画面
  2105.       $scene = Scene_Skill.new(@actor_index)
  2106.       return
  2107.     end
  2108.   end
  2109.   #--------------------------------------------------------------------------
  2110.   # ● 刷新画面 (目标窗口被激活的情况下)
  2111.   #--------------------------------------------------------------------------
  2112.   def update_target
  2113.     # 按下 B 键的情况下
  2114.     if Input.trigger?(Input::B)
  2115.       # 演奏取消 SE
  2116.       $game_system.se_play($data_system.cancel_se)
  2117.       # 删除目标窗口
  2118.       @skill_window.active = true
  2119.       @target_window.visible = false
  2120.       @target_window.active = false
  2121.       return
  2122.     end
  2123.     # 按下 C 键的情况下
  2124.     if Input.trigger?(Input::C)
  2125.       # 因为 SP 不足而无法使用的情况下
  2126.       unless @actor.skill_can_use?(@skill.id)
  2127.         # 演奏冻结 SE
  2128.         $game_system.se_play($data_system.buzzer_se)
  2129.         return
  2130.       end
  2131.       # 目标是全体的情况下
  2132.       if @target_window.index == -1
  2133.         # 对同伴全体应用特技使用效果
  2134.         used = false
  2135.         for i in $game_party.actors
  2136.           used |= i.skill_effect(@actor, @skill)
  2137.         end
  2138.       end
  2139.       # 目标是使用者的情况下
  2140.       if @target_window.index <= -2
  2141.         # 对目标角色应用特技的使用效果
  2142.         target = $game_party.actors[@target_window.index + 10]
  2143.         used = target.skill_effect(@actor, @skill)
  2144.       end
  2145.       # 目标是单体的情况下
  2146.       if @target_window.index >= 0
  2147.         # 对目标角色应用特技的使用效果
  2148.         target = $game_party.actors[@target_window.index]
  2149.         used = target.skill_effect(@actor, @skill)
  2150.       end
  2151.       # 使用特技的情况下
  2152.       if used
  2153.         # 演奏特技使用时的 SE
  2154.         $game_system.se_play(@skill.menu_se)
  2155.         # 消耗 SP
  2156.         @actor.sp -= @skill.sp_cost
  2157.         # 再生成各窗口内容
  2158.         @status_window.refresh
  2159.         @skill_window.refresh
  2160.         @target_window.refresh
  2161.         # 全灭的情况下
  2162.         if $game_party.all_dead?
  2163.           # 切换到游戏结束画面
  2164.           $scene = Scene_Gameover.new
  2165.           return
  2166.         end
  2167.         # 公共事件 ID 有效的情况下
  2168.         if @skill.common_event_id > 0
  2169.           # 预约调用公共事件
  2170.           $game_temp.common_event_id = @skill.common_event_id
  2171.           # 切换到地图画面
  2172.           $scene = Scene_Map.new
  2173.           return
  2174.         end
  2175.       end
  2176.       # 无法使用特技的情况下
  2177.       unless used
  2178.         # 演奏冻结 SE
  2179.         $game_system.se_play($data_system.buzzer_se)
  2180.       end
  2181.       return
  2182.     end
  2183.   end
  2184. end
  2185. #==============================================================================
  2186. # ■ Scene_Equip
  2187. #------------------------------------------------------------------------------
  2188. #  处理装备画面的类。
  2189. #==============================================================================
  2190.  
  2191. class Scene_Equip
  2192.   #--------------------------------------------------------------------------
  2193.   # ● 初始化对像
  2194.   #     actor_index : 角色索引
  2195.   #     equip_index : 装备索引
  2196.   #--------------------------------------------------------------------------
  2197.   def initialize(actor_index = 0, equip_index = 0)
  2198.     @actor_index = actor_index
  2199.     @equip_index = equip_index
  2200.   end
  2201.   #--------------------------------------------------------------------------
  2202.   # ● 主处理
  2203.   #--------------------------------------------------------------------------
  2204.   def main
  2205.     # 获取角色
  2206.     @actor = $game_party.actors[@actor_index]
  2207.     # 生成窗口
  2208.     @help_window = Window_Help.new
  2209.     @left_window = Window_EquipLeft.new(@actor)
  2210.     @right_window = Window_EquipRight.new(@actor)
  2211.     @item_window1 = Window_EquipItem.new(@actor, 0)
  2212.     @item_window2 = Window_EquipItem.new(@actor, 1)
  2213.     @item_window3 = Window_EquipItem.new(@actor, 2)
  2214.     @item_window4 = Window_EquipItem.new(@actor, 3)
  2215.     @item_window5 = Window_EquipItem.new(@actor, 4)
  2216.     # 关联帮助窗口
  2217.     @right_window.help_window = @help_window
  2218.     @item_window1.help_window = @help_window
  2219.     @item_window2.help_window = @help_window
  2220.     @item_window3.help_window = @help_window
  2221.     @item_window4.help_window = @help_window
  2222.     @item_window5.help_window = @help_window
  2223.     # 设置光标位置
  2224.     @right_window.index = @equip_index
  2225.     refresh
  2226.     # 执行过渡
  2227.     Graphics.transition
  2228.     # 主循环
  2229.     loop do
  2230.       # 刷新游戏画面
  2231.       Graphics.update
  2232.       # 刷新输入信息
  2233.       Input.update
  2234.       # 刷新画面
  2235.       update
  2236.       # 如果画面切换的话的就中断循环
  2237.       if $scene != self
  2238.         break
  2239.       end
  2240.     end
  2241.     # 准备过渡
  2242.     Graphics.freeze
  2243.     # 释放窗口
  2244.     @help_window.dispose
  2245.     @left_window.dispose
  2246.     @right_window.dispose
  2247.     @item_window1.dispose
  2248.     @item_window2.dispose
  2249.     @item_window3.dispose
  2250.     @item_window4.dispose
  2251.     @item_window5.dispose
  2252.   end
  2253.   #--------------------------------------------------------------------------
  2254.   # ● 刷新
  2255.   #--------------------------------------------------------------------------
  2256.   def refresh
  2257.     # 设置物品窗口的可视状态
  2258.     @item_window1.visible = (@right_window.index == 0)
  2259.     @item_window2.visible = (@right_window.index == 1)
  2260.     @item_window3.visible = (@right_window.index == 2)
  2261.     @item_window4.visible = (@right_window.index == 3)
  2262.     @item_window5.visible = (@right_window.index == 4)
  2263.     # 获取当前装备中的物品
  2264.     item1 = @right_window.item
  2265.     # 设置当前的物品窗口到 @item_window
  2266.     case @right_window.index
  2267.     when 0
  2268.       @item_window = @item_window1
  2269.     when 1
  2270.       @item_window = @item_window2
  2271.     when 2
  2272.       @item_window = @item_window3
  2273.     when 3
  2274.       @item_window = @item_window4
  2275.     when 4
  2276.       @item_window = @item_window5
  2277.     end
  2278.     # 右窗口被激活的情况下
  2279.     if @right_window.active
  2280.       # 删除变更装备后的能力
  2281.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
  2282.     end
  2283.     # 物品窗口被激活的情况下
  2284.     if @item_window.active
  2285.       # 获取现在选中的物品
  2286.       item2 = @item_window.item
  2287.       # 变更装备
  2288.       last_hp = @actor.hp
  2289.       last_sp = @actor.sp
  2290.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  2291.       # 获取变更装备后的能力值
  2292.       new_atk = @actor.atk
  2293.       new_pdef = @actor.pdef
  2294.       new_mdef = @actor.mdef
  2295.       new_str = @actor.str
  2296.       new_dex = @actor.dex
  2297.       new_eva = @actor.eva
  2298.       new_agi = @actor.agi
  2299.       new_int = @actor.int
  2300.       # 返回到装备
  2301.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  2302.       @actor.hp = last_hp
  2303.       @actor.sp = last_sp
  2304.       # 描画左窗口
  2305.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_eva, new_agi, new_int)
  2306.     end
  2307.   end
  2308.   #--------------------------------------------------------------------------
  2309.   # ● 刷新画面
  2310.   #--------------------------------------------------------------------------
  2311.   def update
  2312.     # 刷新窗口
  2313.     @left_window.update
  2314.     @right_window.update
  2315.     @item_window.update
  2316.     refresh
  2317.     # 右侧窗口被激活的情况下: 调用 update_right
  2318.     if @right_window.active
  2319.       update_right
  2320.       return
  2321.     end
  2322.     # 物品窗口被激活的情况下: 调用 update_item
  2323.     if @item_window.active
  2324.       update_item
  2325.       return
  2326.     end
  2327.   end
  2328.   #--------------------------------------------------------------------------
  2329.   # ● 刷新画面 (右侧窗口被激活的情况下)
  2330.   #--------------------------------------------------------------------------
  2331.   def update_right
  2332.     # 按下 B 键的情况下
  2333.     if Input.trigger?(Input::B)
  2334.       # 演奏取消 SE
  2335.       $game_system.se_play($data_system.cancel_se)
  2336.       # 切换到菜单画面
  2337.       $scene = Scene_Menu.new(2)
  2338.       return
  2339.     end
  2340.     # 按下 C 键的情况下
  2341.     if Input.trigger?(Input::C)
  2342.       # 固定装备的情况下
  2343.       if @actor.equip_fix?(@right_window.index)
  2344.         # 演奏冻结 SE
  2345.         $game_system.se_play($data_system.buzzer_se)
  2346.         return
  2347.       end
  2348.       # 演奏确定 SE
  2349.       $game_system.se_play($data_system.decision_se)
  2350.       # 激活物品窗口
  2351.       @right_window.active = false
  2352.       @item_window.active = true
  2353.       @item_window.index = 0
  2354.       return
  2355.     end
  2356.     # 按下 R 键的情况下
  2357.     if Input.trigger?(Input::R)
  2358.       # 演奏光标 SE
  2359.       $game_system.se_play($data_system.cursor_se)
  2360.       # 移至下一位角色
  2361.       @actor_index += 1
  2362.       @actor_index %= $game_party.actors.size
  2363.       # 切换到别的装备画面
  2364.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  2365.       return
  2366.     end
  2367.     # 按下 L 键的情况下
  2368.     if Input.trigger?(Input::L)
  2369.       # 演奏光标 SE
  2370.       $game_system.se_play($data_system.cursor_se)
  2371.       # 移至上一位角色
  2372.       @actor_index += $game_party.actors.size - 1
  2373.       @actor_index %= $game_party.actors.size
  2374.       # 切换到别的装备画面
  2375.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  2376.       return
  2377.     end
  2378.   end
  2379.   #--------------------------------------------------------------------------
  2380.   # ● 刷新画面 (物品窗口被激活的情况下)
  2381.   #--------------------------------------------------------------------------
  2382.   def update_item
  2383.     # 按下 B 键的情况下
  2384.     if Input.trigger?(Input::B)
  2385.       # 演奏取消 SE
  2386.       $game_system.se_play($data_system.cancel_se)
  2387.       # 激活右侧窗口
  2388.       @right_window.active = true
  2389.       @item_window.active = false
  2390.       @item_window.index = -1
  2391.       return
  2392.     end
  2393.     # 按下 C 键的情况下
  2394.     if Input.trigger?(Input::C)
  2395.       # 演奏装备 SE
  2396.       $game_system.se_play($data_system.equip_se)
  2397.       # 获取物品窗口现在选择的装备数据
  2398.       item = @item_window.item
  2399.       # 变更装备
  2400.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  2401.       # 激活右侧窗口
  2402.       @right_window.active = true
  2403.       @item_window.active = false
  2404.       @item_window.index = -1
  2405.       # 再生成右侧窗口、物品窗口的内容
  2406.       @right_window.refresh
  2407.       @item_window.refresh
  2408.       return
  2409.     end
  2410.   end
  2411. end
  2412. #==============================================================================
  2413. # ■ Scene_Status
  2414. #------------------------------------------------------------------------------
  2415. #  处理状态画面的类。
  2416. #==============================================================================
  2417.  
  2418. class Scene_Status
  2419.   #--------------------------------------------------------------------------
  2420.   # ● 初始化对像
  2421.   #     actor_index : 角色索引
  2422.   #--------------------------------------------------------------------------
  2423.   def initialize(actor_index = 0, equip_index = 0)
  2424.     @actor_index = actor_index
  2425.   end
  2426.   #--------------------------------------------------------------------------
  2427.   # ● 主处理
  2428.   #--------------------------------------------------------------------------
  2429.   def main
  2430.     # 获取角色
  2431.     @actor = $game_party.actors[@actor_index]
  2432.     # 生成状态窗口
  2433.     @status_window = Window_Status.new(@actor)
  2434.     @Q_window = Window_Q.new
  2435.     # 执行过渡
  2436.     Graphics.transition
  2437.     # 主循环
  2438.     loop do
  2439.       # 刷新游戏画面
  2440.       Graphics.update
  2441.       # 刷新输入信息
  2442.       Input.update
  2443.       # 刷新画面
  2444.       update
  2445.       # 如果画面被切换的话就中断循环
  2446.       if $scene != self
  2447.         break
  2448.       end
  2449.     end
  2450.     # 准备过渡
  2451.     Graphics.freeze
  2452.     # 释放窗口
  2453.     @status_window.dispose
  2454.     @Q_window.dispose
  2455.   end
  2456.   #--------------------------------------------------------------------------
  2457.   # ● 刷新画面
  2458.   #--------------------------------------------------------------------------
  2459.   def update
  2460.     # 按下 B 键的情况下
  2461.     if Input.trigger?(Input::B)
  2462.       # 演奏取消 SE
  2463.       $game_system.se_play($data_system.cancel_se)
  2464.       # 切换到菜单画面
  2465.       $scene = Scene_Menu.new(3)
  2466.       return
  2467.     end
  2468.     # 按下 R 键的情况下
  2469.     if Input.trigger?(Input::R)
  2470.       # 演奏光标 SE
  2471.       $game_system.se_play($data_system.cursor_se)
  2472.       # 移至下一位角色
  2473.       @actor_index += 1
  2474.       @actor_index %= $game_party.actors.size
  2475.       # 切换到别的状态画面
  2476.       $scene = Scene_Status.new(@actor_index)
  2477.       return
  2478.     end
  2479.     # 按下 L 键的情况下
  2480.     if Input.trigger?(Input::L)
  2481.       # 演奏光标 SE
  2482.       $game_system.se_play($data_system.cursor_se)
  2483.       # 移至上一位角色
  2484.       @actor_index += $game_party.actors.size - 1
  2485.       @actor_index %= $game_party.actors.size
  2486.       # 切换到别的状态画面
  2487.       $scene = Scene_Status.new(@actor_index)
  2488.       return
  2489.     end
  2490.   end
  2491. end
  2492. #==============================================================================
  2493. # ■ Scene_End
  2494. #------------------------------------------------------------------------------
  2495. #  处理游戏结束画面的类。
  2496. #==============================================================================
  2497.  
  2498. class Scene_End
  2499.   #--------------------------------------------------------------------------
  2500.   # ● 主处理
  2501.   #--------------------------------------------------------------------------
  2502.   def main
  2503.     # 生成命令窗口
  2504.     s1 = "返回标题画面"
  2505.     s2 = "退出"
  2506.     s3 = "取消"
  2507.     @Q_window = Window_Q.new
  2508.     @command_window = Window_Command.new(192, [s1, s2, s3])
  2509.     @command_window.x = 320 - @command_window.width / 2
  2510.     @command_window.y = 240 - @command_window.height / 2
  2511.     # 执行过渡
  2512.     Graphics.transition
  2513.     # 主循环
  2514.     loop do
  2515.       # 刷新游戏画面
  2516.       Graphics.update
  2517.       # 刷新输入情报
  2518.       Input.update
  2519.       # 刷新画面
  2520.       update
  2521.       # 如果画面切换的话就中断循环
  2522.       if $scene != self
  2523.         break
  2524.       end
  2525.     end
  2526.     # 准备过渡
  2527.     Graphics.freeze
  2528.     # 释放窗口
  2529.     @command_window.dispose
  2530.     @Q_window.dispose
  2531.     # 如果在标题画面切换中的情况下
  2532.     if $scene.is_a?(Scene_Title)
  2533.       # 淡入淡出画面
  2534.       Graphics.transition
  2535.       Graphics.freeze
  2536.     end
  2537.   end
  2538.   #--------------------------------------------------------------------------
  2539.   # ● 刷新画面
  2540.   #--------------------------------------------------------------------------
  2541.   def update
  2542.     # 刷新命令窗口
  2543.     @command_window.update
  2544.     @Q_window.update
  2545.     # 按下 B 键的情况下
  2546.     if Input.trigger?(Input::B)
  2547.       # 演奏取消 SE
  2548.       $game_system.se_play($data_system.cancel_se)
  2549.       # 切换到菜单画面
  2550.       $scene = Scene_Menu.new(5)
  2551.       return
  2552.     end
  2553.     # 按下 C 键的场合下
  2554.     if Input.trigger?(Input::C)
  2555.       # 命令窗口光标位置分支
  2556.       case @command_window.index
  2557.       when 0  # 返回标题画面
  2558.         command_to_title
  2559.       when 1  # 退出
  2560.         command_shutdown
  2561.       when 2  # 取消
  2562.         command_cancel
  2563.       end
  2564.       return
  2565.     end
  2566.   end
  2567.   #--------------------------------------------------------------------------
  2568.   # ● 选择命令 [返回标题画面] 时的处理
  2569.   #--------------------------------------------------------------------------
  2570.   def command_to_title
  2571.     # 演奏确定 SE
  2572.     $game_system.se_play($data_system.decision_se)
  2573.     # 淡入淡出 BGM、BGS、ME
  2574.     Audio.bgm_fade(800)
  2575.     Audio.bgs_fade(800)
  2576.     Audio.me_fade(800)
  2577.     # 切换到标题画面
  2578.     $scene = Scene_Title.new
  2579.   end
  2580.   #--------------------------------------------------------------------------
  2581.   # ● 选择命令 [退出] 时的处理
  2582.   #--------------------------------------------------------------------------
  2583.   def command_shutdown
  2584.     # 演奏确定 SE
  2585.     $game_system.se_play($data_system.decision_se)
  2586.     # 淡入淡出 BGM、BGS、ME
  2587.     Audio.bgm_fade(800)
  2588.     Audio.bgs_fade(800)
  2589.     Audio.me_fade(800)
  2590.     # 退出
  2591.     $scene = nil
  2592.   end
  2593.   #--------------------------------------------------------------------------
  2594.   # ● 选择命令 [取消] 时的处理
  2595.   #--------------------------------------------------------------------------
  2596.   def command_cancel
  2597.     # 演奏确定 SE
  2598.     $game_system.se_play($data_system.decision_se)
  2599.     # 切换到菜单画面
  2600.     $scene = Scene_Menu.new(5)
  2601.   end
  2602. end
  2603.  
  2604. #==============================================================================
  2605. # ■ Scene_Shop
  2606. #------------------------------------------------------------------------------
  2607. #  处理商店画面的类。
  2608. #==============================================================================
  2609.  
  2610. class Scene_Shop
  2611.   #--------------------------------------------------------------------------
  2612.   # ● 主处理
  2613.   #--------------------------------------------------------------------------
  2614.   def main
  2615.     # 生成帮助窗口
  2616.     @help_window = Window_Help.new
  2617.     # 生成指令窗口
  2618.     @command_window = Window_ShopCommand.new
  2619.     @Q_window = Window_Q.new
  2620.     # 生成金钱窗口
  2621.     @gold_window = Window_Gold.new
  2622.      @gold_window.opacity = 0
  2623.     @gold_window.x = 480
  2624.     @gold_window.y = 50
  2625.     # 生成时间窗口
  2626.     @dummy_window = Window_Base.new(0, 128, 640, 352)
  2627.     # 生成购买窗口
  2628.     @buy_window = Window_ShopBuy.new($game_temp.shop_goods)
  2629.     @buy_window.active = false
  2630.     @buy_window.visible = false
  2631.     @buy_window.help_window = @help_window
  2632.     # 生成卖出窗口
  2633.     @sell_window = Window_ShopSell.new
  2634.     @sell_window.active = false
  2635.     @sell_window.visible = false
  2636.     @sell_window.help_window = @help_window
  2637.     # 生成数量输入窗口
  2638.     @number_window = Window_ShopNumber.new
  2639.     @number_window.active = false
  2640.     @number_window.visible = false
  2641.     # 生成状态窗口
  2642.     @status_window = Window_ShopStatus.new
  2643.     @status_window.visible = false
  2644.     # 执行过渡
  2645.     Graphics.transition
  2646.     # 主循环
  2647.     loop do
  2648.       # 刷新游戏画面
  2649.       Graphics.update
  2650.       # 刷新输入信息
  2651.       Input.update
  2652.       # 刷新画面
  2653.       update
  2654.       # 如果画面切换的话就中断循环
  2655.       if $scene != self
  2656.         break
  2657.       end
  2658.     end
  2659.     # 准备过渡
  2660.     Graphics.freeze
  2661.     # 释放窗口
  2662.     @help_window.dispose
  2663.     @command_window.dispose
  2664.     @gold_window.dispose
  2665.     @dummy_window.dispose
  2666.     @buy_window.dispose
  2667.     @sell_window.dispose
  2668.     @number_window.dispose
  2669.     @status_window.dispose
  2670.     @Q_window.dispose
  2671.   end
  2672.   #--------------------------------------------------------------------------
  2673.   # ● 刷新画面
  2674.   #--------------------------------------------------------------------------
  2675.   def update
  2676.     # 刷新窗口
  2677.     @help_window.update
  2678.     @command_window.update
  2679.     @gold_window.update
  2680.     @dummy_window.update
  2681.     @buy_window.update
  2682.     @sell_window.update
  2683.     @number_window.update
  2684.     @status_window.update
  2685.     @Q_window.update
  2686.     # 指令窗口激活的情况下: 调用 update_command
  2687.     if @command_window.active
  2688.       update_command
  2689.       return
  2690.     end
  2691.     # 购买窗口激活的情况下: 调用 update_buy
  2692.     if @buy_window.active
  2693.       update_buy
  2694.       return
  2695.     end
  2696.     # 卖出窗口激活的情况下: 调用 update_sell
  2697.     if @sell_window.active
  2698.       update_sell
  2699.       return
  2700.     end
  2701.     # 个数输入窗口激活的情况下: 调用 update_number
  2702.     if @number_window.active
  2703.       update_number
  2704.       return
  2705.     end
  2706.   end
  2707.   #--------------------------------------------------------------------------
  2708.   # ● 刷新画面 (指令窗口激活的情况下)
  2709.   #--------------------------------------------------------------------------
  2710.   def update_command
  2711.     # 按下 B 键的情况下
  2712.     if Input.trigger?(Input::B)
  2713.       # 演奏取消 SE
  2714.       $game_system.se_play($data_system.cancel_se)
  2715.       # 切换到地图画面
  2716.       $scene = Scene_Map.new
  2717.       return
  2718.     end
  2719.     # 按下 C 键的情况下
  2720.     if Input.trigger?(Input::C)
  2721.       # 命令窗口光标位置分支
  2722.       case @command_window.index
  2723.       when 0  # 购买
  2724.         # 演奏确定 SE
  2725.         $game_system.se_play($data_system.decision_se)
  2726.         # 窗口状态转向购买模式
  2727.         @command_window.active = false
  2728.         @dummy_window.visible = false
  2729.         @buy_window.active = true
  2730.         @buy_window.visible = true
  2731.         @buy_window.refresh
  2732.         @status_window.visible = true
  2733.       when 1  # 卖出
  2734.         # 演奏确定 SE
  2735.         $game_system.se_play($data_system.decision_se)
  2736.         # 窗口状态转向卖出模式
  2737.         @command_window.active = false
  2738.         @dummy_window.visible = false
  2739.         @sell_window.active = true
  2740.         @sell_window.visible = true
  2741.         @sell_window.refresh
  2742.       when 2  # 取消
  2743.         # 演奏确定 SE
  2744.         $game_system.se_play($data_system.decision_se)
  2745.         # 切换到地图画面
  2746.         $scene = Scene_Map.new
  2747.       end
  2748.       return
  2749.     end
  2750.   end
  2751.   #--------------------------------------------------------------------------
  2752.   # ● 刷新画面 (购买窗口激活的情况下)
  2753.   #--------------------------------------------------------------------------
  2754.   def update_buy
  2755.     # 设置状态窗口的物品
  2756.     @status_window.item = @buy_window.item
  2757.     # 按下 B 键的情况下
  2758.     if Input.trigger?(Input::B)
  2759.       # 演奏取消 SE
  2760.       $game_system.se_play($data_system.cancel_se)
  2761.       # 窗口状态转向初期模式
  2762.       @command_window.active = true
  2763.       @dummy_window.visible = true
  2764.       @buy_window.active = false
  2765.       @buy_window.visible = false
  2766.       @status_window.visible = false
  2767.       @status_window.item = nil
  2768.       # 删除帮助文本
  2769.       @help_window.set_text("")
  2770.       return
  2771.     end
  2772.     # 按下 C 键的情况下
  2773.     if Input.trigger?(Input::C)
  2774.       # 获取物品
  2775.       @item = @buy_window.item
  2776.       # 物品无效的情况下、或者价格在所持金以上的情况下
  2777.       if @item == nil or @item.price > $game_party.gold
  2778.         # 演奏冻结 SE
  2779.         $game_system.se_play($data_system.buzzer_se)
  2780.         return
  2781.       end
  2782.       # 获取物品所持数
  2783.       case @item
  2784.       when RPG::Item
  2785.         number = $game_party.item_number(@item.id)
  2786.       when RPG::Weapon
  2787.         number = $game_party.weapon_number(@item.id)
  2788.       when RPG::Armor
  2789.         number = $game_party.armor_number(@item.id)
  2790.       end
  2791.       # 如果已经拥有了 99 个情况下
  2792.       if number == 99
  2793.         # 演奏冻结 SE
  2794.         $game_system.se_play($data_system.buzzer_se)
  2795.         return
  2796.       end
  2797.       # 演奏确定 SE
  2798.       $game_system.se_play($data_system.decision_se)
  2799.       # 计算可以最多购买的数量
  2800.       max = @item.price == 0 ? 99 : $game_party.gold / @item.price
  2801.       max = [max, 99 - number].min
  2802.       # 窗口状态转向数值输入模式
  2803.       @buy_window.active = false
  2804.       @buy_window.visible = false
  2805.       @number_window.set(@item, max, @item.price)
  2806.       @number_window.active = true
  2807.       @number_window.visible = true
  2808.     end
  2809.   end
  2810.   #--------------------------------------------------------------------------
  2811.   # ● 画面更新 (卖出窗口激活的情况下)
  2812.   #--------------------------------------------------------------------------
  2813.   def update_sell
  2814.     # 按下 B 键的情况下
  2815.     if Input.trigger?(Input::B)
  2816.       # 演奏取消 SE
  2817.       $game_system.se_play($data_system.cancel_se)
  2818.       # 窗口状态转向初期模式
  2819.       @command_window.active = true
  2820.       @dummy_window.visible = true
  2821.       @sell_window.active = false
  2822.       @sell_window.visible = false
  2823.       @status_window.item = nil
  2824.       # 删除帮助文本
  2825.       @help_window.set_text("")
  2826.       return
  2827.     end
  2828.     # 按下 C 键的情况下
  2829.     if Input.trigger?(Input::C)
  2830.       # 获取物品
  2831.       @item = @sell_window.item
  2832.       # 设置状态窗口的物品
  2833.       @status_window.item = @item
  2834.       # 物品无效的情况下、或者价格为 0 (不能卖出) 的情况下
  2835.       if @item == nil or @item.price == 0
  2836.         # 演奏冻结 SE
  2837.         $game_system.se_play($data_system.buzzer_se)
  2838.         return
  2839.       end
  2840.       # 演奏确定 SE
  2841.       $game_system.se_play($data_system.decision_se)
  2842.       # 获取物品的所持数
  2843.       case @item
  2844.       when RPG::Item
  2845.         number = $game_party.item_number(@item.id)
  2846.       when RPG::Weapon
  2847.         number = $game_party.weapon_number(@item.id)
  2848.       when RPG::Armor
  2849.         number = $game_party.armor_number(@item.id)
  2850.       end
  2851.       # 最大卖出个数 = 物品的所持数
  2852.       max = number
  2853.       # 窗口状态转向个数输入模式
  2854.       @sell_window.active = false
  2855.       @sell_window.visible = false
  2856.       @number_window.set(@item, max, @item.price / 2)
  2857.       @number_window.active = true
  2858.       @number_window.visible = true
  2859.       @status_window.visible = true
  2860.     end
  2861.   end
  2862.   #--------------------------------------------------------------------------
  2863.   # ● 刷新画面 (个数输入窗口激活的情况下)
  2864.   #--------------------------------------------------------------------------
  2865.   def update_number
  2866.     # 按下 B 键的情况下
  2867.     if Input.trigger?(Input::B)
  2868.       # 演奏取消 SE
  2869.       $game_system.se_play($data_system.cancel_se)
  2870.       # 设置个数输入窗口为不活动·非可视状态
  2871.       @number_window.active = false
  2872.       @number_window.visible = false
  2873.       # 命令窗口光标位置分支
  2874.       case @command_window.index
  2875.       when 0  # 购买
  2876.         # 窗口状态转向购买模式
  2877.         @buy_window.active = true
  2878.         @buy_window.visible = true
  2879.       when 1  # 卖出
  2880.         # 窗口状态转向卖出模式
  2881.         @sell_window.active = true
  2882.         @sell_window.visible = true
  2883.         @status_window.visible = false
  2884.       end
  2885.       return
  2886.     end
  2887.     # 按下 C 键的情况下
  2888.     if Input.trigger?(Input::C)
  2889.       # 演奏商店 SE
  2890.       $game_system.se_play($data_system.shop_se)
  2891.       # 设置个数输入窗口为不活动·非可视状态
  2892.       @number_window.active = false
  2893.       @number_window.visible = false
  2894.       # 命令窗口光标位置分支
  2895.       case @command_window.index
  2896.       when 0  # 购买
  2897.         # 购买处理
  2898.         $game_party.lose_gold(@number_window.number * @item.price)
  2899.         case @item
  2900.         when RPG::Item
  2901.           $game_party.gain_item(@item.id, @number_window.number)
  2902.         when RPG::Weapon
  2903.           $game_party.gain_weapon(@item.id, @number_window.number)
  2904.         when RPG::Armor
  2905.           $game_party.gain_armor(@item.id, @number_window.number)
  2906.         end
  2907.         # 刷新各窗口
  2908.         @gold_window.refresh
  2909.         @buy_window.refresh
  2910.         @status_window.refresh
  2911.         # 窗口状态转向购买模式
  2912.         @buy_window.active = true
  2913.         @buy_window.visible = true
  2914.       when 1  # 卖出
  2915.         # 卖出处理
  2916.         $game_party.gain_gold(@number_window.number * (@item.price / 2))
  2917.         case @item
  2918.         when RPG::Item
  2919.           $game_party.lose_item(@item.id, @number_window.number)
  2920.         when RPG::Weapon
  2921.           $game_party.lose_weapon(@item.id, @number_window.number)
  2922.         when RPG::Armor
  2923.           $game_party.lose_armor(@item.id, @number_window.number)
  2924.         end
  2925.         # 刷新各窗口
  2926.         @gold_window.refresh
  2927.         @sell_window.refresh
  2928.         @status_window.refresh
  2929.         # 窗口状态转向卖出模式
  2930.         @sell_window.active = true
  2931.         @sell_window.visible = true
  2932.         @status_window.visible = false
  2933.       end
  2934.       return
  2935.     end
  2936.   end
  2937. end
  2938. #==============================================================================
  2939. # ■ 全部替换 Window_Steps
  2940. #------------------------------------------------------------------------------
  2941. #  菜单画面显示步数的窗口。
  2942. #==============================================================================
  2943.  
  2944. class Window_Map < Window_Base
  2945.   #--------------------------------------------------------------------------
  2946.   # ● 初始化对像
  2947.   #--------------------------------------------------------------------------
  2948.   def initialize
  2949.     super(0, 0, 160, 96)
  2950.     self.contents = Bitmap.new(width - 32, height - 32)
  2951.     refresh
  2952.   end
  2953.   #--------------------------------------------------------------------------
  2954.   # ● 刷新
  2955.   #--------------------------------------------------------------------------
  2956.   def refresh
  2957.      @x = $game_player.x #获取角色X坐标
  2958.      @y = $game_player.y #获取角色Y坐标
  2959.      @id = $game_map.map_id  #获取地图编号
  2960.     self.contents.clear #清除以前的东西
  2961.     $mapnames = load_data("Data/MapInfos.rxdata") #读取地图名文件
  2962.     map_name = $mapnames[@id].name #获得地图名
  2963.     self.contents.font.color = normal_color#颜色,这里是白色~
  2964.     self.contents.draw_text(0, 0, 116, 32, map_name,2)
  2965.     self.contents.font.color = system_color#颜色,暗蓝色
  2966.     self.contents.draw_text(0, 32, 120, 32, "X:")#显示X这个字的位置,引号里面的内容随便改,比如"X坐标地址"
  2967.     self.contents.font.color = normal_color#颜色,这里是白色~
  2968.     self.contents.draw_text(0, 32, 52, 32, @x.to_s,2)
  2969.     self.contents.font.color = system_color#上面那个是X坐标的变量,可以自己更改变量名~
  2970.     self.contents.draw_text(64, 32, 128, 32, "Y:")#显示Y这个字~
  2971.     self.contents.font.color = normal_color
  2972.     self.contents.draw_text(0, 32, 116, 32, @y.to_s,2)
  2973.   end
  2974. end
  2975.  
  2976. class Window_A< Window_Base
  2977.   #--------------------------------------------------------------------------
  2978.   # ● 初始化窗口
  2979.   #--------------------------------------------------------------------------
  2980.   def initialize
  2981.     super(0, 0, 160, 320)
  2982.     #self.back_opacity = 0
  2983.     self.contents = Bitmap.new(width - 32, height - 64)
  2984. #    refresh
  2985.   end
  2986.   #--------------------------------------------------------------------------
  2987.   # ● 刷新
  2988.   #--------------------------------------------------------------------------
  2989. #  def refresh
  2990.     #self.contents.clear
  2991.     #self.contents.font.color = system_color
  2992.    #self.contents.draw_text(4, , 64, 16, "虾米")
  2993. # end
  2994. end
  2995.  
  2996. class Window_B< Window_Base
  2997.   #--------------------------------------------------------------------------
  2998.   # ● 初始化窗口
  2999.   #--------------------------------------------------------------------------
  3000.   def initialize
  3001.     super(0, 0, 160, 320)
  3002.     #self.back_opacity = 0
  3003.     self.contents = Bitmap.new(width - 32, height - 64)
  3004. #    refresh
  3005.   end
  3006.   #--------------------------------------------------------------------------
  3007.   # ● 刷新
  3008.   #--------------------------------------------------------------------------
  3009. #  def refresh
  3010.     #self.contents.clear
  3011.     #self.contents.font.color = system_color
  3012.    #self.contents.draw_text(4, , 64, 16, "虾米")
  3013. # end
  3014. end
  3015.  
  3016. class Window_C< Window_Base
  3017.   #--------------------------------------------------------------------------
  3018.   # ● 初始化窗口
  3019.   #--------------------------------------------------------------------------
  3020.   def initialize
  3021.     super(0, 0, 160, 320)
  3022.     #self.back_opacity = 0
  3023.     self.contents = Bitmap.new(width - 32, height - 64)
  3024. #    refresh
  3025.   end
  3026.   #--------------------------------------------------------------------------
  3027.   # ● 刷新
  3028.   #--------------------------------------------------------------------------
  3029. #  def refresh
  3030.     #self.contents.clear
  3031.     #self.contents.font.color = system_color
  3032.    #self.contents.draw_text(4, , 64, 16, "虾米")
  3033. # end
  3034. end
  3035.  
  3036. class Window_D< Window_Base
  3037.   #--------------------------------------------------------------------------
  3038.   # ● 初始化窗口
  3039.   #--------------------------------------------------------------------------
  3040.   def initialize
  3041.     super(0, 0, 160, 320)
  3042.     #self.back_opacity = 0
  3043.     self.contents = Bitmap.new(width - 32, height - 64)
  3044. #    refresh
  3045.   end
  3046.   #--------------------------------------------------------------------------
  3047.   # ● 刷新
  3048.   #--------------------------------------------------------------------------
  3049. #  def refresh
  3050.     #self.contents.clear
  3051.     #self.contents.font.color = system_color
  3052.    #self.contents.draw_text(4, , 64, 16, "虾米")
  3053. # end
  3054. end
  3055.  
  3056. class Window_Q< Window_Base
  3057.   #--------------------------------------------------------------------------
  3058.   # ● 初始化窗口
  3059.   #--------------------------------------------------------------------------
  3060.   def initialize
  3061.     super(0, 0, 640, 480)
  3062.     #self.back_opacity = 0
  3063.     self.contents = Bitmap.new(width - 32, height - 64)
  3064. #    refresh
  3065.   end
  3066.   #--------------------------------------------------------------------------
  3067.   # ● 刷新
  3068.   #--------------------------------------------------------------------------
  3069. #  def refresh
  3070.     #self.contents.clear
  3071.     #self.contents.font.color = system_color
  3072.    #self.contents.draw_text(4, , 64, 16, "虾米")
  3073. # end
  3074. end
  3075.  
  3076.  
  3077. class Window_Command1 < Window_Selectable
  3078.   #--------------------------------------------------------------------------
  3079.   # ● 初始化对像
  3080.   #     width    : 窗口的宽
  3081.   #     commands : 命令字符串序列
  3082.   #--------------------------------------------------------------------------
  3083.   def initialize(width, commands)
  3084.     # 由命令的个数计算出窗口的高
  3085.     super(0, 0, width, 64)
  3086.     @item_max = commands.size
  3087.     @commands = commands
  3088.     @column_max = commands.size
  3089.     self.contents = Bitmap.new(width - 32, 64- 32)
  3090.     refresh
  3091.     self.index = 0
  3092.   end
  3093.   #--------------------------------------------------------------------------
  3094.   # ● 刷新
  3095.   #--------------------------------------------------------------------------
  3096.   def refresh
  3097.     self.contents.clear
  3098.     for i in 0...@item_max
  3099.       draw_item(i, normal_color)
  3100.     end
  3101.   end
  3102.   #--------------------------------------------------------------------------
  3103.   # ● 描绘项目
  3104.   #     index : 项目编号
  3105.   #     color : 文字色
  3106.   #--------------------------------------------------------------------------
  3107.   def draw_item(index, color)
  3108.     self.contents.font.color = color
  3109.     # 计算光标的宽
  3110.     cursor_width = width / @column_max - 32
  3111.     # 计算光标坐标
  3112.     x = index % @column_max * (cursor_width + 32)
  3113.     #y = @index / @column_max * 32 - self.oy
  3114.     rect = Rect.new(x, 0, cursor_width - 8, 32)
  3115.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3116.     self.contents.draw_text(rect, @commands[index], 1)
  3117.   end
  3118.   #--------------------------------------------------------------------------
  3119.   # ● 项目无效化
  3120.   #     index : 项目编号
  3121.   #--------------------------------------------------------------------------
  3122.   def disable_item(index)
  3123.     draw_item(index, disabled_color)
  3124.   end
  3125. end
  3126.  
  3127. class Game_Actor < Game_Battler
  3128.   def now_exp
  3129.     return @exp - @exp_list[@level]
  3130.   end
  3131.   def next_exp
  3132.     return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  3133.   end
  3134. end
  3135.  
  3136. #==========================================================
  3137. # ■ Window_Base
  3138. #------------------------------------------------------------
  3139. #  ゲーム中のすべてのウィンドウのスーパークラスです。
  3140. #============================================================
  3141.  
  3142. class Window_Base < Window
  3143.   #--------------------------------------------------------
  3144.   # ● HP ゲージの描画
  3145.   #--------------------------------------------------
  3146.   # オリジナルのHP描画を draw_actor_hp_original と名前変更
  3147.   alias :draw_actor_hp_original :draw_actor_hp
  3148.   def draw_actor_hp(actor, x, y, width = 144)
  3149.     # 変数rateに 現在のHP/MHPを代入
  3150.     if actor.maxhp != 0
  3151.       rate = actor.hp.to_f / actor.maxhp
  3152.     else
  3153.       rate = 0
  3154.     end
  3155.     # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
  3156.     # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
  3157.     # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
  3158.     # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
  3159.     # align3:ゲージタイプ 0:左詰め 1:右詰め
  3160.     plus_x = 0
  3161.     rate_x = 0
  3162.     plus_y = 25
  3163.     plus_width = 0
  3164.     rate_width = 85
  3165.     height = 10
  3166.     align1 = 1
  3167.     align2 = 2
  3168.     align3 = 0
  3169.     # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
  3170.     # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
  3171.     grade1 = 1
  3172.     grade2 = 0
  3173.     # 色設定。color1:外枠,color2:中枠
  3174.     # color3:空ゲージダークカラー,color4:空ゲージライトカラー
  3175.     # color5:実ゲージダークカラー,color6:実ゲージライトカラー
  3176.     color1 = Color.new(0, 0, 0, 192)
  3177.     color2 = Color.new(255, 255, 192, 192)
  3178.     color3 = Color.new(0, 0, 0, 192)
  3179.     color4 = Color.new(64, 0, 0, 192)
  3180.     color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
  3181.     color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
  3182.     # 変数spに描画するゲージの幅を代入
  3183.     if actor.maxhp != 0
  3184.       hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
  3185.     else
  3186.       hp = 0
  3187.     end
  3188.     # ゲージの描画
  3189.     gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  3190.                 width, plus_width + width * rate_width / 100,
  3191.                 height, hp, align1, align2, align3,
  3192.                 color1, color2, color3, color4, color5, color6, grade1, grade2)
  3193.     # オリジナルのHP描画処理を呼び出し
  3194.     draw_actor_hp_original(actor, x, y, width)
  3195.   end
  3196.   #--------------------------------------------------------------
  3197.   # ● SP ゲージの描画
  3198.   #------------------------------------------------------------
  3199.   # オリジナルのSP描画を draw_actor_sp_original と名前変更
  3200.   alias :draw_actor_sp_original :draw_actor_sp
  3201.   def draw_actor_sp(actor, x, y, width = 144)
  3202.     # 変数rateに 現在のSP/MSPを代入
  3203.     if actor.maxsp != 0
  3204.       rate = actor.sp.to_f / actor.maxsp
  3205.     else
  3206.       rate = 1
  3207.     end
  3208.     # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
  3209.     # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
  3210.     # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
  3211.     # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
  3212.     # align3:ゲージタイプ 0:左詰め 1:右詰め
  3213.     plus_x = 0
  3214.     rate_x = 0
  3215.     plus_y = 25
  3216.     plus_width = 0
  3217.     rate_width = 85
  3218.     height = 10
  3219.     align1 = 1
  3220.     align2 = 2
  3221.     align3 = 0
  3222.     # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
  3223.     # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
  3224.     grade1 = 1
  3225.     grade2 = 0
  3226.     # 色設定。color1:外枠,color2:中枠
  3227.     # color3:空ゲージダークカラー,color4:空ゲージライトカラー
  3228.     # color5:実ゲージダークカラー,color6:実ゲージライトカラー
  3229.     color1 = Color.new(0, 0, 0, 192)
  3230.     color2 = Color.new(255, 255, 192, 192)
  3231.     color3 = Color.new(0, 0, 0, 192)
  3232.     color4 = Color.new(0, 64, 0, 192)
  3233.     color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
  3234.     color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
  3235.     # 変数spに描画するゲージの幅を代入
  3236.     if actor.maxsp != 0
  3237.       sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
  3238.     else
  3239.       sp = (width + plus_width) * rate_width / 100
  3240.     end
  3241.     # ゲージの描画
  3242.     gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  3243.                 width, plus_width + width * rate_width / 100,
  3244.                 height, sp, align1, align2, align3,
  3245.                 color1, color2, color3, color4, color5, color6, grade1, grade2)
  3246.     # オリジナルのSP描画処理を呼び出し
  3247.     draw_actor_sp_original(actor, x, y, width)
  3248.   end
  3249.   #--------------------------------------------------------
  3250.   # ● EXP ゲージの描画
  3251.   #----------------------------------------------------------
  3252.   # オリジナルのEXP描画を draw_actor_sp_original と名前変更
  3253.   alias :draw_actor_exp_original :draw_actor_exp
  3254.   def draw_actor_exp(actor, x, y, width = 144)
  3255.     # 変数rateに 現在のexp/nextexpを代入
  3256.     if actor.next_exp != 0
  3257.       rate = actor.now_exp.to_f / actor.next_exp
  3258.     else
  3259.       rate = 1
  3260.     end
  3261.     # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
  3262.     # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
  3263.     # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
  3264.     # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
  3265.     # align3:ゲージタイプ 0:左詰め 1:右詰め
  3266.     plus_x = 0
  3267.     rate_x = 0
  3268.     plus_y = 25
  3269.     plus_width = 0
  3270.     rate_width = 85
  3271.     height = 10
  3272.     align1 = 1
  3273.     align2 = 2
  3274.     align3 = 0
  3275.     # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
  3276.     # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
  3277.     grade1 = 1
  3278.     grade2 = 0
  3279.     # 色設定。color1:外枠,color2:中枠
  3280.     # color3:空ゲージダークカラー,color4:空ゲージライトカラー
  3281.     # color5:実ゲージダークカラー,color6:実ゲージライトカラー
  3282.     color1 = Color.new(0, 0, 0, 192)
  3283.     color2 = Color.new(255, 255, 192, 192)
  3284.     color3 = Color.new(0, 0, 0, 192)
  3285.     color4 = Color.new(64, 0, 0, 192)
  3286.     color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
  3287.     color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
  3288.     # 変数expに描画するゲージの幅を代入
  3289.     if actor.next_exp != 0
  3290.       exp = (width + plus_width) * actor.now_exp * rate_width /
  3291.                                                           100 / actor.next_exp
  3292.     else
  3293.       exp = (width + plus_width) * rate_width / 100
  3294.     end
  3295.     # ゲージの描画
  3296.     gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  3297.                 width, plus_width + width * rate_width / 100,
  3298.                 height, exp, align1, align2, align3,
  3299.                 color1, color2, color3, color4, color5, color6, grade1, grade2)
  3300.     # オリジナルのEXP描画処理を呼び出し
  3301.     draw_actor_exp_original(actor, x, y)
  3302.   end
  3303.   #---------------------------------------------------------
  3304.   # ● ゲージの描画
  3305.   #-----------------------------------------------------
  3306.   def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
  3307.                 color1, color2, color3, color4, color5, color6, grade1, grade2)
  3308.     case align1
  3309.     when 1
  3310.       x += (rect_width - width) / 2
  3311.     when 2
  3312.       x += rect_width - width
  3313.     end
  3314.     case align2
  3315.     when 1
  3316.       y -= height / 2
  3317.     when 2
  3318.       y -= height
  3319.     end
  3320.     # 枠描画
  3321.     self.contents.fill_rect(x, y, width, height, color1)
  3322.     self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
  3323.     if align3 == 0
  3324.       if grade1 == 2
  3325.         grade1 = 3
  3326.       end
  3327.       if grade2 == 2
  3328.         grade2 = 3
  3329.       end
  3330.     end
  3331.     if (align3 == 1 and grade1 == 0) or grade1 > 0
  3332.       color = color3
  3333.       color3 = color4
  3334.       color4 = color
  3335.     end
  3336.     if (align3 == 1 and grade2 == 0) or grade2 > 0
  3337.       color = color5
  3338.       color5 = color6
  3339.       color6 = color
  3340.     end
  3341.     # 空ゲージの描画
  3342.     self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
  3343.                                   color3, color4, grade1)
  3344.     if align3 == 1
  3345.       x += width - gauge
  3346.     end
  3347.     # 実ゲージの描画
  3348.     self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
  3349.                                   color5, color6, grade2)
  3350.   end
  3351. end
  3352.  
  3353. #--------------------------------------------------------------
  3354. #  Bitmapクラスに新たな機能を追加します。
  3355. #===================================================================
  3356.  
  3357. class Bitmap
  3358.   #------------------------------------------------------------
  3359.   # ● 矩形をグラデーション表示
  3360.   #     color1 : スタートカラー
  3361.   #     color2 : エンドカラー
  3362.   #     align  :  0:横にグラデーション
  3363.   #               1:縦にグラデーション
  3364.   #               2:斜めにグラデーション(激重につき注意)
  3365.   #--------------------------------------------------------
  3366.   def gradation_rect(x, y, width, height, color1, color2, align = 0)
  3367.     if align == 0
  3368.       for i in x...x + width
  3369.         red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  3370.         green = color1.green +
  3371.                 (color2.green - color1.green) * (i - x) / (width - 1)
  3372.         blue  = color1.blue +
  3373.                 (color2.blue - color1.blue) * (i - x) / (width - 1)
  3374.         alpha = color1.alpha +
  3375.                 (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  3376.         color = Color.new(red, green, blue, alpha)
  3377.         fill_rect(i, y, 1, height, color)
  3378.       end
  3379.     elsif align == 1
  3380.       for i in y...y + height
  3381.         red   = color1.red +
  3382.                 (color2.red - color1.red) * (i - y) / (height - 1)
  3383.         green = color1.green +
  3384.                 (color2.green - color1.green) * (i - y) / (height - 1)
  3385.         blue  = color1.blue +
  3386.                 (color2.blue - color1.blue) * (i - y) / (height - 1)
  3387.         alpha = color1.alpha +
  3388.                 (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  3389.         color = Color.new(red, green, blue, alpha)
  3390.         fill_rect(x, i, width, 1, color)
  3391.       end
  3392.     elsif align == 2
  3393.       for i in x...x + width
  3394.         for j in y...y + height
  3395.           red   = color1.red + (color2.red - color1.red) *
  3396.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  3397.           green = color1.green + (color2.green - color1.green) *
  3398.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  3399.           blue  = color1.blue + (color2.blue - color1.blue) *
  3400.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  3401.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  3402.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  3403.           color = Color.new(red, green, blue, alpha)
  3404.           set_pixel(i, j, color)
  3405.         end
  3406.       end
  3407.     elsif align == 3
  3408.       for i in x...x + width
  3409.         for j in y...y + height
  3410.           red   = color1.red + (color2.red - color1.red) *
  3411.                 ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  3412.           green = color1.green + (color2.green - color1.green) *
  3413.                 ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  3414.           blue  = color1.blue + (color2.blue - color1.blue) *
  3415.                 ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  3416.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  3417.                 ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  3418.           color = Color.new(red, green, blue, alpha)
  3419.           set_pixel(i, j, color)
  3420.         end
  3421.       end
  3422.     end
  3423.   end
  3424. end
  3425.  
  3426. #==================================================================
  3427. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3428. #==================================================================

360软件小助手截图20131013205921.jpg (34.54 KB, 下载次数: 2)

360软件小助手截图20131013205921.jpg

评分

参与人数 1星屑 +35 收起 理由
︶ㄣ牛排ぶ + 35 手动认可奖励

查看全部评分

Lv2.观梦者

梦石
0
星屑
432
在线时间
4175 小时
注册时间
2010-6-26
帖子
6474
2
发表于 2013-10-28 19:14:53 | 只看该作者
update_cursor_rect
这个方法存在于
Window_Base
的很多子类里面,所以光改Windows_Base没有用。
潜水,专心忙活三次元工作了……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
115
在线时间
65 小时
注册时间
2013-1-18
帖子
15
3
 楼主| 发表于 2013-10-28 21:11:57 | 只看该作者
eve592370698 发表于 2013-10-28 19:14
update_cursor_rect
这个方法存在于
Window_Base

那要怎么改?我的其他光标都没有问题,只有选择项光标出现偏差,请教如何只修改选择项光标的位置和大小
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3065
在线时间
1429 小时
注册时间
2009-7-27
帖子
1448
4
发表于 2013-11-13 19:46:09 | 只看该作者
我的用意是,选项的话,效果最好还是用箭头或者手指头比较有美感吧。
自己多PS一个皮肤,讲光标修改成箭头或者手指等的图片。有选项时应用这个皮肤上去,或者直接用以箭头或者指头的光标皮肤。如果非要改的话…………再叫我吧…………

评分

参与人数 1星屑 +70 收起 理由
︶ㄣ牛排ぶ + 70 认可答案

查看全部评分


博客:我的博客
回复 支持 反对

使用道具 举报

Lv1.梦旅人

匿·蹤

梦石
0
星屑
65
在线时间
99 小时
注册时间
2006-3-19
帖子
456
5
发表于 2013-11-14 08:56:38 | 只看该作者
查查Window_Selectable类看看,猜测是定义在了这个类中了。
另外,其实爆焰的思路挺好,值得采纳。
卐忍 → 解忍 → 元忍 → 隐忍 → 卍忍 → 匿踪(最终)
完全退步到了卐忍阶段
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
115
在线时间
65 小时
注册时间
2013-1-18
帖子
15
6
 楼主| 发表于 2013-11-14 13:06:14 | 只看该作者
爆焰 发表于 2013-11-13 19:46
我的用意是,选项的话,效果最好还是用箭头或者手指头比较有美感吧。
自己多PS一个皮肤,讲光标修改成箭头 ...

谢谢帮助……已经改好了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
115
在线时间
65 小时
注册时间
2013-1-18
帖子
15
7
 楼主| 发表于 2013-11-14 13:07:28 | 只看该作者
OCTSJimmy 发表于 2013-11-14 08:56
查查Window_Selectable类看看,猜测是定义在了这个类中了。
另外,其实爆焰的思路挺好,值得采纳。 ...

谢谢帮助……已经改好了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
197 小时
注册时间
2011-6-10
帖子
231
8
发表于 2013-11-14 13:59:31 | 只看该作者
lz想要修改的光标选项是Window_Message里面的,还是Menu里面的……
特点:懒
特性:懒
爱好:潜水

《巴雅前奏曲》目前已完成,正在挖学美工……
新坑:目前正制作中0 0
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-5-3 17:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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