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

Project1

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

[已经过期] 还有研究仙三菜单的人吗??

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
115 小时
注册时间
2010-5-3
帖子
346
跳转到指定楼层
1
发表于 2010-8-23 16:40:41 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 反斗奇彬 于 2010-8-23 16:47 编辑

无影神锋的仙三式菜单里面,战斗使用物品在“仙三式战斗菜单2”那里设置,这个脚本我有点看不太懂,望高手帮忙看看

  1. class Zzh_Window_SkillCommand < Window_Selectable
  2.   attr_accessor :commands
  3. #--------------------------------------------------------------------------
  4. # ● 初始化,生成commands窗口
  5. #--------------------------------------------------------------------------
  6. def initialize(actor)
  7.   super(-16, 160, 280, 300)
  8.   @commands = []
  9.   #————————生成commands窗口
  10.   #@commands.push("技")
  11.   @commands.push("水")
  12.   @commands.push("火")
  13.   @commands.push("雷")
  14.   @commands.push("风")
  15.   @commands.push("土")
  16.   @commands.push("双")
  17.   @actor=actor
  18.   self.windowskin = nil
  19.   if @commands == []
  20.     @commands.push("普通技能")
  21.   end      
  22.   @item_max = @commands.size
  23.   self.contents = Bitmap.new(640, 480)
  24.   self.opacity = 0
  25.   refresh
  26.   self.index = 0
  27.   @oldindex=-1
  28. end

  29. #--------------------------------------------------------------------------
  30. #--------------------------------------------------------------------------
  31. def refresh
  32.    self.contents.clear
  33.    bitmap = Bitmap.new("Graphics/system/battle/menu/仙术底板.png")
  34.    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  35.    self.contents.blt(0, 0, bitmap, src_rect)
  36.    x = @index*32+41
  37.    bitmap = Bitmap.new("Graphics/system/battle/menu/仙术-"[email protected]_s+".png")
  38.    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  39.    self.contents.blt(x, 27, bitmap, src_rect)
  40. end
  41. #--------------------------------------------------------------------------
  42. # 只描绘原文字
  43. #--------------------------------------------------------------------------
  44. def update_help
  45.    @help_window.set_text(@commands[self.index],1)
  46. end

  47.   #--------------------------------------------------------------------------
  48.   # ● 更新光标举行
  49.   #--------------------------------------------------------------------------
  50.   def update_cursor_rect
  51.     # 光标位置不满 0 的情况下
  52.    if @index < 0
  53.       self.cursor_rect.empty
  54.       return
  55.     end
  56.     # 获取当前的行
  57.     row = @index / @column_max
  58.     # 当前行被显示开头行前面的情况下
  59.     if row < self.top_row
  60.       # 从当前行向开头行滚动
  61.       self.cursor_rect.empty
  62.       return
  63.     end
  64.     # 当前行被显示末尾行之后的情况下
  65.     if row > self.top_row + (self.page_row_max - 1)
  66.       # 从当前行向末尾滚动
  67.       self.cursor_rect.empty
  68.       return
  69.     end
  70.    x=@index*32+42
  71.    self.cursor_rect.set(x, 28, 30, 25)
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 刷新画面
  75.   #--------------------------------------------------------------------------
  76. def update
  77.    self_update
  78.    if @index != @oldindex
  79.       refresh
  80.     end
  81.    @oldindex=@indexend
  82.    if self.active and @item_max > 0
  83.      index_var = @index
  84.      tp_index = @index
  85.      mouse_x, mouse_y = Mouse.get_mouse_pos
  86.      mouse_not_in_rect = true
  87.      for i in 0...@item_max
  88.        @index = i
  89.        @zzhaaa_1=1
  90.        update_cursor_rect
  91.        top_x = self.cursor_rect.x + self.x + 16
  92.        top_y = self.cursor_rect.y + self.y + 16
  93.        bottom_x = top_x + self.cursor_rect.width
  94.        bottom_y = top_y + self.cursor_rect.height
  95.        if (mouse_x > top_x) and (mouse_y > top_y) and
  96.           (mouse_x < bottom_x) and (mouse_y < bottom_y)
  97.          mouse_not_in_rect = false
  98.          if tp_index != @index
  99.            tp_index = @index
  100.              $game_system.se_play($data_system.cursor_se)
  101.          end
  102.          break
  103.        end
  104.      end
  105.     if mouse_not_in_rect
  106.        @zzhaaa_1=2
  107.        @index = index_var
  108.        #if self.is_a?(Window_Target)
  109.        #   @index=-3
  110.        #end
  111.        update_cursor_rect
  112.        Mouse.click_lock
  113.      else
  114.        Mouse.click_unlock               
  115.      end
  116.   end   
  117. end
  118. end


  119. #==============================================================================
  120. # ■ Window_Skill
  121. #==============================================================================

  122. class Zzh_Window_SkillList < Window_Selectable
  123. #--------------------------------------------------------------------------
  124. #--------------------------------------------------------------------------
  125. def initialize(actor)
  126.    super(10, 240, 250, 128)
  127.    @actor = actor
  128.    self.opacity = 0
  129.    refresh
  130.    self.index = -1
  131.    @column_max = 1
  132. end
  133. #--------------------------------------------------------------------------
  134. #--------------------------------------------------------------------------
  135. def skill
  136.    return @data[self.index]
  137. end
  138. #--------------------------------------------------------------------------
  139. #--------------------------------------------------------------------------
  140. def refresh
  141.    if self.contents != nil
  142.      self.contents.dispose
  143.      self.contents = nil
  144.    end
  145.    @data = []
  146. end
  147. #--------------------------------------------------------------------------
  148. #--------------------------------------------------------------------------
  149. def set_item(command)
  150.    refresh
  151.    for i in [email protected]
  152.      skill = $data_skills[@actor.skills[i]]
  153.      if skill != nil and skill.desc == command
  154.        @data.push(skill)
  155.      end
  156.    end
  157.    @item_max = @data.size
  158.    if @item_max > 0
  159.      self.contents = Bitmap.new(width - 32, row_max * 32)
  160.      self.contents.clear
  161.      for i in 0...@item_max
  162.        draw_item(i)
  163.      end
  164.    end
  165. end
  166. #-----------------------------------------------------------------------
  167. #--------------------------------------------------------------------------
  168. def draw_item(index)
  169.    skill = @data[index]
  170.     self.contents.font.name = ["华文行楷","黑体","楷体","宋体"]
  171.     self.contents.font.size = 16
  172.    $zzhok = false
  173.    if @actor.skill_can_use?(skill.id)
  174.      self.contents.font.color.set(0,0,0)
  175.    else
  176.      self.contents.font.color.set(0,0,0,128)
  177.    end
  178.    x = 4
  179.    y = index * 19-5
  180.    rect = Rect.new(x, y, self.width / @column_max - 32, 24)
  181.    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  182.    bitmap = RPG::Cache.icon(skill.icon_name)
  183.    opacity = self.contents.font.color == normal_color ? 255 : 128
  184.    self.contents.blt(x, y-5 , bitmap, Rect.new(0, -4, 24, 28), opacity)
  185.    self.contents.draw_text(x + 28, y-2, 204, 32, skill.name, 0)
  186.    self.contents.draw_text(x + 120, y-2, 40, 32, skill.sp_cost.to_s, 2)
  187.    $zzhok = true
  188. end
  189. #--------------------------------------------------------------------------
  190. #--------------------------------------------------------------------------
  191. def update_help
  192.    @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  193. end

  194.    def update_cursor_rect
  195.     # 光标位置不满 0 的情况下
  196.     if @index < 0
  197.       self.cursor_rect.empty
  198.       return
  199.     end
  200.     # 获取当前的行
  201.     row = @index / @column_max
  202.     # 当前行被显示开头行前面的情况下
  203.     if row < self.top_row
  204.       # 从当前行向开头行滚动
  205.       self.cursor_rect.empty
  206.       return
  207.     end
  208.     # 当前行被显示末尾行之后的情况下
  209.     if row > self.top_row + (self.page_row_max - 1)
  210.       # 从当前行向末尾滚动
  211.       self.cursor_rect.empty
  212.       return
  213.     end
  214.     # 计算光标的宽
  215.     cursor_width = 192
  216.     # 计算光标坐标
  217.     x = 7#@index % @column_max  * (cursor_width + 32)-3
  218.     y = (@index-self.top_row) * 19  -2
  219.     # 更新国标矩形
  220.     self.cursor_rect.set(x, y, cursor_width, 19)
  221.   end
  222.   
  223.   def update
  224. #  p @index
  225.    self_update      
  226.      if self.active and @item_max > 0
  227.      index_var = @index
  228.      tp_index = @index
  229.      mouse_x, mouse_y = Mouse.get_mouse_pos
  230.      mouse_not_in_rect = true
  231.      for i in 0...@item_max
  232.        @index = i
  233.        @zzhaaa_1=1
  234.        update_cursor_rect
  235.        top_x = self.cursor_rect.x + self.x + 16
  236.        top_y = self.cursor_rect.y + self.y + 16
  237.        bottom_x = top_x + self.cursor_rect.width
  238.        bottom_y = top_y + self.cursor_rect.height
  239.        if (mouse_x > top_x) and (mouse_y > top_y) and
  240.           (mouse_x < bottom_x) and (mouse_y < bottom_y)
  241.          mouse_not_in_rect = false
  242.          if tp_index != @index
  243.            tp_index = @index
  244.            #if (@index != @oldindex)
  245.              $game_system.se_play($data_system.cursor_se)
  246.            #end
  247.          end
  248.          break
  249.        end
  250.      end
  251.   if mouse_not_in_rect
  252.        mouse_x, mouse_y = Mouse.get_mouse_pos
  253.           # 当前行被显示开头行前面的情况下
  254.           #self.contents.fill_rect(Rect.new(199,92,15,15), Color.new(255, 255, 255, 255))
  255.           mouse_x-=26
  256.           mouse_y-=243
  257.           if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT)and  (mouse_x>199)and(mouse_x<215)and(mouse_y>92)and(mouse_y<107)
  258.             self.top_row +=1
  259.             delay(0.1)
  260.           end
  261.           # 当前行被显示末尾行之后的情况下
  262.           if self.top_row > 0  and Mouse.press?(Mouse::LEFT)and(mouse_x>199)and(mouse_x<215)and(mouse_y>12)and(mouse_y<27)
  263.             # 从当前行向末尾滚动
  264.             self.top_row -=1
  265.             delay(0.1)
  266.           end
  267.        @zzhaaa_1=2
  268.        @index = index_var
  269.        if self.is_a?(Window_Target)
  270.           @index=-3
  271.         end
  272.        update_cursor_rect
  273.        Mouse.click_lock
  274.      else
  275.        Mouse.click_unlock               
  276.      end
  277.    end
  278. end
  279.   def delay(seconds)
  280.     for i in 0...(seconds * 1)
  281.       sleep 0.01
  282.       Graphics.update
  283.     end
  284.   end
  285.   def top_row
  286.     # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
  287.     return self.oy / 19
  288.   end
  289.   #--------------------------------------------------------------------------
  290.   # ● 设置开头行
  291.   #     row : 显示开头的行
  292.   #--------------------------------------------------------------------------
  293.   def top_row=(row)
  294.     # row 未满 0 的场合更正为 0
  295.     if row < 0
  296.       row = 0
  297.     end
  298.     # row 超过 row_max - 1 的情况下更正为 row_max - 1
  299.     if row > row_max - 1
  300.       row = row_max - 1
  301.     end
  302.     # row 1 行高的 32 倍、窗口内容的传送源 Y 坐标

  303.      self.oy = row * 19

  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● 获取 1 页可以显示的行数
  307.   #--------------------------------------------------------------------------
  308.   def page_row_max
  309.     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
  310.     return (self.height - 32) / 19
  311.   end
  312. end




  313. class Window_Help_Zzh < Window_Base
  314.   #--------------------------------------------------------------------------
  315.   # ● 初始化对像
  316.   #--------------------------------------------------------------------------
  317.   def initialize
  318.     super(20, 330, 220, 64)
  319.     self.contents = Bitmap.new(width, height)
  320.     self.opacity = 0
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 设置文本
  324.   #     text  : 窗口显示的字符串
  325.   #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  326.   #--------------------------------------------------------------------------
  327.   def set_text(text, align = 0)
  328.     # 如果文本和对齐方式的至少一方与上次的不同
  329.     if text != @text or align != @align
  330.       # 再描绘文本
  331.       self.contents.clear
  332.       self.contents.font.size = 16
  333.       self.contents.font.name = ["华文行楷","黑体","楷体","宋体"]
  334.       self.contents.font.color.set(0,0,0)
  335.       $zzhok=false
  336.       self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  337.       @text = text
  338.       @align = align
  339.       @actor = nil
  340.       $zzhok=true
  341.     end
  342.     self.visible = true
  343.   end
  344. end




  345. class Zzh_Window_ItemCommand < Window_Selectable
  346.   attr_accessor :commands
  347. #--------------------------------------------------------------------------
  348. # ● 初始化,生成commands窗口
  349. #--------------------------------------------------------------------------
  350. def initialize
  351.   super(-16, 160, 280, 300)
  352.   @commands = []
  353.   #————————生成commands窗口
  354.   @commands.push("恢复类")
  355.   @commands.push("状态类")
  356.   @commands.push("攻击类")
  357.   self.windowskin = nil
  358.   if @commands == []
  359.     @commands.push("普通物品")
  360.   end      
  361.   @item_max = @commands.size
  362.   self.contents = Bitmap.new(640, 480)
  363.   self.opacity = 0
  364.   refresh
  365.   self.index = 0
  366.   @oldindex=-1
  367. end

  368. #--------------------------------------------------------------------------
  369. #--------------------------------------------------------------------------
  370. def refresh
  371.    self.contents.clear
  372.    bitmap = Bitmap.new("Graphics/system/battle/menu/物品底板.png")
  373.    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  374.    self.contents.blt(0, 0, bitmap, src_rect)
  375.    x = @index*32+41
  376.    bitmap = Bitmap.new("Graphics/system/battle/menu/物品-"[email protected]_s+".png")
  377.    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  378.    self.contents.blt(x, 27, bitmap, src_rect)
  379. end
  380. #--------------------------------------------------------------------------
  381. # 只描绘原文字
  382. #--------------------------------------------------------------------------
  383. def update_help
  384.    @help_window.set_text(@commands[self.index],1)
  385. end

  386.   #--------------------------------------------------------------------------
  387.   # ● 更新光标举行
  388.   #--------------------------------------------------------------------------
  389.   def update_cursor_rect
  390.     # 光标位置不满 0 的情况下
  391.     if @index < 0
  392.       self.cursor_rect.empty
  393.       return
  394.     end
  395.     # 获取当前的行
  396.     row = @index / @column_max
  397.     # 当前行被显示开头行前面的情况下
  398.     if row < self.top_row
  399.       # 从当前行向开头行滚动
  400.       self.top_row = row
  401.     end
  402.     # 当前行被显示末尾行之后的情况下
  403.     if row > self.top_row + (self.page_row_max - 1)
  404.       # 从当前行向末尾滚动
  405.       self.top_row = row - (self.page_row_max - 1)
  406.     end
  407.    x=@index*32+42
  408.    self.cursor_rect.set(x, 28, 30, 25)
  409.   end
  410.   #--------------------------------------------------------------------------
  411.   # ● 刷新画面
  412.   #--------------------------------------------------------------------------
  413. def update
  414.    self_update
  415.    if @index != @oldindex
  416.       refresh
  417.     end
  418.    @oldindex=@indexend
  419.    if self.active and @item_max > 0
  420.      index_var = @index
  421.      tp_index = @index
  422.      mouse_x, mouse_y = Mouse.get_mouse_pos
  423.      mouse_not_in_rect = true
  424.      for i in 0...@item_max
  425.        @index = i
  426.        @zzhaaa_1=1
  427.        update_cursor_rect
  428.        top_x = self.cursor_rect.x + self.x + 16
  429.        top_y = self.cursor_rect.y + self.y + 16
  430.        bottom_x = top_x + self.cursor_rect.width
  431.        bottom_y = top_y + self.cursor_rect.height
  432.        if (mouse_x > top_x) and (mouse_y > top_y) and
  433.           (mouse_x < bottom_x) and (mouse_y < bottom_y)
  434.          mouse_not_in_rect = false
  435.          if tp_index != @index
  436.            tp_index = @index
  437.              $game_system.se_play($data_system.cursor_se)
  438.          end
  439.          break
  440.        end
  441.      end
  442.     if mouse_not_in_rect
  443.        @zzhaaa_1=2
  444.        @index = index_var
  445.        #if self.is_a?(Window_Target)
  446.        #   @index=-3
  447.        #end
  448.        update_cursor_rect
  449.        Mouse.click_lock
  450.      else
  451.        Mouse.click_unlock               
  452.      end
  453.   end   
  454. end
  455. end


  456. #==============================================================================
  457. # ■ Window_Item
  458. #==============================================================================

  459. class Zzh_Window_ItemList < Window_Selectable
  460. #--------------------------------------------------------------------------
  461. #--------------------------------------------------------------------------
  462. def initialize
  463.    super(10, 240, 250, 128)#128
  464.    self.opacity = 0
  465.    refresh
  466.    self.index = -1
  467.    @column_max = 1
  468. end
  469. #--------------------------------------------------------------------------
  470. #--------------------------------------------------------------------------
  471. def item
  472.    return @data[self.index]
  473. end
  474. #--------------------------------------------------------------------------
  475. #--------------------------------------------------------------------------
  476. def refresh
  477.    if self.contents != nil
  478.      self.contents.dispose
  479.      self.contents = nil
  480.    end
  481.    @data = []
  482. end
  483. #--------------------------------------------------------------------------
  484. #--------------------------------------------------------------------------
  485. def set_item(command)
  486.     refresh
  487.     for i in 1...$data_items.size
  488.       if $game_party.item_number(i) > 0
  489.         if i<=13 and $data_items[i].desc== command
  490.          @data.push($data_items[i])
  491.         elsif i>13 and i<=35 and command=="状态类"
  492.          @data.push($data_items[i])
  493.         elsif i>35 and$data_items[i].desc== command
  494.          @data.push($data_items[i])
  495.         end
  496.       end
  497.     end
  498.     @item_max = @data.size
  499.     if @item_max > 0
  500.       self.contents = Bitmap.new(width - 32, row_max * 32)
  501.       self.contents.clear
  502.       for i in 0...@item_max
  503.         draw_item(i)
  504.       end
  505.     end
  506. end
  507. #-----------------------------------------------------------------------
  508. #--------------------------------------------------------------------------
  509. def draw_item(index)
  510.     item = @data[index]
  511.     number = $game_party.item_number(item.id)
  512.     self.contents.font.name = ["华文行楷","黑体","楷体","宋体"]
  513.     self.contents.font.size = 16
  514.    $zzhok = false
  515.    if $game_party.item_can_use?(item.id)
  516.       self.contents.font.color.set(0,0,0)
  517.     else
  518.       self.contents.font.color.set(0,0,0,128)
  519.     end
  520.    x = 4
  521.    y = index * 19-5
  522.    rect = Rect.new(x, y, self.width / @column_max - 32, 24)
  523.    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  524.    bitmap = RPG::Cache.icon(item.icon_name)
  525.    opacity = self.contents.font.color == normal_color ? 255 : 128
  526.    self.contents.blt(x, y-5 , bitmap, Rect.new(0, -4, 24, 28), opacity)
  527.    self.contents.draw_text(x + 28, y-2, 204, 32, item.name, 0)
  528.    self.contents.draw_text(x + 130, y-2, 40, 32, number.to_s, 2)
  529.    $zzhok = true
  530. end
  531. #--------------------------------------------------------------------------
  532. #--------------------------------------------------------------------------
  533. def update_help
  534.    @help_window.set_text(self.item == nil ? "" : self.item.description)
  535. end

  536.    def update_cursor_rect
  537.     # 光标位置不满 0 的情况下
  538.     if @index < 0
  539.       self.cursor_rect.empty
  540.       return
  541.     end
  542.     # 获取当前的行
  543.     row = @index / @column_max
  544.     # 当前行被显示开头行前面的情况下
  545.     if row < self.top_row
  546.       # 从当前行向开头行滚动
  547.       self.cursor_rect.empty
  548.       return
  549.     end
  550.     # 当前行被显示末尾行之后的情况下
  551.     if row > self.top_row + (self.page_row_max - 1)
  552.       # 从当前行向末尾滚动
  553.       self.cursor_rect.empty
  554.       return
  555.     end
  556.     # 计算光标的宽
  557.     cursor_width = 192
  558.     # 计算光标坐标
  559.     x = 7#@index % @column_max  * (cursor_width + 32)-3
  560.     y = (@index-self.top_row)  * 19  -2
  561.     # 更新国标矩形
  562.     self.cursor_rect.set(x, y, cursor_width, 19)
  563.   end
  564.   
  565.   def update
  566.    self_update      
  567.      if self.active and @item_max > 0
  568.      index_var = @index
  569.      tp_index = @index
  570.      mouse_x, mouse_y = Mouse.get_mouse_pos
  571.      mouse_not_in_rect = true
  572.      for i in 0...@item_max
  573.        @index = i
  574.        @zzhaaa_1=1
  575.        update_cursor_rect
  576.        top_x = self.cursor_rect.x + self.x + 16
  577.        top_y = self.cursor_rect.y + self.y + 16
  578.        bottom_x = top_x + self.cursor_rect.width
  579.        bottom_y = top_y + self.cursor_rect.height
  580.        if (mouse_x > top_x) and (mouse_y > top_y) and
  581.           (mouse_x < bottom_x) and (mouse_y < bottom_y)
  582.          mouse_not_in_rect = false
  583.          if tp_index != @index
  584.            tp_index = @index
  585.            #if (@index != @oldindex)
  586.              $game_system.se_play($data_system.cursor_se)
  587.            #end
  588.          end
  589.          break
  590.        end
  591.      end
  592.   if mouse_not_in_rect
  593.        mouse_x, mouse_y = Mouse.get_mouse_pos
  594.           # 当前行被显示开头行前面的情况下
  595.           #self.contents.fill_rect(Rect.new(199,92,15,15), Color.new(255, 255, 255, 255))
  596.           mouse_x-=26
  597.           mouse_y-=243
  598.           if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT)and  (mouse_x>199)and(mouse_x<215)and(mouse_y>92)and(mouse_y<107)
  599.             self.top_row +=1
  600.             delay(0.1)
  601.           end
  602.           # 当前行被显示末尾行之后的情况下
  603.           if self.top_row > 0  and Mouse.press?(Mouse::LEFT)and(mouse_x>199)and(mouse_x<215)and(mouse_y>12)and(mouse_y<27)
  604.             # 从当前行向末尾滚动
  605.             self.top_row -=1
  606.             delay(0.1)
  607.           end
  608.        @zzhaaa_1=2
  609.        @index = index_var
  610.        if self.is_a?(Window_Target)
  611.           @index=-3
  612.         end
  613.        update_cursor_rect
  614.        Mouse.click_lock
  615.      else
  616.        Mouse.click_unlock               
  617.      end
  618.    end
  619. end
  620.   def delay(seconds)
  621.     for i in 0...(seconds * 1)
  622.       sleep 0.01
  623.       Graphics.update
  624.     end
  625.   end
  626.   def top_row
  627.     # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
  628.     return self.oy / 19
  629.   end
  630.   #--------------------------------------------------------------------------
  631.   # ● 设置开头行
  632.   #     row : 显示开头的行
  633.   #--------------------------------------------------------------------------
  634.   def top_row=(row)
  635.     # row 未满 0 的场合更正为 0
  636.     if row < 0
  637.       row = 0
  638.     end
  639.     # row 超过 row_max - 1 的情况下更正为 row_max - 1
  640.     if row > row_max - 1
  641.       row = row_max - 1
  642.     end
  643.     # row 1 行高的 32 倍、窗口内容的传送源 Y 坐标

  644.      self.oy = row * 19

  645.   end
  646.   #--------------------------------------------------------------------------
  647.   # ● 获取 1 页可以显示的行数
  648.   #--------------------------------------------------------------------------
  649.   def page_row_max
  650.     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
  651.     return (self.height - 32) / 19
  652.   end
  653. end



  654. class Window_Skill2_Picture < Window_Base
  655.   def initialize
  656.    super(-16,120,260,300)
  657.    self.contents = Bitmap.new(640, 480)
  658.    self.opacity = 0
  659.    self.contents.clear
  660.    bitmap = Bitmap.new("Graphics/System/battle/menu/特技底板.png")
  661.    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  662.    self.contents.blt(0, 0 , bitmap, src_rect)
  663.   end
  664. end
  665. #==============================================================================
  666. # ■ Window_Skill
  667. #==============================================================================

  668. class Zzh_Window_SkillList2 < Window_Selectable
  669. #--------------------------------------------------------------------------
  670. #--------------------------------------------------------------------------
  671. def initialize(actor)
  672.    super(10, 200, 250, 148)
  673.    @actor = actor
  674.    self.opacity = 0
  675.    refresh
  676.    self.index = -1
  677.    @column_max = 1
  678. end
  679. #--------------------------------------------------------------------------
  680. #--------------------------------------------------------------------------
  681. def skill
  682.    return @data[self.index]
  683. end
  684. #--------------------------------------------------------------------------
  685. #--------------------------------------------------------------------------
  686. def refresh
  687.    if self.contents != nil
  688.      self.contents.dispose
  689.      self.contents = nil
  690.    end
  691.    @data = []
  692. end
  693. #--------------------------------------------------------------------------
  694. #--------------------------------------------------------------------------
  695. def set_item(command)
  696.    refresh
  697.    for i in [email protected]
  698.      skill = $data_skills[@actor.skills[i]]
  699.      if skill != nil and skill.desc == command
  700.        @data.push(skill)
  701.      end
  702.    end
  703.    @item_max = @data.size
  704.    if @item_max > 0
  705.      self.contents = Bitmap.new(width - 32, row_max * 32)
  706.      self.contents.clear
  707.      for i in 0...@item_max
  708.        draw_item(i)
  709.      end
  710.    end
  711. end
  712. #-----------------------------------------------------------------------
  713. #--------------------------------------------------------------------------
  714. def draw_item(index)
  715.    skill = @data[index]
  716.     self.contents.font.name = ["华文行楷","黑体","楷体","宋体"]
  717.     self.contents.font.size = 16
  718.    $zzhok = false
  719.    if @actor.skill_can_use?(skill.id)
  720.      self.contents.font.color.set(0,0,0)
  721.    else
  722.      self.contents.font.color.set(0,0,0,128)
  723.    end
  724.    x = 4
  725.    y = index * 19-5
  726.    rect = Rect.new(x, y, self.width / @column_max - 32, 24)
  727.    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  728.    bitmap = RPG::Cache.icon(skill.icon_name)
  729.    opacity = self.contents.font.color == normal_color ? 255 : 128
  730.    self.contents.blt(x, y-5 , bitmap, Rect.new(0, -4, 24, 28), opacity)
  731.    self.contents.draw_text(x + 28, y-2, 204, 32, skill.name, 0)
  732.    self.contents.draw_text(x + 130, y-2, 40, 32, skill.sp_cost.to_s, 2)
  733.    $zzhok = true
  734. end
  735. #--------------------------------------------------------------------------
  736. #--------------------------------------------------------------------------
  737. def update_help
  738.    @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  739. end

  740.    def update_cursor_rect
  741.     # 光标位置不满 0 的情况下
  742.     if @index < 0
  743.       self.cursor_rect.empty
  744.       return
  745.     end
  746.     # 获取当前的行
  747.     row = @index / @column_max
  748.     # 当前行被显示开头行前面的情况下
  749.     if row < self.top_row
  750.       # 从当前行向开头行滚动
  751.       self.cursor_rect.empty
  752.       return
  753.     end
  754.     # 当前行被显示末尾行之后的情况下
  755.     if row > self.top_row + (self.page_row_max - 1)
  756.       # 从当前行向末尾滚动
  757.       self.cursor_rect.empty
  758.       return
  759.     end
  760.     # 计算光标的宽
  761.     cursor_width = 192
  762.     # 计算光标坐标
  763.     x = 7#@index % @column_max  * (cursor_width + 32)-3
  764.     y = @index  * 19  -2
  765.     # 更新国标矩形
  766.     self.cursor_rect.set(x, y, cursor_width, 19)
  767.   end
  768.   
  769.   def update
  770.    self_update      
  771.      if self.active and @item_max > 0
  772.      index_var = @index
  773.      tp_index = @index
  774.      mouse_x, mouse_y = Mouse.get_mouse_pos
  775.      mouse_not_in_rect = true
  776.      for i in 0...@item_max
  777.        @index = i
  778.        @zzhaaa_1=1
  779.        update_cursor_rect
  780.        top_x = self.cursor_rect.x + self.x + 16
  781.        top_y = self.cursor_rect.y + self.y + 16
  782.        bottom_x = top_x + self.cursor_rect.width
  783.        bottom_y = top_y + self.cursor_rect.height
  784.        if (mouse_x > top_x) and (mouse_y > top_y) and
  785.           (mouse_x < bottom_x) and (mouse_y < bottom_y)
  786.          mouse_not_in_rect = false
  787.          if tp_index != @index
  788.            tp_index = @index
  789.            #if (@index != @oldindex)
  790.              $game_system.se_play($data_system.cursor_se)
  791.            #end
  792.          end
  793.          break
  794.        end
  795.      end
  796.   if mouse_not_in_rect
  797.        mouse_x, mouse_y = Mouse.get_mouse_pos
  798.           # 当前行被显示开头行前面的情况下
  799.           #self.contents.fill_rect(Rect.new(199,92,15,15), Color.new(255, 255, 255, 255))
  800.           mouse_x-=26
  801.           mouse_y-=243
  802.           if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT)and  (mouse_x>199)and(mouse_x<215)and(mouse_y>92)and(mouse_y<107)
  803.             self.top_row +=1
  804.             delay(0.1)
  805.           end
  806.           # 当前行被显示末尾行之后的情况下
  807.           if self.top_row > 0  and Mouse.press?(Mouse::LEFT)and(mouse_x>199)and(mouse_x<215)and(mouse_y>12)and(mouse_y<27)
  808.             # 从当前行向末尾滚动
  809.             self.top_row -=1
  810.             delay(0.1)
  811.           end
  812.        @zzhaaa_1=2
  813.        @index = index_var
  814.        if self.is_a?(Window_Target)
  815.           @index=-3
  816.         end
  817.        update_cursor_rect
  818.        Mouse.click_lock
  819.      else
  820.        Mouse.click_unlock               
  821.      end
  822.    end
  823. end
  824.   def delay(seconds)
  825.     for i in 0...(seconds * 1)
  826.       sleep 0.01
  827.       Graphics.update
  828.     end
  829.   end
  830.   def top_row
  831.     # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
  832.     return self.oy / 19
  833.   end
  834.   #--------------------------------------------------------------------------
  835.   # ● 设置开头行
  836.   #     row : 显示开头的行
  837.   #--------------------------------------------------------------------------
  838.   def top_row=(row)
  839.     # row 未满 0 的场合更正为 0
  840.     if row < 0
  841.       row = 0
  842.     end
  843.     # row 超过 row_max - 1 的情况下更正为 row_max - 1
  844.     if row > row_max - 1
  845.       row = row_max - 1
  846.     end
  847.     # row 1 行高的 32 倍、窗口内容的传送源 Y 坐标

  848.      self.oy = row * 19

  849.   end
  850.   #--------------------------------------------------------------------------
  851.   # ● 获取 1 页可以显示的行数
  852.   #--------------------------------------------------------------------------
  853.   def page_row_max
  854.     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
  855.     return (self.height - 32) / 19
  856.   end
  857. end
复制代码
506-527这段是关系到战斗中使用物品的调用,数据库中已经设置好,我就是有点看不明白这段,麻烦各位帮忙解析一下

错误.jpg (14.22 KB, 下载次数: 7)

错误.jpg

点评

感觉脚本不完整,还缺少一部分,desc可能是额外定义的方法  发表于 2010-8-23 18:07
你把这个desc改成description试试  发表于 2010-8-23 18:05
帮你顶了一下,我也求解。  发表于 2010-8-23 18:02

Lv1.梦旅人

梦石
0
星屑
120
在线时间
92 小时
注册时间
2009-8-1
帖子
438
2
发表于 2010-8-23 18:01:28 | 只看该作者
我只想说,肯定有人在研究…要不你直接找写这个脚本的人吧,呵呵!
我脚本比你弱很多,我不多说了…
哎呦,好像快要能发布一款游戏了,这次一定要低调!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
115 小时
注册时间
2010-5-3
帖子
346
3
 楼主| 发表于 2010-8-24 01:08:02 | 只看该作者
我只是想知道那部分是干什么的,初看是定义物品的,但检查发现也没什么问题,之前也正常运行,后来我在数据库增加了点东西后就不行了(增加的不是物品)
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
102
在线时间
123 小时
注册时间
2010-8-13
帖子
100
4
发表于 2010-8-27 12:24:27 | 只看该作者
我也想用这个,但是不管怎么设置,在战斗中显示都为空。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-29 05:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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