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

Project1

 找回密码
 注册会员
搜索

选项光标距离在那个脚本里设置?

查看数: 3189 | 评论数: 16 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2011-5-30 05:56

正文摘要:

回复

郭嘉 发表于 2011-6-2 06:20:44
提示: 作者被禁止或删除 内容自动屏蔽
jhhuang 发表于 2011-6-1 15:23:23
本帖最后由 jhhuang 于 2011-6-1 15:29 编辑

class Window_EquipRight < Window_Selectable中的父类Window_Selectable是光标的类.
我在Window_EquipRight中定义了一个光标的方法def update_cursor_rect
Window_EquipRight在自己的类中找到了光标定义方法,就不会去父类找.
其他的类如果父类是Window_Selectable,但自己没定义,就会去Window_Selectable找
比如:class Window_ABC < Window_Selectable
ABC会用Selectable的光标但不会用EquipRight的光标,所以其他分类可以这样在自己身上定义而不会影响到其他类的光标.

评分

参与人数 1星屑 +400 梦石 +2 收起 理由
「旅」 + 400 + 2

查看全部评分

郭嘉 发表于 2011-6-1 14:56:55
提示: 作者被禁止或删除 内容自动屏蔽
jhhuang 发表于 2011-6-1 12:13:04
  1. #==============================================================================
  2. # ■ Window_EquipRight
  3. #------------------------------------------------------------------------------
  4. #  装备画面、显示角色现在装备的物品的窗口。
  5. #==============================================================================

  6. class Window_EquipRight < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     actor : 角色
  10.   #--------------------------------------------------------------------------
  11.   def initialize(actor)
  12.     super(-1, 253, 312, 310 )
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     @actor = actor
  15.     self.opacity = 0
  16.     refresh
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 获取物品
  20.   #--------------------------------------------------------------------------
  21.   def item
  22.     return @data[self.index]
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 刷新
  26.   #--------------------------------------------------------------------------
  27.   def refresh
  28.     self.contents.clear
  29.     @data = []
  30.     @data.push($data_weapons[@actor.weapon_id])
  31.     @data.push($data_armors[@actor.armor1_id])
  32.     @data.push($data_armors[@actor.armor2_id])
  33.     @data.push($data_armors[@actor.armor3_id])
  34.     @data.push($data_armors[@actor.armor4_id])
  35.     @item_max = @data.size
  36.     self.contents.font.color = system_color
  37.     self.contents.draw_text(20, 1, 92, 32, $data_system.words.weapon)
  38.     self.contents.draw_text(20, 37, 92, 32, $data_system.words.armor1)
  39.     self.contents.draw_text(20, 76, 92, 32, $data_system.words.armor2)
  40.     self.contents.draw_text(20, 115 , 92, 32, $data_system.words.armor3)
  41.     self.contents.draw_text(20, 152, 92, 32, $data_system.words.armor4)
  42.     draw_item_name(@data[0], 100, 1  )
  43.     draw_item_name(@data[1], 100, 37  )
  44.     draw_item_name(@data[2], 100, 76  )
  45.     draw_item_name(@data[3], 100, 115  )
  46.     draw_item_name(@data[4], 100, 152 )
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 刷新帮助文本
  50.   #--------------------------------------------------------------------------
  51.   def update_help
  52.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  53.   end
  54.     ##################定义光标##################
  55.   def update_cursor_rect
  56.     # 光标位置不满 0 的情况下
  57.     if @index < 0
  58.       self.cursor_rect.empty
  59.       return
  60.     end
  61.     # 获取当前的行
  62.     row = @index / @column_max
  63.     # 当前行被显示开头行前面的情况下
  64.     if row < self.top_row
  65.       # 从当前行向开头行滚动
  66.       self.top_row = row
  67.     end
  68.     # 当前行被显示末尾行之后的情况下
  69.     if row > self.top_row + (self.page_row_max - 1)
  70.       # 从当前行向末尾滚动
  71.       self.top_row = row - (self.page_row_max - 1)
  72.     end
  73.     # 计算光标的宽
  74.     cursor_width = self.width / @column_max - 32
  75.     # 计算光标坐标
  76.     x = @index % @column_max * (cursor_width + 32)
  77.     y = @index / @column_max * 32 - self.oy
  78.     # 更新国标矩形
  79.     self.cursor_rect.set(x, y, cursor_width, 32)
  80.   end
  81.   ###########################################
  82. end
复制代码
郭嘉 发表于 2011-6-1 06:35:11
提示: 作者被禁止或删除 内容自动屏蔽
fux2 发表于 2011-5-31 12:00:30
郭嘉 发表于 2011-5-31 10:17
#==============================================================================
# ■ Window_EquipRig ...

13行,310改大一点
郭嘉 发表于 2011-5-31 10:17:28
提示: 作者被禁止或删除 内容自动屏蔽
郭嘉 发表于 2011-5-31 07:42:03
提示: 作者被禁止或删除 内容自动屏蔽
郭嘉 发表于 2011-5-31 07:40:56
提示: 作者被禁止或删除 内容自动屏蔽
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2024-9-27 17:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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