查看: 2565|回复: 4

[RMVA发布] 帮朋友制作的一个事件薄菜单

[复制链接]
梦石
0
星屑
60
在线时间
9 小时
注册时间
2007-2-23
回帖
23
发表于 2013-4-13 18:35:42 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 rrobin 于 2013-4-13 19:05 编辑

朋友在做一个侦探类的游戏,需要记录发成过的案件以及得到的线索,于是就帮忙做了一个
具体的内容有:
1.在主界面显示一个菜单选项,默认为"事件薄",可自定义,按ok进入事件薄主界面
2.事件薄主界面1显示章节标签,事件薄封面资源可替换,标签资源可替换,每页显示标签数可设置,指示标签(当所有标签大于显示标签数量时出现)内容可替换
3.事件薄主界面2显示案件标签,按ok进入案件线索界面
4.线索详细内容自动换行
5.章节名,案件名,线索名,线索详细内容均可自定义
6.可保存,可读取
效果图:

主界面

主界面

事件薄界面1

事件薄界面1

事件薄界面2

事件薄界面2

评分

参与人数 1星屑 +20 收起 理由
joe5491 + 20 塞糖

查看全部评分

梦石
0
星屑
60
在线时间
9 小时
注册时间
2007-2-23
回帖
23
 楼主| 发表于 2013-4-13 18:42:36 | 显示全部楼层
本帖最后由 rrobin 于 2013-4-13 21:53 编辑

效果图:


  1. #-----------------------------------------------------------------------------
  2. # 游戏任务事件对象
  3. #-----------------------------------------------------------------------------

  4. class Game_EventVariables
  5.   attr_accessor :Chapter        #进行了的章节
  6.   attr_accessor :Last_Chapter   #正在进行的章节
  7.   def initialize
  8.     @Chapter = []
  9.     @Last_Chapter = -1
  10.   end

  11.   # 新的一章开始时调用
  12.   # 此调用必须!! 否则保存的事件薄数据将会错误
  13.   # 最好在新章节开始时过场事件内调用
  14.   def StartChapter(name)
  15.     chapter = EventBookDef.getChapter(name)
  16.     if !EventBookDef.has_Chapter?(chapter.id)
  17.       msgbox("使用了未定义的章节名<#{name}>")
  18.       return
  19.     end
  20.     if @Chapter.include?(chapter.id)
  21.       msgbox("已经进行过了此章节<#{name}>")
  22.       return
  23.     end
  24.     @Chapter[chapter.id] = Game_SaveChapter.new(chapter.id)
  25.     @Last_Chapter = chapter.id
  26.   end
  27.   
  28.   
  29.   # 获得一个案件的线索时调用 传入案件名字以及对应的线索名字
  30.   def FindKey(caseName,keyName)
  31.     chapter = EventBookDef.getChapterByIndex(@Last_Chapter)
  32.     if chapter == nil
  33.       msgbox("获得线索时未找到当前章节,确认是否在章节开始时调用过StartChapter脚本")
  34.       return
  35.     end
  36.     caseName.gsub!(/\n/) {""}  #去掉脚本输入框带来的\n
  37.     caseTemp = chapter.getCase(caseName)
  38.     if caseTemp == nil
  39.       msgbox("未在当前章节找到案件<#{caseName}>")
  40.       return
  41.     end
  42.     keyName.gsub!(/\n/) {""}   #去掉脚本输入框带来的\n
  43.     keyIndex = caseTemp.getKeyIndex(keyName)
  44.     if keyIndex == -1
  45.       msgbox("未在当前章节案件<#{caseName}>中找到线索<#{keyName}>")
  46.       return
  47.     end
  48.     @Chapter[@Last_Chapter].getCase(caseTemp.id).addKey(keyIndex)
  49.   end
  50. end

  51. # 用来保存的数据
  52. class Game_SaveChapter
  53. attr_accessor :id
  54. attr_accessor :case
  55.   def initialize(id)
  56.     @id = id
  57.     @case = []          # 正在进行中的案件,保存index
  58.   end
  59.   
  60.   def getCase(index)
  61.     return @case[index]  if @case.size > index
  62.     @case[index] = Game_SaveCase.new(index)
  63.     return @case[index]
  64.   end
  65. end

  66. class Game_SaveCase
  67. attr_accessor :id
  68. attr_accessor :Keys       # 已获得的Key,保存index
  69.   def initialize(id)
  70.     @id = id
  71.     @Keys = []
  72.   end
  73.   
  74.   def addKey(key_id)
  75.     @Keys.push key_id unless @Keys.include?(key_id)
  76.   end
  77. end


  78. # 用来显示的数据

  79. class Game_Chapter
  80. attr_accessor :name
  81. attr_accessor :id
  82.   def initialize(name,id)
  83.    @name = name
  84.    @id = id
  85.    @case = {}
  86. end

  87. def addCase(name)
  88.    return @case[name] if @case.include?(name)
  89.    @case[name] = Game_Case.new(name,@case.size)
  90. end

  91. def getCase(name)
  92.     return nil unless @case.include?(name)
  93.     return @case[name]
  94.   end
  95.   
  96.   def getCaseName(index)
  97.     @case.each { |p| return p[1].name if p[1].id == index}
  98.     return "未知案件"
  99.   end

  100. end


  101. class Game_Case
  102.   attr_accessor :name
  103.   attr_accessor :id
  104.   def initialize(name,id)
  105.     @name = name
  106.     @id = id
  107.     [url=home.php?mod=space&uid=20462]@KEY[/url] = []
  108.   end
  109.   
  110.   def Key(index)
  111.       return nil unless @key.size > index
  112.       return @key[index]
  113.   end

  114.   def addKey(keyname, keydetail)
  115.     @key.each{|p| return if p.name == keyname }
  116.     @key.push(Game_EventKey.new(keyname,keydetail))  
  117.   end

  118.   def getKeyIndex(keyname)
  119.     i = 0
  120.     until i >= @key.size
  121.       return i if @key[i].name == keyname  
  122.       i += 1
  123.     end
  124.     return -1
  125.   end
  126. end


  127. class Game_EventKey
  128.   attr_accessor :name
  129.   attr_accessor :detail
  130.   
  131.   def initialize(name,detail)
  132.     @name = name
  133.     @detail = detail
  134.   end
  135. end

  136. #-----------------------------------------------------------------------------
  137. # 事件薄系统宏
  138. #-----------------------------------------------------------------------------

  139. module EventBookDef
  140.   
  141.   def self.init()
  142.     @Chapter = {}
  143.     create_all_chapter
  144.     @ChapterCount = @Chapter.size
  145.   end
  146.   
  147.   Menu  = "事件薄"
  148.   
  149.   # 文件存放路径
  150.   ResFolder = "Graphics/EventBook/"
  151.   # 事件薄封面图
  152.   ResCover =  "cover"
  153.   # 标签图
  154.   ResTag   =  "tag"
  155.   
  156.   # 事件薄侧标签最大显示个数
  157.   BookTagPreCount = 5
  158.   
  159.   # 这里最好自己用注释做一些分类,按章节,按案件内容随个人喜好, 这里并不需要顺序的添加
  160.   # 章节里线索信息
  161.   def self.create_all_chapter
  162.     addKey("章节1","案件1","线索1","看看这里能不能编辑需要显示的文字,看看这里能不能编辑需要显示的
  163. 文字.看看这里能不能编辑需要显示的文字,看看这里能不能编辑需要
  164. 显示的文字")
  165.     addKey("章节1","案件1","线索2","测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行")
  166.     addKey("章节1","案件1","线索3","测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行")
  167.     addKey("章节1","案件2","线索1","测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行")
  168.     addKey("章节1","案件2","线索1","测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行")
  169.     addKey("章节1","案件2","线索1","测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行")
  170.     addKey("章节1","案件3","线索1","测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行测试多行")
  171.   end
  172.   
  173.   def self.addChapter(chapter)
  174.     @Chapter[chapter] = Game_Chapter.new(chapter,@Chapter.size) unless @Chapter.include?(chapter)
  175.     return @Chapter[chapter]
  176.   end
  177.   
  178.   def self.getChapter(chapter)
  179.     return @Chapter[chapter] if @Chapter.include?(chapter)
  180.     return addChapter(chapter)
  181.   end
  182.   
  183.   def self.has_Chapter?(index)
  184.     @ChapterCount > index
  185.   end
  186.   
  187.   def self.getChapterByIndex(index)
  188.     @Chapter.each do |p|
  189.       return p[1] if p[1].id == index
  190.     end
  191.     return nil
  192.   end
  193.   
  194.   def self.getChapterName(index)
  195.    
  196.     @Chapter.each do |p|
  197.       return p[1].name if p[1].id == index
  198.     end
  199.     return "未知章节"
  200.   end
  201.   
  202.   def self.getCaseName(chapter,case_id)
  203.     return "未知案件" unless @Chapter.include?(chapter)
  204.     return @Chapter[chapter].getCaseName(case_id)
  205.   end
  206.   
  207.   def self.addKey(chapter,_case,key,detail)
  208.     getChapter(chapter).addCase(_case).addKey(key,detail)
  209.   end

  210.   def self.setDetailData(data)
  211.     @detailData = data
  212.   end
  213.   
  214.   def self.getDetailData()
  215.     return @detailData
  216.   end
  217.   
  218.   PointText = "..."
  219. end
  220.   

  221. #-----------------------------------------------------------------------------
  222. # 事件薄主界面
  223. #-----------------------------------------------------------------------------

  224. # 事件薄标签
  225. class EventNoteTag < Sprite
  226. attr_accessor:info
  227.   def initialize(viewport = nil)
  228.     super(viewport)
  229.     create_tag
  230.   end
  231.   
  232.   def dispose
  233.     self.bitmap.dispose if bitmap
  234.     super
  235.   end
  236.   
  237.   def selected
  238.     self.zoom_x = 1.1
  239.     self.zoom_y = 1.1
  240.   end
  241.   
  242.   def unselected
  243.     self.zoom_x = 1
  244.     self.zoom_y = 1
  245.   end
  246.   
  247.   def create_tag
  248.     self.bitmap = Cache.load_bitmap(EventBookDef::ResFolder,EventBookDef::ResTag).clone
  249.   end
  250.   
  251.   def setPos(x,y)
  252.     self.x = x
  253.     self.y = y
  254.   end
  255.   
  256.   def update
  257.     super
  258.   end
  259.   
  260.   def info=(info)
  261.     @info = info
  262.     update_info
  263.   end

  264.   def update_info
  265.     #self.contents.draw_text(self.bitmap.rect,"",1)
  266.     self.bitmap.clear
  267.     self.bitmap = Cache.load_bitmap(EventBookDef::ResFolder,EventBookDef::ResTag).clone
  268.     self.bitmap.draw_text(self.bitmap.rect,info,1)
  269.   end
  270. end

  271. # 事件薄标签菜单
  272. class EventNoteMenu < Window
  273. attr_accessor:preCount        #一页可显示标签数
  274. attr_accessor:index           #当前光标所在位置

  275. attr_reader:startIndex        #当前页开始位置
  276. attr_reader:endIndex          #当前页结束位置

  277.   def initialize(preCount = 1,x,y,w,h)
  278.      super(x,y,w,h)
  279.      @preCount = preCount
  280.      @viewport = Viewport.new
  281.      @tags = []
  282.      @tagsData = []
  283.      @pointTag = []
  284.      @index = -1
  285.      @last_index = -2
  286.      @maxSize = 0
  287.      @startIndex = 0
  288.      @last_startIndex = -1
  289.      @maxSize > @preCount ? @endIndex = @preCount : @endIndex = @maxSize
  290.      create_onePageTags
  291.      create_pointTags
  292.      update_tagsContent
  293.      update_tags
  294.      #select(0)
  295.    end
  296.    
  297.   def dispose
  298.     @viewport.dispose if @viewport
  299.     super
  300.   end
  301.    
  302.   def create_onePageTags
  303.     count = 0
  304.     until count == @preCount || count == @maxSize
  305.       @tags.push(EventNoteTag.new(@viewport))
  306.       count+=1
  307.     end
  308.     @startIndex = 0 if @maxSize
  309.   end  
  310.   
  311.   def create_pointTags
  312.     return unless @maxSize > @preCount
  313.     @pointTag[0] = EventNoteTag.new(@viewport)
  314.     @pointTag[0].x = x
  315.     @pointTag[0].y = y
  316.     @pointTag[0].info = EventBookDef::PointText
  317.     @pointTag[1] = EventNoteTag.new(@viewport)
  318.     @pointTag[1].info = EventBookDef::PointText
  319.     @pointTag[1].x = x
  320.     @pointTag[1].y = y
  321.   end
  322.   
  323.   def setData(tagsData)
  324.     @tagsData.clear if @tagsData
  325.     @tagsData = tagsData
  326.     @maxSize = @tagsData.size
  327.     @maxSize > @preCount ? @endIndex = @preCount : @endIndex = @maxSize
  328.     @tags.each {|tag| tag.dispose}
  329.     @tags.clear
  330.     @pointTag.each{|tag| tag.dispose }
  331.     @pointTag.clear
  332.     create_onePageTags
  333.     create_pointTags
  334.     update_tagsContent
  335.     @index = -1
  336.     @last_index = -2
  337.     update_tags
  338.     select(0)
  339.   end
  340.   
  341.   def getData
  342.     return @tagsData[@startIndex + @index] if @index && @startIndex
  343.     return nil
  344.   end
  345.   
  346.   def cursor_movable?
  347.     @index >= 0 && @index < @preCount
  348.   end
  349.   
  350.   def cursor_up(wrap = false)
  351.     @index -= 1
  352.     select(@index)
  353.   end
  354.   
  355.   def cursor_down(wrap = false)   
  356.     @index += 1
  357.     select(@index)
  358.   end
  359.   
  360.   def pageUp
  361.     @index -= @preCount
  362.     select([@index,@startIndex].max)
  363.   end
  364.   
  365.   def pageDown
  366.     @index += @preCount
  367.     select([@index,@endIndex].min)
  368.   end
  369.   
  370.   def select(index)
  371.     return unless @maxSize != 0
  372.     @index = index
  373.     if @index < 0
  374.       if @startIndex > 0
  375.         @startIndex -= 1
  376.         @endIndex -= 1
  377.       else
  378.         Sound.play_buzzer
  379.       end
  380.       @index = 0
  381.       update_tagsContent
  382.       Sound.play_cursor
  383.     else
  384.       if @index == (@endIndex - @startIndex)
  385.         if @endIndex != @maxSize
  386.           @startIndex += 1
  387.           @endIndex += 1
  388.         else
  389.           Sound.play_buzzer
  390.         end
  391.         @index -= 1
  392.         update_tagsContent
  393.         Sound.play_cursor
  394.       end
  395.     end
  396.     @tags[@index].selected if @index >= 0
  397.     @tags[@last_index].unselected if @last_index >= 0 &&  @index != @last_index
  398.     update_tags
  399.   end
  400.   
  401.   def process_cursor_move
  402.     return unless cursor_movable?
  403.     @last_index = @index
  404.     cursor_down (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
  405.     cursor_up   (Input.trigger?(:UP))    if Input.repeat?(:UP)
  406.     pageUp      if Input.trigger?(:R)
  407.     pageDown    if Input.trigger?(:L)
  408.     Sound.play_cursor if @index != @last_index
  409.   end

  410.   def update
  411.     super
  412.     process_cursor_move
  413.   end
  414.   
  415.   def update_tags
  416.     #return unless @index != @last_index
  417.     index = 0
  418.     height = 0
  419.     until index == @preCount || index == @maxSize
  420.       @tags[index].setPos(x,(index+1) * @tags[index].height + y) if index != @index
  421.       @tags[index].setPos(x, @tags[index-1].height * index+@tags[index].height + y) if index > 0
  422.       height = @tags[index].y
  423.       index += 1
  424.     end
  425.     update_pointTags(height)
  426.   end
  427.   
  428.   def update_pointTags(height)
  429.       return unless @maxSize > @preCount
  430.       @startIndex == 0 ? @pointTag[0].visible = false : @pointTag[0].visible = true
  431.       @endIndex == @maxSize ? @pointTag[1].visible = false : @pointTag[1].visible = true
  432.       @pointTag[1].setPos(x,height+@pointTag[1].height)
  433.   end
  434.   
  435.   def update_tagsContent
  436.     index = 0
  437.     until index == @preCount || index == @maxSize
  438.     @tags[index].info = @tagsData[@startIndex + index][:text]
  439.     index += 1
  440.     end
  441.   end
  442. end


  443. #--------------------------------------------------------------------------------
  444. # 事件薄详细内容窗口
  445. #--------------------------------------------------------------------------------
  446. class Window_EventBook < Window_Selectable
  447.   #--------------------------------------------------------------------------
  448.   # ● 定义实例变量
  449.   #--------------------------------------------------------------------------
  450.   attr_accessor :BGSprite
  451.   attr_accessor :type
  452.   
  453.   def initialize
  454.     @BGSprite = Sprite.new(Viewport.new)
  455.     @BGSprite.bitmap = Cache.load_bitmap(EventBookDef::ResFolder,EventBookDef::ResCover)
  456.     bitmapTemp = Cache.load_bitmap(EventBookDef::ResFolder,EventBookDef::ResTag)
  457.     if @BGSprite != nil
  458.       super(([email]Graphics.width-@BGSprite.width[/email] - bitmapTemp.width)/2,(Graphics.height - @BGSprite.height)/2, @BGSprite.width, @BGSprite.height)
  459.     else
  460.       super(([email]Graphics.width-@BGSprite.width[/email] - bitmapTemp.width)/2,(Graphics.height - @BGSprite.height)/2, Graphics.width, Graphics.height)
  461.     end
  462.     @BGSprite.x = self.x
  463.     @BGSprite.y = self.y
  464.     self.windowskin = nil
  465.     preCount = EventBookDef::BookTagPreCount + 2#@BGSprite.height / bitmapTemp.height
  466.     book_x = x + @BGSprite.width
  467.     book_y = y + (@BGSprite.height - bitmapTemp.height*preCount)/2
  468.     preCount -= 2 #这里减去上下翻页提示数量
  469.     @book_menu = EventNoteMenu.new(preCount,book_x,book_y,bitmapTemp.width,bitmapTemp.height*preCount)
  470.     bitmapTemp.dispose
  471.     @type = 0
  472.     @dirty = true
  473.     activate
  474.   end
  475.   
  476.   def Type?(type)
  477.     @type == type
  478.   end
  479.   
  480.   def type=(type)
  481.     @type = type
  482.     @dirty = true
  483.   end
  484.   
  485.   def switchChapters
  486.     return unless @book_menu != nil
  487.     if @type == 0 && @dirty
  488.       data = []
  489.       i = 0
  490.       if $game_eventVar.Last_Chapter == -1
  491.         msgbox("未调用任何StartChapter")
  492.         @dirty = false
  493.         return
  494.       end
  495.       until i > $game_eventVar.Last_Chapter
  496.         data.push({:text=>EventBookDef.getChapterByIndex(i).name,:context => i})
  497.         i+=1
  498.       end
  499.        @book_menu.setData(data)
  500.         @dirty = false
  501.     end
  502.   end

  503. def switchEvent
  504.     return unless @book_menu != nil
  505.     if @type == 1 && @dirty
  506.      @dirty = false
  507.      data = []
  508.      @chapter = @book_menu.getData
  509.      if @chapter == nil
  510.        @type = 0
  511.        Sound.play_buzzer
  512.        return
  513.      end
  514.      caseTemp = $game_eventVar.Chapter[@book_menu.getData[:context]].case
  515.      if caseTemp.size == 0
  516.        @type = 0
  517.        Sound.play_buzzer
  518.        return
  519.      end
  520.      caseTemp.each {|p| data.push({:text=>EventBookDef.getCaseName(@chapter[:text],p.id),:context=>p.id})}
  521.      @book_menu.setData(data)
  522.     end
  523.   end
  524.   
  525.   def update
  526.     super
  527.     @book_menu.update
  528.     switchChapters
  529.     switchEvent
  530.   end
  531.   
  532.   def selectEvent
  533.      data = {:chapter=>@chapter,:case=>@book_menu.getData}
  534.      EventBookDef.setDetailData(data)
  535.   end
  536. end

  537. #-------------------------------------------------------------------------
  538. # 事件薄界面
  539. #-------------------------------------------------------------------------

  540. class Scene_EventBook < Scene_MenuBase
  541.    def start
  542.     super
  543.     create_book
  544.   end
  545.   
  546.   def create_book
  547.     @book_window = Window_EventBook.new
  548.     @book_window.set_handler(:cancel, method(:on_cancel))
  549.     @book_window.set_handler(:ok, method(:on_ok))
  550.   end
  551.   
  552.   def on_cancel
  553.     case @book_window.type
  554.     when 1
  555.       @book_window.type = 0
  556.       @book_window.activate
  557.     when 0
  558.       return_scene
  559.     end
  560.   end
  561.   
  562.   def on_ok
  563.     case @book_window.type
  564.     when 0
  565.       @book_window.type = 1
  566.       @book_window.activate
  567.     when 1
  568.       @book_window.selectEvent
  569.       SceneManager.call(Scene_EventDetail)
  570.     end
  571.   end
  572. end


  573. #------------------------------------------------------------------------------
  574. # 事件薄案件详细内容场景
  575. #------------------------------------------------------------------------------


  576. class Scene_EventDetail < Scene_Base
  577.   def start
  578.     super
  579.     create_detailWindow
  580.   end
  581.   
  582.   def create_detailWindow
  583.     @detail_window = Window_EventDetail.new()
  584.     @detail_window.set_handler(:cancel,method(:return_scene))
  585.   end  
  586. end

  587. #------------------------------------------------------------------------------
  588. # 事件薄案件详细内容窗口
  589. #------------------------------------------------------------------------------

  590. class Window_EventDetail < Window_Selectable
  591.    def initialize
  592.     super(0, 0, Graphics.width, Graphics.height)
  593.     @data = EventBookDef.getDetailData
  594.     @line = 0
  595.     create_tile
  596.     create_key_content
  597.     activate
  598.   end

  599.   def create_tile
  600.       str = @data[:case][:text]
  601.       p str
  602.       draw_text_ex((Graphics.width-text_size(str).width)/2,Font.default_size * @line,str)
  603.       @line += 1
  604.   end
  605.    
  606.   
  607.   def create_key_content
  608.      # 画线索的名字
  609.      chapter = @data[:chapter]
  610.      castTemp = $game_eventVar.Chapter[chapter[:context]].getCase(@data[:case][:context])
  611.      i = 0
  612.      until i >= castTemp.Keys.size
  613.        chapterIns = EventBookDef.getChapterByIndex(chapter[:context])
  614.        caseIns = chapterIns.getCase(@data[:case][:text])
  615.        keyIns = caseIns.Key(castTemp.Keys[i])
  616.        draw_text_ex(4, Font.default_size*@line,keyIns.name)
  617.        @line += 1
  618.        draw_text_ex(20,Font.default_size*@line,keyIns.detail)
  619.        @line += 1
  620.        i+=1
  621.      end
  622.    end
  623.   
  624.   # 难道需要自动换行?
  625.     #--------------------------------------------------------------------------
  626.   # ● 文字的处理
  627.   #     c    : 文字
  628.   #     text : 绘制处理中的字符串缓存(字符串可能会被修改)
  629.   #     pos  : 绘制位置 {:x, :y, :new_x, :height}
  630.   #--------------------------------------------------------------------------
  631.   alias parent_process_character process_character
  632.   def process_character(c, text, pos)
  633.     case c
  634.     when "\r"   # 回车
  635.       return
  636.     when "\n"   # 换行
  637.       return
  638.     when "\f"   # 翻页
  639.       return
  640.     when "\e"   # 控制符
  641.       process_escape_character(obtain_escape_code(text), text, pos)
  642.     else        # 普通文字
  643.       process_normal_character(c,pos)
  644.       process_next_character(text.slice(0,1),text,pos)
  645.     end
  646.   end
  647.   
  648.   
  649.   def process_next_character(c,text,pos)
  650.     case c
  651.     when "\r"
  652.       return
  653.     when "\n"
  654.       return
  655.     when "\f"
  656.       return
  657.     when "\e"
  658.       return
  659.     else
  660.       next_pos = pos[:x] + text_size(c).width * 2 + self.padding
  661.       if next_pos > width
  662.         process_new_line(text,pos)
  663.         @line += 1
  664.       end
  665.     end
  666.   end
  667. end

复制代码


下面是在原始脚本里添加的
DataManager里
  1.   #--------------------------------------------------------------------------
  2.   # ● 生成各种游戏对象
  3.   #--------------------------------------------------------------------------
  4.   def self.create_game_objects
  5.     $game_temp          = Game_Temp.new
  6.     $game_system        = Game_System.new
  7.     $game_timer         = Game_Timer.new
  8.     $game_message       = Game_Message.new
  9.     $game_switches      = Game_Switches.new
  10.     $game_variables     = Game_Variables.new
  11.     $game_self_switches = Game_SelfSwitches.new
  12.     $game_actors        = Game_Actors.new
  13.     $game_party         = Game_Party.new
  14.     $game_troop         = Game_Troop.new
  15.     $game_map           = Game_Map.new
  16.     $game_player        = Game_Player.new
  17.     $game_eventVar      = Game_EventVariables.new
  18.   end
复制代码


SceneManager里
  1. #--------------------------------------------------------------------------
  2.   # ● 运行
  3.   #--------------------------------------------------------------------------
  4.   def self.run
  5.     DataManager.init
  6.     EventBookDef.init
  7.     Audio.setup_midi if use_midi?
  8.     @scene = first_scene_class.new
  9.     @scene.main while @scene
  10.   end
复制代码


Window_MenuCommand里
  1. #--------------------------------------------------------------------------
  2.   # ● 独自添加指令用
  3.   #--------------------------------------------------------------------------
  4.   def add_original_commands
  5.   add_command(EventBookDef::Menu, :eventBook)
  6.   end
复制代码


Scene_Menu里
  1.   #--------------------------------------------------------------------------
  2.   # ● 生成指令窗口
  3.   #--------------------------------------------------------------------------
  4.   def create_command_window
  5.     @command_window = Window_MenuCommand.new
  6.     @command_window.set_handler(:item,      method(:command_item))
  7.     @command_window.set_handler(:skill,     method(:command_personal))
  8.     @command_window.set_handler(:equip,     method(:command_personal))
  9.     @command_window.set_handler(:status,    method(:command_personal))
  10.     @command_window.set_handler(:formation, method(:command_formation))
  11.     @command_window.set_handler(:save,      method(:command_save))
  12.     @command_window.set_handler(:game_end,  method(:command_game_end))
  13.     @command_window.set_handler(:cancel,    method(:return_scene))
  14.     @command_window.set_handler(:eventBook, method(:command_openBook))
  15.   end

  16. # 事件薄
  17.   def command_openBook
  18.       SceneManager.call(Scene_EventBook)
  19.   end
复制代码


未使用任何自定义脚本可使用此文件直接替代工程下Data文件里的对应文件
Scripts.rar (149.74 KB, 下载次数: 71)

工程中的调用



资源: Garphics.rar (29.56 KB, 下载次数: 60)
拷贝到工程目录就行,无需导入

线索详细内容的编辑在这里

第一个参数为章节名,第二个参数为案件名,第三个参数为线索名,第四个参数为详细内容
详细内容支持自动换行
编辑详细内容时不需要像编辑对话框内容那么辛苦,还要去注意输入回车换行,直接在txt里一行键入所有内容,然后拷贝到这里就可以了

无奈的吐槽:
第一次写RM脚本,还是RUBY的,在处理bug上花了好大的心思,最后终于发现用控制台,加上p 和 msgbox终于能快速的debug了.然后对语法的不熟悉也消耗了大量的时间...代码中用到的枚举很少..有很多难看的数字硬代码,这都是没有理解Ruby的Symbol导致的.后来也不想去改了.本来还想做一个游戏内编辑案件内容的功能和案件线索的总结功能的,无奈还要开发公司的2d骨骼动画编辑器..只有作罢了.之后最多可能就是把按键的声音修改成可配置的

示例工程:
http://pan.baidu.com/share/link?shareid=398891&uk=2956369506
带横版战斗的示例工程:
http://pan.baidu.com/share/link?shareid=398888&uk=2956369506

详细信息界面

详细信息界面

脚本调用

脚本调用

编辑修改

编辑修改

点评

⊙_⊙ 不错啊  发表于 2013-8-25 09:30
回复

使用道具 举报

梦石
0
星屑
60
在线时间
9 小时
注册时间
2007-2-23
回帖
23
 楼主| 发表于 2013-4-13 20:22:24 | 显示全部楼层
只能传999kb的文件?示例工程怎么上传呢?都大于999kb
回复

使用道具 举报

梦石
0
星屑
50
在线时间
133 小时
注册时间
2012-8-23
回帖
60
发表于 2013-4-13 20:42:29 | 显示全部楼层
rrobin 发表于 2013-4-13 20:22
只能传999kb的文件?示例工程怎么上传呢?都大于999kb

有几种网盘可以选择:
百度网盘、华为网盘、360网盘等等,建议使用百度网盘。
先注册一个帐号,然后把你的游戏打包(是整个游戏文件夹),即弄成压缩文件,电脑自己有这个功能,然后在网盘里找到上传。
上传后就可以在网盘文件夹里看到你的压缩包,然后找到分享这个按钮,这时会网盘给你一个分享的链接,复制这个链接贴到你的发布贴里就OK了。这样别人点开链接就能下载。

建议用百度网盘,界面简洁没广告,上传无限制且永久有效。
回复

使用道具 举报

梦石
0
星屑
60
在线时间
9 小时
注册时间
2007-2-23
回帖
23
 楼主| 发表于 2013-4-13 21:03:08 | 显示全部楼层
1396 发表于 2013-4-13 20:42
有几种网盘可以选择:
百度网盘、华为网盘、360网盘等等,建议使用百度网盘。
先注册一个帐号,然后把你 ...

多谢指教,已经成功上传示例工程链接
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部