Project1

标题: 很多选择该怎么办 [打印本页]

作者: 暗●乩童    时间: 2008-1-10 18:51
标题: 很多选择该怎么办
遇到某个事件后,会跳出100个选择,不同的选择都会打开一个不同的开关,哪位高手教教我该如何做?对话框的样子,像RM默认的物品浏览窗口,但不需要显示物品图片。 [LINE]1,#dddddd[/LINE]版务信息:本贴由楼主自主结贴~
作者: 暗●乩童    时间: 2008-1-10 18:51
标题: 很多选择该怎么办
遇到某个事件后,会跳出100个选择,不同的选择都会打开一个不同的开关,哪位高手教教我该如何做?对话框的样子,像RM默认的物品浏览窗口,但不需要显示物品图片。 [LINE]1,#dddddd[/LINE]版务信息:本贴由楼主自主结贴~
作者: 精灵使者    时间: 2008-1-10 18:53
我记得有一个超级选择项脚本……
作者: 最後一滴淚    时间: 2008-1-10 19:05
  1. class Game_Temp
  2.   attr_accessor :need_show_more
  3.   attr_accessor :window_pos_y
  4.   attr_accessor :choices
  5.   
  6.   alias old_ini initialize
  7.   def initialize
  8.     old_ini
  9.     @need_show_more = false
  10.     @window_pos_y = 16
  11.     @choices = nil
  12.   end
  13. end

  14. class Window_Message < Window_Selectable
  15.   alias old_ref refresh
  16.   def refresh
  17.     if $game_temp.need_show_more
  18.       self.y = $game_temp.window_pos_y
  19.       self.height = 160 + 32 * ($game_temp.choice_max - 4)
  20.       self.contents = Bitmap.new(self.width - 32, self.height - 32)
  21.     else
  22.       self.height = 160
  23.       self.contents = Bitmap.new(self.width - 32, self.height - 32)
  24.     end
  25.     old_ref
  26.   end
  27.   #--------------------------------------------------------------------------
  28.   # ● 刷新画面
  29.   #--------------------------------------------------------------------------
  30.   def update
  31.     super
  32.     # 渐变的情况下
  33.     if @fade_in
  34.       self.contents_opacity += 24
  35.       if @input_number_window != nil
  36.         @input_number_window.contents_opacity += 24
  37.       end
  38.       if self.contents_opacity == 255
  39.         @fade_in = false
  40.       end
  41.       return
  42.     end
  43.     # 输入数值的情况下
  44.     if @input_number_window != nil
  45.       @input_number_window.update
  46.       # 确定
  47.       if Input.trigger?(Input::C)
  48.         $game_system.se_play($data_system.decision_se)
  49.         $game_variables[$game_temp.num_input_variable_id] =
  50.           @input_number_window.number
  51.         $game_map.need_refresh = true
  52.         # 释放输入数值窗口
  53.         @input_number_window.dispose
  54.         @input_number_window = nil
  55.         terminate_message
  56.       end
  57.       return
  58.     end
  59.     # 显示信息中的情况下
  60.     if @contents_showing
  61.       # 如果不是在显示选择项中就显示暂停标志
  62.       if $game_temp.choice_max == 0
  63.         self.pause = true
  64.       end
  65.       # 取消
  66.       if Input.trigger?(Input::B)
  67.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  68.           $game_system.se_play($data_system.cancel_se)
  69.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  70.           $game_variables[100] = $game_temp.choice_cancel_type - 1
  71.           $game_temp.need_show_more = false
  72.           terminate_message
  73.         end
  74.       end
  75.       # 确定
  76.       if Input.trigger?(Input::C)
  77.         if $game_temp.choice_max > 0
  78.           $game_system.se_play($data_system.decision_se)
  79.           $game_variables[100] = self.index
  80.           $game_temp.choice_proc.call(self.index)
  81.         end
  82.         $game_temp.need_show_more = false
  83.         terminate_message
  84.       end
  85.       return
  86.     end
  87.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  88.     if @fade_out == false and $game_temp.message_text != nil
  89.       @contents_showing = true
  90.       $game_temp.message_window_showing = true
  91.       reset_window
  92.       refresh
  93.       Graphics.frame_reset
  94.       self.visible = true
  95.       self.contents_opacity = 0
  96.       if @input_number_window != nil
  97.         @input_number_window.contents_opacity = 0
  98.       end
  99.       @fade_in = true
  100.       return
  101.     end
  102.     # 没有可以显示的信息、但是窗口为可见的情况下
  103.     if self.visible
  104.       @fade_out = true
  105.       self.opacity -= 48
  106.       if self.opacity == 0
  107.         self.visible = false
  108.         @fade_out = false
  109.         $game_temp.message_window_showing = false
  110.       end
  111.       return
  112.     end
  113.   end
  114. end

  115. class Interpreter
  116.   def command_102
  117.     # 文章已经设置过 message_text 的情况下
  118.     if $game_temp.message_text != nil
  119.       # 结束
  120.       return false
  121.     end
  122.     # 设置信息结束后待机和返回调用标志
  123.     @message_waiting = true
  124.     $game_temp.message_proc = Proc.new { @message_waiting = false }
  125.     # 设置选择项
  126.     $game_temp.message_text = ""
  127.     $game_temp.choice_start = 0
  128.     if $game_temp.need_show_more
  129.       @parameters = [$game_temp.choices, $game_temp.choice_cancel_type]
  130.     end
  131.     setup_choices(@parameters)
  132.     # 继续
  133.     return true
  134.   end
  135. end
复制代码

http://rpg.blue/web/htm/news371.htm [LINE]1,#dddddd[/LINE]系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1