赞 | 0 |
VIP | 7 |
好人卡 | 0 |
积分 | 1 |
经验 | 3983 |
最后登录 | 2013-2-27 |
在线时间 | 72 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 72 小时
- 注册时间
- 2010-10-18
- 帖子
- 104
|
回复 冰舞蝶恋 的帖子
去掉对话框的部份了
应该其他部份没啥问题了~- #==============================================================================
- # ■ Window_Selectable
- #------------------------------------------------------------------------------
- # 拥有光标的移动以及滚动功能的窗口类。
- #==============================================================================
- class Window_Selectable < Window_Base
- #--------------------------------------------------------------------------
- # ● 更新光标
- #--------------------------------------------------------------------------
- def update_cursor
- self.cursor_rect.empty
- if @index < 0 # 当光标位置小于0
- self.cursor_rect.empty # 隐藏光标
- else # 当光标位置为0或大于
- row = @index / @column_max # 获取当前行
- if row < top_row # 若先于首行
- self.top_row = row # 向上滚动
- end
- if row > bottom_row # 若後于末行
- self.bottom_row = row # 向下滚动
- end
- rect = item_rect(@index) # 获取所选项目矩形
- rect.y -= self.oy # 设矩形为滚动位置
- self.cursor_rect = rect # 更新光标矩形
- self.cursor_rect.empty
- end
- end
-
- end
- class Window_Base < Window
-
- #--------------------------------------------------------------------------
- # ○ 描边字
- #--------------------------------------------------------------------------
- def draw_stroke_text(rect, str, enabled = true, align = 0, color = nil)
- x = rect.x
- y = rect.y
- width = rect.width
- height = rect.height
- # 准备字体
- font_backup = self.contents.font.clone
- if color
- self.contents.font.color.red = color.red
- self.contents.font.color.green = color.green
- self.contents.font.color.blue = color.blue
- end
- # 关闭默认阴影
- self.contents.font.shadow = false
- # 描绘边缘
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(x-1, y-1, width, height, str, align)
- self.contents.draw_text(x-1, y+1, width, height, str, align)
- self.contents.draw_text(x+1, y-1, width, height, str, align)
- self.contents.draw_text(x+1, y+1, width, height, str, align)
- self.contents.draw_text(x, y-1, width, height, str, align)
- self.contents.draw_text(x, y+1, width, height, str, align)
- self.contents.draw_text(x-1, y, width, height, str, align)
- self.contents.draw_text(x+1, y, width, height, str, align)
- # 描绘主文字
- self.contents.font.color = font_backup.color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(x, y, width, height, str, align)
-
- # 还原默认字体
- self.contents.font = font_backup
- end
- end
- #==============================================================================
- # ■ Window_Command 捣鼓 by 水镜风生 (描边字部分出自沉影不器)
- #------------------------------------------------------------------------------
- # 一般的命令选择行窗口。
- #==============================================================================
- FONT_COLOR_ID = 1 # 描边颜色ID,请参考[显示文章]中\C[n]的颜色
- class Window_Command < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对象 追加定义
- #--------------------------------------------------------------------------
- alias Mro_initialize initialize
- def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
- @enabled_list = []
- Mro_initialize(width, commands, column_max, row_max, spacing)
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目 追加定义
- #--------------------------------------------------------------------------
- alias Mro_draw_item draw_item
- def draw_item(index, enabled = true)
- @enabled_list[index] = enabled
- Mro_draw_item(index, @enabled_list[index])
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update
- super
- if @last_index != self.index
- @last_index = self.index
- for i in 0...@item_max
- rect = item_rect(i)
- self.contents.clear_rect(rect)
- next if i == @old_index
- draw_item(i, @enabled_list[i])
- end
- rect = item_rect(self.index)
- self.contents.clear_rect(rect)
- color = text_color(FONT_COLOR_ID)
- draw_stroke_text(rect, @commands[@index], @enabled_list[@index], 0, color)
- end
- end
- end
- #==============================================================================
- # ■ Window_Item
- #------------------------------------------------------------------------------
- # 物品画面、战斗画面、显示浏览物品的窗口。
- #==============================================================================
- class Window_Item < Window_Selectable
- alias Mro_initialize0 initialize
- def initialize(x, y, width, height)
- @enabled_list = []
- Mro_initialize0(x, y, width, height)
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- @data = []
- for item in $game_party.items
- next unless include?(item)
- @data.push(item)
- if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
- self.index = @data.size - 1
- end
- end
- @data.push(nil) if include?(nil)
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
-
- def update
- super
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- rect = item_rect(i)
- self.contents.clear_rect(rect)
- next if i == @old_index
- draw_item(i)
- end
- rect = item_rect(self.index)
- rect.width -= 60
- rect.x += 24
- self.contents.clear_rect(rect)
- color = text_color(FONT_COLOR_ID)
- if @data[@index] != nil
- draw_stroke_text(rect, @data[@index].name, @enabled_list[index], 0, color)
- else
- draw_stroke_text(rect, "无", true, 0, color)
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- item = @data[index]
- if item != nil
- number = $game_party.item_number(item)
- enabled = enable?(item)
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enabled)
- self.contents.draw_text(rect, sprintf(":%2d", number), 2)
- else
- rect.x += 24
- self.contents.draw_text(rect,"无")
- end
- @enabled_list[index] = enabled
- end
- end
- class Window_Equip < Window_Selectable
- alias Mro_initialize4 initialize
- def initialize(x, y, actor)
- Mro_initialize4(x, y, actor)
- end
-
- def update
- super
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- rect = item_rect(i)
- self.contents.clear_rect(rect)
- next if i == @old_index
- draw_item_name(@data[i],92,WLH*i)
- end
- rect = item_rect(self.index)
- rect.x += 115
- self.contents.clear_rect(rect)
- color = text_color(FONT_COLOR_ID)
- if @data[@index] != nil
- draw_stroke_text(rect, @data[@index].name, true, 0, color)
- else
- draw_stroke_text(rect, "无", true, 0, color)
- end
- self.contents.font.color = system_color
- if @actor.two_swords_style
- self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1)
- self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2)
- else
- self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon)
- self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::armor1)
- end
- self.contents.draw_text(4, WLH * 2, 92, WLH, Vocab::armor2)
- self.contents.draw_text(4, WLH * 3, 92, WLH, Vocab::armor3)
- self.contents.draw_text(4, WLH * 4, 92, WLH, Vocab::armor4)
- self.contents.font.color = Color.new(255,255,255)
- if @data[0] == nil
- self.contents.draw_text(116, 0,92,WLH,"无")
- end
- if @data[1] == nil
- self.contents.draw_text(116, WLH,92,WLH,"无")
- end
- if @data[2] == nil
- self.contents.draw_text(116, WLH*2,92,WLH,"无")
- end
- if @data[3] == nil
- self.contents.draw_text(116, WLH*3,92,WLH,"无")
- end
- if @data[4] == nil
- self.contents.draw_text(116, WLH*4,92,WLH,"无")
- end
- end
- end
- class Window_Skill < Window_Selectable
- alias Mro_initialize3 initialize
- def initialize(x, y, width, height, actor)
- @enabled_list = []
- Mro_initialize3(x, y, width, height,actor)
- end
-
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- skill = @data[index]
- if skill != nil
- rect.width -= 4
- enabled = @actor.skill_can_use?(skill)
- draw_item_name(skill, rect.x, rect.y, enabled)
- self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
- end
- @enabled_list[index] = enabled
- end
-
- def update
- super
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- rect = item_rect(i)
- self.contents.clear_rect(rect)
- next if i == @old_index
- draw_item(i)
- end
- rect = item_rect(self.index)
- rect.width -= 60
- rect.x += 24
- self.contents.clear_rect(rect)
- color = text_color(FONT_COLOR_ID)
- if @data[@index] != nil
- draw_stroke_text(rect, @data[@index].name, @enabled_list[index], 0, color)
- else
- draw_stroke_text(rect, "无", false, 0, color)
- end
- end
- end
- class Window_ShopBuy < Window_Selectable
- alias Mro_initialize5 initialize
- def initialize(x, y)
- @enabled_list = []
- Mro_initialize5(x,y)
- end
-
- def draw_item(index)
- item = @data[index]
- number = $game_party.item_number(item)
- enabled = (item.price <= $game_party.gold and number < 99)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- draw_item_name(item, rect.x, rect.y, enabled)
- rect.width -= 4
- self.contents.draw_text(rect, item.price, 2)
- @enabled_list[index] = enabled
- end
-
- def update
- super
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- rect = item_rect(i)
- self.contents.clear_rect(rect)
- next if i == @old_index
- draw_item(i)
- end
- rect = item_rect(self.index)
- rect.width -= 60
- rect.x += 24
- self.contents.clear_rect(rect)
- color = text_color(FONT_COLOR_ID)
- draw_stroke_text(rect, @data[@index].name, @enabled_list[index], 0, color)
- end
- end
复制代码 |
|