Project1

标题: 如何在標題畫面增加網站連結的功能? [打印本页]

作者: 冷徹心扉    时间: 2014-6-23 14:24
标题: 如何在標題畫面增加網站連結的功能?
簡單說,在標題畫面底下

開始遊戲
讀取進度
結束遊戲

中間新增一個選項「作者網站」
點選之後可直接開啟網頁前往指定的連結
有可能做到嗎,謝謝!
作者: Mr.Jin    时间: 2014-6-24 22:59
你把你的Scene_Title贴出来,我帮你写
作者: 冷徹心扉    时间: 2014-6-25 01:36
Mr.Jin 发表于 2014-6-24 22:59
你把你的Scene_Title贴出来,我帮你写

麻煩了,十分感謝。
  1. #==============================================================================
  2. # ** Scene_Title
  3. #------------------------------------------------------------------------------
  4. #  This class performs the title screen processing.
  5. #==============================================================================

  6. class Scene_Title < Scene_Base
  7.   #--------------------------------------------------------------------------
  8.   # * Main Processing
  9.   #--------------------------------------------------------------------------
  10.   def main
  11.     if $BTEST                         # If battle test
  12.       battle_test                     # Start battle test
  13.     else                              # If normal play
  14.       super                           # Usual main processing
  15.     end
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # * Start processing
  19.   #--------------------------------------------------------------------------
  20.   def start
  21.     super
  22.     load_database                     # Load database
  23.     create_game_objects               # Create game objects
  24.     check_continue                    # Determine if continue is enabled
  25.     create_title_graphic              # Create title graphic
  26.     create_command_window             # Create command window
  27.     play_title_music                  # Play title screen music
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # * Execute Transition
  31.   #--------------------------------------------------------------------------
  32.   def perform_transition
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # * Post-Start Processing
  36.   #--------------------------------------------------------------------------
  37.   def post_start
  38.     super
  39.     open_command_window
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # * Pre-termination Processing
  43.   #--------------------------------------------------------------------------
  44.   def pre_terminate
  45.     super
  46.     close_command_window
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # * Termination Processing
  50.   #--------------------------------------------------------------------------
  51.   def terminate
  52.     super
  53.     dispose_command_window
  54.     snapshot_for_background
  55.     dispose_title_graphic
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # * Frame Update
  59.   #--------------------------------------------------------------------------
  60.   def update
  61.     super
  62.     @command_window.update
  63.     if Input.trigger?(Input::C)
  64.       case @command_window.index
  65.       when 0    #新的遊戲
  66.         command_new_game
  67.       when 1    # 讀取進度
  68.         command_continue
  69.       when 2    # 結束遊戲
  70.         command_shutdown
  71.         
  72.         
  73.       end
  74.     end
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # * Load Database
  78.   #--------------------------------------------------------------------------
  79.   def load_database
  80.     $data_actors        = load_data("Data/Actors.rvdata")
  81.     $data_classes       = load_data("Data/Classes.rvdata")
  82.     $data_skills        = load_data("Data/Skills.rvdata")
  83.     $data_items         = load_data("Data/Items.rvdata")
  84.     $data_weapons       = load_data("Data/Weapons.rvdata")
  85.     $data_armors        = load_data("Data/Armors.rvdata")
  86.     $data_enemies       = load_data("Data/Enemies.rvdata")
  87.     $data_troops        = load_data("Data/Troops.rvdata")
  88.     $data_states        = load_data("Data/States.rvdata")
  89.     $data_animations    = load_data("Data/Animations.rvdata")
  90.     $data_common_events = load_data("Data/CommonEvents.rvdata")
  91.     $data_system        = load_data("Data/System.rvdata")
  92.     $data_areas         = load_data("Data/Areas.rvdata")
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # * Load Battle Test Database
  96.   #--------------------------------------------------------------------------
  97.   def load_bt_database
  98.     $data_actors        = load_data("Data/BT_Actors.rvdata")
  99.     $data_classes       = load_data("Data/BT_Classes.rvdata")
  100.     $data_skills        = load_data("Data/BT_Skills.rvdata")
  101.     $data_items         = load_data("Data/BT_Items.rvdata")
  102.     $data_weapons       = load_data("Data/BT_Weapons.rvdata")
  103.     $data_armors        = load_data("Data/BT_Armors.rvdata")
  104.     $data_enemies       = load_data("Data/BT_Enemies.rvdata")
  105.     $data_troops        = load_data("Data/BT_Troops.rvdata")
  106.     $data_states        = load_data("Data/BT_States.rvdata")
  107.     $data_animations    = load_data("Data/BT_Animations.rvdata")
  108.     $data_common_events = load_data("Data/BT_CommonEvents.rvdata")
  109.     $data_system        = load_data("Data/BT_System.rvdata")
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # * Create Game Objects
  113.   #--------------------------------------------------------------------------
  114.   def create_game_objects
  115.     $game_temp          = Game_Temp.new
  116.     $game_message       = Game_Message.new
  117.     $game_system        = Game_System.new
  118.     $game_switches      = Game_Switches.new
  119.     $game_variables     = Game_Variables.new
  120.     $game_self_switches = Game_SelfSwitches.new
  121.     $game_actors        = Game_Actors.new
  122.     $game_party         = Game_Party.new
  123.     $game_troop         = Game_Troop.new
  124.     $game_map           = Game_Map.new
  125.     $game_player        = Game_Player.new
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # * Determine if Continue is Enabled
  129.   #--------------------------------------------------------------------------
  130.   def check_continue
  131.     @continue_enabled = (Dir.glob('Save*.rvdata').size > 0)
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # * Create Title Graphic
  135.   #--------------------------------------------------------------------------
  136.   def create_title_graphic
  137.     [url=home.php?mod=space&uid=114926]@sprite[/url] = Sprite.new
  138.     @sprite.bitmap = Cache.system("Title")
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # * Dispose of Title Graphic
  142.   #--------------------------------------------------------------------------
  143.   def dispose_title_graphic
  144.     @sprite.bitmap.dispose
  145.     @sprite.dispose
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # * Create Command Window
  149.   #--------------------------------------------------------------------------
  150.   def create_command_window
  151.     s1 = Vocab::new_game
  152.     s2 = Vocab::continue
  153.     s3 = Vocab::shutdown
  154.    
  155.   
  156.    
  157.    
  158.     @command_window = Window_Command.new(172, [s1, s2, s3 ])
  159.     @command_window.opacity = 0 #標題選單視窗透明度
  160.     @command_window.x = (910 - @command_window.width) / 2 # 標題視窗位置
  161.     @command_window.y = 290 # 標題視窗位置
  162.     if @continue_enabled                    # If continue is enabled
  163.       @command_window.index = 1             # Move cursor over command
  164.     else                                    # If disabled
  165.       @command_window.draw_item(1, false)   # Make command semi-transparent
  166.     end
  167.     @command_window.openness = 0
  168.     @command_window.open
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # * Dispose of Command Window
  172.   #--------------------------------------------------------------------------
  173.   def dispose_command_window
  174.     @command_window.dispose
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # * Open Command Window
  178.   #--------------------------------------------------------------------------
  179.   def open_command_window
  180.     @command_window.open
  181.     begin
  182.       @command_window.update
  183.       Graphics.update
  184.     end until @command_window.openness == 255
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # * Close Command Window
  188.   #--------------------------------------------------------------------------
  189.   def close_command_window
  190.     @command_window.close
  191.     begin
  192.       @command_window.update
  193.       Graphics.update
  194.     end until @command_window.openness == 0
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # * Play Title Screen Music
  198.   #--------------------------------------------------------------------------
  199.   def play_title_music
  200.     $data_system.title_bgm.play
  201.     RPG::BGS.stop
  202.     RPG::ME.stop
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # * Check Player Start Location Existence
  206.   #--------------------------------------------------------------------------
  207.   def confirm_player_location
  208.     if $data_system.start_map_id == 0
  209.       print "Player start location not set."
  210.       exit
  211.     end
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # * Command: New Game
  215.   #--------------------------------------------------------------------------
  216.   def command_new_game
  217.     confirm_player_location
  218.     Sound.play_decision #選擇新遊戲音效
  219.     $game_party.setup_starting_members            # Initial party
  220.     $game_map.setup($data_system.start_map_id)    # Initial map position
  221.     $game_player.moveto($data_system.start_x, $data_system.start_y)
  222.     $game_player.refresh
  223.     $scene = Scene_Map.new
  224.     RPG::BGM.fade(1500)
  225.     close_command_window
  226.     Graphics.fadeout(60)
  227.     Graphics.wait(40)
  228.     Graphics.frame_count = 0
  229.     RPG::BGM.stop
  230.     $game_map.autoplay
  231.   end
  232.   #--------------------------------------------------------------------------
  233.   # * Command: Continue
  234.   #--------------------------------------------------------------------------
  235.   def command_continue
  236.     if @continue_enabled
  237.       Sound.play_decision
  238.       $scene = Scene_File.new(false, true, false)
  239.     else
  240.       Sound.play_buzzer
  241.     end
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # * Command: Shutdown
  245.   #--------------------------------------------------------------------------
  246.   def command_shutdown
  247.     Sound.play_decision
  248.     RPG::BGM.fade(800)
  249.     RPG::BGS.fade(800)
  250.     RPG::ME.fade(800)
  251.     $scene = nil
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # * Battle Test
  255.   #--------------------------------------------------------------------------
  256.   def battle_test
  257.     load_bt_database                  # Load battle test database
  258.     create_game_objects               # Create game objects
  259.     Graphics.frame_count = 0          # Initialize play time
  260.     $game_party.setup_battle_test_members
  261.     $game_troop.setup($data_system.test_troop_id)
  262.     $game_troop.can_escape = true
  263.     $game_system.battle_bgm.play
  264.     snapshot_for_background
  265.     $scene = Scene_Battle.new
  266.   end
  267. end
复制代码

作者: Mr.Jin    时间: 2014-6-25 08:55
Project1004.rar (233.83 KB, 下载次数: 26)
直接给你工程算了,你把里面的Scene_Title拿出来用就行了
因为直接贴脚本有一大堆url..
作者: 冷徹心扉    时间: 2014-6-25 13:43
Mr.Jin 发表于 2014-6-25 08:55
直接给你工程算了,你把里面的Scene_Title拿出来用就行了
因为直接贴脚本有一大堆url.. ...

運作沒有問題,十分感謝
另外想請問預設是在後台開啟網頁的
如果想在開啟網頁前,遊戲視窗自動縮小到工作列,該怎麼做呢?
謝謝!




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1