Project1

标题: 登入脚本问题 [打印本页]

作者: RPG问题多多者    时间: 2011-8-10 00:07
标题: 登入脚本问题
本帖最后由 RPG问题多多者 于 2011-8-10 00:13 编辑

请问有大大能修改这个脚本让这个脚本不影响其它窗口吗?

※脚本过長我分成两段:
  1. #出自50rpg---http://www.50rpg.com/---這行請勿刪除
  2. if $gmae_F12 ; $add_save_load.save $add_50rpg
  3. end ; $gmae_F12 = true
  4. class String ; def text_size ; self.split(//u).length ; end ; end
  5. class Bitmap ; def word_step1(x, y, width, height, str, align = 0) ; str_arr = str.split(//u) ; str_arr.
  6. size.times{|i|self.draw_text(x + i*self.font.size, y, width, height, str_arr[i], align)} ; end ; end
  7. #class Game_Map ; def initialize ; @map_id, @display_x, @display_y = 1, 0, 0 ; end ; end
  8. class Initialization < Window_Base
  9.   def initialize ; super(200, 240-22-32, 240, 22+32) ; Graphics.transition
  10.     self.contents = Bitmap.new(width - 32, height - 32) ; self.contents.clear ; self.back_opacity =  200
  11.     35.times{|i| ; self.contents.clear
  12.     self.contents.draw_text(0, 0, 340-32, 22, "--- Now Loading " + "-"*(i/3), 0) ; update
  13.     3.times{Graphics.update}} ; 44.times{Graphics.update} ; Graphics.freeze ; self.dispose
  14.     unless FileTest.exist?("Data/add_address_pass_word.rmxp50rpg") ; $add_pass_hash_50rpg = {}
  15.       $add_pass_50rpg = open("Data/add_address_pass_word.rmxp50rpg", "w")
  16.       Marshal.dump($add_pass_hash_50rpg, $add_pass_50rpg) ; $add_pass_50rpg.close
  17.     end ; $add_pass_50rpg = Marshal.load(open("Data/add_address_pass_word.rmxp50rpg"))
  18.   end
  19. end
  20. class Scene_Map
  21.   def call_menu
  22.     $game_temp.menu_calling = false
  23.     if $game_temp.menu_beep
  24.       $game_system.se_play($data_system.decision_se) ; $game_temp.menu_beep = false
  25.     end ; $game_player.straighten ; $scene_menu = Scene_Menu.new
  26.   end
  27.   def call_save
  28.     $game_player.straighten ; $scene_save = Scene_Save.new
  29.   end
  30. end
  31. class Object ; def stop_g ; Graphics.freeze ; end ; end
  32. class Scene_Menu ; alias update_command_part1 update_command
  33.   def initialize(menu_index = 0)
  34.     @menu_index = menu_index ; @out = false ; @del = false ; main
  35.   end
  36.   def main
  37.     s1 = $data_system.words.item
  38.     s2 = $data_system.words.skill
  39.     s3 = $data_system.words.equip
  40.     s4 = "狀態"
  41.     s5 = "存檔"
  42.     s6 = "離開"
  43.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
  44.     @command_window.index = @menu_index
  45.     @command_window.back_opacity =  255
  46.     if $game_party.actors.size == 0
  47.       @command_window.disable_item(0)
  48.       @command_window.disable_item(1)
  49.       @command_window.disable_item(2)
  50.       @command_window.disable_item(3)
  51.     end ; @command_window.disable_item(4) if $game_system.save_disabled
  52.     @playtime_window = Window_PlayTime.new
  53.     @playtime_window.back_opacity = 255
  54.     @playtime_window.x = 0 ; @playtime_window.y = 224 ; @playtime_window.z = 999999
  55.     @steps_window = Window_Steps.new
  56.     @steps_window.back_opacity = 255 ; @steps_window.x = 0 ; @steps_window.y = 320 ; @steps_window.z = 999999
  57.     @gold_window = Window_Gold.new
  58.     @gold_window.back_opacity = 255 ; @gold_window.x = 0 ; @gold_window.y = 416 ; @gold_window.z = 999999
  59.     @status_window = Window_MenuStatus.new
  60.     @status_window.back_opacity = 255 ; @status_window.x = 160 ; @status_window.y = 0 ; @status_window.z = 999999
  61.     Graphics.transition
  62.     loop{Graphics.update ; Input.update ; update ; break if @out} ; del_win
  63.   end
  64.   def del_win ; unless @del ; @out = !@out
  65.     @command_window.dispose ; @playtime_window.dispose ; @del = !@del
  66.     @status_window.dispose ; @steps_window.dispose ; @gold_window.dispose ; end
  67.   end
  68.   def update ; @command_window.update ; @playtime_window.update
  69.     @steps_window.update ; @gold_window.update ; @status_window.update
  70.     if @command_window.active ; update_command ; return ; end
  71.     if @status_window.active ; update_status ; return ; end
  72.   end
  73.   def update_command
  74.     if Input.trigger?(Input::B)
  75.       $game_system.se_play($data_system.cancel_se) ; @out = !@out ; return
  76.     end
  77.     if Input.trigger?(Input::C)
  78.       if $game_party.actors.size == 0 and @command_window.index < 4
  79.         $game_system.se_play($data_system.buzzer_se) ; return
  80.       end
  81.       case @command_window.index
  82.       when 0 ; stop_g ; del_win
  83.         $game_system.se_play($data_system.decision_se) ; $scene_item = Scene_Item.new
  84.       when 1
  85.         $game_system.se_play($data_system.decision_se) ; @command_window.active = false
  86.         @status_window.active = true ; @status_window.index = 0
  87.       when 2
  88.         $game_system.se_play($data_system.decision_se) ; @command_window.active = false
  89.         @status_window.active = true ; @status_window.index = 0
  90.       when 3
  91.         $game_system.se_play($data_system.decision_se) ; @command_window.active = false
  92.         @status_window.active = true ; @status_window.index = 0
  93.       when 4 ; stop_g
  94.         if $game_system.save_disabled
  95.           $game_system.se_play($data_system.buzzer_se) ; return
  96.         end
  97.         $game_system.se_play($data_system.decision_se)
  98.         del_win ; $scene_save = Scene_Save.new
  99.       when 5 ; stop_g
  100.         $game_system.se_play($data_system.decision_se) ; del_win ; $scene_end = Scene_End.new
  101.       end ; return
  102.     end
  103.   end
  104.   def update_status
  105.     if Input.trigger?(Input::B)
  106.       $game_system.se_play($data_system.cancel_se)
  107.       @command_window.active = true
  108.       @status_window.active = false
  109.       @status_window.index = -1
  110.       return
  111.     end
  112.     if Input.trigger?(Input::C)
  113.       case @command_window.index
  114.       when 1 ; stop_g ; del_win
  115.         if $game_party.actors[@status_window.index].restriction >= 2
  116.           $game_system.se_play($data_system.buzzer_se) ; return
  117.         end
  118.         $game_system.se_play($data_system.decision_se)
  119.         $scene_skill = Scene_Skill.new(@status_window.index)
  120.       when 2 ; stop_g ; del_win
  121.         $game_system.se_play($data_system.decision_se)
  122.         $scene_Equip = Scene_Equip.new(@status_window.index)
  123.       when 3 ; stop_g ; del_win
  124.         $game_system.se_play($data_system.decision_se)
  125.         $scene_status = Scene_Status.new(@status_window.index)
  126.       end
  127.       return
  128.     end
  129.   end
  130. end
  131. class Scene_Item ; def initialize ; @out = false ; main ; end
  132.   def main ; @help_window = Window_Help.new ; @item_window = Window_Item.new
  133.     @item_window.help_window = @help_window ; @target_window = Window_Target.new
  134.     @help_window.back_opacity = 255
  135.     @item_window.back_opacity = 255
  136.     @target_window.back_opacity = 255
  137.     @target_window.visible = false ; @target_window.active = false ; Graphics.transition
  138.     loop{Graphics.update ; Input.update ; update ; break if @out}
  139.   end
  140.   def del_win ; @out = !@out
  141.     @help_window.dispose ; @item_window.dispose ; @target_window.dispose
  142.   end
  143.   def update ; @help_window.update ; @item_window.update ; @target_window.update
  144.     if @item_window.active ; update_item ; return ; end
  145.     if @target_window.active ; update_target ; return ; end
  146.   end
  147.   def update_item
  148.     if Input.trigger?(Input::B) ; del_win
  149.       $game_system.se_play($data_system.cancel_se)
  150.       $scene_menu = Scene_Menu.new(0) ; return
  151.     end
  152.     if Input.trigger?(Input::C)
  153.       @item = @item_window.item
  154.       unless @item.is_a?(RPG::Item)
  155.         $game_system.se_play($data_system.buzzer_se)
  156.         return
  157.       end
  158.       unless $game_party.item_can_use?(@item.id)
  159.         $game_system.se_play($data_system.buzzer_se)
  160.         return
  161.       end
  162.       $game_system.se_play($data_system.decision_se)
  163.       if @item.scope >= 3
  164.         @item_window.active = false
  165.         @target_window.x = (@item_window.index + 1) % 2 * 304
  166.         @target_window.visible = true
  167.         @target_window.active = true
  168.         if @item.scope == 4 || @item.scope == 6
  169.           @target_window.index = -1
  170.         else
  171.           @target_window.index = 0
  172.         end
  173.       else
  174.         if @item.common_event_id > 0
  175.           $game_temp.common_event_id = @item.common_event_id
  176.           $game_system.se_play(@item.menu_se)
  177.           if @item.consumable
  178.             $game_party.lose_item(@item.id, 1)
  179.             @item_window.draw_item(@item_window.index)
  180.           end ; @out = !@out ; return
  181.         end
  182.       end
  183.       return
  184.     end
  185.   end
  186.   def update_target
  187.     if Input.trigger?(Input::B)
  188.       $game_system.se_play($data_system.cancel_se)
  189.       unless $game_party.item_can_use?(@item.id)
  190.         @item_window.refresh
  191.       end
  192.       @item_window.active = true
  193.       @target_window.visible = false
  194.       @target_window.active = false
  195.       return
  196.     end
  197.     if Input.trigger?(Input::C)
  198.       if $game_party.item_number(@item.id) == 0
  199.         $game_system.se_play($data_system.buzzer_se)
  200.         return
  201.       end
  202.       if @target_window.index == -1
  203.         used = false
  204.         for i in $game_party.actors
  205.           used |= i.item_effect(@item)
  206.         end
  207.       end
  208.       if @target_window.index >= 0
  209.         target = $game_party.actors[@target_window.index]
  210.         used = target.item_effect(@item)
  211.       end
  212.       if used
  213.         $game_system.se_play(@item.menu_se)
  214.         if @item.consumable
  215.           $game_party.lose_item(@item.id, 1)
  216.           @item_window.draw_item(@item_window.index)
  217.         end
  218.         @target_window.refresh
  219.         if $game_party.all_dead? ; del_win
  220.           $scene = Scene_Gameover.new
  221.           return
  222.         end
  223.         if @item.common_event_id > 0 ; del_win
  224.           $game_temp.common_event_id = @item.common_event_id
  225.           return
  226.         end
  227.       end
  228.       unless used
  229.         $game_system.se_play($data_system.buzzer_se)
  230.       end
  231.       return
  232.     end
  233.   end
  234. end
  235. class Scene_Skill
  236.   def initialize(actor_index = 0, equip_index = 0)
  237.     @actor_index = actor_index ; @out = false ; main
  238.   end
  239.   def main
  240.     @actor = $game_party.actors[@actor_index]
  241.     @help_window = Window_Help.new
  242.     @status_window = Window_SkillStatus.new(@actor)
  243.     @skill_window = Window_Skill.new(@actor)
  244.     @skill_window.help_window = @help_window
  245.     @target_window = Window_Target.new
  246.     @help_window.back_opacity = 255
  247.     @status_window.back_opacity = 255
  248.     @skill_window.back_opacity = 255
  249.     @target_window.back_opacity = 255
  250.     @target_window.visible = false
  251.     @target_window.active = false
  252.     Graphics.transition
  253.     loop{Graphics.update ; Input.update ; update ; break if @out}
  254.   end
  255.   def del_win ; @out = !@out ; stop_g
  256.     @help_window.dispose ; @status_window.dispose
  257.     @skill_window.dispose ; @target_window.dispose
  258.   end
  259.   def update
  260.     @help_window.update ; @status_window.update
  261.     @skill_window.update ; @target_window.update
  262.     if @skill_window.active
  263.       update_skill
  264.       return
  265.     end
  266.     if @target_window.active
  267.       update_target
  268.       return
  269.     end
  270.   end
  271.   def update_skill
  272.     if Input.trigger?(Input::B) ; del_win
  273.       $game_system.se_play($data_system.cancel_se)
  274.       $scene_menu = Scene_Menu.new(1)
  275.       return
  276.     end
  277.     if Input.trigger?(Input::C)
  278.       @skill = @skill_window.skill
  279.       if @skill == nil or not @actor.skill_can_use?(@skill.id)
  280.         $game_system.se_play($data_system.buzzer_se)
  281.         return
  282.       end
  283.       $game_system.se_play($data_system.decision_se)
  284.       if @skill.scope >= 3
  285.         @skill_window.active = false
  286.         @target_window.x = (@skill_window.index + 1) % 2 * 304
  287.         @target_window.visible = true
  288.         @target_window.active = true
  289.         if @skill.scope == 4 || @skill.scope == 6
  290.           @target_window.index = -1
  291.         elsif @skill.scope == 7
  292.           @target_window.index = @actor_index - 10
  293.         else
  294.           @target_window.index = 0
  295.         end
  296.       else
  297.         if @skill.common_event_id > 0 ; del_win
  298.           $game_temp.common_event_id = @skill.common_event_id
  299.           $game_system.se_play(@skill.menu_se) ; @actor.sp -= @skill.sp_cost
  300.           @status_window.refresh ; @skill_window.refresh ; @target_window.refresh
  301.           return
  302.         end
  303.       end
  304.       return
  305.     end
  306.     if Input.trigger?(Input::R) ; del_win
  307.       $game_system.se_play($data_system.cursor_se)
  308.       @actor_index = @actor_index+1 == $game_party.actors.size ? 0 : @actor_index+1
  309.       $scene_skill = Scene_Skill.new(@actor_index)
  310.       return
  311.     end
  312.     if Input.trigger?(Input::L) ; del_win
  313.       $game_system.se_play($data_system.cursor_se)
  314.       @actor_index = @actor_index-1 < 0 ? $game_party.actors.size-1 : @actor_index-1
  315.       $scene_skill = Scene_Skill.new(@actor_index)
  316.       return
  317.     end
  318.   end
  319.   def update_target
  320.     if Input.trigger?(Input::B)
  321.       $game_system.se_play($data_system.cancel_se)
  322.       @skill_window.active = true
  323.       @target_window.visible = false
  324.       @target_window.active = false
  325.       return
  326.     end
  327.     if Input.trigger?(Input::C)
  328.       unless @actor.skill_can_use?(@skill.id)
  329.         $game_system.se_play($data_system.buzzer_se)
  330.         return
  331.       end
  332.       if @target_window.index == -1
  333.         used = false
  334.         for i in $game_party.actors
  335.           used |= i.skill_effect(@actor, @skill)
  336.         end
  337.       end
  338.       if @target_window.index <= -2
  339.         target = $game_party.actors[@target_window.index + 10]
  340.         used = target.skill_effect(@actor, @skill)
  341.       end
  342.       if @target_window.index >= 0
  343.         target = $game_party.actors[@target_window.index]
  344.         used = target.skill_effect(@actor, @skill)
  345.       end
  346.       if used
  347.         $game_system.se_play(@skill.menu_se)
  348.         @actor.sp -= @skill.sp_cost
  349.         @status_window.refresh
  350.         @skill_window.refresh
  351.         @target_window.refresh
  352.         if $game_party.all_dead?
  353.           $scene = Scene_Gameover.new
  354.           return
  355.         end
  356.         if @skill.common_event_id > 0
  357.           $game_temp.common_event_id = @skill.common_event_id
  358.           $scene = Scene_Map.new
  359.           return
  360.         end
  361.       end
  362.       unless used
  363.         $game_system.se_play($data_system.buzzer_se)
  364.       end
  365.       return
  366.     end
  367.   end
  368. end
  369. class Scene_Equip
  370.   def initialize(actor_index = 0, equip_index = 0)
  371.     @actor_index = actor_index ; @equip_index = equip_index ; @out = false ; main
  372.   end
  373.   def main
  374.     @actor = $game_party.actors[@actor_index]
  375.     @help_window = Window_Help.new
  376.     @left_window = Window_EquipLeft.new(@actor)
  377.     @right_window = Window_EquipRight.new(@actor)
  378.     @item_window1 = Window_EquipItem.new(@actor, 0)
  379.     @item_window2 = Window_EquipItem.new(@actor, 1)
  380.     @item_window3 = Window_EquipItem.new(@actor, 2)
  381.     @item_window4 = Window_EquipItem.new(@actor, 3)
  382.     @item_window5 = Window_EquipItem.new(@actor, 4)
  383.     @help_window.back_opacity = 255
  384.     @left_window.back_opacity = 255
  385.     @right_window.back_opacity = 255
  386.     @item_window1.back_opacity = 255
  387.     @item_window2.back_opacity = 255
  388.     @item_window3.back_opacity = 255
  389.     @item_window4.back_opacity = 255
  390.     @item_window5.back_opacity = 255
  391.     @right_window.help_window = @help_window
  392.     @item_window1.help_window = @help_window
  393.     @item_window2.help_window = @help_window
  394.     @item_window3.help_window = @help_window
  395.     @item_window4.help_window = @help_window
  396.     @item_window5.help_window = @help_window
  397.     @right_window.index = @equip_index ; refresh
  398.     Graphics.transition
  399.     loop{Graphics.update ; Input.update ; update ; break if @out}
  400.   end
  401.   def del_win ; stop_g ; @out = !@out ; @help_window.dispose ; @left_window.dispose
  402.     @right_window.dispose ; @item_window1.dispose ; @item_window2.dispose
  403.     @item_window3.dispose ; @item_window4.dispose ; @item_window5.dispose
  404.   end
  405.   def refresh
  406.     @item_window1.visible = (@right_window.index == 0)
  407.     @item_window2.visible = (@right_window.index == 1)
  408.     @item_window3.visible = (@right_window.index == 2)
  409.     @item_window4.visible = (@right_window.index == 3)
  410.     @item_window5.visible = (@right_window.index == 4)
  411.     item1 = @right_window.item
  412.     case @right_window.index
  413.     when 0
  414.       @item_window = @item_window1
  415.     when 1
  416.       @item_window = @item_window2
  417.     when 2
  418.       @item_window = @item_window3
  419.     when 3
  420.       @item_window = @item_window4
  421.     when 4
  422.       @item_window = @item_window5
  423.     end
  424.     if @right_window.active
  425.       @left_window.set_new_parameters(nil, nil, nil)
  426.     end
  427.     if @item_window.active
  428.       item2 = @item_window.item
  429.       last_hp = @actor.hp
  430.       last_sp = @actor.sp
  431.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  432.       new_atk = @actor.atk
  433.       new_pdef = @actor.pdef
  434.       new_mdef = @actor.mdef
  435.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  436.       @actor.hp = last_hp
  437.       @actor.sp = last_sp
  438.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
  439.     end
  440.   end
  441.   def update ; @left_window.update ; @right_window.update ; @item_window.update ; refresh
  442.     if @right_window.active ; update_right ; return ; end
  443.     if @item_window.active ; update_item ; return ; end
  444.   end
  445.   def update_right
  446.     if Input.trigger?(Input::B) ; del_win
  447.       $game_system.se_play($data_system.cancel_se)
  448.       $scene_menu = Scene_Menu.new(2)
  449.       return
  450.     end
  451.     if Input.trigger?(Input::C)
  452.       if @actor.equip_fix?(@right_window.index)
  453.         $game_system.se_play($data_system.buzzer_se)
  454.         return
  455.       end
  456.       $game_system.se_play($data_system.decision_se)
  457.       @right_window.active = false
  458.       @item_window.active = true
  459.       @item_window.index = 0
  460.       return
  461.     end
  462.     if Input.trigger?(Input::R) ; del_win
  463.       $game_system.se_play($data_system.cursor_se)
  464.       @actor_index = @actor_index+1 == $game_party.actors.size ? 0 : @actor_index+1
  465.       $scene_Equip = Scene_Equip.new(@actor_index, @right_window.index)
  466.       return
  467.     end
  468.     if Input.trigger?(Input::L) ; del_win
  469.       $game_system.se_play($data_system.cursor_se)
  470.       @actor_index = @actor_index-1 < 0 ? $game_party.actors.size-1 : @actor_index-1
  471.       $scene_Equip = Scene_Equip.new(@actor_index, @right_window.index)
  472.       return
  473.     end
  474.   end
  475.   def update_item
  476.     if Input.trigger?(Input::B)
  477.       $game_system.se_play($data_system.cancel_se)
  478.       @right_window.active = true
  479.       @item_window.active = false
  480.       @item_window.index = -1
  481.       return
  482.     end
  483.     if Input.trigger?(Input::C)
  484.       $game_system.se_play($data_system.equip_se)
  485.       item = @item_window.item
  486.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  487.       @right_window.active = true
  488.       @item_window.active = false
  489.       @item_window.index = -1
  490.       @right_window.refresh
  491.       @item_window.refresh
  492.       return
  493.     end
  494.   end
  495. end
  496. class Scene_Status
  497.   def initialize(actor_index = 0, equip_index = 0)
  498.     @actor_index = actor_index ; @out = false ; main
  499.   end
  500.   def main
  501.     @actor = $game_party.actors[@actor_index]
  502.     @status_window = Window_Status.new(@actor)
  503.     @status_window.back_opacity = 0
  504.     Graphics.transition
  505.     loop{Graphics.update ; Input.update ; update ; break if @out}
  506.   end
  507.   def del_win ; stop_g ; @out = !@out ; @status_window.dispose ; end
  508.   def update
  509.     if Input.trigger?(Input::B) ; del_win
  510.       $game_system.se_play($data_system.cancel_se)
  511.       $scene_menu = Scene_Menu.new(3)
  512.       return
  513.     end
  514.     if Input.trigger?(Input::R) ; del_win
  515.       $game_system.se_play($data_system.cursor_se)
  516.       @actor_index = @actor_index+1 == $game_party.actors.size ? 0 : @actor_index+1
  517.       $scene_status = Scene_Status.new(@actor_index)
  518.       return
  519.     end
  520.     if Input.trigger?(Input::L) ; del_win
  521.       $game_system.se_play($data_system.cursor_se)
  522.       @actor_index = @actor_index-1 < 0 ? $game_party.actors.size-1 : @actor_index-1
  523.       $scene_status = Scene_Status.new(@actor_index)
  524.       return
  525.     end
  526.   end
  527. end
  528. class Scene_End ; def initialize ; @out = false ; main ; end
  529.   def main ; s1, s2, s3 = "重新登入(關閉)", "結 束 遊 戲", "回 到 遊 戲"
  530.     @command_window = Window_Command.new(192, [s1, s2, s3])
  531.     @command_window.x = 320 - @command_window.width / 2
  532.     @command_window.y = 240 - @command_window.height / 2
  533.     @command_window.back_opacity =  255 ; Graphics.transition
  534.     loop{Graphics.update ; Input.update ; update ; break if @out}
  535.     if $scene.is_a?(Scene_Title) ; del_win ; Graphics.transition ; Graphics.freeze ; end
  536.   end
  537.   def del_win ; stop_g ; @out = !@out ; @command_window.dispose ; end
  538.   def update ; @command_window.update
  539.     if Input.trigger?(Input::B) ; del_win
  540.       $game_system.se_play($data_system.cancel_se) ; $scene_menu = Scene_Menu.new(5) ; return
  541.     end
  542.     if Input.trigger?(Input::C)
  543.       case @command_window.index
  544.       when 0 ; command_to_title
  545.       when 1 ; command_shutdown
  546.       when 2 ; command_cancel
  547.       end ; return
  548.     end
  549.   end
  550.   def command_to_title ; $game_system.se_play($data_system.decision_se)
  551.     Audio.bgm_fade(800) ; Audio.bgs_fade(800) ; Audio.me_fade(800)
  552.     del_win ; @out = !@out ; $scene = Scene_Title.new
  553.   end
  554.   def command_shutdown ; $game_system.se_play($data_system.decision_se)
  555.     Audio.bgm_fade(800) ; Audio.bgs_fade(800) ; Audio.me_fade(800) ; exit
  556.   end
  557.   def command_cancel ; $game_system.se_play($data_system.decision_se)
  558.     $scene_menu = Scene_Menu.new(5)
  559.   end
  560. end
  561. class Window_SaveFile < Window_Base
  562.   attr_reader    :filename                 # 檔案名稱
  563.   attr_reader    :selected                 # 選擇狀態
  564.   attr_accessor :index_selected
  565.   def initialize(filename) ; super(0, 64, 640, 104*4)
  566.     self.contents = Bitmap.new(width - 32, height - 32)
  567.     self.back_opacity =  255 ; @filename = name = filename
  568.     @time_stamp = Time.at(0) ; @file_exist = FileTest.exist?(@filename)
  569.     @gogo_num = 0 ; @gogo = 0 ; @index_selected = 0
  570.     unless @file_exist ; print "! 您的資料遭到刪除 !", "3" ; print "! 您的資料遭到刪除 !", "2"
  571.     print "! 您的資料遭到刪除 !", "1" ; exit ; end
  572.     file = File.open(@filename, "r")
  573.     @time_stamp = file.mtime
  574.     @characters = Marshal.load(file)
  575.     @frame_count = Marshal.load(file)
  576.     @game_system = Marshal.load(file)
  577.     @game_switches = Marshal.load(file)
  578.     @game_variables = Marshal.load(file)
  579.     $total_sec = @frame_count / Graphics.frame_rate
  580.     file.close ; refresh ; @selected = false
  581.   end
  582.   def update ; refresh
复制代码
  1.     @index_selected = @index_selected - 1 < 0 ? 1 : 0 if Input.repeat?(Input::LEFT)
  2.     @index_selected = @index_selected + 1 > 1 ? 0 : 1 if Input.repeat?(Input::RIGHT)
  3.     update_cursor_rect
  4.     if @gogo_num == 5
  5.       @gogo = @gogo + 1 > 3 ? 0 : @gogo + 1 ; @gogo_num = 0 ; else ; @gogo_num += 1
  6.     end ; super
  7.   end
  8.   def refresh
  9.     self.contents.clear ; self.contents.font.color = normal_color
  10.     if @file_exist
  11.       for i in [email protected]
  12.         bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
  13.         cw = bitmap.rect.width / 4
  14.         ch = bitmap.rect.height / 4
  15.         src_rect = Rect.new(@gogo*32, 0, cw, ch)
  16.         x2 = ch + 10 + 640/5*i ; x3 = 640/4*i-i*3
  17.         #x = 640/10 + ch/2 + 640/5*i#(640/8 + 640/5*i)#300 - @characters.size * 32 + i * 64 - cw / 2
  18.         x = 640/10 + 640/5*i + ch/2
  19.         self.contents.blt(x3, 68 - ch, bitmap, src_rect)
  20.         @actor = $game_party.actors[i]
  21.         xx = (@actor.name.text_size-2)*22 ; draw_actor_name(@actor, x3, 0)#(@actor, x-xx, 0)
  22.         xx = @actor.class_name.text_size*22 ; draw_actor_class(@actor, x3+22*2, 22)
  23.         draw_actor_level(@actor, x3+22*2, 22*2)
  24.         draw_actor_state(@actor, x3, 64)#(@actor, 640/4*i, 64)
  25.         draw_actor_hp(@actor, x3, 22*4, 170)
  26.         draw_actor_sp(@actor, x3, 22*5, 170)
  27.         draw_actor_parameter(@actor, x3, 22*7, 0)
  28.         draw_actor_parameter(@actor, x3, 22*8, 1)
  29.         draw_actor_parameter(@actor, x3, 22*9, 2)
  30.         draw_actor_parameter(@actor, x3, 22*10, 3)
  31.         draw_actor_parameter(@actor, x3, 22*11, 4)
  32.         draw_actor_parameter(@actor, x3, 22*12, 5)
  33.         draw_actor_parameter(@actor, x3, 22*13, 6)
  34.       end
  35.       self.contents.font.color = normal_color
  36.       time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  37.       self.contents.draw_text(4, 480-32*4, 600, 32, time_string, 2)
  38.       self.contents.draw_text(4, 480-32*4, 600, 32, "存檔", 0)
  39.       self.contents.draw_text(4+22*4, 480-32*4, 600, 32, "刪除", 0)
  40.     end
  41.   end
  42.   def draw_actor_level(actor, x, y)
  43.     self.contents.font.color = system_color
  44.     self.contents.draw_text(x, y, 32, 32, "Lv")
  45.     self.contents.font.color = normal_color
  46.     self.contents.draw_text(x + 20, y, 24, 32, actor.level.to_s, 2)
  47.   end
  48.   def draw_actor_hp(actor, x, y, width = 144)
  49.     self.contents.font.color = system_color
  50.     self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
  51.       hp_x = x + 32
  52.       flag = true
  53.     self.contents.font.color = actor.hp == 0 ? knockout_color :
  54.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  55.     self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 0)
  56.     if flag
  57.       self.contents.font.color = normal_color
  58.       self.contents.draw_text(hp_x + 38, y, 12, 32, "/", 0)
  59.       self.contents.draw_text(hp_x + 50, y, 48, 32, actor.maxhp.to_s)
  60.     end
  61.   end
  62.   def draw_actor_sp(actor, x, y, width = 144)
  63.     self.contents.font.color = system_color
  64.     self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
  65.       sp_x = x + 32
  66.       flag = true
  67.     self.contents.font.color = actor.sp == 0 ? knockout_color :
  68.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  69.     self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 0)
  70.     if flag
  71.       self.contents.font.color = normal_color
  72.       self.contents.draw_text(sp_x + 38, y, 12, 32, "/", 0)
  73.       self.contents.draw_text(sp_x + 50, y, 48, 32, actor.maxsp.to_s)
  74.     end
  75.   end
  76.   def draw_actor_parameter(actor, x, y, type)
  77.     case type
  78.     when 0
  79.       parameter_name = $data_system.words.atk
  80.       parameter_value = actor.atk
  81.     when 1
  82.       parameter_name = $data_system.words.pdef
  83.       parameter_value = actor.pdef
  84.     when 2
  85.       parameter_name = $data_system.words.mdef
  86.       parameter_value = actor.mdef
  87.     when 3
  88.       parameter_name = $data_system.words.str
  89.       parameter_value = actor.str
  90.     when 4
  91.       parameter_name = $data_system.words.dex
  92.       parameter_value = actor.dex
  93.     when 5
  94.       parameter_name = $data_system.words.agi
  95.       parameter_value = actor.agi
  96.     when 6
  97.       parameter_name = $data_system.words.int
  98.       parameter_value = actor.int
  99.     end
  100.     self.contents.font.color = system_color
  101.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  102.     self.contents.font.color = normal_color
  103.     self.contents.draw_text(x + 90, y, 36, 32, parameter_value.to_s, 2)
  104.   end
  105.   def selected=(selected)
  106.     @selected = selected
  107.     update_cursor_rect
  108.   end
  109.   def update_cursor_rect
  110.     if @selected
  111.       self.cursor_rect.set(@index_selected*22*4, 480-32*4, 22*2+8, 32)
  112.     else
  113.       self.cursor_rect.empty
  114.     end
  115.   end
  116. end
  117. class Scene_File
  118.   def initialize(help_text)
  119.     @help_text = help_text ; @out = false ; @del = false ; main
  120.   end
  121.   def main ; @savefile_windows = Window_SaveFile.new "#{$add_50rpg}.rxdata"
  122.     @help_window = Window_Help.new
  123.     hour = $total_sec / 60 / 60 ; min = $total_sec / 60 % 60 ; sec = $total_sec % 60
  124.     time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  125.     @help_window.set_text("手動存檔" + " "*5 + @help_text  + " "*5 + time_string)
  126.     @help_window.back_opacity =  255
  127.     @file_index = $game_temp.last_file_index
  128.     @savefile_windows.selected = true ; Graphics.transition
  129.     loop{Graphics.update ; Input.update ; update ; break if @out} ; del_win
  130.   end
  131.   def del_win ; unless @del ; @out = !@out
  132.     @help_window.dispose ; @savefile_windows.dispose ; @del = !@del ; end
  133.   end
  134.   def update
  135.     @help_window.update
  136.     @savefile_windows.update
  137.     if Input.trigger?(Input::C)
  138.       if @savefile_windows.index_selected == 1 ; $add_pass_50rpg.delete($add_50rpg)
  139.         $add_pass_hash_50rpg = open("Data/add_address_pass_word.rmxp50rpg", "w")
  140.         Marshal.dump($add_pass_50rpg, $add_pass_hash_50rpg) ; $add_pass_hash_50rpg.close
  141.         $files1 = $add_50rpg + ".rxdata"
  142.         $dels = true
  143.         File.delete($files1)
  144.         while FileTest.exist?($files1)
  145.           Graphics.update
  146.         end
  147.         Thread.new {system('Game')} ; exit
  148.       else
  149.         del_win
  150.         on_decision($add_50rpg)
  151.         $game_temp.last_file_index = @file_index
  152.         return
  153.       end
  154.     end
  155.     if Input.trigger?(Input::B)
  156.       del_win ; on_cancel
  157.       return
  158.     end
  159.   end
  160. end
  161. class Scene_Save < Scene_File
  162.   def initialize
  163.     super("帳 號 : #$add_50rpg")
  164.   end
  165.   def on_decision(filename)
  166.     $game_system.se_play($data_system.save_se)
  167.     file = File.open(filename + ".rxdata", "wb")
  168.     write_save_data(file)
  169.     file.close
  170.     if $game_temp.save_calling
  171.       $game_temp.save_calling = false
  172.       return
  173.     end
  174.     $scene_menu = Scene_Menu.new(4)
  175.   end
  176.   def on_cancel
  177.     $game_system.se_play($data_system.cancel_se)
  178.     if $game_temp.save_calling
  179.       $game_temp.save_calling = false
  180.       return
  181.     end
  182.     $scene_menu = Scene_Menu.new(4)
  183.   end
  184.   def write_save_data(file)
  185.     characters = []
  186.     for i in 0...$game_party.actors.size
  187.       actor = $game_party.actors[i]
  188.       characters.push([actor.character_name, actor.character_hue])
  189.     end
  190.     Marshal.dump(characters, file)
  191.     Marshal.dump(Graphics.frame_count, file)
  192.     $game_system.save_count += 1
  193.     $game_system.magic_number = $data_system.magic_number
  194.     Marshal.dump($game_system, file)
  195.     Marshal.dump($game_switches, file)
  196.     Marshal.dump($game_variables, file)
  197.     Marshal.dump($game_self_switches, file)
  198.     Marshal.dump($game_screen, file)
  199.     Marshal.dump($game_actors, file)
  200.     Marshal.dump($game_party, file)
  201.     Marshal.dump($game_troop, file)
  202.     Marshal.dump($game_map, file)
  203.     Marshal.dump($game_player, file)
  204.   end
  205. end
  206. class Scene_Load < Scene_File
  207.   def initialize
  208.     $game_temp = Game_Temp.new
  209.     $game_temp.last_file_index = 0
  210.     latest_time = Time.at(0)
  211.     for i in 0..3
  212.       filename = make_filename(i)
  213.       if FileTest.exist?(filename)
  214.         file = File.open(filename, "r")
  215.         if file.mtime > latest_time
  216.           latest_time = file.mtime
  217.           $game_temp.last_file_index = i
  218.         end
  219.         file.close
  220.       end
  221.     end
  222.     super("帳 號 : #{$add_50rpg}")
  223.   end
  224.   def on_decision(filename)
  225.     unless FileTest.exist?(filename)
  226.       $game_system.se_play($data_system.buzzer_se)
  227.       return
  228.     end
  229.     $game_system.se_play($data_system.load_se)
  230.     file = File.open(filename + ".rxdata", "rb")
  231.     read_save_data(file)
  232.     file.close
  233.     # 還原 BGM、BGS
  234.     $game_system.bgm_play($game_system.playing_bgm)
  235.     $game_system.bgs_play($game_system.playing_bgs)
  236.     $game_map.update
  237.   end
  238.   def on_cancel
  239.     $game_system.se_play($data_system.cancel_se)
  240.     $scene = Scene_Title.new
  241.   end
  242.   def read_save_data(file)
  243.     characters = Marshal.load(file)
  244.     Graphics.frame_count = Marshal.load(file)
  245.     $game_system        = Marshal.load(file)
  246.     $game_switches      = Marshal.load(file)
  247.     $game_variables     = Marshal.load(file)
  248.     $game_self_switches = Marshal.load(file)
  249.     $game_screen        = Marshal.load(file)
  250.     $game_actors        = Marshal.load(file)
  251.     $game_party         = Marshal.load(file)
  252.     $game_troop         = Marshal.load(file)
  253.     $game_map           = Marshal.load(file)
  254.     $game_player        = Marshal.load(file)
  255.     if $game_system.magic_number != $data_system.magic_number
  256.       $game_map.setup($game_map.map_id)
  257.       $game_player.center($game_player.x, $game_player.y)
  258.     end
  259.     $game_party.refresh
  260.   end
  261. end
  262. class Window_Password < Window_Base ; def initialize ; initializes ; @input = Input_English.new
  263.     super(100, 480/3, 640-200, 480/3) ; self.contents = Bitmap.new(width - 32, height - 32)
  264.     self.contents.clear ; self.back_opacity = 0 ; self.opacity = 0; @address = "" ; @address_x = 0 ; @pass_word = ""
  265.     @pass_word_x = 0 ; @text_glitters = Sprite.new ; @text_glitters.bitmap = Bitmap.new(22*2 +
  266.     2, 24) ; @text_glitters.z = 1000 ; @text_glitters.x = -3 ; @text_glitters.y = -24
  267.     @item = 1 ; @item_glitters = true ; @item_glitters_num = 0 ; @items = 1 ; @pass_words = 0
  268.     self.contents.draw_text(0, 32*3, 340-32, 22, "    ", 1) ; @system_message = ""
  269.     $add_save_load = Add_save_load.new ; @system_messages = "帳號密碼限英文、數字  Delete清除全部"
  270.   end ; def initializes ; @initialize = Initialization.new ; end
  271.   def update ; if TrueInput.trigger?(0x2E) ; del_text ; end
  272.     if Input.repeat?(Input::DOWN) ; @item = @item + 1 > 5 ? 1 : @item + 1 ; end
  273.     if Input.repeat?(Input::UP) ; @item = @item-1 < 1 ? 5 : @item-1 ; end
  274.     self.contents.clear ; self.opacity = 0 ; self.back_opacity = 0 ; super
  275.     self.contents.font.color = Color.new(255, 0, 0) ; if @system_message  ==  ""
  276.     self.contents.draw_text(0, 32*3-20, 440-32, 22, "輸入完畢請操作上下鍵到登入並按下【Enter】", 1)
  277.     else ; self.contents.draw_text(0, 32*3-22, 440-32, 22, "#@system_message", 1)
  278.     end ; self.contents.draw_text(0, 32*3+4, 440-32, 22, "#@system_messages", 1)
  279.     self.contents.font.color = Color.new(255, 255, 255) ; @pass_words = @pass_word.size
  280.     self.contents.word_step1(0, 0, 440, 22, "帳號:#@address")
  281.     self.contents.word_step1(0, 32, 440, 22, "密碼:" + "*"*@pass_words)
  282.     self.contents.draw_text(0, 32+22, 440-32, 22, "登入  清除  離開", 1) ; case @item
  283.     when 1 ; item_update ; @address_x = @address.text_size*self.contents.font.size
  284.       if @items != 1 ; @item_glitters_num = 0 ; @items = 1 ; @text_glitters.bitmap.clear
  285.       end ; if @address.size < 16 ; @address += @input.update
  286.       else ; @system_message = "帳號過長(1~16) 重新輸入請按Delete" ; end
  287.       @text_glitters.x = 100 + 22*3 + 10 + @address_x ; @text_glitters.y = 480/3 + 32/2
  288.     when 2 ; item_update ; @pass_word_x = @pass_word.text_size*self.contents.font.size
  289.       @text_glitters.x = 100 + 22*3 + 10 + @pass_word_x ; @text_glitters.y = 480/3 + 32/2 + 32
  290.       if @items != 2 ; @item_glitters_num = 0 ; @items = 2 ; @text_glitters.bitmap.clear
  291.       end ; if @pass_word.size < 16 ; @pass_word += @input.update
  292.       else ; @system_message = "密碼過長(1~16) 重新輸入請按Delete" ; end
  293.       @text_glitters.x = 100 + 22*3 + 10 + @pass_word_x ; @text_glitters.y = 480/3 + 32/2 + 32
  294.     when 3 ; if @address  ==  "" and @pass_word  ==  "" ; @system_message = "請輸入帳號密碼"
  295.       elsif @address  ==  "" ; @system_message = "請輸入帳號"
  296.       elsif @pass_word  ==  "" ; @system_message = "請輸入密碼"
  297.       else ; @system_message = "輸入完畢請操作上下鍵到登入並按下【Enter】"
  298.         if Kboard.keyb($R_Key_RETURN) == 1
  299.           $add_save_load.save_add(@address, @pass_word)
  300.           @system_messages = "密碼錯誤"
  301.         end
  302.       end ; item_update true
  303.       @text_glitters.x = 210 ; @text_glitters.y = 480/3 + 32/2 + 32*2+11 ; @items = 3
  304.     when 4 ; @text_glitters.x = 210 + 22*4 ; @text_glitters.y = 480/3 + 32/2 + 32*2+11
  305.       item_update true ; @system_message = "重新輸入帳號密碼" ; @items = 4
  306.       del_text if Kboard.keyb($R_Key_RETURN) == 1
  307.       @system_messages = "【Delete】清除全部"
  308.     when 5 ; exit if Kboard.keyb($R_Key_RETURN) == 1 ; item_update true
  309.       @text_glitters.x = 210 + 22*8 ; @text_glitters.y = 480/3 + 32/2 + 32*2+11
  310.       @system_message = "結束遊戲" ; @items = 5
  311.     end
  312.   end
  313.   def item_update(i = false) ; @system_message = ""
  314.     if i ; @text_glitters.bitmap.clear
  315.       @text_glitters.bitmap.fill_rect(0, 0, 22*2 + 2, 1, Color.new(255, 255, 255))
  316.     else
  317.       if @item_glitters_num  ==  10 ; @item_glitters = !@item_glitters ; @item_glitters_num = 0
  318.       else ; @item_glitters_num  +=  1 ; end
  319.       if @item_glitters ; @text_glitters.bitmap.fill_rect(0, 0, 3, 24, Color.new(100, 100, 100))
  320.       else ; @text_glitters.bitmap.clear ; end
  321.     end
  322.   end ; def del_text ; @address, @pass_word = "", "" ; end
  323.   def del_w ; self.contents.clear ; self.dispose ; @text_glitters.dispose ; end
  324. end
  325. class Add_save_load
  326.   def save_add(add, pass)
  327.     $add_50rpg = add
  328.     if $add_pass_50rpg[add] ; $game_temp = Game_Temp.new
  329.       if $add_pass_50rpg[add] == pass ; load(add) ; $scene = Scene_Map.new ; end
  330.     else ; $add_pass_50rpg[add] = pass
  331.       $add_pass_hash_50rpg = open("Data/add_address_pass_word.rmxp50rpg", "w")
  332.       Marshal.dump($add_pass_50rpg, $add_pass_hash_50rpg) ; $add_pass_hash_50rpg.close
  333.       $add_pass_50rpg = Marshal.load(open("Data/add_address_pass_word.rmxp50rpg"))
  334.       $game_system = Game_System.new ; $game_troop = Game_Troop.new
  335.       $game_switches = Game_Switches.new ; $game_temp = Game_Temp.new
  336.       $game_variables = Game_Variables.new ; $game_party = Game_Party.new
  337.       $game_self_switches = Game_SelfSwitches.new ; $game_map = Game_Map.new
  338.       $game_actors = Game_Actors.new ; $game_player = Game_Player.new
  339.       $game_screen = Game_Screen.new ; $add_pass_50rpg[add] = pass ; save(add)
  340.       $game_party.setup_starting_members ; $game_map.setup($data_system.start_map_id)
  341.       $game_player.moveto($data_system.start_x, $data_system.start_y)
  342.       $game_player.refresh ; $game_map.autoplay ; $game_map.update
  343.       save(add) ; $scene = Scene_Map.new
  344.     end
  345.   end
  346.   def save(add) ; file = File.open(add + ".rxdata", "wb") ; characters = []
  347.     for i in 0...$game_party.actors.size
  348.       actor = $game_party.actors[i] ; characters.push([actor.character_name, actor.character_hue])
  349.     end ; Marshal.dump(characters, file) ; Marshal.dump(Graphics.frame_count, file)
  350.     $game_system.save_count += 1 ; $game_system.magic_number = $data_system.magic_number
  351.     Marshal.dump($game_system, file) ; Marshal.dump($game_switches, file)
  352.     Marshal.dump($game_variables, file) ; Marshal.dump($game_self_switches, file)
  353.     Marshal.dump($game_screen, file) ; Marshal.dump($game_actors, file)
  354.     Marshal.dump($game_party, file) ; Marshal.dump($game_troop, file)
  355.     Marshal.dump($game_map, file) ; Marshal.dump($game_player, file) ; file.close
  356.   end
  357.   def load(add)
  358.     unless FileTest.exist?(add+".rxdata") ; print "! 您的帳號已刪除 !    4"
  359.       print "! 您的帳號已刪除 !    3" ; print "! 您的帳號已刪除 !    2"
  360.       print "! 您的帳號已刪除 !    1" ; print "帳號初始化..." ; $game_screen = Game_Screen.new
  361.       $game_system = Game_System.new ; $game_troop = Game_Troop.new
  362.       $game_switches = Game_Switches.new ; $game_temp = Game_Temp.new
  363.       $game_variables = Game_Variables.new ; $game_party = Game_Party.new
  364.       $game_self_switches = Game_SelfSwitches.new ; $game_map = Game_Map.new
  365.       $game_actors = Game_Actors.new ; $game_player = Game_Player.new
  366.       $game_party.setup_starting_members ; $game_map.setup($data_system.start_map_id)
  367.       $game_player.moveto($data_system.start_x, $data_system.start_y)
  368.       $game_player.refresh ; $game_map.autoplay ; $game_map.update ; save(add)
  369.     end ; file = File.open(add+".rxdata", "rb")
  370.     characters = Marshal.load(file) ; Graphics.frame_count = Marshal.load(file)
  371.     $game_system        = Marshal.load(file) ; $game_switches      = Marshal.load(file)
  372.     $game_variables     = Marshal.load(file) ; $game_self_switches = Marshal.load(file)
  373.     $game_screen        = Marshal.load(file) ; $game_actors        = Marshal.load(file)
  374.     $game_party         = Marshal.load(file) ; $game_troop         = Marshal.load(file)
  375.     $game_map           = Marshal.load(file) ; $game_player        = Marshal.load(file)
  376.     if $game_system.magic_number != $data_system.magic_number
  377.       $game_map.setup($game_map.map_id)
  378.       $game_player.center($game_player.x, $game_player.y)
  379.     end ; $game_party.refresh
  380.   end
  381. end
  382. class Scene_Title ; alias main_part1 main ; alias update_part1 update
  383. def main ; if $BTEST ; battle_test ; return ; end
  384. $data_actors = load_data("Data/Actors.rxdata")
  385. $data_classes = load_data("Data/Classes.rxdata")
  386. $data_skills =  load_data("Data/Skills.rxdata")
  387. $data_items = load_data("Data/Items.rxdata")
  388. $data_weapons = load_data("Data/Weapons.rxdata")
  389. $data_armors = load_data("Data/Armors.rxdata")
  390. $data_enemies = load_data("Data/Enemies.rxdata")
  391. $data_troops = load_data("Data/Troops.rxdata")
  392. $data_states = load_data("Data/States.rxdata")
  393. $data_animations = load_data("Data/Animations.rxdata")
  394. $data_tilesets = load_data("Data/Tilesets.rxdata")
  395. $data_common_events = load_data("Data/CommonEvents.rxdata")
  396. $data_system = load_data("Data/System.rxdata")
  397. $game_system = Game_System.new ; @pass_windows = Window_Password.new
  398. @sprite = Sprite.new ; @sprite.bitmap = RPG::Cache.title($data_system.title_name)
  399. $game_system.bgm_play($data_system.title_bgm) ; Audio.me_stop ; Audio.bgs_stop
  400. Graphics.transition ; loop{Graphics.update ; Input.update ; update ; if $scene != self
  401. @pass_windows.del_w ; break ; end} ; Graphics.freeze ; @sprite.dispose ; end
  402. def update ; @pass_windows.update
  403. if Kboard.keyb($R_Key_RETURN) ; end ; end ; end ; module Kboard
  404. $Rmouse_BUTTON_L = 0x01 # left mouse button
  405. $Rmouse_BUTTON_R = 0x02 # right mouse button
  406. $Rmouse_BUTTON_M = 0x04 # middle mouse button
  407. $Rmouse_BUTTON_4 = 0x05 # 4th mouse button
  408. $Rmouse_BUTTON_5 = 0x06 # 5th mouse button
  409. $R_Key_BACK = 0x08 # BACKSPACE key
  410. $R_Key_TAB = 0x09 # TAB key
  411. $R_Key_RETURN = 0x0D # ENTER key
  412. $R_Key_SHIFT = 0x10 # SHIFT key
  413. $R_Key_CTLR = 0x11 # CTLR key
  414. $R_Key_ALT = 0x12 # ALT key
  415. $R_Key_PAUSE = 0x13 # PAUSE key
  416. $R_Key_CAPITAL = 0x14 # CAPS LOCK key
  417. $R_Key_ESCAPE = 0x1B # ESC key
  418. $R_Key_SPACE = 0x20 # SPACEBAR
  419. $R_Key_PRIOR = 0x21 # PAGE UP key
  420. $R_Key_NEXT = 0x22 # PAGE DOWN key
  421. $R_Key_END = 0x23 # END key
  422. $R_Key_HOME = 0x24 # HOME key
  423. $R_Key_LEFT = 0x25 # LEFT ARROW key
  424. $R_Key_UP = 0x26 # UP ARROW key
  425. $R_Key_RIGHT = 0x27 # RIGHT ARROW key
  426. $R_Key_DOWN = 0x28 # DOWN ARROW key
  427. $R_Key_SELECT = 0x29 # SELECT key
  428. $R_Key_PRINT = 0x2A # PRINT key
  429. $R_Key_SNAPSHOT = 0x2C # PRINT SCREEN key
  430. $R_Key_INSERT = 0x2D # INS key
  431. $R_Key_DELETE = 0x2E # DEL key
  432. $R_Key_0 = 0x30 # 0 key
  433. $R_Key_1 = 0x31 # 1 key
  434. $R_Key_2 = 0x32 # 2 key
  435. $R_Key_3 = 0x33 # 3 key
  436. $R_Key_4 = 0x34 # 4 key
  437. $R_Key_5 = 0x35 # 5 key
  438. $R_Key_6 = 0x36 # 6 key
  439. $R_Key_7 = 0x37 # 7 key
  440. $R_Key_8 = 0x38 # 8 key
  441. $R_Key_9 = 0x39 # 9 key
  442. $R_Key_A = 0x41 # A key
  443. $R_Key_B = 0x42 # B key
  444. $R_Key_C = 0x43 # C key
  445. $R_Key_D = 0x44 # D key
  446. $R_Key_E = 0x45 # E key
  447. $R_Key_F = 0x46 # F key
  448. $R_Key_G = 0x47 # G key
  449. $R_Key_H = 0x48 # H key
  450. $R_Key_I = 0x49 # I key
  451. $R_Key_J = 0x4A # J key
  452. $R_Key_K = 0x4B # K key
  453. $R_Key_L = 0x4C # L key
  454. $R_Key_M = 0x4D # M key
  455. $R_Key_N = 0x4E # N key
  456. $R_Key_O = 0x4F # O key
  457. $R_Key_P = 0x50 # P key
  458. $R_Key_Q = 0x51 # Q key
  459. $R_Key_R = 0x52 # R key
  460. $R_Key_S = 0x53 # S key
  461. $R_Key_T = 0x54 # T key
  462. $R_Key_U = 0x55 # U key
  463. $R_Key_V = 0x56 # V key
  464. $R_Key_W = 0x57 # W key
  465. $R_Key_X = 0x58 # X key
  466. $R_Key_Y = 0x59 # Y key
  467. $R_Key_Z = 0x5A # Z key
  468. $R_Key_LWIN = 0x5B # Left Windows key (Microsoft Natural keyboard)
  469. $R_Key_RWIN = 0x5C # Right Windows key (Natural keyboard)
  470. $R_Key_APPS = 0x5D # Applications key (Natural keyboard)
  471. $R_Key_NUMPAD0 = 0x60 # Numeric keypad 0 key
  472. $R_Key_NUMPAD1 = 0x61 # Numeric keypad 1 key
  473. $R_Key_NUMPAD2 = 0x62 # Numeric keypad 2 key
  474. $R_Key_NUMPAD3 = 0x63 # Numeric keypad 3 key
  475. $R_Key_NUMPAD4 = 0x64 # Numeric keypad 4 key
  476. $R_Key_NUMPAD5 = 0x65 # Numeric keypad 5 key
  477. $R_Key_NUMPAD6 = 0x66 # Numeric keypad 6 key
  478. $R_Key_NUMPAD7 = 0x67 # Numeric keypad 7 key
  479. $R_Key_NUMPAD8 = 0x68 # Numeric keypad 8 key
  480. $R_Key_NUMPAD9 = 0x69 # Numeric keypad 9 key
  481. $R_Key_MULTIPLY = 0x6A # Multiply key (*)
  482. $R_Key_ADD = 0x6B # Add key ( + )
  483. $R_Key_SEPARATOR = 0x6C # Separator key
  484. $R_Key_SUBTRACT = 0x6D # Subtract key (-)
  485. $R_Key_DECIMAL = 0x6E # Decimal key
  486. $R_Key_DIVIDE = 0x6F # Divide key (/)
  487. $R_Key_F1 = 0x70 # F1 key
  488. $R_Key_F2 = 0x71 # F2 key
  489. $R_Key_F3 = 0x72 # F3 key
  490. $R_Key_F4 = 0x73 # F4 key
  491. $R_Key_F5 = 0x74 # F5 key
  492. $R_Key_F6 = 0x75 # F6 key
  493. $R_Key_F7 = 0x76 # F7 key
  494. $R_Key_F8 = 0x77 # F8 key
  495. $R_Key_F9 = 0x78 # F9 key
  496. $R_Key_F10 = 0x79 # F10 key
  497. $R_Key_F11 = 0x7A # F11 key
  498. $R_Key_F12 = 0x7B # F12 key
  499. $R_Key_NUMLOCK = 0x90 # NUM LOCK key
  500. $R_Key_SCROLL = 0x91 # SCROLL LOCK key
  501. $R_Key_LSHIFT = 0xA0 # Left SHIFT key
  502. $R_Key_RSHIFT = 0xA1 # Right SHIFT key
  503. $R_Key_LCONTROL = 0xA2 # Left CONTROL key
  504. $R_Key_RCONTROL = 0xA3 # Right CONTROL key
  505. $R_Key_L_ALT = 0xA4 # Left ALT key
  506. $R_Key_R_ALT = 0xA5 # Right ALT key
  507. $R_Key_SEP = 0xBC # , key
  508. $R_Key_DASH = 0xBD # - key
  509. $R_Key_DOTT = 0xBE # . Key
  510. GetKeyState = Win32API.new("user32","GetAsyncKeyState",['I'],'I')
  511. GetKeyboardState = Win32API.new("user32","GetKeyState",['I'],'I')
  512. GetSetKeyState = Win32API.new("user32","SetKeyboardState",['I'],'I')
  513. module_function
  514. def keyb(rkey) ; if GetKeyState.call(rkey) !=  0 ; return 1 ; end ; return 0 ; end# ; alias repeat? keyb
  515. def 按著(rkey) ; GetKeyState.call(rkey) & 0x01  ==  1 ; end# ; alias press? 按著
  516. def key(rkey, key = 0) ; GetKeyboardState.call(rkey) & 0x01  ==  key ; end# ; alias trigger? key
  517. end
  518. class Input_English
  519. def initialize
  520. #@GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
  521. @GetAsyncKeyState = Win32API.new("user32","GetAsyncKeyState",['I'],'I')
  522. @GetKeyState = Win32API.new("user32","GetKeyState",['I'],'I')
  523. @SetKeyboardState = Win32API.new("user32","SetKeyboardState",['I'],'I')
  524. @input = [$R_Key_0 = 0x30,$R_Key_1 = 0x31,$R_Key_2 = 0x32,$R_Key_3 = 0x33,#0~9,A~Z
  525. $R_Key_4 = 0x34,$R_Key_5 = 0x35,$R_Key_6 = 0x36,$R_Key_7 = 0x37,$R_Key_8 = 0x38,
  526. $R_Key_9 = 0x39,$R_Key_A = 0x41,$R_Key_B = 0x42,$R_Key_C = 0x43,$R_Key_D = 0x44,
  527. $R_Key_E = 0x45,$R_Key_F = 0x46,$R_Key_G = 0x47,$R_Key_H = 0x48, $R_Key_I = 0x49,
  528. $R_Key_J = 0x4A,$R_Key_K = 0x4B,$R_Key_L = 0x4C,$R_Key_M = 0x4D,$R_Key_N = 0x4E,
  529. $R_Key_O = 0x4F,$R_Key_P = 0x50,$R_Key_Q = 0x51,$R_Key_R = 0x52,$R_Key_S = 0x53,
  530. $R_Key_T = 0x54,$R_Key_U = 0x55,$R_Key_V = 0x56,$R_Key_W = 0x57,$R_Key_X = 0x58,
  531. $R_Key_Y = 0x59,$R_Key_Z = 0x5A] ; @inputs = "0123456789abcdefghijklmnopqrstuvwxyz"
  532. end ; def update ; @keys = 0 ; for key in @input
  533. if TrueInput.trigger?(key) ; TrueInput.update ; return @inputs.split(//u)[@keys] ; end ; @keys  +=  1
  534. end ; TrueInput.update ; return "" ; end ; end
  535. module TrueInput
  536.   VK_HOME=0x24;VK_LEFT=0x25;VK_UP=0x26;VK_RIGHT=0x27 ; VK_DOWN=0x28
  537. @GetKeyState=Win32API.new("user32","GetKeyState",'i','i')
  538. @keys_list=[];@keys_state={};@keys_trigger={};@keys_trigger_r={}
  539. @keys_repeat={};@dir4input=[0];@dir8input=[];@dir4=0;@dir8=0
  540. def self.update
  541. for key in@keys_list
  542. [email protected](key);@keys_state[key][email protected](key)
  543. if @keys_state[key]==nil
  544. @keys_trigger_r[key]=false;@keys_trigger[key]=true;@keys_repeat[key]=false;next
  545. end;@keys_trigger_r[key]=false
  546. if @keys_state[key][7]==1;@keys_repeat[key]=(not@keys_repeat[key])
  547. unless@keys_trigger[key];@keys_trigger[key]=true;@keys_trigger_r[key]=true;end
  548. else;@keys_repeat[key]=false;@keys_trigger[key]=false;end
  549. end;self.dir4input(VK_DOWN,2);self.dir4input(VK_LEFT,4)
  550. self.dir4input(VK_RIGHT,6);self.dir4input(VK_UP,8)
  551. @[email protected];@dir4=@dir4input[-1];@[email protected]
  552. case @dir8;when 2,8;@dir8+=dir8load(4,6,-1,+1)#VK_DOWN,VK_UP
  553. when 4,6;@dir8+=dir8load(8,2,+3,-3)#VK_LEFT,VK_RIGHT
  554. end
  555. end
  556. def self.press?(key)
  557. unless@keys_list.include?(key);@keys_list.push(key);@keys_state[key]=0;end
  558. return (@keys_state[key][7]==1)
  559. end
  560. def self.trigger?(key)
  561. unless@keys_list.include?(key)
  562. @keys_list.push(key);@keys_trigger[key]=false;@keys_trigger_r[key]=false
  563. end;return @keys_trigger_r[key]
  564. end
  565. def self.repeat?(key)
  566. @keys_list.push(key);@keys_repeat[key]=falseunless@keys_list.include?(key)
  567. return @keys_repeat[key]
  568. end
  569. def self.toggled?(key)
  570. unless@keys_list.include?(key);@keys_list.push(key);@keys_state[key]=0;end
  571. if @keys_state[key]==nil;return false;else;return (@keys_state[key][0]==1);end
  572. end
  573. def self.dir4;return @dir4;end;def self.dir8;return @dir8;end
  574. def self.dir4input(key,dir_int)
  575. if self.press?(key);@dir4input.push(dir_int)[email protected]?(dir_int)
  576. elsif @dir4input.include?(dir_int);@dir4input.delete(dir_int);end
  577. end;def self.dir8load(dir_a,dir_b,val_a,val_b)
  578. [email protected];if last==0;return 0;elsif last==dir_a;return val_a
  579. elsif last==dir_b;return val_b;else;return self.dir8load(dir_a,dir_b,val_a,val_b);end;end;end
  580. #TrueInput.update 更新按鍵狀態,每一FRAME調用一次 (同Input模組)
  581. #TrueInput.press?(key)判定key所代表的鍵是否被按下 (同Input模組)
  582. #TrueInput.trigger?(key)判定key所代表的鍵是否重新按下 (同Input模組)
  583. #TrueInput.repeat?(key) 判定key所代表的鍵是否重新按下(自動) (同Input模組)
  584. #TrueInput.toggled?(key)判定Caps Lock、Num Lock、Scroll Lock是否被打開用。
  585. begin ; Font.default_name = (["華康中圓體", "微軟正黑體","新細明體", "細明體",
  586.   "新?明体", "標楷体", "宋体", "黑体", "??", "MS P????", "MS PGothic",
  587.   "Tahoma", "Arial", "Arial Unicode MS"]) ; Graphics.freeze
  588.   $scene = Scene_Title.new ; while $scene != nil ; $scene.main ; end ; Graphics.transition(20)
  589. rescue Errno::ENOENT
  590.   filename = $!.message.sub("No such file or directory - ", "")
  591.   print("沒有發現檔案 #{filename}。 ")
  592. rescue SystemExit
  593.   $add_save_load.save $add_50rpg if $add_50rpg
  594.   File.delete($files1) if $dels
  595.   if $add_50rpg
  596.     Graphics.update while FileTest.exist?($add_50rpg + ".rxdata") if $dels
  597.   end
  598. end ; exit
  599. #出自50rpg---http://www.50rpg.com/---這行請勿刪除
复制代码

dsu_plus_rewardpost_czw
作者: 癫狂侠客    时间: 2011-8-10 09:48
本帖最后由 癫狂侠客 于 2011-8-10 09:53 编辑

基本不可能,某侠大致看了下,你的脚本重写的很多脚本,
也就是说,有很多脚本是自己重新定义的,还没测试,一会测试了在补充回答

刚刚测试得出结果,你的上述脚本基本从新定义了所有的现实脚本,所以改起来相当的困难!!!
作者: RPG问题多多者    时间: 2011-8-10 22:13
所以只想要登入的系统而不定义现实脚本是做不到的吗?
作者: Wind2010    时间: 2011-8-10 22:19
不影响其他窗口是指什么呢?
作者: RPG问题多多者    时间: 2011-8-11 21:57
不要連菜單画面中都显示其它窗口(图片不覺得怪怪的吗=口=!!




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