IceDragon200

Window_MapName-edit

Jul 23rd, 2011
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 12.21 KB | None | 0 0
  1. class Game_Actor < Game_Battler
  2.   def now_exp
  3.     return @exp - @exp_list[@level]
  4.   end
  5.   def next_exp
  6.     return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  7.   end
  8. end
  9. ###############
  10. # Window_Base #
  11. ###############
  12. class Window_Base < Window  
  13.   def draw_actor_level_menu(actor, x, y)
  14.     self.contents.font.color = system_color
  15.     self.contents.draw_text(x, y, 32, WLH, Vocab::level_a)
  16.     self.contents.font.color = normal_color
  17.     self.contents.draw_text(x + 16, y, 30, WLH, actor.level, 2)
  18.   end  
  19.   def draw_actor_class_menu(actor, x, y)
  20.     self.contents.font.color = normal_color
  21.     self.contents.draw_text(x, y, 85, WLH, actor.class.name)
  22.   end    
  23.   def exp_gauge_color1
  24.     return text_color(30)
  25.   end
  26.   def exp_gauge_color2
  27.     return text_color(31)
  28.   end  
  29.   def draw_actor_exp_meter(actor, x, y, width = 100)  
  30.     if actor.next_exp != 0
  31.       exp = actor.now_exp
  32.     else
  33.       exp = 1
  34.     end
  35.     gw = width * exp / [actor.next_exp, 1].max
  36.     gc1 = exp_gauge_color1
  37.     gc2 = exp_gauge_color2
  38.     self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
  39.     self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  40.     self.contents.font.color = system_color
  41.     self.contents.draw_text(x, y, 30, WLH, "Exp")    
  42.     self.contents.font.color = normal_color
  43.     xr = x + width
  44.     self.contents.draw_text(xr - 60, y, 60, WLH,  actor.next_rest_exp_s, 2)    
  45.   end
  46. end
  47. #####################
  48. # Window_MenuStatus #
  49. #####################
  50. class Window_MenuStatus < Window_Selectable
  51.   def initialize(x, y)
  52.     super(x, y, 384, 416)
  53.     refresh
  54.     self.active = false
  55.     self.index = -1
  56.   end
  57.   def refresh
  58.     self.contents.clear
  59.     @item_max = $game_party.members.size
  60.     for actor in $game_party.members
  61.       draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
  62.       x = 104
  63.       y = actor.index * 96 + WLH / 2
  64.       draw_actor_name(actor, x, y)
  65.       draw_actor_class_menu(actor, x + 120, y)
  66.       draw_actor_level_menu(actor, x + 200, y)
  67.       draw_actor_state(actor, x, y + WLH * 2)
  68.       draw_actor_hp(actor, x + 120, y + WLH * 1)
  69.       draw_actor_mp(actor, x + 120, y + WLH * 2)
  70.       draw_actor_exp_meter(actor, x , y + WLH * 1)
  71.     end
  72.   end
  73.   def update_cursor
  74.     if @index < 0              
  75.       self.cursor_rect.empty
  76.     elsif @index < @item_max  
  77.       self.cursor_rect.set(0, @index * 96, contents.width, 96)
  78.     elsif @index >= 100        
  79.       self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
  80.     else                    
  81.       self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
  82.     end
  83.   end
  84. end
  85. ############
  86. # Game_Map #
  87. ############
  88. class Game_Map
  89.   attr_reader   :map_id  
  90.   def mpname
  91.     $mpname = load_data("Data/MapInfos.rvdata")
  92.     $mpname[@map_id].name
  93.   end
  94. end
  95. ###################
  96. # Window_Location #
  97. ###################
  98. class Window_Mapname < Window_Base
  99.  
  100.   def initialize(x, y)
  101.     if !$game_switches[122]
  102.       super(x, y, 160, WLH + 118) #Window? 160 61 TOP SMALLER #47
  103.     else
  104.       super(x, y, 160, WLH + 75)
  105.     end
  106.     refresh()
  107.   end
  108.  
  109.   def refresh()
  110.     self.contents.clear
  111.     if $game_switches[122]
  112.       self.contents.font.size = 18
  113.       self.contents.font.bold = true
  114.     end    
  115.     self.contents.font.color = system_color #Left,
  116.     if !$game_switches[122] #Is summons disabled?
  117.       self.contents.draw_text(4, -9, 120, 32, "Location:") #TEXT
  118.     else
  119.       self.contents.draw_text(4, -13, 120, 32, "Location:")
  120.     end
  121.     self.contents.font.color = normal_color #TEXT
  122.     if !$game_switches[122] #Is summons disabled?
  123.       self.contents.draw_text(4, 13, 120, 32, $game_map.mpname.to_s, 2) #TEXT
  124.     else
  125.       self.contents.font.size = 15
  126.       self.contents.font.bold = false
  127.       self.contents.draw_text(4, 4, 120, 32, $game_map.mpname.to_s, 2)
  128.     end
  129.     draw_playtime( 4, 32 )
  130.   end
  131.  
  132.   def draw_playtime(x, y)  
  133.     self.contents.font.size = Font.default_size
  134.     self.contents.clear_rect( x, y, self.contents.width, 64 )
  135.     self.contents.font.color = system_color
  136.     self.contents.draw_text(x, y, 120, 32, "Play Time:") # // 4, -11, 120, 32
  137.     total_sec = Graphics.frame_count / Graphics.frame_rate
  138.     hour = total_sec / 60 / 60
  139.     min  = total_sec / 60 % 60
  140.     sec  = total_sec % 60
  141.     text = sprintf("%02d:%02d:%02d", hour, min, sec)
  142.     self.contents.font.color = normal_color
  143.     self.contents.font.size = 17
  144.     self.contents.font.bold = false
  145.     self.contents.draw_text(x+4, y+18, 120, 32, text, 2)
  146.   end  
  147.  
  148.   def update
  149.     super
  150.     draw_playtime( 4, 32 )
  151.   end
  152.  
  153. end
  154. ###############
  155. # Window_Time #
  156. ###############
  157. =begin
  158. class Window_Time < Window_Base
  159.   def initialize(x, y)
  160.     if !$game_switches[122] #Is summons disabled?
  161.       super(x, y, 160, WLH + 47)
  162.     else
  163.       super(x, y, 160, WLH + 35)
  164.     end
  165.     refresh
  166.   end
  167.   def refresh
  168.     self.contents.clear
  169.     if $game_switches[122]
  170.       self.contents.font.size = 18
  171.       self.contents.font.bold = true
  172.     end
  173.     self.contents.font.color = system_color
  174.     if !$game_switches[122] #Is summons disabled?
  175.       self.contents.draw_text(4, -9, 120, 32, "Play Time:")#4,0,120,32
  176.     else
  177.       self.contents.draw_text(4, -11, 120, 32, "Play Time:")
  178.     end
  179.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  180.     hour = @total_sec / 60 / 60
  181.     min = @total_sec / 60 % 60
  182.     sec = @total_sec % 60
  183.     text = sprintf("%02d:%02d:%02d", hour, min, sec)
  184.     self.contents.font.color = normal_color
  185.     if !$game_switches[122] #Is summons disabled?
  186.       self.contents.draw_text(4, 13, 120, 32, text, 2)#4,32,120,32
  187.     else
  188.       self.contents.font.size = 17
  189.       self.contents.font.bold = false
  190.       self.contents.draw_text(4, 6, 120, 32, text, 2)
  191.     end
  192.   end
  193.   def update
  194.     super
  195.     if Graphics.frame_count / Graphics.frame_rate != @total_sec
  196.       refresh
  197.     end
  198.   end
  199. end
  200. =end
  201. ##############
  202. # Scene_Menu #
  203. ##############
  204. class Scene_Menu #< Scene_Base
  205.  
  206.   def main
  207.     start                        
  208.     perform_transition            
  209.     Input.update                
  210.     loop do
  211.       Graphics.update            
  212.       Input.update              
  213.       update                      
  214.       break if $scene != self      
  215.     end
  216.     Graphics.update
  217.     pre_terminate            
  218.     Graphics.freeze              
  219.     terminate                  
  220.   end  
  221.  
  222.   def initialize(menu_index = 0)
  223.     @menu_index = menu_index
  224.   end  
  225.  
  226.   def create_menu_background
  227.     @menuback_sprite = Sprite.new
  228.     @menuback_sprite.bitmap = $game_temp.background_bitmap
  229.     @menuback_sprite.color.set(16, 16, 16, 128)
  230.     update_menu_background
  231.   end
  232.  
  233.   def dispose_menu_background
  234.     @menuback_sprite.dispose
  235.   end
  236.  
  237.   def update_menu_background
  238.   end  
  239.  
  240.   def perform_transition
  241.     Graphics.transition(10)
  242.   end
  243.  
  244.   def start
  245.     create_menu_background
  246.     create_command_window
  247.     @gold_window = Window_Gold.new(0, 366)
  248.     @status_window = Window_MenuStatus.new(160, 0)
  249.     if !$game_switches[122] #Is summons disabled?
  250.       # @playtime_window = Window_Time.new(0, 295)
  251.       @mapname_window = Window_Mapname.new(0, 224)
  252.     else
  253.       # @playtime_window = Window_Time.new (0, 307)
  254.       @mapname_window = Window_Mapname.new(0, 248)
  255.     end
  256.     #@mapname_window = Window_Mapname.new(0, 224)
  257.     @status_window.openness = 0
  258.     #@playtime_window.openness = 0
  259.     @mapname_window.openness = 0
  260.     @gold_window.openness = 0
  261.     @status_window.open
  262.     #    @playtime_window.open
  263.     @mapname_window.open
  264.     @gold_window.open
  265.   end
  266.  
  267.   def pre_terminate
  268.     @status_window.close
  269.     #@playtime_window.close
  270.     @mapname_window.close
  271.     @gold_window.close
  272.     @command_window.close
  273.     begin
  274.       @status_window.update
  275.       #@playtime_window.update
  276.       @mapname_window.update
  277.       @gold_window.update
  278.       @command_window.update
  279.       Graphics.update
  280.     end until @status_window.openness == 0
  281.   end
  282.  
  283.   def terminate
  284.     dispose_menu_background
  285.     @command_window.dispose
  286.     @gold_window.dispose
  287.     @status_window.dispose
  288.     #@playtime_window.dispose
  289.     @mapname_window.dispose
  290.   end
  291.  
  292.   def update
  293.     update_menu_background
  294.     @command_window.update
  295.     @gold_window.update
  296.     @status_window.update
  297.     @mapname_window.update
  298.     #@playtime_window.update
  299.     if @command_window.active
  300.       update_command_selection
  301.     elsif @status_window.active
  302.       update_actor_selection
  303.     end
  304.   end
  305.  
  306.   def create_command_window
  307.     y = 6
  308.     s1 = Vocab::item
  309.     s2 = Vocab::skill
  310.     s3 = Vocab::equip
  311.     s4 = Vocab::status
  312.     s5 = Current_Objective::option
  313.     s6 = "Options"
  314.     s7 = Vocab::save
  315.     s8 = Vocab::game_end
  316.     if $game_switches[122]
  317.       y += 1
  318.       s9 = "Guardians"
  319.       @command_window = Window_Command.new(160, [s1, s2, s3, s9, s4, s5, s6, s7, s8])
  320.       #@command_window.height -= 26
  321.     else
  322.       @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8])
  323.     end
  324.     @command_window.index = @menu_index
  325.     @command_window.openness = 0
  326.     @command_window.open
  327.     if $game_party.members.size == 0          
  328.       @command_window.draw_item(0, false)    
  329.       @command_window.draw_item(1, false)    
  330.       @command_window.draw_item(2, false)      
  331.       @command_window.draw_item(3, false)    
  332.     end
  333.     if $game_system.save_disabled              
  334.       @command_window.draw_item(y, false)    
  335.     end
  336.   end
  337.  
  338.   def update_command_selection
  339.     if Input.trigger?(Input::B)
  340.       Sound.play_cancel
  341.       $scene = Scene_Map.new
  342.     elsif Input.trigger?(Input::C)
  343.       if $game_party.members.size == 0 and @command_window.index < 4
  344.         Sound.play_buzzer
  345.         return
  346.       elsif $game_system.save_disabled and @command_window.index == 6
  347.         Sound.play_buzzer
  348.         return
  349.       end
  350.       Sound.play_decision
  351.       if !$game_switches[122]
  352.         case @command_window.index
  353.           when 0      
  354.           $scene = Scene_Item.new
  355.           when 1,2,3  
  356.           start_actor_selection
  357.           when 4
  358.           $scene = Objective_Screen.new
  359.           when 5    
  360.           $scene = Scene_Options.new
  361.           when 6      
  362.           $scene = Scene_File.new(true, false, false)
  363.           when 7    
  364.           $scene = Scene_End.new        
  365.         end
  366.       else
  367.         case @command_window.index
  368.           when 0      
  369.           $scene = Scene_Item.new
  370.           when 1,2,3,4
  371.           start_actor_selection
  372.           when 5
  373.           $scene = Objective_Screen.new
  374.           when 6    
  375.           $scene = Scene_Options.new
  376.           when 7      
  377.           $scene = Scene_File.new(true, false, false)
  378.           when 8    
  379.           $scene = Scene_End.new        
  380.         end
  381.       end
  382.     end
  383.   end
  384.  
  385.   def start_actor_selection
  386.     @command_window.active = false
  387.     @status_window.active = true
  388.     if $game_party.last_actor_index < @status_window.item_max
  389.       @status_window.index = $game_party.last_actor_index
  390.     else
  391.       @status_window.index = 0
  392.     end
  393.   end
  394.  
  395.   def end_actor_selection
  396.     @command_window.active = true
  397.     @status_window.active = false
  398.     @status_window.index = -1
  399.   end
  400.  
  401.   def update_actor_selection
  402.     if Input.trigger?(Input::B)
  403.       Sound.play_cancel
  404.       end_actor_selection
  405.     elsif Input.trigger?(Input::C)
  406.       $game_party.last_actor_index = @status_window.index
  407.       Sound.play_decision
  408.       if $game_switches[122]
  409.         case @command_window.index
  410.           when 1
  411.           $scene = Scene_Skill.new(@status_window.index)
  412.           when 2  
  413.           $scene = Scene_Equip.new(@status_window.index)
  414.           when 4
  415.           $scene = Scene_Status.new(@status_window.index)
  416.           when 3
  417.           $scene = Scene_Summon.new($game_party.members[@status_window.index])
  418.         end
  419.       else
  420.         case @command_window.index
  421.           when 1
  422.           $scene = Scene_Skill.new(@status_window.index)
  423.           when 2  
  424.           $scene = Scene_Equip.new(@status_window.index)
  425.           when 3
  426.           $scene = Scene_Status.new(@status_window.index)
  427.         end
  428.       end
  429.     end
  430.   end
  431.  
  432. end
  433. $mogscript = {} if $mogscript == nil
  434. $mogscript["basic_menu_plus"] = true
Advertisement
Add Comment
Please, Sign In to add comment