查看: 3904|回复: 2

[已经过期] 怎么播放一段视频

[复制链接]
梦石
0
星屑
393
在线时间
18 小时
注册时间
2013-12-6
回帖
9
发表于 2017-2-4 22:05:35 | 显示全部楼层 |阅读模式

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

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

×
我是新手,不会用脚本,想在一个地方对话完之后播放一段视频,但是不会用,有没有大神会的,教一下我
我连怎么用脚本都不会,麻烦能不能讲详细一点,谢谢了!!!
梦石
0
星屑
125
在线时间
171 小时
注册时间
2014-4-14
回帖
135
发表于 2017-2-5 05:02:10 | 显示全部楼层
用swf播放(flash)脚本,如果视频格式不是swf要把视频格式转为swf。
脚本代码
  1. #------------------------------------------------------------------------------
  2. #swf播放器
  3. #------------------------------------------------------------------------------
  4. =begin
  5. 使用方法:插入下面这段脚本。
  6. 其中“title.swf”是视频的名称,视频要放在工程目录下(和game.exe同目录)
  7. 如果是在对话后播放要先等待20帧(脚本@wait_count = 20),不然对话框来不及消失。

  8. fls = RMFlash.load("title.swf",640,480)
  9. fls.x = 0
  10. fls.y = 0
  11. fls.loop = 1
  12. while true
  13.         Graphics.update
  14.         fls.update
  15.         break if !fls.playing?
  16. end
  17. fls.dispose


  18. =end


  19. class String
  20.   
  21.   CP_ACP = 0
  22.   CP_UTF8 = 65001
  23.   
  24.   def u2s
  25.     m2w = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi", "i")
  26.     w2m = Win32API.new("kernel32", "WideCharToMultiByte", "ilpipipp", "i")
  27.    
  28.     len = m2w.call(CP_UTF8, 0, self, -1, nil, 0)
  29.     buf = "\0" * (len*2)
  30.     m2w.call(CP_UTF8, 0, self, -1, buf, buf.size/2)
  31.    
  32.     len = w2m.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil)
  33.     ret = "\0" * len
  34.     w2m.call(CP_ACP, 0, buf, -1, ret, ret.size, nil, nil)
  35.    
  36.     return ret
  37.   end
  38.   
  39.   def s2u
  40.     m2w = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi", "i")
  41.     w2m = Win32API.new("kernel32", "WideCharToMultiByte", "ilpipipp", "i")
  42.   
  43.     len = m2w.call(CP_ACP, 0, self, -1, nil, 0);
  44.     buf = "\0" * (len*2)
  45.     m2w.call(CP_ACP, 0, self, -1, buf, buf.size/2);
  46.   
  47.     len = w2m.call(CP_UTF8, 0, buf, -1, nil, 0, nil, nil);
  48.     ret = "\0" * len
  49.     w2m.call(CP_UTF8, 0, buf, -1, ret, ret.size, nil, nil);
  50.      
  51.     return ret
  52.   end

  53.   def s2u!
  54.     self[0, length] = s2u
  55.   end  
  56.   
  57.   def u2s!
  58.     self[0, length] = u2s
  59.   end
  60.   
  61. end

  62. class Bitmap
  63.   
  64.   RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  65.   RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')

  66.   def address
  67.     buffer, ad = "xxxx", object_id * 2 + 16
  68.     RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L")[0] + 8
  69.     RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L")[0] + 16
  70.     RtlMoveMemory_pi.call(buffer, ad, 4); return buffer.unpack("L")[0]
  71.   end
  72.   
  73. end

  74. class RMFlash

  75.         API_NEW                      = Win32API.new("RMFlash", "_new", "piil", "l")
  76.         API_UPDATE            = Win32API.new("RMFlash", "_update", "l", "v")
  77.         API_FREE              = Win32API.new("RMFlash", "_free", "l", "v")
  78.         API_PLAYING     = Win32API.new("RMFlash", "_is_playing", "l", "i")
  79.         API_PAUSE              = Win32API.new("RMFlash", "_pause", "l", "v")
  80.         API_RESUME            = Win32API.new("RMFlash", "_resume", "l", "v")
  81.         API_BACK              = Win32API.new("RMFlash", "_back", "l", "v")
  82.         API_REWIND            = Win32API.new("RMFlash", "_rewind", "l", "v")
  83.         API_FORWARD            = Win32API.new("RMFlash", "_forward", "l", "v")
  84.         API_CURFRAME          = Win32API.new("RMFlash", "_cur_frame", "l", "i")
  85.         API_TOTALFRAME        = Win32API.new("RMFlash", "_total_frames", "l", "i")
  86.         API_GOTOFRAME          = Win32API.new("RMFlash", "_goto_frame", "li", "v")
  87.         API_GETLOOP                  = Win32API.new("RMFlash", "_get_loop", "l", "i")
  88.         API_SETLOOP                  = Win32API.new("RMFlash", "_set_loop", "li", "v")
  89.         API_CLEARALL          = Win32API.new("RMFlash", "_clear_all", "v", "v")
  90.   API_VALID       = Win32API.new("RMFlash", "_valid", "l", "i")
  91.   API_SENDMSG     = Win32API.new("RMFlash", "_send_message", "liii", "l")
  92.        
  93.   CUR_PATH        = Dir.pwd
  94.   
  95.         def self.get_version

  96.         end

  97.         def self.clear_all
  98.                 API_CLEARALL.call
  99.         end
  100.   
  101.   def self.load(name, width, height, v = nil)
  102.     new("#{CUR_PATH}/#{name}".u2s, width, height, v)
  103.   end
  104.   
  105.   attr_reader   :valid

  106.         def initialize(flash_name, flash_width, flash_height, viewport = nil)
  107.                 @sprite = Sprite.new(viewport)
  108.                 @sprite.bitmap = Bitmap.new(flash_width, flash_height)
  109.                 @value = API_NEW.call(flash_name, flash_width, flash_height, @sprite.bitmap.address)
  110.                 [url=home.php?mod=space&uid=520184]@loop[/url] = API_GETLOOP.call(@value) > 0
  111.     @valid = API_VALID.call(@value) > 0
  112.         end

  113.         def viewport
  114.                 @sprite.viewport
  115.         end

  116.         def update
  117.                 API_UPDATE.call(@value)
  118.         end

  119.         def dispose
  120.                 API_FREE.call(@sprite.bitmap.address)
  121.     @sprite.bitmap.dispose
  122.     @sprite.dispose
  123.         end

  124.         def playing?
  125.                 API_PLAYING.call(@value) > 0
  126.         end

  127.         def pause
  128.                 API_PAUSE.call(@value)
  129.         end

  130.         def resume
  131.                 API_RESUME.call(@value)
  132.         end

  133.         def back
  134.                 API_BACK.call(@value)
  135.         end

  136.         def rewind
  137.                 API_REWIND.call(@value)
  138.         end

  139.         def forward
  140.                 API_FORWARD.call(@value)
  141.         end

  142.         def current_frame
  143.                 API_CURFRAME.call(@value)
  144.         end

  145.         def total_frames
  146.                 API_TOTALFRAME.call(@value)
  147.         end

  148.         def goto_frame(goal_frame)
  149.                 API_GOTOFRAME.call(@value, goal_frame)
  150.         end

  151.         def x
  152.                 @sprite.x
  153.         end

  154.         def x=(v)
  155.                 @sprite.x = v
  156.         end

  157.         def y
  158.                 @sprite.y
  159.         end

  160.         def y=(v)
  161.                 @sprite.y = v
  162.         end

  163.         def z
  164.                 @sprite.z
  165.         end

  166.         def z=(v)
  167.                 @sprite.z = v
  168.         end

  169.         def width
  170.                 @sprite.bitmap.width
  171.         end

  172.         def height
  173.                 @sprite.bitmap.height
  174.         end

  175.         def loop?
  176.                 @loop
  177.         end

  178.         def loop=(v)
  179.                 if @loop != v
  180.                         @loop = v
  181.                         API_SETLOOP.call(@value, v)
  182.                 end
  183.         end
  184.   
  185.   def msg_to_flash(msg, wParam, lParam)
  186.     return API_SENDMSG.call(@value, msg, wParam, lParam)
  187.   end
  188.   
  189.   #  例
  190.   WM_MOUSEMOVE  = 0x0200
  191.   
  192.   def make_long(a, b)
  193.     return (a & 0xffff ) | (b & 0xffff) << 16
  194.   end
  195.   
  196.   def on_mouse_move(x, y)
  197.     return msg_to_flash(WM_MOUSEMOVE, 0, make_long(x, y))
  198.   end

  199. end

  200. module Kernel

  201.   alias origin_exit exit unless method_defined? :exit
  202.   
  203.   def exit(*args)
  204.     RMFlash.clear_all
  205.     origin_exit(*args)
  206.   end
  207.   
  208. end


  209. #fls = RMFlash.load("2.swf", 640, 480)

  210. #while true
  211. #        Graphics.update
  212. #        Input.update
  213. #        fls.update
  214. #        break if Input.trigger?(13)
  215. #end
  216. #fls.dispose

  217. #exit

  218. =begin
  219. class RMFlash
  220.   API_NEW = Win32API.new("RMFlash", "_new", "piil", "l")
  221.   API_UPDATE = Win32API.new("RMFlash", "_update", "l", "v")
  222.   API_FREE = Win32API.new("RMFlash", "_free", "l", "v")
  223.   #def self.new(*args)
  224.   #  obj = super(*args)
  225.   #  obj.send :initialize, *args
  226.   #  obj
  227.   #end
  228.   
  229.   def initialize(flashname, fw, fh)
  230.    
  231.   end
  232.   
  233. end

  234. RMFlash.new
  235. exit
  236. =end
复制代码


下面图片为教程:
更多图片 小图 大图
组图打开中,请稍候......

swf problem.7z

1.24 MB, 下载次数: 236

附件

评分

参与人数 1星屑 +60 收起 理由
89444640 + 60 塞糖

查看全部评分

Vanyogin
回复 1 0

使用道具 举报

梦石
0
星屑
52
在线时间
4 小时
注册时间
2017-11-26
回帖
7
发表于 2017-12-11 06:30:23 | 显示全部楼层
好神奇,感谢分享
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部