Project1

标题: 标题增加选项:网页(网站)跳转 [打印本页]

作者: Yui    时间: 2011-12-22 13:02
标题: 标题增加选项:网页(网站)跳转
本帖最后由 Yui 于 2011-12-22 13:07 编辑

肿么能少了这个功能呢~大家说是不是。





使用方法:脚本编辑器 Main前插入

修改跳转网址页在147行。
  1. #==============================================================================
  2. # ■ Window_TitleCommand
  3. #------------------------------------------------------------------------------
  4. #  66RPG /YUI
  5. #    2011/12/22
  6. #==============================================================================


  7. class Window_TitleCommand < Window_Command
  8.   #--------------------------------------------------------------------------
  9.   # ● 生成指令列表
  10.   #--------------------------------------------------------------------------
  11.   def make_command_list
  12.    add_command(Vocab::new_game, :new_game)
  13.     add_command(Vocab::continue, :continue, continue_enabled)
  14.     add_command("关于作者YUI", :jump)#引号内中文自由编辑
  15.     add_command(Vocab::shutdown, :shutdown)
  16.   end
  17. end

  18. #==============================================================================
  19. # ■ Scene_Title
  20. #------------------------------------------------------------------------------
  21. #  标题画面
  22. #==============================================================================

  23. class Scene_Title < Scene_Base
  24.   #--------------------------------------------------------------------------
  25.   # ● 开始处理
  26.   #--------------------------------------------------------------------------
  27.   def start
  28.     super
  29.     SceneManager.clear
  30.     Graphics.freeze
  31.     create_background
  32.     create_foreground
  33.     create_command_window
  34.     play_title_music
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 取得渐变速度
  38.   #--------------------------------------------------------------------------
  39.   def transition_speed
  40.     return 20
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # ● 结束处理
  44.   #--------------------------------------------------------------------------
  45.   def terminate
  46.     super
  47.     SceneManager.snapshot_for_background
  48.     dispose_background
  49.     dispose_foreground
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● 生成背景
  53.   #--------------------------------------------------------------------------
  54.   def create_background
  55.     @sprite1 = Sprite.new
  56.     @sprite1.bitmap = Cache.title1($data_system.title1_name)
  57.     @sprite2 = Sprite.new
  58.     @sprite2.bitmap = Cache.title2($data_system.title2_name)
  59.     center_sprite(@sprite1)
  60.     center_sprite(@sprite2)
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 生成前景
  64.   #--------------------------------------------------------------------------
  65.   def create_foreground
  66.     @foreground_sprite = Sprite.new
  67.     @foreground_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  68.     @foreground_sprite.z = 100
  69.     draw_game_title if $data_system.opt_draw_title
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 描画游戏标题
  73.   #--------------------------------------------------------------------------
  74.   def draw_game_title
  75.     @foreground_sprite.bitmap.font.size = 48
  76.     rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
  77.     @foreground_sprite.bitmap.draw_text(rect, $data_system.game_title, 1)
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 释放背景
  81.   #--------------------------------------------------------------------------
  82.   def dispose_background
  83.     @sprite1.bitmap.dispose
  84.     @sprite1.dispose
  85.     @sprite2.bitmap.dispose
  86.     @sprite2.dispose
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 释放前景
  90.   #--------------------------------------------------------------------------
  91.   def dispose_foreground
  92.     @foreground_sprite.bitmap.dispose
  93.     @foreground_sprite.dispose
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 执行活动块的居中化
  97.   #--------------------------------------------------------------------------
  98.   def center_sprite(sprite)
  99.     sprite.ox = sprite.bitmap.width / 2
  100.     sprite.oy = sprite.bitmap.height / 2
  101.     sprite.x = Graphics.width / 2
  102.     sprite.y = Graphics.height / 2
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ● 生成指令窗口
  106.   #--------------------------------------------------------------------------
  107.   def create_command_window
  108.     @command_window = Window_TitleCommand.new
  109.     @command_window.set_handler(:new_game, method(:command_new_game))
  110.     @command_window.set_handler(:continue, method(:command_continue))
  111.     @command_window.set_handler(:jump, method(:command_jump))
  112.     @command_window.set_handler(:shutdown, method(:command_shutdown))
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 关闭指令窗口
  116.   #--------------------------------------------------------------------------
  117.   def close_command_window
  118.     @command_window.close
  119.     update until @command_window.close?
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● 指令[新游戏]
  123.   #--------------------------------------------------------------------------
  124.   def command_new_game
  125.     DataManager.setup_new_game
  126.     close_command_window
  127.     fadeout_all
  128.     $game_map.autoplay
  129.     SceneManager.goto(Scene_Map)
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 指令[继续]
  133.   #--------------------------------------------------------------------------
  134.   def command_continue
  135.     close_command_window
  136.     SceneManager.call(Scene_Load)
  137.   end
  138.     #--------------------------------------------------------------------------
  139.   # ● 跳转网页
  140.   #--------------------------------------------------------------------------
  141.   def command_jump
  142.   @jump = Win32API.new('shell32.dll','ShellExecuteA',%w(p p p p p i),'i')#
  143.   @jump.call(0, 'open','http://hi.baidu.com/yuilife',0, 0, 1) # 修改网址
  144.    @command_window.activate
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ● 指令[退出]
  148.   #--------------------------------------------------------------------------
  149.   def command_shutdown
  150.     close_command_window
  151.     fadeout_all
  152.     SceneManager.exit
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 演奏标题画面的音乐
  156.   #--------------------------------------------------------------------------
  157.   def play_title_music
  158.     $data_system.title_bgm.play
  159.     RPG::BGS.stop
  160.     RPG::ME.stop
  161.   end
  162. 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