secondsen 发表于 2010-6-29 20:07:39

有?("Save/OPENING.rxdata") 的话 就 不会 p 1
没有的话会新建

把 p 1 换成Flash就好了。。。

我还想做高级点的。。。发现这个东西也用不了多高级。。。

secondsen 发表于 2010-6-29 20:08:39

另外补充一点。。。没有save文件夹的话 会杯具

liqunsz 发表于 2010-6-29 20:51:19

成功了哦噢噢噢噢…………
BTW,这一段是附在RMFlash脚本后面的,我不知道怎么,弄得故障了,井号掉了以后B键退出功能又没了
不知道什么故障呢
undefined method '[]' for nil:NilClass


#Flash 播放器 v1.3   作者:灼眼的夏娜

class String

CP_ACP = 0
CP_UTF8 = 65001

def u2s
    m2w = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi", "i")
    w2m = Win32API.new("kernel32", "WideCharToMultiByte", "ilpipipp", "i")
   
    len = m2w.call(CP_UTF8, 0, self, -1, nil, 0)
    buf = "\\0" * (len*2)
    m2w.call(CP_UTF8, 0, self, -1, buf, buf.size/2)
   
    len = w2m.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil)
    ret = "\\0" * len
    w2m.call(CP_ACP, 0, buf, -1, ret, ret.size, nil, nil)
   
    return ret
end

def s2u
    m2w = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi", "i")
    w2m = Win32API.new("kernel32", "WideCharToMultiByte", "ilpipipp", "i")

    len = m2w.call(CP_ACP, 0, self, -1, nil, 0);
    buf = "\\0" * (len*2)
    m2w.call(CP_ACP, 0, self, -1, buf, buf.size/2);

    len = w2m.call(CP_UTF8, 0, buf, -1, nil, 0, nil, nil);
    ret = "\\0" * len
    w2m.call(CP_UTF8, 0, buf, -1, ret, ret.size, nil, nil);
   
    return ret
end

def s2u!
    self = s2u
end

def u2s!
    self = u2s
end

end

class Bitmap

RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')

def address
    buffer, ad = "xxxx", object_id * 2 + 16
    RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L") + 8
    RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L") + 16
    RtlMoveMemory_pi.call(buffer, ad, 4); return buffer.unpack("L")
end

end

class RMFlash

    API_NEW            = Win32API.new("RMFlash", "_new", "piil", "l")
    API_UPDATE      = Win32API.new("RMFlash", "_update", "l", "v")
    API_FREE          = Win32API.new("RMFlash", "_free", "l", "v")
    API_PLAYING   = Win32API.new("RMFlash", "_is_playing", "l", "i")
    API_PAUSE          = Win32API.new("RMFlash", "_pause", "l", "v")
    API_RESUME      = Win32API.new("RMFlash", "_resume", "l", "v")
    API_BACK          = Win32API.new("RMFlash", "_back", "l", "v")
    API_REWIND      = Win32API.new("RMFlash", "_rewind", "l", "v")
    API_FORWARD      = Win32API.new("RMFlash", "_forward", "l", "v")
    API_CURFRAME      = Win32API.new("RMFlash", "_cur_frame", "l", "i")
    API_TOTALFRAME    = Win32API.new("RMFlash", "_total_frames", "l", "i")
    API_GOTOFRAME      = Win32API.new("RMFlash", "_goto_frame", "li", "v")
    API_GETLOOP          = Win32API.new("RMFlash", "_get_loop", "l", "i")
    API_SETLOOP          = Win32API.new("RMFlash", "_set_loop", "li", "v")
    API_CLEARALL      = Win32API.new("RMFlash", "_clear_all", "v", "v")
API_VALID       = Win32API.new("RMFlash", "_valid", "l", "i")
API_SENDMSG   = Win32API.new("RMFlash", "_send_message", "liii", "l")
   
CUR_PATH      = Dir.pwd

    def self.get_version

    end

    def self.clear_all
      API_CLEARALL.call
    end

def self.load(name, width, height, v = nil)
    new("#{CUR_PATH}/#{name}".u2s, width, height, v)
end

attr_reader   :valid

    def initialize(flash_name, flash_width, flash_height, viewport = nil)
      @sprite = Sprite.new(viewport)
      @sprite.bitmap = Bitmap.new(flash_width, flash_height)
      @value = API_NEW.call(flash_name, flash_width, flash_height, @sprite.bitmap.address)
      @loop = API_GETLOOP.call(@value) > 0
    @valid = API_VALID.call(@value) > 0
    end

    def viewport
      @sprite.viewport
    end

    def update
      API_UPDATE.call(@value)
    end

    def dispose
      API_FREE.call(@sprite.bitmap.address)
    @sprite.dispose#AVG
    end

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

    def pause
      API_PAUSE.call(@value)
    end

    def resume
      API_RESUME.call(@value)
    end

    def back
      API_BACK.call(@value)
    end

    def rewind
      API_REWIND.call(@value)
    end

    def forward
      API_FORWARD.call(@value)
    end

    def current_frame
      API_CURFRAME.call(@value)
    end

    def total_frames
      API_TOTALFRAME.call(@value)
    end

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

    def x
      @sprite.x
    end

    def x=(v)
      @sprite.x = v
    end

    def y
      @sprite.y
    end

    def y=(v)
      @sprite.y = v
    end

    def z
      @sprite.z
    end

    def z=(v)
      @sprite.z = v
    end

    def width
      @sprite.bitmap.width
    end

    def height
      @sprite.bitmap.height
    end

    def loop?
      @loop
    end

    def loop=(v)
      if @loop != v
            @loop = v
            API_SETLOOP.call(@value, v)
      end
    end

def msg_to_flash(msg, wParam, lParam)
    return API_SENDMSG.call(@value, msg, wParam, lParam)
end

#例
WM_MOUSEMOVE= 0x0200

def make_long(a, b)
    return (a & 0xffff ) | (b & 0xffff) << 16
end

def on_mouse_move(x, y)
    return msg_to_flash(WM_MOUSEMOVE, 0, make_long(x, y))
end

end

module Kernel

alias origin_exit exit unless method_defined? :exit

def exit(*args)
    RMFlash.clear_all
    origin_exit(*args)
end

end


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

#while true
#    Graphics.update
#    Input.update
#    fls.update
#    break if Input.trigger?(13)
#end
#fls.dispose

#exit

=begin
class RMFlash
API_NEW = Win32API.new("RMFlash", "_new", "piil", "l")
API_UPDATE = Win32API.new("RMFlash", "_update", "l", "v")
API_FREE = Win32API.new("RMFlash", "_free", "l", "v")
#def self.new(*args)
#obj = super(*args)
#obj.send :initialize, *args
#obj
#end

def initialize(flashname, fw, fh)
   
end

end

RMFlash.new
exit
=end

#==============AVG新加Flash类播放修改TT======================

class Flash
def initialize(name,sizex=640,sizey=480,loop=nil,x=0,y=0,z=99999)
    @fls = RMFlash.load(name, sizex, sizey)
    @fls.x = x
    @fls.y = y
    @fls.z = z
    if loop != nil
    @fls.loop = loop
    end
while true
    Graphics.update
    #Input.update
    @fls.update
   break if !@fls.playing?
    if $game_switches == true#AVG如果看片头中跳回标题
            Input.update
          if Input.trigger?(Input::B)
          $scene = Scene_Title.new
          break
      end
      else
      Input.update
      break if Input.trigger?(Input::B)
   end
    end
   @fls.dispose
end
end





就是后面的【AVG新加Flash类播放修改】的故障

secondsen 发表于 2010-6-29 21:06:04

哪一句报错

liqunsz 发表于 2010-6-29 21:28:23

回 13楼(secondsen) 的帖子

【if $game_switches == true#AVG如果看片头中跳回标题】
报错……

先睡了啊~

secondsen 发表于 2010-6-29 23:00:40

你用开关怎么可能能行啊!开关是在Scene_Title中定义的。。。你用的时候还没有定义呢

liqunsz 发表于 2010-6-30 18:36:47

我是不想用它那个开关啊……请教一下怎么改可以让这个开关去掉,然后保留在播放动画时按B键退出的功能?

我提供一下整个的Flash脚本原版,怎么变成按B键退出?

范例会自动播放一个叫02的swf,在根目录……
调用时还是用Flash.new吗??

class String

CP_ACP = 0
CP_UTF8 = 65001

def u2s
    m2w = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi", "i")
    w2m = Win32API.new("kernel32", "WideCharToMultiByte", "ilpipipp", "i")
   
    len = m2w.call(CP_UTF8, 0, self, -1, nil, 0)
    buf = "\\0" * (len*2)
    m2w.call(CP_UTF8, 0, self, -1, buf, buf.size/2)
   
    len = w2m.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil)
    ret = "\\0" * len
    w2m.call(CP_ACP, 0, buf, -1, ret, ret.size, nil, nil)
   
    return ret
end

def s2u
    m2w = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi", "i")
    w2m = Win32API.new("kernel32", "WideCharToMultiByte", "ilpipipp", "i")

    len = m2w.call(CP_ACP, 0, self, -1, nil, 0);
    buf = "\\0" * (len*2)
    m2w.call(CP_ACP, 0, self, -1, buf, buf.size/2);

    len = w2m.call(CP_UTF8, 0, buf, -1, nil, 0, nil, nil);
    ret = "\\0" * len
    w2m.call(CP_UTF8, 0, buf, -1, ret, ret.size, nil, nil);
   
    return ret
end

def s2u!
    self = s2u
end

def u2s!
    self = u2s
end

end

class Bitmap

RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')

def address
    buffer, ad = "xxxx", object_id * 2 + 16
    RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L") + 8
    RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L") + 16
    RtlMoveMemory_pi.call(buffer, ad, 4); return buffer.unpack("L")
end

end

class RMFlash

    API_NEW            = Win32API.new("RMFlash", "_new", "piil", "l")
    API_UPDATE      = Win32API.new("RMFlash", "_update", "l", "v")
    API_FREE          = Win32API.new("RMFlash", "_free", "l", "v")
    API_PLAYING   = Win32API.new("RMFlash", "_is_playing", "l", "i")
    API_PAUSE          = Win32API.new("RMFlash", "_pause", "l", "v")
    API_RESUME      = Win32API.new("RMFlash", "_resume", "l", "v")
    API_BACK          = Win32API.new("RMFlash", "_back", "l", "v")
    API_REWIND      = Win32API.new("RMFlash", "_rewind", "l", "v")
    API_FORWARD      = Win32API.new("RMFlash", "_forward", "l", "v")
    API_CURFRAME      = Win32API.new("RMFlash", "_cur_frame", "l", "i")
    API_TOTALFRAME    = Win32API.new("RMFlash", "_total_frames", "l", "i")
    API_GOTOFRAME      = Win32API.new("RMFlash", "_goto_frame", "li", "v")
    API_GETLOOP          = Win32API.new("RMFlash", "_get_loop", "l", "i")
    API_SETLOOP          = Win32API.new("RMFlash", "_set_loop", "li", "v")
    API_CLEARALL      = Win32API.new("RMFlash", "_clear_all", "v", "v")
API_VALID       = Win32API.new("RMFlash", "_valid", "l", "i")
API_SENDMSG   = Win32API.new("RMFlash", "_send_message", "liii", "l")
   
CUR_PATH      = Dir.pwd

    def self.get_version

    end

    def self.clear_all
      API_CLEARALL.call
    end

def self.load(name, width, height, v = nil)
    new("#{CUR_PATH}/#{name}".u2s, width, height, v)
end

attr_reader   :valid

    def initialize(flash_name, flash_width, flash_height, viewport = nil)
      @sprite = Sprite.new(viewport)
      @sprite.bitmap = Bitmap.new(flash_width, flash_height)
      @value = API_NEW.call(flash_name, flash_width, flash_height, @sprite.bitmap.address)
      @loop = API_GETLOOP.call(@value) > 0
    @valid = API_VALID.call(@value) > 0
    end

    def viewport
      @sprite.viewport
    end

    def update
      API_UPDATE.call(@value)
    end

    def dispose
      API_FREE.call(@sprite.bitmap.address)
    end

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

    def pause
      API_PAUSE.call(@value)
    end

    def resume
      API_RESUME.call(@value)
    end

    def back
      API_BACK.call(@value)
    end

    def rewind
      API_REWIND.call(@value)
    end

    def forward
      API_FORWARD.call(@value)
    end

    def current_frame
      API_CURFRAME.call(@value)
    end

    def total_frames
      API_TOTALFRAME.call(@value)
    end

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

    def x
      @sprite.x
    end

    def x=(v)
      @sprite.x = v
    end

    def y
      @sprite.y
    end

    def y=(v)
      @sprite.y = v
    end

    def z
      @sprite.z
    end

    def z=(v)
      @sprite.z = v
    end

    def width
      @sprite.bitmap.width
    end

    def height
      @sprite.bitmap.height
    end

    def loop?
      @loop
    end

    def loop=(v)
      if @loop != v
            @loop = v
            API_SETLOOP.call(@value, v)
      end
    end

def msg_to_flash(msg, wParam, lParam)
    return API_SENDMSG.call(@value, msg, wParam, lParam)
end

#例
WM_MOUSEMOVE= 0x0200

def make_long(a, b)
    return (a & 0xffff ) | (b & 0xffff) << 16
end

def on_mouse_move(x, y)
    return msg_to_flash(WM_MOUSEMOVE, 0, make_long(x, y))
end

end

module Kernel

alias origin_exit exit unless method_defined? :exit

def exit(*args)
    RMFlash.clear_all
    origin_exit(*args)
end

end

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

while true
    Graphics.update
    Input.update
    fls.update
    break if Input.trigger?(13)
end
fls.dispose

exit

=begin
class RMFlash
API_NEW = Win32API.new("RMFlash", "_new", "piil", "l")
API_UPDATE = Win32API.new("RMFlash", "_update", "l", "v")
API_FREE = Win32API.new("RMFlash", "_free", "l", "v")
#def self.new(*args)
#obj = super(*args)
#obj.send :initialize, *args
#obj
#end

def initialize(flashname, fw, fh)
   
end

end

RMFlash.new
exit
=end



夏娜大的原脚本,不是改过的,原始范例里面放在Game_Temp的上面,调用了两个外部的,一个是【RMFlash.dll】,一个是Flash.ocx

liqunsz 发表于 2010-7-1 21:48:03

版大不见了,下载了脚本和调用……
呆在论坛主页??挂机??
…………呼叫ING~
睡觉了…………

liqunsz 发表于 2010-7-2 21:33:05

………………已解决~
主楼已更新~
页: 1 [2]
查看完整版本: 一次性片头动画如何制作?