赞 | 12 |
VIP | 107 |
好人卡 | 6 |
积分 | 4 |
经验 | 31122 |
最后登录 | 2024-6-29 |
在线时间 | 1606 小时 |
Lv2.观梦者 傻♂逼
- 梦石
- 0
- 星屑
- 374
- 在线时间
- 1606 小时
- 注册时间
- 2007-3-13
- 帖子
- 6562
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
要求:
你得有个服务器= =,虽然6R的ftp似乎可以起到相同的效果,不过你嘚想好,6r的ftp不支持建立目录<-渣渣 更新:
1.0.0 120
使用HTTP协议,不支持CRC校验 效果:
不用再费力的脱离RTP了……你弄不干净的,基础下载量小 使用方法:
找个空间,把X:\Program Files (x86)\RPG Maker VX\RGSS2
下的Audio和Graphics传上去(也可以把你的一些其他素材也传上去
!注意!
你需要把所有的扩展名改成rxd,或许你可以试试:
rename *.* *.rxd
另外确保您在游戏中没有使用XXX.xxx这样的调用(在RM里面会自动识别扩展名的)
另外对Graphics.transition的渐变图完全不支持,请不要尝试使用。另外您可以把一些教常用也较大的数据放在游戏里而不必上传……:)
图片
代码:
HTTP(请注意这段代码的版权信息,虽然我也不知道原作者是谁= =)- class Get_Http_Info
- AGENT = "66RPG Jail"
- INTERNET_OPEN_TYPE_PRECONFIG = 0 # IEの設定を仕様
- INTERNET_OPEN_TYPE_DIRECT = 1 # プロキシを使用しない
- def Get_Http_Info.InternetOpen()
- io = Win32API.new('wininet', 'InternetOpen', %(p, l, p, p, l), 'l')
- hInternet = io.call(AGENT, INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0)
- return hInternet
- end
- def Get_Http_Info.InternetOpenUrl(hSession, url)
- iou = Win32API.new('wininet', 'InternetOpenUrl', %(l, p, p, l, l, l), 'l')
- hService = iou.call(hSession, url, nil, 0, 0, 0)
- return hService
- end
- def Get_Http_Info.InternetReadFile(hService)
- content = ""
- read_size = 1024 # 一次读入文件的尺寸
- irf = Win32API.new('wininet', 'InternetReadFile', %(l, p, i, p), 'i')
- while(true)
- buf = "\0" * read_size
- red = [0].pack('L')
- irf.call( hService, buf, read_size, red )
- if(red.unpack('L') == [0])
- #读到文件末端
- break
- end
- buf.delete!("\0")
- content += buf
- end
- return content
- end
- def Get_Http_Info.NewInternetReadFile(hService,length,cb,f)
-
- content = ""
- read_size = 1024 # 一次读入文件的尺寸
- irf = Win32API.new('wininet', 'InternetReadFile', %(l, p, i, p), 'i')
- id=1
- cb.call(0,length)
- while(true)
- buf = "\0" * read_size
- red = [0].pack('L')
- irf.call( hService, buf, read_size, red )
- #buf.delete!("\0")
- f.write(buf)
- cb.call(id*read_size,length)
-
- if(red.unpack('L') == [0])
- #读到文件末端
- break
- end
- #buf.delete!("\0")
- #content += buf
- id+=1
- end
-
- return content
-
-
- end
- HTTP_QUERY_STATUS_CODE = 19
- CONTENT_LENGTH=5
- def Get_Http_Info.HttpQueryInfo(hService)
- read_size = 1024
- buf = "\0" * read_size
- red = [read_size-1].pack('L')
- hqi = Win32API.new('wininet', 'HttpQueryInfo', %(l, l, p, p, p), 'i')
- isOk = hqi.call( hService, HTTP_QUERY_STATUS_CODE, buf, red, nil)
- buf.delete!("\0")
- return buf
- end
- def Get_Http_Info.HttpQuerySize(hService)
- read_size = 1024
- buf = "\0" * read_size
- red = [read_size-1].pack('L')
- hqi = Win32API.new('wininet', 'HttpQueryInfo', %(l, l, p, p, p), 'i')
- isOk = hqi.call( hService, CONTENT_LENGTH, buf, red, nil)
- buf.delete!("\0")
- return buf
- end
- def Get_Http_Info.InternetCloseHandle(hInternet)
- ich = Win32API.new('winInet', 'InternetCloseHandle', %(l), 'i')
- isOk = ich.call(hInternet)
- return isOk
- end
- HTTP_CODE_OK = "200"
- def Get_Http_Info.get_info(url)
- info = nil
- begin
- hInternet = InternetOpen()
- if(hInternet != 0)
- hService = InternetOpenUrl(hInternet, url)
- if(hService != 0)
- status_code = HttpQueryInfo(hService)
- if(status_code == HTTP_CODE_OK)
- info = InternetReadFile(hService)
- end
- InternetCloseHandle(hService)
- end
- InternetCloseHandle(hInternet)
- end
- rescue
- # 例外发生
- return ""
- end
- ary = []
- info.each_line do |line|
- next if line.empty?
- ary.push line
- end
- return ary[271].scan(/\w+<\/a>/)
- end
- def Get_Http_Info.get_html(url)
- info = nil
- begin
- hInternet = InternetOpen()
- if(hInternet != 0)
- hService = InternetOpenUrl(hInternet, url)
- if(hService != 0)
- status_code = HttpQueryInfo(hService)
- if(status_code == HTTP_CODE_OK)
- info = InternetReadFile(hService)
- end
- InternetCloseHandle(hService)
- end
- InternetCloseHandle(hInternet)
- end
- rescue
- # 例外发生
- return ""
- end
- return info
- end
- def Get_Http_Info.down_load(url,save,cb,fn)
- info = nil
- begin
-
- hInternet = InternetOpen()
- if(hInternet != 0)
- hService = InternetOpenUrl(hInternet, url)
- if(hService != 0)
- status_code = HttpQueryInfo(hService)
- length=HttpQuerySize(hService).to_i
- #p length
- if(status_code == HTTP_CODE_OK)
- f=File.open(fn,"wb")
- info = NewInternetReadFile(hService,length,cb,f)
- f.close
- end
- InternetCloseHandle(hService)
- end
- InternetCloseHandle(hInternet)
- end
- rescue
- # 例外发生
- return ""
- end
- return info
- end
- end
- #$s=Sprite.new
- #$s.bitmap=Bitmap.new(544,24)
- #$s.bitmap.fill_rect(0,0,544,24,Color.new(255,255,255))
- #p Get_Http_Info.down_load("http://rpg.blue/thread-201129-1-1.html","",proc { |a,b|$s.bitmap.fill_rect(0,0,544*(a/b),24,Color.new(0,0,255)) ;Graphics.update})
复制代码 主程序- unless $@ #和谐F12
- #namespace Yangff
- $Yangff={} if $Yangff.nil?
- if not $Yangff["$WebCache"]
- $Yangff["$WebCache"]="1.0.0 120"
- module Yangff
- module WebCache
- V="1.0.0 120"
- NV = "1.0.1 220"
- FileURL="http://127.0.0.1:1108/RTP/"
- CRC=false # in 1.0.1
- begin
- Width=Graphics.width
- Height=Graphics.height
- RPG="VX"
- rescue
- Width=640
- Height=480
- RPG="XP"
- end
- if CRC
- raise "Sorry.We donot support CRC Check in V#{V} .You may find it in #{NV}"
- end
- def self.cache_file(urls)
- if $Yangff["$WebCache$Background$Viewport"].nil?
- $Yangff["$WebCache$Background$Viewport"]=Viewport.new(0,0,Width,Height)
- $Yangff["$WebCache$Background$Viewport"].z=9999999
- $Yangff["$WebCache$Background$Sprite"] = Sprite.new
- $Yangff["$WebCache$Background$Sprite"].z= 9999900
- $Yangff["$WebCache$Background$Sprite"].bitmap=Bitmap.new(Width,Height)
- $Yangff["$WebCache$Background$Sprite"].bitmap.fill_rect(0,0,Width,Height,Color.new(0,0,0,100))
- $Yangff["$WebCache$Background$Sprite"].viewport=$Yangff["$WebCache$Background$Viewport"]
- $Yangff["$WebCache$Background$SpriteLoop"] = Sprite.new
- $Yangff["$WebCache$Background$SpriteLoop"].viewport=$Yangff["$WebCache$Background$Viewport"]
- $Yangff["$WebCache$Background$SpriteLoop"].z= 9999900
- $Yangff["$WebCache$Background$SpriteLoop"].bitmap=Bitmap.new(Width,24)
- end
- o=Graphics.brightness
- Graphics.transition(1)
- Graphics.fadein(1)
- $Yangff["$WebCache$Background$Viewport"].visible =true
- #returns=[]
- for url in urls
- $Yangff["$WebCache$Background$SpriteLoop"].bitmap.fill_rect(0,0,Width,24,Color.new(255,255,255))
- if not $WebCache[url] #returns
- fn=rand(999999).to_s+rand(999999).to_s+rand(999999).to_s+rand(999999).to_s+rand(999999).to_s+rand(999999).to_s+".rxd"
- $ts=Time.now
- #f=File.open("Cache/#{fn}","wb")
- Get_Http_Info.down_load("#{Yangff::WebCache::FileURL}#{url}.rxd","",proc { |a,b|$Yangff["$WebCache$Background$SpriteLoop"].bitmap.fill_rect(0,0,Width,24,Color.new(255,255,255));$Yangff["$WebCache$Background$SpriteLoop"].bitmap.fill_rect(0,0,Yangff::WebCache::Width*(a.to_f/b.to_f),24,Color.new(0,0,255)) ;str="Downloading #{url}... #{(a.to_f/b.to_f*100).to_i}% Speed: #{(a.to_f/((Time.now-$ts)*1000)).to_i} k/s" ;rect=$Yangff["$WebCache$Background$SpriteLoop"].bitmap.text_size(str) ;$Yangff["$WebCache$Background$SpriteLoop"].bitmap.draw_text(rect,str,1) ;Graphics.update; Graphics.frame_reset
- },"Cache/#{fn}")
- #f.close
- $WebCache[url]="Cache/#{fn}"
- save_data($WebCache,"Data/WebCache.rvdata")
- end
- end
- $Yangff["$WebCache$Background$Viewport"].visible =false
- Graphics.brightness=o
- end
- end
- end
- if not FileTest.directory?("Cache")
- Dir.mkdir("Cache")
- $WebCache={}
- else
- $WebCache=load_data("Data/WebCache.rvdata")
- end
- alias yangff_old_exit exit
- def exit(*args)
- save_data($WebCache,"Data/WebCache.rvdata")
- yangff_old_exit(*args)
- end
- class Bitmap
- alias yangff_old_initialize initialize
- def initialize(*args)
- if args.size>1
- return yangff_old_initialize(*args)
- else
- begin
- return yangff_old_initialize(*args)
- rescue Errno::ENOENT
- Yangff::WebCache.cache_file([args[0]])
- return yangff_old_initialize($WebCache[args[0]])
- end
- end
- end
- end
- class <<Audio
- alias yangff_old_bgm_play bgm_play
- alias yangff_old_bgs_play bgs_play
- alias yangff_old_me_play me_play
- alias yangff_old_se_play se_play
- def bgm_play(*args)
- begin
- yangff_old_bgm_play(*args)
- rescue Errno::ENOENT
- Yangff::WebCache.cache_file([args[0]])
- args[0]=$WebCache[args[0]]
- yangff_old_bgm_play(*args)
- end
- end
- def bgs_play(*args)
- begin
- yangff_old_bgs_play(*args)
- rescue Errno::ENOENT
- Yangff::WebCache.cache_file([args[0]])
- args[0]=$WebCache[args[0]]
- yangff_old_bgs_play(*args)
- end
- end
- def me_play(*args)
- begin
- yangff_old_me_play(*args)
- rescue Errno::ENOENT
- Yangff::WebCache.cache_file([args[0]])
- args[0]=$WebCache[args[0]]
- yangff_old_me_play(*args)
- end
- end
- def se_play(*args)
- begin
- yangff_old_se_play(*args)
- rescue Errno::ENOENT
- Yangff::WebCache.cache_file([args[0]])
- args[0]=$WebCache[args[0]]
- yangff_old_se_play(*args)
- end
- end
-
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|