设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
12
返回列表 发新帖
楼主: BB崽
打印 上一主题 下一主题

[原创发布] RMXP SDK(震撼登场)

 关闭 [复制链接]

Lv1.梦旅人

贵宾

梦石
0
星屑
50
在线时间
261 小时
注册时间
2005-10-21
帖子
489

贵宾

11
 楼主| 发表于 2005-12-21 22:14:31 | 显示全部楼层

  1. #==============================================================================
  2. # ** Scene_Menu
  3. #------------------------------------------------------------------------------
  4. #  This class performs menu screen processing.
  5. #==============================================================================

  6. class Scene_Menu
  7.   #--------------------------------------------------------------------------
  8.   # * Object Initialization
  9.   #     menu_index : command cursor's initial position
  10.   #--------------------------------------------------------------------------
  11.   def initialize(menu_index = 0)
  12.     @menu_index = menu_index
  13.     commands_init
  14.   end
  15.   #--------------------------------------------------------------------------
  16.   # * Set Commands
  17.   #--------------------------------------------------------------------------
  18.   def commands_init
  19.     @commands = []
  20.     s1 = $data_system.words.item
  21.     s2 = $data_system.words.skill
  22.     s3 = $data_system.words.equip
  23.     s4 = "Status"
  24.     s5 = "Save"
  25.     s6 = "End Game"
  26.     @commands.push(s1, s2, s3, s4, s5, s6).flatten!
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # * Main Processing
  30.   #--------------------------------------------------------------------------
  31.   def main
  32.     main_command_window
  33.     main_windows
  34.     # Execute transition
  35.     Graphics.transition
  36.     # Main loop
  37.     loop do
  38.       main_loop
  39.       break if main_scenechange?
  40.     end
  41.     # Refresh map
  42.     $game_map.refresh
  43.     # Prepare for transition
  44.     Graphics.freeze
  45.     main_dispose
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # * Main Command Window
  49.   #--------------------------------------------------------------------------
  50.   def main_command_window
  51.     @command_window = Window_Command.new(160, @commands)
  52.     @command_window.index = @menu_index
  53.     @command_window.height = 224
  54.     # If number of party members is 0
  55.     if $game_party.actors.size == 0
  56.       # Disable items, skills, equipment, and status
  57.       @command_window.disable_item(0)
  58.       @command_window.disable_item(1)
  59.       @command_window.disable_item(2)
  60.       @command_window.disable_item(3)
  61.     end
  62.     # If save is forbidden
  63.     if $game_system.save_disabled
  64.       # Disable save
  65.       @command_window.disable_item(4)
  66.     end
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # * Main Command Window
  70.   #--------------------------------------------------------------------------
  71.   def main_windows
  72.     # Make play time window
  73.     @playtime_window = Window_PlayTime.new
  74.     @playtime_window.x = 0
  75.     @playtime_window.y = 224
  76.     # Make steps window
  77.     @steps_window = Window_Steps.new
  78.     @steps_window.x = 0
  79.     @steps_window.y = 320
  80.     # Make gold window
  81.     @gold_window = Window_Gold.new
  82.     @gold_window.x = 0
  83.     @gold_window.y = 416
  84.     # Make status window
  85.     @status_window = Window_MenuStatus.new
  86.     @status_window.x = 160
  87.     @status_window.y = 0
  88.    end
  89.   #--------------------------------------------------------------------------
  90.   # * Main Loop
  91.   #--------------------------------------------------------------------------
  92.    def main_loop
  93.      # Update game screen
  94.      Graphics.update
  95.      # Update input information
  96.      Input.update
  97.      # Frame update
  98.      update
  99.    end
  100.   #--------------------------------------------------------------------------
  101.   # * Scene Change
  102.   #--------------------------------------------------------------------------
  103.   def main_scenechange?
  104.     # Abort loop if screen is changed
  105.     if $scene != self
  106.       return true
  107.     end
  108.     return false
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # * Main Dispose
  112.   #--------------------------------------------------------------------------
  113.   def main_dispose
  114.     # Dispose of windows
  115.     @command_window.dispose
  116.     @playtime_window.dispose
  117.     @steps_window.dispose
  118.     @gold_window.dispose
  119.     @status_window.dispose
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # * Frame Update
  123.   #--------------------------------------------------------------------------
  124.   def update
  125.     # Update windows
  126.     @command_window.update
  127.     @playtime_window.update
  128.     @steps_window.update
  129.     @gold_window.update
  130.     @status_window.update
  131.     # If command window is active: call update_command
  132.     if @command_window.active
  133.       update_command
  134.       return
  135.     end
  136.     # If status window is active: call update_status
  137.     if @status_window.active
  138.       update_status
  139.       return
  140.     end
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # * Frame Update (when command window is active)
  144.   #--------------------------------------------------------------------------
  145.   def update_command
  146.     # If B button was pressed
  147.     if Input.trigger?(Input::B)
  148.       # Play cancel SE
  149.       $game_system.se_play($data_system.cancel_se)
  150.       # Switch to map screen
  151.       $scene = Scene_Map.new
  152.       return
  153.     end
  154.     # If C button was pressed
  155.     if Input.trigger?(Input::C)
  156.       update_command_check
  157.       return
  158.     end
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # * Frame Update (when status window is active)
  162.   #--------------------------------------------------------------------------
  163.   def update_status
  164.     # If B button was pressed
  165.     if Input.trigger?(Input::B)
  166.       # Play cancel SE
  167.       $game_system.se_play($data_system.cancel_se)
  168.       # Make command window active
  169.       @command_window.active = true
  170.       @status_window.active = false
  171.       @status_window.index = -1
  172.       return
  173.     end
  174.     # If C button was pressed
  175.     if Input.trigger?(Input::C)
  176.       buzzer_check
  177.       update_status_check unless buzzer_check
  178.       return
  179.     end
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # * Buzzer Check
  183.   #--------------------------------------------------------------------------
  184.   def buzzer_check
  185.     # If command other than save or end game, and party members = 0
  186.     if $game_party.actors.size == 0 and @command_window.index < 4
  187.       # Play buzzer SE
  188.       $game_system.se_play($data_system.buzzer_se)
  189.       return true
  190.     end
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # * Update Command Check
  194.   #--------------------------------------------------------------------------
  195.   def update_command_check
  196.     # Loads Current Command
  197.     command = @commands[@command_window.index]
  198.     # Checks Commands
  199.     if command == $data_system.words.item
  200.       command_item
  201.     elsif command == $data_system.words.skill
  202.       command_start_skill
  203.     elsif command == $data_system.words.equip
  204.       command_start_equip
  205.     elsif command == 'Status'
  206.       command_start_status
  207.     elsif command == 'Save'
  208.       command_save
  209.     elsif command == 'End Game'
  210.       command_endgame
  211.     end
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # * Update Status Check
  215.   #--------------------------------------------------------------------------
  216.   def update_status_check
  217.     # Loads Current Command
  218.     command = @commands[@command_window.index]
  219.     # Checks Command By Name
  220.     if command == $data_system.words.skill
  221.       command_skill
  222.     elsif command == $data_system.words.equip
  223.       command_equip
  224.     elsif command == 'Status'
  225.       command_status
  226.     end
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # * Command Item
  230.   #--------------------------------------------------------------------------
  231.   def command_item
  232.     # Play decision SE
  233.     $game_system.se_play($data_system.decision_se)
  234.     # Switch to item screen
  235.     $scene = Scene_Item.new
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # * Command Start Skill
  239.   #--------------------------------------------------------------------------
  240.   def command_start_skill
  241.     activate_status
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # * Command Skill
  245.   #--------------------------------------------------------------------------
  246.   def command_skill
  247.     # If this actor's action limit is 2 or more
  248.     if $game_party.actors[@status_window.index].restriction >= 2
  249.       # Play buzzer SE
  250.       $game_system.se_play($data_system.buzzer_se)
  251.       return
  252.     end
  253.     # Play decision SE
  254.     $game_system.se_play($data_system.decision_se)
  255.     # Switch to skill screen
  256.     $scene = Scene_Skill.new(@status_window.index)
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # * Command Start Equip
  260.   #--------------------------------------------------------------------------
  261.   def command_start_equip
  262.     activate_status
  263.   end
  264.   #--------------------------------------------------------------------------
  265.   # * Command Equip
  266.   #--------------------------------------------------------------------------
  267.   def command_equip
  268.     # Play decision SE
  269.     $game_system.se_play($data_system.decision_se)
  270.     # Switch to equipment screen
  271.     $scene = Scene_Equip.new(@status_window.index)
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # * Command Start Status
  275.   #--------------------------------------------------------------------------
  276.   def command_start_status
  277.     activate_status
  278.   end
  279.   #--------------------------------------------------------------------------
  280.   # * Command Status
  281.   #--------------------------------------------------------------------------
  282.   def command_status
  283.     # Play decision SE
  284.     $game_system.se_play($data_system.decision_se)
  285.     # Switch to status screen
  286.     $scene = Scene_Status.new(@status_window.index)
  287.   end
  288.   #--------------------------------------------------------------------------
  289.   # * Command Save
  290.   #--------------------------------------------------------------------------
  291.   def command_save
  292.     # If saving is forbidden
  293.     if $game_system.save_disabled
  294.       # Play buzzer SE
  295.       $game_system.se_play($data_system.buzzer_se)
  296.       return
  297.     end
  298.     # Play decision SE
  299.     $game_system.se_play($data_system.decision_se)
  300.     # Switch to save screen
  301.     $scene = Scene_Save.new
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # * Command End Game
  305.   #--------------------------------------------------------------------------
  306.   def command_endgame
  307.     # Play decision SE
  308.     $game_system.se_play($data_system.decision_se)
  309.     # Switch to end game screen
  310.     $scene = Scene_End.new
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # * Activate Status Window
  314.   #--------------------------------------------------------------------------
  315.   def activate_status
  316.     # Play decision SE
  317.     $game_system.se_play($data_system.decision_se)
  318.     # Make status window active
  319.     @command_window.active = false
  320.     @status_window.active = true
  321.     @status_window.index = 0
  322.   end
  323. end

复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

贵宾

梦石
0
星屑
50
在线时间
261 小时
注册时间
2005-10-21
帖子
489

贵宾

12
 楼主| 发表于 2005-12-21 22:14:47 | 显示全部楼层

  1. #==============================================================================
  2. # ** Scene_Save
  3. #------------------------------------------------------------------------------
  4. #  This class performs save screen processing.
  5. #==============================================================================

  6. class Scene_Save < Scene_File
  7.   #--------------------------------------------------------------------------
  8.   # * Write Save Data
  9.   #     file : write file object (opened)
  10.   #--------------------------------------------------------------------------
  11.   def write_save_data(file)
  12.     write_characters(file)
  13.     write_frame(file)
  14.     write_setup(file)
  15.     write_data(file)
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # * Make Character Data
  19.   #--------------------------------------------------------------------------
  20.   def write_characters(file)
  21.     # Make character data for drawing save file
  22.     characters = []
  23.     for i in 0...$game_party.actors.size
  24.       actor = $game_party.actors[i]
  25.       characters.push([actor.character_name, actor.character_hue])
  26.     end
  27.     # Write character data for drawing save file
  28.     Marshal.dump(characters, file)
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # * Write Frame Count
  32.   #--------------------------------------------------------------------------
  33.   def write_frame(file)
  34.     # Wrire frame count for measuring play time
  35.     Marshal.dump(Graphics.frame_count, file)
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # * Write Setup
  39.   #--------------------------------------------------------------------------
  40.   def write_setup(file)
  41.     # Increase save count by 1
  42.     $game_system.save_count += 1
  43.     # Save magic number
  44.     # (A random value will be written each time saving with editor)
  45.     $game_system.magic_number = $data_system.magic_number
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # * Write Data
  49.   #--------------------------------------------------------------------------
  50.   def write_data(file)
  51.     # Write each type of game object
  52.     Marshal.dump($game_system, file)
  53.     Marshal.dump($game_switches, file)
  54.     Marshal.dump($game_variables, file)
  55.     Marshal.dump($game_self_switches, file)
  56.     Marshal.dump($game_screen, file)
  57.     Marshal.dump($game_actors, file)
  58.     Marshal.dump($game_party, file)
  59.     Marshal.dump($game_troop, file)
  60.     Marshal.dump($game_map, file)
  61.     Marshal.dump($game_player, file)
  62.   end
  63. end

复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

贵宾

梦石
0
星屑
50
在线时间
261 小时
注册时间
2005-10-21
帖子
489

贵宾

13
 楼主| 发表于 2005-12-21 22:14:59 | 显示全部楼层

  1. #==============================================================================
  2. # ** Scene_Load
  3. #------------------------------------------------------------------------------
  4. #  This class performs load screen processing.
  5. #==============================================================================

  6. class Scene_Load < Scene_File
  7.   #--------------------------------------------------------------------------
  8.   # * Read Save Data
  9.   #     file : file object for reading (opened)
  10.   #--------------------------------------------------------------------------
  11.   def read_save_data(file)
  12.     read_characters(file)
  13.     read_frame(file)
  14.     read_data(file)
  15.     read_edit
  16.     read_refresh
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # * Read Character Data
  20.   #--------------------------------------------------------------------------
  21.   def read_characters(file)
  22.     # Read character data for drawing save file
  23.     characters = Marshal.load(file)
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # * Read Frame Count
  27.   #--------------------------------------------------------------------------
  28.   def read_frame(file)
  29.     # Read frame count for measuring play time
  30.     Graphics.frame_count = Marshal.load(file)
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # * Read Data
  34.   #--------------------------------------------------------------------------
  35.   def read_data(file)
  36.     # Read each type of game object
  37.     $game_system        = Marshal.load(file)
  38.     $game_switches      = Marshal.load(file)
  39.     $game_variables     = Marshal.load(file)
  40.     $game_self_switches = Marshal.load(file)
  41.     $game_screen        = Marshal.load(file)
  42.     $game_actors        = Marshal.load(file)
  43.     $game_party         = Marshal.load(file)
  44.     $game_troop         = Marshal.load(file)
  45.     $game_map           = Marshal.load(file)
  46.     $game_player        = Marshal.load(file)
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # * Read Edit
  50.   #--------------------------------------------------------------------------
  51.   def read_edit
  52.     # If magic number is different from when saving
  53.     # (if editing was added with editor)
  54.     if $game_system.magic_number != $data_system.magic_number
  55.       # Load map
  56.       $game_map.setup($game_map.map_id)
  57.       $game_player.center($game_player.x, $game_player.y)
  58.     end
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # * Refresh Game Party
  62.   #--------------------------------------------------------------------------
  63.   def read_refresh
  64.     # Refresh party members
  65.     $game_party.refresh
  66.   end
  67. end

复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

贵宾

梦石
0
星屑
50
在线时间
261 小时
注册时间
2005-10-21
帖子
489

贵宾

14
 楼主| 发表于 2005-12-21 22:15:27 | 显示全部楼层

  1. #==============================================================================
  2. # ** Scene_Battle
  3. #------------------------------------------------------------------------------
  4. #  This class performs battle screen processing.
  5. #==============================================================================
  6.   
  7. class Scene_Battle
  8.   #--------------------------------------------------------------------------
  9.   # * Object Initialization
  10.   #     menu_index : command cursor's initial position
  11.   #--------------------------------------------------------------------------
  12.   def initialize
  13.     commands_init
  14.   end
  15.   #--------------------------------------------------------------------------
  16.   # * Set Commands
  17.   #--------------------------------------------------------------------------
  18.   def commands_init
  19.     @commands = []
  20.     s1 = $data_system.words.attack
  21.     s2 = $data_system.words.skill
  22.     s3 = $data_system.words.guard
  23.     s4 = $data_system.words.item
  24.     @commands.push(s1, s2, s3, s4).flatten!
  25.   end
  26.   #--------------------------------------------------------------------------
  27.   # * Main Processing
  28.   #--------------------------------------------------------------------------
  29.   def main
  30.     main_temp
  31.     main_troop
  32.     main_command
  33.     main_windows
  34.     main_spriteset
  35.     main_transition
  36.     # Start pre-battle phase
  37.     start_phase1
  38.     # Execute transition
  39.     Graphics.transition
  40.     # Main loop
  41.     loop do
  42.       main_loop
  43.       break if main_scenechange?
  44.     end
  45.     # Refresh map
  46.     $game_map.refresh
  47.     # Prepare for transition
  48.     Graphics.freeze
  49.     main_dispose
  50.     main_end
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # * Game Temp Variable Setup
  54.   #--------------------------------------------------------------------------
  55.   def main_temp
  56.     # Initialize each kind of temporary battle data
  57.     $game_temp.in_battle = true
  58.     $game_temp.battle_turn = 0
  59.     $game_temp.battle_event_flags.clear
  60.     $game_temp.battle_abort = false
  61.     $game_temp.battle_main_phase = false
  62.     $game_temp.battleback_name = $game_map.battleback_name
  63.     $game_temp.forcing_battler = nil
  64.     # Initialize battle event interpreter
  65.     $game_system.battle_interpreter.setup(nil, 0)
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # * Troop Setup
  69.   #--------------------------------------------------------------------------
  70.   def main_troop
  71.     # Prepare troop
  72.     @troop_id = $game_temp.battle_troop_id
  73.     $game_troop.setup(@troop_id)
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # * Main Command Setup
  77.   #--------------------------------------------------------------------------
  78.   def main_command
  79.     @actor_command_window = Window_Command.new(160, @commands)
  80.     @actor_command_window.height = 160
  81.     @actor_command_window.y = 160
  82.     @actor_command_window.back_opacity = 160
  83.     @actor_command_window.active = false
  84.     @actor_command_window.visible = false
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # * Scene Window Setup
  88.   #--------------------------------------------------------------------------
  89.   def main_windows
  90.     # Make other windows
  91.     @party_command_window = Window_PartyCommand.new
  92.     @help_window = Window_Help.new
  93.     @help_window.back_opacity = 160
  94.     @help_window.visible = false
  95.     @status_window = Window_BattleStatus.new
  96.     @message_window = Window_Message.new
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # * Spriteset Setup
  100.   #--------------------------------------------------------------------------
  101.   def main_spriteset
  102.     # Make sprite set
  103.     @spriteset = Spriteset_Battle.new
  104.     # Initialize wait count
  105.     @wait_count = 0
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # * Main Transition
  109.   #--------------------------------------------------------------------------
  110.   def main_transition
  111.     # Execute transition
  112.     if $data_system.battle_transition == ""
  113.       Graphics.transition(20)
  114.     else
  115.       Graphics.transition(40, "Graphics/Transitions/" +
  116.         $data_system.battle_transition)
  117.     end
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # * Main Loop
  121.   #--------------------------------------------------------------------------
  122.   def main_loop
  123.     # Update game screen
  124.     Graphics.update
  125.     # Update input information
  126.     Input.update
  127.     # Frame update
  128.     update
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # * Scene Change
  132.   #--------------------------------------------------------------------------
  133.   def main_scenechange?
  134.     # Abort loop if screen is changed
  135.     if $scene != self
  136.       return true
  137.     end
  138.     return false
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # * Main Dispose
  142.   #--------------------------------------------------------------------------
  143.   def main_dispose
  144.     # Dispose of windows
  145.     @actor_command_window.dispose
  146.     @party_command_window.dispose
  147.     @help_window.dispose
  148.     @status_window.dispose
  149.     @message_window.dispose
  150.     @skill_window.dispose unless @skill_window == nil
  151.     @item_window.dispose unless @item_window == nil
  152.     @result_window.dispose unless @result_window == nil
  153.     # Dispose of sprite set
  154.     @spriteset.dispose
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # * Main End
  158.   #--------------------------------------------------------------------------
  159.   def main_end
  160.     # If switching to title screen
  161.     if $scene.is_a?(Scene_Title)
  162.       # Fade out screen
  163.       Graphics.transition
  164.       Graphics.freeze
  165.     end
  166.     # If switching from battle test to any screen other than game over screen
  167.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  168.       $scene = nil
  169.     end
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # * Frame Update
  173.   #--------------------------------------------------------------------------
  174.   def update
  175.     update_event
  176.     update_system
  177.     update_objects
  178.     update_transition
  179.     # If message window is showing
  180.     if $game_temp.message_window_showing
  181.       return
  182.     end
  183.     # If effect is showing
  184.     if @spriteset.effect?
  185.       return
  186.     end
  187.     update_scene_exit
  188.     update_abort
  189.     update_waiting
  190.     update_phase
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # * Event Update
  194.   #--------------------------------------------------------------------------
  195.   def update_event
  196.     # If battle event is running
  197.     if $game_system.battle_interpreter.running?
  198.       # Update interpreter
  199.       $game_system.battle_interpreter.update
  200.       # If a battler which is forcing actions doesn't exist
  201.       if $game_temp.forcing_battler == nil
  202.         # If battle event has finished running
  203.         unless $game_system.battle_interpreter.running?
  204.           # Rerun battle event set up if battle continues
  205.           unless judge
  206.             setup_battle_event
  207.           end
  208.         end
  209.         # If not after battle phase
  210.         if @phase != 5
  211.           # Refresh status window
  212.           @status_window.refresh
  213.         end
  214.       end
  215.     end
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # * System Update
  219.   #--------------------------------------------------------------------------
  220.   def update_system
  221.     # Update system (timer) and screen
  222.     $game_system.update
  223.     $game_screen.update
  224.     # If timer has reached 0
  225.     if $game_system.timer_working and $game_system.timer == 0
  226.       # Abort battle
  227.       $game_temp.battle_abort = true
  228.     end
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # * Windows and Sprites Update
  232.   #--------------------------------------------------------------------------
  233.   def update_objects
  234.     # Update windows
  235.     @help_window.update
  236.     @party_command_window.update
  237.     @actor_command_window.update
  238.     @status_window.update
  239.     @message_window.update
  240.     # Update sprite set
  241.     @spriteset.update
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # * Transition Update
  245.   #--------------------------------------------------------------------------
  246.   def update_transition
  247.     # If transition is processing
  248.     if $game_temp.transition_processing
  249.       # Clear transition processing flag
  250.       $game_temp.transition_processing = false
  251.       # Execute transition
  252.       if $game_temp.transition_name == ""
  253.         Graphics.transition(20)
  254.       else
  255.         Graphics.transition(40, "Graphics/Transitions/" +
  256.           $game_temp.transition_name)
  257.       end
  258.     end
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   # * Scene Exit Update
  262.   #--------------------------------------------------------------------------
  263.   def update_scene_exit
  264.     # If game over
  265.     if $game_temp.gameover
  266.       # Switch to game over screen
  267.       $scene = Scene_Gameover.new
  268.       return
  269.     end
  270.     # If returning to title screen
  271.     if $game_temp.to_title
  272.       # Switch to title screen
  273.       $scene = Scene_Title.new
  274.       return
  275.     end
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # * Abort Update
  279.   #--------------------------------------------------------------------------
  280.   def update_abort
  281.     # If battle is aborted
  282.     if $game_temp.battle_abort
  283.       # Return to BGM used before battle started
  284.       $game_system.bgm_play($game_temp.map_bgm)
  285.       # Battle ends
  286.       battle_end(1)
  287.       return
  288.     end
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # * Waiting Update
  292.   #--------------------------------------------------------------------------
  293.   def update_waiting
  294.     # If waiting
  295.     if @wait_count > 0
  296.       # Decrease wait count
  297.       @wait_count -= 1
  298.       return
  299.     end
  300.     # If battler forcing an action doesn't exist,
  301.     # and battle event is running
  302.     if $game_temp.forcing_battler == nil and
  303.        $game_system.battle_interpreter.running?
  304.       return
  305.     end
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # * Phase Update
  309.   #--------------------------------------------------------------------------
  310.   def update_phase
  311.     # Branch according to phase
  312.     case @phase
  313.     when 1  # pre-battle phase
  314.       update_phase1
  315.     when 2  # party command phase
  316.       update_phase2
  317.     when 3  # actor command phase
  318.       update_phase3
  319.     when 4  # main phase
  320.       update_phase4
  321.     when 5  # after battle phase
  322.       update_phase5
  323.     end
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # * Frame Update (actor command phase : basic command)
  327.   #--------------------------------------------------------------------------
  328.   def update_phase3_basic_command
  329.     # If B button was pressed
  330.     if Input.trigger?(Input::B)
  331.       # Play cancel SE
  332.       $game_system.se_play($data_system.cancel_se)
  333.       # Go to command input for previous actor
  334.       phase3_prior_actor
  335.       return
  336.     end
  337.     # If C button was pressed
  338.     if Input.trigger?(Input::C)
  339.       check_commands
  340.       return
  341.     end
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # * Check Commands
  345.   #--------------------------------------------------------------------------
  346.   def check_commands
  347.     # Loads Current Command
  348.     command = @commands[@actor_command_window.index]
  349.     # Branches Possible Commands
  350.     if command == $data_system.words.attack
  351.       update_phase3_command_attack
  352.     elsif command == $data_system.words.skill
  353.       update_phase3_command_skill
  354.     elsif command == $data_system.words.guard
  355.       update_phase3_command_guard
  356.     elsif command == $data_system.words.item
  357.       update_phase3_command_item
  358.     end
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # * Command : Attack
  362.   #--------------------------------------------------------------------------
  363.   def update_phase3_command_attack
  364.     # Play decision SE
  365.     $game_system.se_play($data_system.decision_se)
  366.     # Set action
  367.     @active_battler.current_action.kind = 0
  368.     @active_battler.current_action.basic = 0
  369.     # Start enemy selection
  370.     start_enemy_select
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # * Command : Skill
  374.   #--------------------------------------------------------------------------
  375.   def update_phase3_command_skill
  376.     # Play decision SE
  377.     $game_system.se_play($data_system.decision_se)
  378.     # Set action
  379.     @active_battler.current_action.kind = 1
  380.     # Start skill selection
  381.     start_skill_select
  382.   end
  383.   #--------------------------------------------------------------------------
  384.   # * Command : Guard
  385.   #--------------------------------------------------------------------------
  386.   def update_phase3_command_guard
  387.     # Play decision SE
  388.     $game_system.se_play($data_system.decision_se)
  389.     # Set action
  390.     @active_battler.current_action.kind = 0
  391.     @active_battler.current_action.basic = 1
  392.     # Go to command input for next actor
  393.     phase3_next_actor
  394.   end
  395.   #--------------------------------------------------------------------------
  396.   # * Command : Item
  397.   #--------------------------------------------------------------------------
  398.   def update_phase3_command_item
  399.     # Play decision SE
  400.     $game_system.se_play($data_system.decision_se)
  401.     # Set action
  402.     @active_battler.current_action.kind = 2
  403.     # Start item selection
  404.     start_item_select
  405.   end
  406.   #--------------------------------------------------------------------------
  407.   # * Make Basic Action Results
  408.   #--------------------------------------------------------------------------
  409.   def make_basic_action_result
  410.     # If attack
  411.     if @active_battler.current_action.basic == 0
  412.       make_basic_action_result_attack
  413.       return
  414.     end
  415.     # If guard
  416.     if @active_battler.current_action.basic == 1
  417.       make_basic_action_result_guard
  418.       return
  419.     end
  420.     # If escape
  421.     if @active_battler.is_a?(Game_Enemy) and
  422.        @active_battler.current_action.basic == 2
  423.       make_basic_action_result_escape
  424.       return
  425.     end
  426.     # If doing nothing
  427.     if @active_battler.current_action.basic == 3
  428.       make_basic_action_result_nothing
  429.       return
  430.     end
  431.   end
  432.   #--------------------------------------------------------------------------
  433.   # * Make Basic Action Results - Attack
  434.   #--------------------------------------------------------------------------
  435.   def make_basic_action_result_attack
  436.     # Set anaimation ID
  437.     @animation1_id = @active_battler.animation1_id
  438.     @animation2_id = @active_battler.animation2_id
  439.     # If action battler is enemy
  440.     if @active_battler.is_a?(Game_Enemy)
  441.       if @active_battler.restriction == 3
  442.         target = $game_troop.random_target_enemy
  443.       elsif @active_battler.restriction == 2
  444.         target = $game_party.random_target_actor
  445.       else
  446.         index = @active_battler.current_action.target_index
  447.         target = $game_party.smooth_target_actor(index)
  448.       end
  449.     end
  450.     # If action battler is actor
  451.     if @active_battler.is_a?(Game_Actor)
  452.       if @active_battler.restriction == 3
  453.         target = $game_party.random_target_actor
  454.       elsif @active_battler.restriction == 2
  455.         target = $game_troop.random_target_enemy
  456.       else
  457.         index = @active_battler.current_action.target_index
  458.         target = $game_troop.smooth_target_enemy(index)
  459.       end
  460.     end
  461.     # Set array of targeted battlers
  462.     @target_battlers = [target]
  463.     # Apply normal attack results
  464.     for target in @target_battlers
  465.       target.attack_effect(@active_battler)
  466.     end
  467.   end
  468.   #--------------------------------------------------------------------------
  469.   # * Make Basic Action Results - Guard
  470.   #--------------------------------------------------------------------------
  471.   def make_basic_action_result_guard
  472.     # Display "Guard" in help window
  473.     @help_window.set_text($data_system.words.guard, 1)
  474.   end
  475.   #--------------------------------------------------------------------------
  476.   # * Make Basic Action Results - Escape
  477.   #--------------------------------------------------------------------------
  478.   def make_basic_action_result_escape
  479.     # Display "Escape" in help window
  480.     @help_window.set_text("Escape", 1)
  481.     # Escape
  482.     @active_battler.escape
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   # * Make Basic Action Results - Nothing
  486.   #--------------------------------------------------------------------------
  487.   def make_basic_action_result_nothing
  488.     # Clear battler being forced into action
  489.     $game_temp.forcing_battler = nil
  490.     # Shift to step 1
  491.     @phase4_step = 1
  492.   end
  493. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

贵宾

梦石
0
星屑
50
在线时间
261 小时
注册时间
2005-10-21
帖子
489

贵宾

15
 楼主| 发表于 2005-12-21 22:18:23 | 显示全部楼层
不好意思,中间两位~~为了脚本的连贯性,删除了你们的帖子!{/ll}{/ll}

抱歉~~~

这个算是这几个月来~国外高手研究的成果吧!

针对原有代码的优化

大家还是慢慢看吧

最新资料哦
回复 支持 反对

使用道具 举报

Lv1.梦旅人

贵宾

梦石
0
星屑
50
在线时间
261 小时
注册时间
2005-10-21
帖子
489

贵宾

16
 楼主| 发表于 2005-12-21 22:28:47 | 显示全部楼层
sdk是程序开发包,api是windows的接口函数

API是指通过DLL输出函数为使用该DLL的程序提供的编程接口,不仅包括MS提供的,也包括其他厂商提供的,我们自己做的DLL提供给别人使用也叫API,不过在windows平台下一般提到API,均指MS专有的API,所以咬文嚼字的人会纠正你:win32 API。
操作系统专门提供的叫系统服务,那不叫API,不过有人说可以看作是API,大概可以吧,对于系统服务,一般程序用不到,可能只有驱动程序之类的会用到。

SDK字面意思是指软件开发包,其实就是一个二次开发平台,就是说他把下面的东西都封装了,不希望甚至根本就不让你看到底下的内容,只允许使用它提供的API做开发,和API的性质差不多,最初也不是但指MS的,任意厂商提供的开发环境都叫SDK,但后来在windows平台下一般提到SDK,均指MS专有的SDK环境

这个解释貌似很好

回复 支持 反对

使用道具 举报

Lv1.梦旅人

贵宾

梦石
0
星屑
50
在线时间
261 小时
注册时间
2005-10-21
帖子
489

贵宾

17
 楼主| 发表于 2005-12-22 19:39:39 | 显示全部楼层
召唤一个人翻译一下开头的介绍吧
回复 支持 反对

使用道具 举报

Lv1.梦旅人

贵宾

梦石
0
星屑
50
在线时间
261 小时
注册时间
2005-10-21
帖子
489

贵宾

18
 楼主| 发表于 2005-12-22 22:54:26 | 显示全部楼层
提高运行速度是肯定会的!

不过起码要先弄清楚大概内容!

这个可不是单纯的一粘帖就OK了的

等66看了,给个评估吧
回复 支持 反对

使用道具 举报

Lv1.梦旅人

贵宾

梦石
0
星屑
50
在线时间
261 小时
注册时间
2005-10-21
帖子
489

贵宾

19
 楼主| 发表于 2005-12-26 17:45:45 | 显示全部楼层
不行啊!!他们工作组的论坛要认证{/ll}{/ll}{/ll}

进不了的说!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-4 10:22

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表