Project1

标题: 自己乱搞了个窗口,想做其它用途,失败,求助! [打印本页]

作者: kvkv97    时间: 2015-8-6 14:19
标题: 自己乱搞了个窗口,想做其它用途,失败,求助!
本帖最后由 kvkv97 于 2015-8-6 14:25 编辑

  1. #【说明】:在地图上建立一个事件调用脚本,事件脚本“$scene = My_scene.new”
  2. #用ABC做其它作用
  3. class My_window < Window_Selectable
  4.   def initialize(width,aaa) #aaa表示光标选项
  5.     super(0,0,100,aaa.size * 32 + 32)
  6.     @item_max = aaa.size
  7.     @aaa[/url] = aaa
  8.     self.contents = Bitmap.new(width, @item_max * 32)
  9.     refresh
  10.     self.index = 0
  11.   end
  12.   def refresh
  13.     for i in [email][email protected][/email]
  14.       draw_item(i)#
  15.     end
  16.   end
  17.   def draw_item(index)
  18.     rect = Rect.new(4, 32*index, self.contents.width, 32)
  19.     self.contents.draw_text(rect, @aaa[index])#在矩形中描绘字符串(数组)
  20.   end
  21. end
  22. class My_scene
  23.   def main
  24.     s1 = "A"
  25.     s2 = "B"
  26.     s3 = "C"
  27.     @my_window = My_window.new(32, [s1, s2, s3])
  28.     Graphics.transition
  29.     loop do
  30.       Graphics.update
  31.       Input.update
  32.       update
  33.       if $scene != self
  34.         break
  35.       end
  36.     end
  37.     Graphics.freeze
  38.     @my_window.dispose
  39.   end
  40.   def update
  41.     # 刷新命令窗口
  42.     @my_window.update
  43.     if Input.trigger?(Input::C)
  44.       # 命令窗口的光标位置的分支
  45.       case @my_window.index
  46.       when 0  # A
  47. #        command_new_game
  48.       when 1  # B
  49. #        command_continue
  50.       when 2  # C
  51. #        command_shutdown
  52.     end
  53.     end
  54.     if Input.trigger?(Input::SHIFT)
  55.       $game_system.se_play($data_system.cancel_se)
  56.       $scene = Scene_Map.new
  57.     end
  58.   end
  59. end
复制代码
发现初始化不了场景,急求助大神。帮解决!!
作者: 英顺的马甲    时间: 2015-8-6 16:24
继承错了,应该要继承Window_Command




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