Project1

标题: [PS0]读书读报系统(2012.02.24) [打印本页]

作者: 仲秋启明    时间: 2012-2-5 11:05
标题: [PS0]读书读报系统(2012.02.24)
本帖最后由 仲秋启明 于 2012-2-24 20:56 编辑

VA的“显示滚动文字”是个新东西,用这个就可以直接改为读书读报系统
此读书读报系统和XP的不一样

RUBY 代码复制
  1. #==============================================================================
  2. # [PS0]读书读报系统
  3. #      Reading_System
  4. #==============================================================================
  5. # [更新记录]
  6. #    - 2011.12.27 By 仲秋启明
  7. #      * 编写开始,遵循PS0协议;
  8. #      * 设定开关以控制
  9. #    - 2012.02.24 By feizhaodan
  10. #      * 修正没法翻页和显示问题
  11. #------------------------------------------------------------------------------
  12. # [使用方法]
  13. #    - 替换原Window_ScrollText或复制到Main之前
  14. #    - 打开Reading_System_Switch定义的开关
  15. #==============================================================================
  16. $_PS0 = {} if $_PS0 == nil  
  17. $_PS0["Reading_System"] = 20120205
  18. #==============================================================================
  19. # [PS0] 通用配置模块  
  20. #==============================================================================
  21. module PS0
  22.   module Reading_System
  23.     Reading_System_Switch = 50
  24.   end
  25. end
  26. #==============================================================================
  27. # ■ Window_ScrollText
  28. #------------------------------------------------------------------------------
  29. #  显示滚动文字的窗口。
  30. #   这类窗口没有边框,归类为窗口只是为了方便。
  31. #   窗口打开时角色不能移动。
  32. #==============================================================================
  33.  
  34. class Window_ScrollText < Window_Base
  35.   #--------------------------------------------------------------------------
  36.   # ● 初始化对象
  37.   #--------------------------------------------------------------------------
  38.   def initialize
  39.     super(0, 0, Graphics.width, Graphics.height)
  40.     self.opacity = 0
  41.     self.arrows_visible = false
  42.     hide
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 更新画面
  46.   #--------------------------------------------------------------------------
  47.   def update
  48.     super
  49.     if $game_switches[PS0::Reading_System::Reading_System_Switch] != true
  50.       if $game_message.scroll_mode
  51.         self.opacity = 0
  52.         update_message if @text
  53.         start_message if !@text && $game_message.has_text?
  54.       end
  55.     else
  56.       self.opacity = 200
  57.       if Input.trigger?(:B) or Input.trigger?(:C)
  58.         terminate_message
  59.       elsif Input.trigger?(:DOWN) or Input.trigger?(:RIGHT)
  60.         self.oy += 512 if self.oy + 512 < contents.height
  61.         self.oy = [self.oy,contents.height].min
  62.       elsif Input.trigger?(:UP) or Input.trigger?(:LEFT)
  63.         self.oy -= 512
  64.         self.oy = [self.oy,0].max
  65.       end
  66.       if $game_message.scroll_mode
  67.         start_message if !@text && $game_message.has_text?
  68.       end
  69.     end
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 开始信息的显示
  73.   #--------------------------------------------------------------------------
  74.   def start_message
  75.     @text = $game_message.all_text
  76.     refresh
  77.     show
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 刷新
  81.   #--------------------------------------------------------------------------
  82.   def refresh
  83.     reset_font_settings
  84.     update_all_text_height
  85.     create_contents
  86.     draw_text_ex(4, 0, @text)
  87.     if $game_switches[PS0::Reading_System::Reading_System_Switch] != true
  88.       self.oy = @scroll_pos = -height
  89.     end
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● 更新绘制所有内容所需的高度
  93.   #--------------------------------------------------------------------------
  94.   def update_all_text_height
  95.     @all_text_height = 1
  96.     convert_escape_characters(@text).each_line do |line|
  97.       @all_text_height += calc_line_height(line, false)
  98.     end
  99.     reset_font_settings
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ● 计算窗口内容的高度
  103.   #--------------------------------------------------------------------------
  104.   def contents_height
  105.     @all_text_height ? @all_text_height : super
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 更新信息
  109.   #--------------------------------------------------------------------------
  110.   def update_message
  111.     if $game_switches[PS0::Reading_System::Reading_System_Switch] != true
  112.     @scroll_pos += scroll_speed
  113.     self.oy = @scroll_pos
  114.     terminate_message if @scroll_pos >= contents.height
  115.     end
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ● 获取滚动速度
  119.   #--------------------------------------------------------------------------
  120.   def scroll_speed
  121.     $game_message.scroll_speed * (show_fast? ? 1.0 : 0.5)
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 快进判定
  125.   #--------------------------------------------------------------------------
  126.   def show_fast?
  127.     !$game_message.scroll_no_fast && (Input.press?(:A) || Input.press?(:C))
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # ● 结束信息的显示
  131.   #--------------------------------------------------------------------------
  132.   def terminate_message
  133.     @text = nil
  134.     $game_message.clear
  135.     hide
  136.   end
  137. end

效果:


与XP版的区别

直接上图
作者: 凌依约    时间: 2012-2-5 18:45
好东西哟,不过要是界面能够再华丽点,然后支持用PgUP PgDn 或者 ← →键来控制就好了
作者: 迷糊的安安    时间: 2012-2-22 21:09
本帖最后由 迷糊的安安 于 2012-2-22 21:10 编辑

报告两个BUG
1、文字比较长的时候没法翻页。
2、将50开关打开,启用读报系统,显示滚动文字以后,将开关关闭,再显示滚动文字,依然带有框。此后若再打开开关,则什么都显示不出来。
@仲秋启明
作者: 仲秋启明    时间: 2012-2-22 21:38
迷糊的安安 发表于 2012-2-22 21:09
报告两个BUG
1、文字比较长的时候没法翻页。
2、将50开关打开,启用读报系统,显示滚动文字以后,将开关关 ...

1.这个……手动翻页我还要试一下
2.这个我没遇到过,我只遇到过滚动文字有时显示不全
作者: 迷糊的安安    时间: 2012-2-23 02:11
本帖最后由 迷糊的安安 于 2012-2-23 02:12 编辑
仲秋启明 发表于 2012-2-22 21:38
1.这个……手动翻页我还要试一下
2.这个我没遇到过,我只遇到过滚动文字有时显示不全 ...


是这样的 我详细地说明一下吧

按照这样的流程走
1、显示第一段滚动文字。
2、打开开关50,显示第二段滚动文字。
3、关闭开关50,显示第三段滚动文字。
4、打开开关50,显示第四段滚动文字。

若如此做,则:
第一段:正常滚动文字。
第二段:带底框的读报文字。
第三段:带底框的滚动文字。
第四段:只显示框,什么字也显示不出来。

第三段和第四段明显是不正常的……

@仲秋启明
作者: 各种压力的猫君    时间: 2012-2-23 04:19
与其对原来的滚动文字下手……不如直接对事件解释器下手,
把文字截出来。然后自己写窗口,这样也不会导致奇怪的BUG。
作者: eve592370698    时间: 2012-2-24 11:33
凌依约 发表于 2012-2-5 18:45
好东西哟,不过要是界面能够再华丽点,然后支持用PgUP PgDn 或者 ← →键来控制就好了 ...

很悲剧!我还以为是Xp的读取txt脚本移植过来了呢.
作者: 仲秋启明    时间: 2012-2-24 20:56
迷糊的安安 发表于 2012-2-22 21:09
报告两个BUG
1、文字比较长的时候没法翻页。
2、将50开关打开,启用读报系统,显示滚动文字以后,将开关关 ...

BUG已由FZD君修复
作者: 敏儿    时间: 2012-3-5 14:46
读书读报系统是不是不需要使用事件来进行?
要是很长的文字显示应该没有什么缺少吧
因为是新人,所以不太懂。。。不好意思
作者: 迷糊的安安    时间: 2012-3-9 21:41
本帖最后由 迷糊的安安 于 2012-3-9 21:42 编辑







翻页存在一些问题。
@feizhaodan
@仲秋启明
作者: 仲秋启明    时间: 2012-3-9 21:52
迷糊的安安 发表于 2012-3-9 21:41
翻页存在一些问题。
@feizhaodan
@仲秋启明

准确的说目前不支持翻页,本来也没想做翻页效果




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