设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3710|回复: 5
打印 上一主题 下一主题

[已经解决] 如何在地图显示流动文字(歌词)——谢谢!

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
7 小时
注册时间
2010-8-2
帖子
51
跳转到指定楼层
1
发表于 2010-8-31 18:18:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
如题——谢谢!

点评

请在得到答案后在认可帖认可[url]http://bbs.66rpg.com/thread-155199-1-1.html[/url]  发表于 2010-9-15 03:30

Lv1.梦旅人

梦石
0
星屑
50
在线时间
16 小时
注册时间
2009-9-20
帖子
232
2
发表于 2010-8-31 18:23:37 | 只看该作者
……我建议你把歌词打在ps里保存成图片,然后移动图片。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
7 小时
注册时间
2010-8-2
帖子
51
3
 楼主| 发表于 2010-8-31 18:28:15 | 只看该作者
本帖最后由 Amasawa 于 2010-8-31 18:30 编辑

恩——谢谢!(正在尝试)有可有直接用文字的吗?
.
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (管理员)

老黄鸡

梦石
0
星屑
39689
在线时间
7486 小时
注册时间
2009-7-6
帖子
13483

开拓者贵宾

4
发表于 2010-8-31 20:17:19 | 只看该作者
用脚本显示无边框对话框,往左移,

点评

o(︶︿︶)o 唉.想象力丰富而无用  发表于 2010-8-31 21:11
RGDirect - DirectX驱动的RGSS,点我了解.
RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
79
在线时间
211 小时
注册时间
2010-8-21
帖子
442
5
发表于 2010-8-31 20:27:45 | 只看该作者
请问下LS的那个怎么实现啊,教一下
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
398
在线时间
972 小时
注册时间
2007-12-31
帖子
2137
6
发表于 2010-9-4 11:33:33 | 只看该作者



以下为66的MTV系统

发布页:http://rpg.blue/htm/Topic_6764.htm
范例在中间……


BTW:LZ你这是一贴多发


功能:

就是播BGM的时候,可以顺便播放.lrc的歌词。当然不一定是.lrc的,.txt也可以。不过文件内容的格式必须是:

[时间1][时间2]歌词

比如:

[01:52.81][00:18.40]多少恋情回想时只剩结局和起头

在网上流行的歌词制作软件,常常制做出各不相同的lrc歌词格式(比如有的中括号时间只精确到秒,或者分钟和秒写在一起等),本脚本只支持此一种,其它的请自己用记事本打开修改为这样的。

要求:

[分钟:秒.小数2位]歌词
也就是中括号内总共有8个字节。

本效果歌词在战斗中不会停止。如果需要停止,则把Scene_Battle部分删了即可。同时就算切出游戏也不会打乱歌词。
使用:

1、读取:MTV.load("歌词文件名",总秒数*10)
如:MTV.load("爱不留歌词.lrc",2870)
其中总秒数*10表示一首歌结束,歌词开始循环的时间。如果不填这一项则歌词只显示1遍。而爱不留这首歌长度是287秒,输入2870则可以不断循环

2、播放BGM

3、MTV.mtv_begin,开始显示歌词

停止:MTV.stop,关掉歌词。BGM用事件关就行了


范例下载
密码:lrcmtv

全脚本
  1. #=================================================================
  2. # MTV 脚本,by 66RPG_柳柳
  3. #=================================================================
  4. module MTV  
  5. #===============================================================
  6. # 读取文件。文件相对地址:Audio/BGM
  7. # file_name:文件名;length:MTV长度,按照.1秒为单位记数
  8. #===============================================================
  9. def self.load(file_name,length = 0)
  10.    $mtv_time = []
  11.    $mtv_text = []
  12.    $game_system.mtv_length = length
  13.    #=============================================================
  14.    # 打开文件并且读取之
  15.    #=============================================================
  16.    file =  File.open("Audio/BGM/"+file_name)
  17.    #=============================================================
  18.    # 读取歌词
  19.    #=============================================================
  20.    for line in file.readlines
  21.      #===========================================================
  22.      # 转为UTF-8编码
  23.      #===========================================================
  24.      line = EasyConv.s2u(line)
  25.      #===========================================================
  26.      # 寻找本行歌词
  27.      #===========================================================
  28.      this_line_text = line[line.scan(/\]/).size*10,line.size]
  29.      #===========================================================
  30.      # 把读取的行分存成时间与文字
  31.      #===========================================================
  32.      for i in 0...line.scan(/\]/).size
  33.        temp_b = line[i*10+1,8]
  34.        temp_c = temp_b.split(/:/)[0]
  35.        mmsecond = 600 * temp_c.to_i
  36.        temp_c = temp_b.split(/:/)[1]
  37.        mmsecond += 10 * temp_c.to_f
  38.        $mtv_time.push(mmsecond.to_i)
  39.        $mtv_text.push(this_line_text)
  40.      end
  41.    end
  42.    file.close
  43. end
  44. #===============================================================
  45. # 开始MTV字幕
  46. #===============================================================
  47. def self.mtv_begin
  48.    $game_system.mtv_now = true
  49.    $game_system.mtv_begin_time = $sys_timer.now()
  50.    $lrc_text = ""
  51.    return
  52. end
  53. #===============================================================
  54. # 结束MTV字幕
  55. #===============================================================
  56. def self.stop
  57.    $game_system.mtv_now = false
  58.    return
  59. end
  60. #===============================================================
  61. # 测试MTV是否播放
  62. #===============================================================
  63. def self.mtv?
  64.    return $game_system.mtv_now
  65. end
  66. #===============================================================
  67. # 获取MTV字幕
  68. #===============================================================
  69. def self.new_text
  70.    if $game_system.mtv_now
  71.      #===========================================================
  72.      # 求出已经经过的时间
  73.      #===========================================================
  74.      nt = $sys_timer.now()
  75.      nt -= $game_system.mtv_begin_time
  76.      nt = nt.to_i
  77.      nt /= 100      
  78.      #===========================================================
  79.      # 制作循环
  80.      #===========================================================
  81.      if $game_system.mtv_length>0 and nt > $game_system.mtv_length
  82.        nt -= $game_system.mtv_length
  83.      end
  84.      #===========================================================
  85.      # 放出字幕
  86.      #===========================================================
  87.      for tm in 0...$mtv_time.size
  88.        if $mtv_time[tm] == nt
  89.          $lrc_text = $mtv_text[tm]
  90.          break
  91.        end
  92.      end
  93.    else
  94.      $lrc_text = ""
  95.    end
  96. end
  97. end
  98. #==============================================================================
  99. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  100. #==============================================================================
  101. # ------------------------------------------------------------------------
  102. # 高精度计时器 by FantasyDR
  103. # ------------------------------------------------------------------------
  104. # E-mail: [email protected]
  105. # ------------------------------------------------------------------------
  106. # 2005.10.18
  107. # ------------------------------------------------------------------------
  108. # 该类已经被定义为全局变量 $sys_timer
  109. # 如果只需要精确到毫秒,请设置初始化参数为true
  110. # decimal属性设置返回时间值的小数位数。
  111. # ------------------------------------------------------------------------
  112. # 下面是一些有用的方法列表,调用时写:$sys_timer.方法名
  113. # 例如 $sys_timer.clear()
  114. # ------------------------------------------------------------------------
  115. # clear() :计时器清零
  116. # now() :获取当前经过的时间,单位毫秒
  117. # now_s() :获取当前经过的时间,单位秒
  118. # ------------------------------------------------------------------------
  119. class SystemTimer
  120. attr_accessor:decimal #小数位数设定,默认为3

  121. def initialize(use_GetTime=false)
  122. # 初始化,根据系统选择不同精度计时器
  123. @qpFrequency = Win32API.new("kernel32","QueryPerformanceFrequency",'p','L')
  124. @qpCounter = Win32API.new("kernel32","QueryPerformanceCounter",'p','L')
  125. @tGetTime = Win32API.new("winmm","timeGetTime",'','L')

  126. @decimal=3
  127. @perf_cnt=" " * 8
  128. @time_start=" " * 8
  129. @time_now=" " * 8

  130. result = @qpFrequency.call(@perf_cnt)

  131. if use_GetTime
  132. result = 0
  133. end

  134. if result!=0
  135. @perf_flag=true
  136. else
  137. @perf_flag=false
  138. @perf_cnt=[1000,0].pack('LL')
  139. end

  140. #设置时间比例因数
  141. @time_scale=@perf_cnt.unpack('LL')
  142. @time_scale[0] /= 1000.0
  143. @time_scale[1] /= 1000.0

  144. #起始时间清零
  145. self.clear()
  146. end

  147. #-=====================-#
  148. # 计时器清零
  149. #-=====================-#
  150. def clear()
  151. if @perf_flag
  152. @qpCounter.call(@time_start)
  153. else
  154. @time_start=[@tGetTime.call(),0].pack('LL')
  155. end
  156. end

  157. #-==============================-#
  158. # 获取当前经过的时间,单位毫秒
  159. #-==============================-#
  160. def now()
  161. now_time = 0.0e1
  162. now_time += self.timer() - self.start()
  163. now_time /= self.scale()
  164. return self.debug(now_time)
  165. end

  166. #-==============================-#
  167. # 获取当前经过的时间,单位秒
  168. #-==============================-#
  169. def now_s()
  170. now_time = 0.0e1
  171. now_time += self.timer() - self.start()
  172. now_time /= (self.scale()*1000)
  173. return self.debug(now_time)
  174. end

  175. #-==============================-#
  176. # 帧错...
  177. #-==============================-#
  178. def debug(now_time)
  179. if @decimal>0
  180. now_time = (now_time * (10**@decimal)).floor/(10.0**@decimal)
  181. else
  182. now_time = now_time.floor
  183. end
  184. return now_time

  185. #以下用于debug模式
  186. if now_time < 0
  187. p "Timer Wrong!! Clear...",now_time,\
  188. @perf_flag,@qpCounter,@tGetTime,
  189. @time_now.unpack('LL')[0],@time_now.unpack('LL')[1],
  190. @time_start.unpack('LL')[0],@time_start.unpack('LL')[1]
  191. self.clear()
  192. return 0.0
  193. else
  194. return now_time
  195. end
  196. end

  197. #-=====================-#
  198. # 获取时间比例因数
  199. #-=====================-#
  200. def scale()
  201. return @time_scale[0]+\
  202. @time_scale[1]*0xffffffff
  203. end

  204. #-=====================-#
  205. # 获取起始滴答数
  206. #-=====================-#
  207. def start()
  208. return @time_start.unpack('LL')[0]+\
  209. @time_start.unpack('LL')[1]*0xffffffff
  210. end

  211. #-=====================-#
  212. # 获取当前的嘀哒数
  213. #-=====================-#
  214. def timer()
  215. if @perf_flag
  216. @qpCounter.call(@time_now)
  217. else
  218. @time_now=[@tGetTime.call(),0].pack('LL')
  219. end
  220. return @time_now.unpack('LL')[0]+\
  221. @time_now.unpack('LL')[1]*0xffffffff
  222. end
  223. end
  224. #-------------------------------------#
  225. # 初始化自身成一个全局变量
  226. #-------------------------------------#
  227. $sys_timer=SystemTimer.new()
  228. #-------------------------------------#




  229. #==============================================================================
  230. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  231. #==============================================================================


  232. #==============================================================================
  233. # 仭 EasyConv module - Ver 0.90
  234. #------------------------------------------------------------------------------
  235. # Moonlight INN
  236. # http://cgi.members.interq.or.jp/aquarius/rasetsu/
  237. # RaTTiE
  238. # [email protected]
  239. #------------------------------------------------------------
  240. # EasyConv::s2u(text) : S-JIS -> UTF-8
  241. # EasyConv::u2s(text) : UTF-8 -> S-JIS
  242. #==============================================================================
  243. module EasyConv
  244. # API梡掕悢掕媊
  245.   CP_ACP = 0
  246.   CP_UTF8 = 65001

  247. #--------------------------------------------------------------------------
  248. # 仠 S-JIS -> UTF-8
  249. #--------------------------------------------------------------------------
  250. def s2u(text)
  251. # API掕媊
  252.   m2w = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
  253.   w2m = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')

  254. # S-JIS -> Unicode
  255.   len = m2w.call(CP_ACP, 0, text, -1, nil, 0);
  256.   buf = "\0" * (len*2)
  257.   m2w.call(CP_ACP, 0, text, -1, buf, buf.size/2);

  258. # Unicode -> UTF-8
  259.   len = w2m.call(CP_UTF8, 0, buf, -1, nil, 0, nil, nil);
  260.   ret = "\0" * len
  261.   w2m.call(CP_UTF8, 0, buf, -1, ret, ret.size, nil, nil);
  262.   
  263.   return ret
  264. end
  265. # module_function偲偟偰岞奐
  266. module_function :s2u
  267. #--------------------------------------------------------------------------
  268. # 仠 UTF-8 -> S-JIS
  269. #--------------------------------------------------------------------------
  270. def u2s(text)
  271. # API掕媊
  272.   m2w = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
  273.   w2m = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')

  274. # UTF-8 -> Unicode
  275.   len = m2w.call(CP_UTF8, 0, text, -1, nil, 0);
  276.   buf = "\0" * (len*2)
  277.   m2w.call(CP_UTF8, 0, text, -1, buf, buf.size/2);

  278. # Unicode -> S-JIS
  279.   len = w2m.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil);
  280.   ret = "\0" * len
  281.   w2m.call(CP_ACP, 0, buf, -1, ret, ret.size, nil, nil);
  282.   
  283.   return ret
  284. end
  285. # module_function偲偟偰岞奐
  286. module_function :u2s
  287. end


  288. #==============================================================================
  289. # ■ Game_System
  290. #------------------------------------------------------------------------------
  291. #  处理系统附属数据的类。也可执行诸如 BGM 管理之类的功能。本类的实例请参考
  292. # $game_system 。
  293. #==============================================================================
  294. class Game_System
  295. #--------------------------------------------------------------------------
  296. # ● 定义实例变量
  297. #--------------------------------------------------------------------------
  298. attr_accessor :mtv_begin_time
  299. attr_accessor :mtv_now
  300. attr_accessor :mtv_length
  301. #--------------------------------------------------------------------------
  302. # ● 初始化对像
  303. #--------------------------------------------------------------------------
  304. alias mtv_gamesystem_initialize initialize
  305. def initialize
  306.    mtv_gamesystem_initialize
  307.    @mtv_begin_time = $sys_timer.now()
  308.    @mtv_now = false
  309.    @mtv_length = 0
  310. end
  311. end  

  312. #==============================================================================
  313. # ■ Scene_Map
  314. #------------------------------------------------------------------------------
  315. #  处理地图画面的类。
  316. #==============================================================================
  317. class Scene_Map
  318. #--------------------------------------------------------------------------
  319. # ● 刷新画面
  320. #--------------------------------------------------------------------------
  321. alias mtv_scenemap_update update
  322. def update
  323.    @mtv_window.refresh
  324.    mtv_scenemap_update
  325. end
  326. #--------------------------------------------------------------------------
  327. # ● 主处理
  328. #--------------------------------------------------------------------------
  329. alias mtv_scenemap_main main
  330. def main
  331.    @mtv_window = Window_MTV.new
  332.    mtv_scenemap_main
  333.    @mtv_window.dispose
  334. end
  335. #--------------------------------------------------------------------------
  336. # ● 调用战斗 (调整自动切换BGM)
  337. #--------------------------------------------------------------------------
  338. def call_battle
  339.    # 清除战斗调用标志
  340.    $game_temp.battle_calling = false
  341.    # 清除菜单调用标志
  342.    $game_temp.menu_calling = false
  343.    $game_temp.menu_beep = false
  344.    # 生成遇敌计数
  345.    $game_player.make_encounter_count
  346.    # 记忆地图 BGM 、停止 BGM
  347.    $game_temp.map_bgm = $game_system.playing_bgm
  348.    unless MTV.mtv?      
  349.      $game_system.bgm_play($game_system.battle_bgm)
  350.      # 演奏战斗开始 SE
  351.      $game_system.se_play($data_system.battle_start_se)
  352.    end
  353.    # 矫正主角姿势
  354.    $game_player.straighten
  355.    # 切换到战斗画面
  356.    $scene = Scene_Battle.new
  357. end
  358. end

  359. #==============================================================================
  360. # ■ Scene_Battle
  361. #------------------------------------------------------------------------------
  362. #  处理战斗的类。
  363. #==============================================================================
  364. class Scene_Battle
  365. #--------------------------------------------------------------------------
  366. # ● 刷新画面
  367. #--------------------------------------------------------------------------
  368. alias mtv_scenebattle_update update
  369. def update
  370.    @mtv_window.refresh
  371.    mtv_scenebattle_update
  372. end
  373. #--------------------------------------------------------------------------
  374. # ● 主处理
  375. #--------------------------------------------------------------------------
  376. alias mtv_scenebattle_main main
  377. def main
  378.    @mtv_window = Window_MTV.new
  379.    mtv_scenebattle_main
  380.    @mtv_window.dispose
  381. end
  382. end

  383. #==============================================================================
  384. # ■ Window_MTV
  385. #------------------------------------------------------------------------------
  386. #  显示MTV字幕的窗口。
  387. #==============================================================================

  388. class Window_MTV < Window_Base
  389. #--------------------------------------------------------------------------
  390. # ● 初始化窗口
  391. #--------------------------------------------------------------------------
  392. def initialize
  393.    super(0, 416, 640, 64)
  394.    self.contents = Bitmap.new(width - 32, height - 32)
  395.    $lrc_text = ""
  396.    self.z = 9999
  397.    refresh
  398. end
  399. #--------------------------------------------------------------------------
  400. # ● 刷新
  401. #--------------------------------------------------------------------------
  402. def refresh(text = "")
  403.    MTV.new_text
  404.    self.contents.clear   
  405.    if $game_temp.in_battle
  406.      self.opacity = 120
  407.    else
  408.      self.opacity = 0
  409.    end
  410.    self.contents.font.color = Color.new(0,0,0,255)
  411.    self.contents.draw_text(0, 0, 608, 32, $lrc_text, 1)   
  412.    self.contents.font.color = Color.new(255,255,255,255)
  413.    self.contents.draw_text(1, 1, 608, 32, $lrc_text, 1)   
  414. end
  415. end
复制代码

点评

精细啊,获奖与否?  发表于 2010-9-4 13:16

评分

参与人数 1星屑 +200 收起 理由
六祈 + 200 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-30 05:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表