赞 | 0 |
VIP | 2 |
好人卡 | 2 |
积分 | 1 |
经验 | 15467 |
最后登录 | 2014-8-15 |
在线时间 | 184 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 184 小时
- 注册时间
- 2010-6-27
- 帖子
- 1794
|
本帖最后由 SVM伟 于 2010-9-8 19:27 编辑
- #--------------------------------------------------------------------------
- # ○ 获得选项,立即执行确定选择方案
- #--------------------------------------------------------------------------
- def choices_start?(option_text)
- return false if option_text.include?("準備") # 准备好唯一的选择的场合
- return false if choices_check?(option_text) # 检查是否选择
- return true
- end
- #--------------------------------------------------------------------------
- # ○ 获得选项检查,以确定是否选择替代
- #--------------------------------------------------------------------------
- def choices_check?(option_text)
- return true if option_text.include?("チェック") #检查得到的选项
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 从一个确定的选项时自动选择一个选择
- #--------------------------------------------------------------------------
- def choices_one?(option_text)
- return true if /[\'’]/ =~ option_text # 自动选择时,选择选项
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 其他过滤选项命令与注释
- #--------------------------------------------------------------------------
- def choices_command
- return false if @list[@index].code != 108
- text = @list[@index].parameters[0]
- if /\A追加選択肢\s?[::]/ =~ text
- additional_choices
- return true
- elsif /\Aオプションを?取得[::]/ =~ text
- $game_temp.choices.get_option($')
- return true
- elsif /\Aヘルプ/ =~ text
- if /[::]/ =~ text
- text = $'
- if /\[(\d+)\]/ =~ $`
- index = $1.to_i - 1
- else
- index = nil
- end
- $game_temp.choices.set_help(text, index)
- end
- return true
- elsif /\A有効な?選択肢数を?取得/ =~ text
- $game_variables[Expansion_Choices::CHOICE_RESUIT_VARIABLES] = $game_temp.choices.size
- return true
- elsif /\Aグループ\[/ =~ text or /\AG\[/i =~ text
- if /\[(\d+)\]を?初期化/ =~ text
- $game_party.group[$1.to_i] = []
- $game_map.need_refresh = true
- return true
- elsif /\[(\d+)\]を?作成[::]/ =~ text
- group_number = $1.to_i
- crowd = $'
- $game_party.group[group_number] = []
- if /\Aパーティー/ =~ crowd
- for actor in $game_party.members
- $game_party.group[group_number].push(actor.id)
- end
- else
- before_group = crowd.split(/[\|\s]/)
- before_group.delete("")
- for i in before_group
- $game_party.group[group_number].push(i.to_i)
- end
- end
- $game_map.need_refresh = true
- return true
- elsif /\[(\d+)\]に?[\((](\d+)[\))]を?追加/ =~ text
- $game_party.group[$1.to_i] = [] if $game_party.group[$1.to_i].nil?
- unless $game_party.group[$1.to_i].include?($2.to_i)
- $game_party.group[$1.to_i].push($2.to_i)
- end
- $game_map.need_refresh = true
- return true
- elsif /\[(\d+)\]に?選択アクターを?追加/ =~ text
- $game_party.group[$1.to_i] = [] if $game_party.group[$1.to_i].nil?
- unless $game_party.group[$1.to_i].include?($game_variables[TARGET_V])
- $game_party.group[$1.to_i].push($game_variables[TARGET_V])
- end
- $game_map.need_refresh = true
- return true
- elsif /\[(\d+)\]か?ら?[\((](\d+)[\))]を?削除/ =~ text
- $game_party.group[$1.to_i] = [] if $game_party.group[$1.to_i].nil?
- $game_party.group[$1.to_i].delete($2.to_i)
- $game_map.need_refresh = true
- return true
- elsif /\[(\d+)\]か?ら?選択アクターを?削除/ =~ text
- $game_party.group[$1.to_i] = [] if $game_party.group[$1.to_i].nil?
- $game_party.group[$1.to_i].delete($game_variables[TARGET_V])
- $game_map.need_refresh = true
- return true
- elsif /\[(\d+)\]へ?に?パーティーを?変更/ =~ text
- $game_party.group[$1.to_i] = [] if $game_party.group[$1.to_i].nil?
- return true if $game_party.group[$1.to_i].empty?
- for m in $game_party.members
- $game_party.remove_actor(m.id)
- end
- for i in $game_party.group[$1.to_i]
- $game_party.add_actor(i)
- end
- $game_map.need_refresh = true
- return true
- end
- elsif /\A選択アクターを?予備に?へ?格納/ =~ text
- $game_party.reserve_choice_id = $game_variables[TARGET_V]
- elsif /\A選択アクターを?予備か?ら?[習取]得/ =~ text
- $game_variables[TARGET_V] = $game_party.reserve_choice_id
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 追加额外的选择
- # ※ 这不是一个命令
- # 被视为唯一的例外。(不确定)
- # 这种方法本身是不足以自动处理。
- #--------------------------------------------------------------------------
- def additional_choices
- return unless /[::]/ =~ @list[@index].parameters[0]
- text = conversion_choices_switch_data($')
- $game_temp.choices.create_free_choices(text)
- temp_index = 1
- while @list[@index+temp_index].code == 408 # さらに注釈データから追加
- text = conversion_choices_switch_data(@list[@index+temp_index].parameters[0])
- $game_temp.choices.create_free_choices(text)
- temp_index += 1
- end
- end
- #--------------------------------------------------------------------------
- # ○ 获取下一个选择
- #--------------------------------------------------------------------------
- def next_choices_search
- index = @index + 1
- while @list[index].code == 401 or
- @list[index].code == 355 or @list[index].code == 655
- index += 1
- end
- return nil if index >= @list.size - 1
- return nil unless @list[index].code == 108
- return nil if /\A選択肢開始/ =~ @list[index].parameters[0]
- return index if /\A選択肢/ =~ @list[index].parameters[0]
- return nil
- end
- #--------------------------------------------------------------------------
- # ◎文本视图
- #--------------------------------------------------------------------------
- alias tig_ec_command_101 command_101
- def command_101
-
- # 有效的选择和替代选择,隐藏前面的文章(不清楚啊)
- if /\\\*/ =~ @list[@index + 1].parameters[0]
- next_choices_index = next_choices_search
- unless next_choices_index.nil?
- text = @list[next_choices_index].parameters[0]
- if /[::]パーティー/ =~ text
- choices = command_setup_actor_choice(nil, next_choices_index)
- elsif /[::]グループ\[(\d+)\]/ =~ text
- choices = command_setup_actor_choice($1.to_i, next_choices_index)
- else
- choices = command_setup_free_choice(next_choices_index)
- end
- return true if choices.size == 1 or choices.active_item_index.size == 0
- end
- end
-
- $game_message.last_face_name = @params[0]
- $game_message.last_face_index = @params[1]
- $game_message.last_background = @params[2]
- $game_message.last_position = @params[3]
- return tig_ec_command_101
- end
- #--------------------------------------------------------------------------
- # ◎ 选项出现
- #--------------------------------------------------------------------------
- alias tig_ec_command_102 command_102
- def command_102 # 得到的坐标
- $game_message.face_name = $game_message.last_face_name
- $game_message.face_index = $game_message.last_face_index
- $game_message.background = $game_message.last_background
- $game_message.position = $game_message.last_position
- return tig_ec_command_102
- end
- #--------------------------------------------------------------------------
- # ○ 初始化文本显示参数
- # ※ 如果你不想继续选择
- # 运行脚本继续事件
- #--------------------------------------------------------------------------
- def last_parameters_clear
- $game_message.last_face_name = ""
- $game_message.last_face_index = 0
- $game_message.last_background = 0
- $game_message.last_position = 2
- end
- end
- #==============================================================================
- # ■ Window_Message
- #------------------------------------------------------------------------------
- # 用来显示文字信息窗口的。
- #==============================================================================
- class Window_Message < Window_Selectable
- #--------------------------------------------------------------------------
- # ◎对象初始化
- #--------------------------------------------------------------------------
- alias tig_ec_initialize initialize
- def initialize
- tig_ec_initialize
- create_frame_choices_window
- end
- #--------------------------------------------------------------------------
- # ◎ 释放
- #--------------------------------------------------------------------------
- alias tig_ec_dispose dispose
- def dispose
- tig_ec_dispose
- dispose_frame_choices_window
- end
- #--------------------------------------------------------------------------
- # ○ 创建一个窗口的其他选择
- #--------------------------------------------------------------------------
- def create_frame_choices_window
- @frame_choices_window = Window_Choice.new
- @frame_choices_window.openness = 0
- @frame_choices_picjkup_window = Window_Pickup.new(@frame_choices_window)
- @frame_choices_picjkup_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ○ 其他选择的自由选择窗口
- #--------------------------------------------------------------------------
- def dispose_frame_choices_window
- @frame_choices_window.dispose
- @frame_choices_picjkup_window.dispose
- end
- #--------------------------------------------------------------------------
- # ◎ 视图更新
- #--------------------------------------------------------------------------
- alias tig_ec_update update
- def update
- update_frame_choices_window
- tig_ec_update
- unless @opening or @closing
- if self.openness == 0
- if $game_message.show_ex_choices and @frame_choices_window.openness == 0
- start_ex_choice
- end
- end
- end
- unless @face_sprite.nil?
- @face_sprite.visible = self.openness == 255 unless @face_sprite.disposed?
- end
- end
- #--------------------------------------------------------------------------
- # ○ 更新其他选择窗口
- #--------------------------------------------------------------------------
- def update_frame_choices_window
- @frame_choices_window.update
- @frame_choices_picjkup_window.update
- end
- #--------------------------------------------------------------------------
- # ◎ 选择的開始
- #--------------------------------------------------------------------------
- alias tig_ec_start_choice start_choice
- def start_choice
- return start_ex_choice if $game_message.show_ex_choices
- tig_ec_start_choice
- end
- #--------------------------------------------------------------------------
- # ○ 启动其他选择窗口
- #--------------------------------------------------------------------------
- def start_ex_choice
- self.active = true
- self.index = -1
- @frame_choices_window.setting($game_message.show_ex_choices)
- @frame_choices_window.open
- @frame_choices_window.index = 0
- @frame_choices_picjkup_window.refresh
- end
- #--------------------------------------------------------------------------
- # ◎ 选择结束
- #--------------------------------------------------------------------------
- alias tig_ec_terminate_message terminate_message
- def terminate_message
- tig_ec_terminate_message
- $game_message.show_ex_choices = nil
- @frame_choices_window.close
- @frame_choices_window.index = -1
- @frame_choices_picjkup_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 选择输入处理
- #--------------------------------------------------------------------------
- def input_choice
- return input_pick_up if $game_temp.choices.pick_up ###
- if $game_message.show_ex_choices ###
- return if @frame_choices_window.delay != 0
- index = @frame_choices_window.index ### 追加部分
- else ###
- index = self.index ###
- end ###
-
- if Input.trigger?(Input::B)
- Sound.play_cancel ### 追加部分
- if $game_message.choice_cancel_type != 0 ### 変更部分 > → !=
- #Sound.play_cancel ###文本
- scroll_contents_clear ### 追加部分
- $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
- terminate_message
- end
- elsif Input.trigger?(Input::C)
- return if can_not_select?(index) ### 追加・変更部分
- Sound.play_decision
- scroll_contents_clear ### 追加部分
- $game_message.choice_proc.call(index) ### 変更部分
- terminate_message
- end
- end
- #--------------------------------------------------------------------------
- # ○选择项处理
- #--------------------------------------------------------------------------
- def input_pick_up
- if Input.trigger?(Input::B)
- Sound.play_cancel
- if $game_message.show_ex_choices.pick_up.empty?
- $game_variables[Expansion_Choices::CHOICE_RESUIT_VARIABLES] = 0
- scroll_contents_clear
- $game_message.show_ex_choices.pick_up = nil
- $game_message.show_ex_choices.pick_up_result = -1
- terminate_message
- else
- $game_message.show_ex_choices.pick_up.pop
- @frame_choices_window.index = [@frame_choices_window.index, 0].max
- @frame_choices_window.refresh
- @frame_choices_picjkup_window.refresh
- end
- elsif Input.trigger?(Input::C)
- if @frame_choices_window.index == -1
- Sound.play_decision
- if $game_message.show_ex_choices.actor_choice?
- array = []
- for i in $game_message.show_ex_choices.pick_up
- array.push($game_message.show_ex_choices.actor_id[i])
- end
- if $game_message.show_ex_choices.pick_up_result >= 0
- $game_party.group[$game_message.show_ex_choices.pick_up_result] = array
- end
- else
- array = []
- for i in $game_message.show_ex_choices.pick_up
- array.push(i + 1)
- end
- if $game_message.show_ex_choices.pick_up_result >= 0
- $game_party.group[$game_message.show_ex_choices.pick_up_result] = $game_message.show_ex_choices.pick_up
- end
- end
- $game_variables[Expansion_Choices::CHOICE_RESUIT_VARIABLES] = $game_party.group[$game_message.show_ex_choices.pick_up_result][0]
- scroll_contents_clear
- $game_message.show_ex_choices.pick_up = nil
- $game_message.show_ex_choices.pick_up_result = 0
- terminate_message
- else
- return if can_not_select?(@frame_choices_window.index)
- Sound.play_decision
- $game_message.show_ex_choices.pick_up.push($game_message.show_ex_choices.display_item_index[@frame_choices_window.index])
- @frame_choices_window.refresh
- @frame_choices_picjkup_window.refresh
- end
- end
- end
- #--------------------------------------------------------------------------
- # ○ 当您在选择一个项目选定的不是正确的
- # ※ 如果您选择是,负伤者的警告音响起的结果返回。(应该是返回选择)
- #--------------------------------------------------------------------------
- def can_not_select?(index)
- return false if $game_temp.choices.display_item_index.empty?
- if $game_temp.choices.can_not_select_active.include?(index)
- Sound.play_buzzer
- return true
- elsif $game_temp.choices.price[$game_temp.choices.display_item_index[index]]
- if $game_temp.choices.price[$game_temp.choices.display_item_index[index]] > $game_party.gold
- Sound.play_buzzer
- return true
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 初始化后,项目选择选项4个窗口
- #--------------------------------------------------------------------------
- def scroll_contents_clear
- if $game_message.choice_max > MAX_LINE
- @item_max = 0
- self.oy = 0
- create_contents
- end
- end
- #--------------------------------------------------------------------------
- # ◎ 转换特殊字符
- #--------------------------------------------------------------------------
- alias tig_ec_convert_special_characters convert_special_characters
- def convert_special_characters
- @text.gsub!(/\\N\[選択アクター\]/i) { $game_actors[$game_variables[Expansion_Choices::TARGET_ACTOR_ID_VARIABLES]].name }
- @text.gsub!(/\\N\[選択\]/i) { $game_actors[$game_variables[Expansion_Choices::TARGET_ACTOR_ID_VARIABLES]].name }
- @text.gsub!(/\\N\[choice\]/i) { $game_actors[$game_variables[Expansion_Choices::TARGET_ACTOR_ID_VARIABLES]].name }
- @text.gsub!(/\\N\[予備アクター\]/i) { $game_actors[$game_party.reserve_choice_id].name }
- @text.gsub!(/\\N\[予備\]/i) { $game_actors[$game_party.reserve_choice_id].name }
- @text.gsub!(/\\N\[reserve\]/i) { $game_actors[$game_party.reserve_choice_id].name }
- @text.gsub!(/\\N\[選択項目\]/i) { $game_temp.last_select_choice }
- @text.gsub!(/\\\*/){ "" }
- tig_ec_convert_special_characters
- end
- #--------------------------------------------------------------------------
- # ◎ 消息开始(估计是帮助)
- #--------------------------------------------------------------------------
- alias tig_ec_start_message start_message
- def start_message
- face_sprite_dispose
- tig_ec_start_message
- if @item_max > MAX_LINE
- create_contents # 最大項目以上の選択肢の際に項目をすべて線画させる
- unless $game_message.face_name.empty?
- draw_face_sprite($game_message.face_name, $game_message.face_index)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ◎ 分页进程处理
- #--------------------------------------------------------------------------
- alias tig_ec_new_page new_page
- def new_page
- tig_ec_new_page
- if @item_max > 4
- @line_count = 4 - @item_max
- end
- end
- #--------------------------------------------------------------------------
- # ○ 工作面图形(精灵【就是活动版块吧】)的描绘
- # face_name : 图形文件名称
- # face_index : 图形对照的参数
- # size : 查看尺寸
- #--------------------------------------------------------------------------
- def draw_face_sprite(face_name, face_index, size = 96)
- rect = Rect.new(0, 0, 0, 0)
- rect.x = face_index % 4 * 96 + (96 - size) / 2
- rect.y = face_index / 4 * 96 + (96 - size) / 2
- rect.width = size
- rect.height = size
- @face_sprite = Sprite.new
- @face_sprite.bitmap = Cache.face(face_name)
- @face_sprite.src_rect = rect
- @face_sprite.z = 200
- @face_sprite.x = self.x + 16
- @face_sprite.y = self.y + 16
- end
- #--------------------------------------------------------------------------
- # ○ 开放脸图形(精灵)
- #--------------------------------------------------------------------------
- def face_sprite_dispose
- unless @face_sprite.nil?
- @face_sprite.dispose unless @face_sprite.disposed?
- end
- end
- #--------------------------------------------------------------------------
- # ○ 开放脸图形
- #--------------------------------------------------------------------------
- def dispose
- super
- face_sprite_dispose
- end
- #--------------------------------------------------------------------------
- # ○ 关闭脸图形
- #--------------------------------------------------------------------------
- def close
- super
- face_sprite_dispose
- end
- #--------------------------------------------------------------------------
- # ● 更新光标
- #--------------------------------------------------------------------------
- def update_cursor
- 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
- x = $game_message.face_name.empty? ? 0 : 112
- y = ($game_message.choice_start + @index) * WLH
- y -= self.oy
- self.cursor_rect.set(x, y, contents.width - x, WLH)
- end
- end
- #--------------------------------------------------------------------------
- # ◎ 发送输入处理
- #--------------------------------------------------------------------------
- alias tig_ec_input_pause input_pause
- def input_pause
- if $game_message.cancel_input
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $game_variables[Expansion_Choices::CHOICE_RESUIT_VARIABLES] = 0
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- $game_variables[Expansion_Choices::CHOICE_RESUIT_VARIABLES] = -1
- end
- end
- tig_ec_input_pause
- end
- end
- #==============================================================================
- # □ Window_Choice
- #------------------------------------------------------------------------------
- # 窗口显示其他选择
- #==============================================================================
- class Window_Choice < Window_Selectable
- #--------------------------------------------------------------------------
- # ○ 公共实例变量
- #--------------------------------------------------------------------------
- attr_reader :choice
- attr_reader :window_row_max
- attr_accessor :delay
- #--------------------------------------------------------------------------
- # ○ 对象初始化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 64, 64)
- @column_max = 1
- @spacing = 16
- @delay = 0
- create_help_window
- create_gold_window
- end
- #--------------------------------------------------------------------------
- # ○ 获取窗口类型
- #--------------------------------------------------------------------------
- def window_type
- return -1 if @choice == nil
- return @choice.window_type
- end
- #--------------------------------------------------------------------------
- # ○ 设置窗口
- #--------------------------------------------------------------------------
- def setting(choice)
- @choice = choice
- @item_max = @choice.size
- case @choice.window_type
- when -1 # 使用的坐标定位选项
- @window_row_max = 9
- set_column_max
- self.width = choise_width
- self.height = choise_height
- self.x = 288
- self.y = center_y(144)
- when 0 # 为窗口的位置定义(不清楚)
- @window_row_max = 4
- set_column_max
- self.width = 544
- self.height = 128
- self.x = 0
- case $game_message.position
- when 0 ; self.y = 288 # 上
- when 1 ; self.y = 288 # 真ん中
- when 2 ; self.y = 0 # 下
- end
- when 1 # 当1号的消息窗口向上或向下时,选择适当的位置
- @window_row_max = 4
- set_column_max
- self.width = choise_width
- self.height = choise_height
- self.x = align_right_x(480)
- self.y = center_y(208)
- when 2 # 帮助窗口,并为稍低的位置选择合适的位置
- @window_row_max = 7
- set_column_max
- self.width = choise_width
- self.height = choise_height
- self.x = align_right_x(480)
- self.y = center_y(172)
- when 3 # 中心窗口的位置
- @window_row_max = 4
- set_column_max
- self.width = choise_width
- self.height = choise_height
- self.x = center_x(272)
- self.y = center_y(208)
- when 4 # 使用金币的帮助下显示位置位于商店
- @window_row_max = 7
- set_column_max
- self.width = choise_width
- self.height = choise_height
- self.x = 50
- self.y = center_y(172)
- end
- self.index = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ 坐标和位置 (不清楚啊)
- #--------------------------------------------------------------------------
- def set_column_max
- if @choice.column
- @column_max = @choice.size / @window_row_max
- @column_max += 1 if @choice.size % @window_row_max != 0
- else
- @column_max = 1
- end
- end
- #--------------------------------------------------------------------------
- # ○ 获得整个选择窗口
- #--------------------------------------------------------------------------
- def choise_width
- size = 32
- for i in @choice.choices
- size = [size, self.contents.text_size(i).width].max + 1
- end
- unless @choice.icon.empty? # 如果图标显示范围太长就延长(好像是这样的)
- size += 24
- end
- unless @choice.price.empty? # 如果价格显示太长就延长(一样)
- size += 80
- cx = contents.text_size(Vocab::gold).width
- size += cx if contents.text_size(Vocab::gold).width <= 36
- end
- size *= @column_max
- unless @choice.face_name == "" # 如果宽度显示短,并延伸宽度
- size += 112
- end
- return size + (@spacing * (@column_max - 1)) + 32 + 1
- end
- #--------------------------------------------------------------------------
- # ○ 根据选择获取窗口的高度
- #--------------------------------------------------------------------------
- def choise_height
- row = row_max
- row += @choice.pick_up.size if @choice.pick_up
- height = row * WLH
- unless @choice.face_name == ""
- height = [96, height].max
- end
- max_height = @window_row_max * WLH
- return [height, max_height].min + 32
- end
- #--------------------------------------------------------------------------
- # ○ 中心窗口 X坐标(中心)
- #--------------------------------------------------------------------------
- def center_x(x)
- return x - self.width / 2
- end
- #--------------------------------------------------------------------------
- # ○ 得到完成窗口和窗口时的终点 X坐标(右对齐)
- #--------------------------------------------------------------------------
- def align_right_x(x)
- return x - self.width
- end
- #--------------------------------------------------------------------------
- # ○ 中心窗口 Y坐标(中心)
- #--------------------------------------------------------------------------
- def center_y(y)
- return y - self.height / 2
- end
- #--------------------------------------------------------------------------
- # ○ 得到完窗成口和窗口时的终点 Y坐标(下)
- #--------------------------------------------------------------------------
- def align_bottom_y(y)
- return y - self.height
- end
- #--------------------------------------------------------------------------
- # ○ 创建一个帮助窗口
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Help.new
- @help_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ○ 创建一个所持金币窗口
- #--------------------------------------------------------------------------
- def create_gold_window
- @gold_window = Window_Gold.new(384, 0)
- @gold_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ○ 打开窗口
- #--------------------------------------------------------------------------
- def dispose
- super
- face_sprite_dispose
- dispose_gold_window
- dispose_gold_window
- end
- #--------------------------------------------------------------------------
- # ○ 帮助的窗口释放
- #--------------------------------------------------------------------------
- def dispose_help_window
- @help_window.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 所持金币窗口的释放
- #--------------------------------------------------------------------------
- def dispose_gold_window
- @gold_window.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 刷新窗口
- #--------------------------------------------------------------------------
- def refresh
- @item_max = @choice.size
- create_contents
- return if @choice.nil?
- unless @choice.face_name == "" # 人脸图形
- draw_face_sprite(@choice.face_name, @choice.face_index, @choice.re_face)
- end
- for i in 0...@item_max
- draw_item(i)
- end
- @index = [@index, @item_max - 1].min
- unless @index < 0
- self.bottom_row = [@index / @column_max, self.bottom_row].min
- end
- end
- #--------------------------------------------------------------------------
- # ○ 获取项目窗口
- # index : 项目编号
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- width = contents.width
- width -= 112 if @choice.face_name != ""
- rect.width = (width + @spacing) / @column_max - @spacing
- rect.height = WLH
- rect.x = index % @column_max * (rect.width + @spacing)
- rect.x += 112 if @choice.face_name != "" and not @choice.re_face
- rect.y = index / @column_max * WLH
- return rect
- end
- #--------------------------------------------------------------------------
- # ○ 窗口(或者是选择,不确定)描绘
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- if @choice.icon[@choice.display_item_index[index]] # 加上图标
- draw_icon(@choice.icon[@choice.display_item_index[index]], rect.x, rect.y, enabled(index))
- end
- unless @choice.icon.empty?
- rect.x += 24
- rect.width -= 24
- end
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled(index) ? 255 : 128
- self.contents.draw_text(rect, @choice.item[index])
- if @choice.price[@choice.display_item_index[index]] # 查看价格值
- value = @choice.price[@choice.display_item_index[index]]
- rect.width -= 4
- cx = contents.text_size(Vocab::gold).width
- if cx <= 36 # 短时期显示货币,你隐藏窗口长时间(不确定)
- self.contents.font.color = system_color
- self.contents.font.color.alpha = enabled(index) ? 255 : 128
- self.contents.draw_text(rect, Vocab::gold, 2)
- rect.width -= ( cx + 2 )
- end
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled(index) ? 255 : 128
- self.contents.draw_text(rect, value, 2)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 描画工作面图形(精灵)
- # face_name : 图形文件名称
- # face_index : 图形对应参数
- # size : 查看尺寸
- #--------------------------------------------------------------------------
- def draw_face_sprite(face_name, face_index, re_fase, size = 96)
-
- rect = Rect.new(0, 0, 0, 0)
- rect.x = face_index % 4 * 96 + (96 - size) / 2
- rect.y = face_index / 4 * 96 + (96 - size) / 2
- rect.width = size
- rect.height = size
- @face_sprite = Sprite.new
- @face_sprite.bitmap = Cache.face(face_name)
- @face_sprite.src_rect = rect
- @face_sprite.z = 200
- if re_fase
- @face_sprite.x = self.x + self.width - size - 16
- @face_sprite.mirror = true
- else
- @face_sprite.x = self.x + 16
- end
- @face_sprite.y = self.y + 16
- end
- #--------------------------------------------------------------------------
- # ○ 开放脸图形(精灵)
- #--------------------------------------------------------------------------
- def face_sprite_dispose
- unless @face_sprite.nil?
- @face_sprite.dispose unless @face_sprite.disposed?
- end
- end
- #--------------------------------------------------------------------------
- # ○启用编号标志
- #--------------------------------------------------------------------------
- def enabled(index)
- return false if @choice.can_not_select_active.include?(index)
- if @choice.price[@choice.display_item_index[index]]
- if @choice.price[@choice.display_item_index[index]] > $game_party.gold
- return false
- end
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ○ 窗口更新
- #--------------------------------------------------------------------------
- def update
- super
- @delay -= 1 unless @delay == 0
- @help_window.update
- @gold_window.update
- unless @face_sprite.nil?
- @face_sprite.visible = self.openness == 255 unless @face_sprite.disposed?
- end
- end
- #--------------------------------------------------------------------------
- # ○ 打开一个窗口
- #--------------------------------------------------------------------------
- def open
- super
- return unless @opening
- if $game_message.show_ex_choices.help_text != []
- @help_window.visible = true
- end
- unless @choice.price.empty?
- @gold_window.y = $game_message.show_ex_choices.help_text.empty? ? 0 : 56
- @gold_window.refresh
- @gold_window.visible = true
- end
- @delay = Expansion_Choices::EX_CHOICES_DELAY #延迟的时间(不确定)
- end
- #--------------------------------------------------------------------------
- # ○ 关闭窗口
- #--------------------------------------------------------------------------
- def close
- super
- return unless @closing
- face_sprite_dispose
- @help_window.visible = false
- @gold_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ○ 说明文字更新
- #--------------------------------------------------------------------------
- def update_help
- return if @choice.nil?
- if @choice.display_item_index[@index].nil?
- @help_window.set_text("")
- else
- text = @choice.help_text[@choice.display_item_index[@index]]
- @help_window.set_text(text.nil? ? "" : text)
- end
- end
- end
- #==============================================================================
- # □ Window_Pickup
- #------------------------------------------------------------------------------
- # 对于您所选择的选项处理窗口。
- #==============================================================================
- class Window_Pickup < Window_Selectable
- #--------------------------------------------------------------------------
- # ○ 对象初始化
- #--------------------------------------------------------------------------
- def initialize(choice_window)
- @choice_window = choice_window
- super(0, 0, 64, 64)
- end
- #--------------------------------------------------------------------------
- # ○ 刷新窗口
- #--------------------------------------------------------------------------
- def refresh
- self.x = @choice_window.x - @choice_window.width - 32
- self.y = @choice_window.y
- self.width = @choice_window.width
- self.height = @choice_window.height
- create_contents
- return if @choice_window.choice.nil?
- return if @choice_window.choice.pick_up.nil?
- self.visible = true
- @item_max = [@choice_window.choice.pick_up.size, @choice_window.window_row_max].min
- y = 0
- ([@choice_window.choice.pick_up.size - @item_max, 0].max).upto(@choice_window.choice.pick_up.size) do |i|
- draw_item(i, y)
- y += 1
- end
- end
- #--------------------------------------------------------------------------
- # ○ 項目的描绘
- #--------------------------------------------------------------------------
- def draw_item(index, y)
- return if @choice_window.choice.pick_up[index].nil?
- rect = item_rect(y)
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.draw_text(rect, @choice_window.choice.choices[@choice_window.choice.pick_up[index]])
- end
- end
复制代码 |
评分
-
查看全部评分
|