Project1
标题:
标题增加选项:网页(网站)跳转
[打印本页]
作者:
Yui
时间:
2011-12-22 13:02
标题:
标题增加选项:网页(网站)跳转
本帖最后由 Yui 于 2011-12-22 13:07 编辑
肿么能少了这个功能呢~大家说是不是。
使用方法:脚本编辑器 Main前插入
修改跳转网址页在147行。
#==============================================================================
# ■ Window_TitleCommand
#------------------------------------------------------------------------------
# 66RPG /YUI
# 2011/12/22
#==============================================================================
class Window_TitleCommand < Window_Command
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
add_command(Vocab::new_game, :new_game)
add_command(Vocab::continue, :continue, continue_enabled)
add_command("关于作者YUI", :jump)#引号内中文自由编辑
add_command(Vocab::shutdown, :shutdown)
end
end
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# 标题画面
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
SceneManager.clear
Graphics.freeze
create_background
create_foreground
create_command_window
play_title_music
end
#--------------------------------------------------------------------------
# ● 取得渐变速度
#--------------------------------------------------------------------------
def transition_speed
return 20
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
SceneManager.snapshot_for_background
dispose_background
dispose_foreground
end
#--------------------------------------------------------------------------
# ● 生成背景
#--------------------------------------------------------------------------
def create_background
@sprite1 = Sprite.new
@sprite1.bitmap = Cache.title1($data_system.title1_name)
@sprite2 = Sprite.new
@sprite2.bitmap = Cache.title2($data_system.title2_name)
center_sprite(@sprite1)
center_sprite(@sprite2)
end
#--------------------------------------------------------------------------
# ● 生成前景
#--------------------------------------------------------------------------
def create_foreground
@foreground_sprite = Sprite.new
@foreground_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
@foreground_sprite.z = 100
draw_game_title if $data_system.opt_draw_title
end
#--------------------------------------------------------------------------
# ● 描画游戏标题
#--------------------------------------------------------------------------
def draw_game_title
@foreground_sprite.bitmap.font.size = 48
rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
@foreground_sprite.bitmap.draw_text(rect, $data_system.game_title, 1)
end
#--------------------------------------------------------------------------
# ● 释放背景
#--------------------------------------------------------------------------
def dispose_background
@sprite1.bitmap.dispose
@sprite1.dispose
@sprite2.bitmap.dispose
@sprite2.dispose
end
#--------------------------------------------------------------------------
# ● 释放前景
#--------------------------------------------------------------------------
def dispose_foreground
@foreground_sprite.bitmap.dispose
@foreground_sprite.dispose
end
#--------------------------------------------------------------------------
# ● 执行活动块的居中化
#--------------------------------------------------------------------------
def center_sprite(sprite)
sprite.ox = sprite.bitmap.width / 2
sprite.oy = sprite.bitmap.height / 2
sprite.x = Graphics.width / 2
sprite.y = Graphics.height / 2
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_TitleCommand.new
@command_window.set_handler(:new_game, method(:command_new_game))
@command_window.set_handler(:continue, method(:command_continue))
@command_window.set_handler(:jump, method(:command_jump))
@command_window.set_handler(:shutdown, method(:command_shutdown))
end
#--------------------------------------------------------------------------
# ● 关闭指令窗口
#--------------------------------------------------------------------------
def close_command_window
@command_window.close
update until @command_window.close?
end
#--------------------------------------------------------------------------
# ● 指令[新游戏]
#--------------------------------------------------------------------------
def command_new_game
DataManager.setup_new_game
close_command_window
fadeout_all
$game_map.autoplay
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# ● 指令[继续]
#--------------------------------------------------------------------------
def command_continue
close_command_window
SceneManager.call(Scene_Load)
end
#--------------------------------------------------------------------------
# ● 跳转网页
#--------------------------------------------------------------------------
def command_jump
@jump = Win32API.new('shell32.dll','ShellExecuteA',%w(p p p p p i),'i')#
@jump.call(0, 'open','http://hi.baidu.com/yuilife',0, 0, 1) # 修改网址
@command_window.activate
end
#--------------------------------------------------------------------------
# ● 指令[退出]
#--------------------------------------------------------------------------
def command_shutdown
close_command_window
fadeout_all
SceneManager.exit
end
#--------------------------------------------------------------------------
# ● 演奏标题画面的音乐
#--------------------------------------------------------------------------
def play_title_music
$data_system.title_bgm.play
RPG::BGS.stop
RPG::ME.stop
end
end
复制代码
作者:
fux2
时间:
2011-12-22 13:10
好坑爹的老句子= =
作者:
精灵使者
时间:
2011-12-22 13:45
我记得宝典里面以前某柳有过这个帖子……
作者:
Yui
时间:
2011-12-22 13:53
就是单纯的直接调用而已啊~囧TZ
作者:
火星·奈
时间:
2012-1-20 18:02
楼主砍了我吧。
作者:
z13979811166
时间:
2012-2-18 10:33
这个……怎么说……还可以吧……
作者:
熊熊烈火雄壮
时间:
2012-2-21 16:08
def command_jump
146. @jump = Win32API.new('shell32.dll','ShellExecuteA',%w(p p p p p i),'i')#
147. @jump.call(0, 'open','http://hi.baidu.com/yuilife',0, 0, 1) # 修改网址
148. @command_window.activate
149. end
这段是精华,顶了~
作者:
食人族幽灵
时间:
2012-7-4 15:54
lz用的是啥字体?
作者:
咚小黑
时间:
2012-7-17 06:34
恩!!?? 这脚本怎么这么面熟?
作者:
DBZ-1
时间:
2012-7-18 13:21
嗯...不好意思 不知道算不算挖坟
我只是问一句,这个直接在sence——title里加一段不好吗?
作者:
′芙兰朵露
时间:
2012-9-17 08:43
额。字体好奇怪的说。
怎么改回默认字体,或者其他下载字体?
作者:
Williamnice
时间:
2018-1-19 11:00
找了这么多,这个才最有效,最简单!感谢楼主!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1