Connexion automatique

Pas encore membre ? Inscrivez-vous ici !
Vous avez oublié votre mot de passe ? On vous aide ici

AccueilPage d'accueilFAQRechercherS'enregistrerConnexion

Sélecteur de thème :


Partagez | .
Another new menu

Dudu'
Staffieux retraité

Staffieux retraité
avatar

Nombre de messages : 2060
Age : 26
Capacités : bon
Distinction : Apprenti KGB-boy en avenir
[Coco' Smile]
Hamsterphile de service ^^
[Balby' le Fake]
Grand prof de la MA
[Skillo]
Ce grand programmateur, mon coeur, ma vie ! [Hamu']
Date d'inscription : 22/06/2009

MessageSujet: Another new menu   Lun 28 Juin 2010 - 22:48

Another new menu



Author: Adurna
Date: 02/06/2010
Version:1.2
Description: A menu different from the original with more options!

screen:


Code:


#==============================================================================
# ** Scene_Menu
#By Adurna                        02/06/2010
#        www.rpgmakervx-fr.com
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================
module Adurna

  Commandes=[
  "Items",
  "Skills",
  "Equip",
  "Status",
  "Save",
  "Load",
  "Exit"]
 
    Help_txt=[
    "Use items ?",
    "Use a skill ?",
    "Change the teams' equipment ?",
    "See the status of the hero ? ",
    "Save the progression ?",
    "Load a game ?",
    "Leave the game ?",
    ]
   
  Icon = {
  "or"=>147 ,
  "pas"=>48 ,
  "lieu"=>153
  }
end

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    @gold_window = Window_Gold.new(0, 364)
    @status_window = Window_MenuStatus.new(0, 56)
    @help_window=Window_Help.new
    @help_window.width=544-160
    @help_window.height=56
    @help_window.contents = Bitmap.new(@help_window.width - 32, @help_window.height - 32)
    @temp=Window_Temp.new(544-160,364-54)
    @loc=Window_lieu.new(544-250,364)
    @step=Window_Step.new(160,364)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @command_window.dispose
    @gold_window.dispose
    @temp.dispose
    @status_window.dispose
    @help_window.dispose
    @step.dispose
    @loc.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    update_help_window
    @temp.update
    @step.update
    @command_window.update
    @gold_window.update
  @loc.update
    @status_window.update
    if @command_window.active
      update_command_selection
    elsif @status_window.active
      update_actor_selection
    end
  end
 
  #---------------------------------------------------------
  #window_help
  #---------------------------------------------------------
 
def update_help_window
  if @command_window .active
    @help_window.set_text(Adurna::Help_txt[@command_window.index],1)
  end
end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_Command2.new(160, Adurna::Commandes ,1,11)
    @command_window .x=544-160
    @command_window.index = @menu_index
    if $game_party.members.size == 0          # If number of party members is 0
      @command_window.draw_item(0, false)    # Disable item
      @command_window.draw_item(1, false)    # Disable skill
      @command_window.draw_item(2, false)    # Disable equipment
      @command_window.draw_item(3, false)    # Disable status
    end
    if $game_system.save_disabled            # If save is forbidden
      @command_window.draw_item(4, false)    # Disable save
    end
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      if $game_party.members.size == 0 and @command_window.index < 4
        Sound.play_buzzer
        return
      elsif $game_system.save_disabled and @command_window.index == 4
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      case @command_window.index
      when 0      # Item
        $scene = Scene_Item.new
      when 1,2,3  # Skill, equipment, status
        start_actor_selection
      when 4      # Save
        $scene = Scene_File.new(true, false, false)
      when 5
        $scene = Scene_File.new(false, false, false, 5)
      when 6      # End Game
        $scene = Scene_End.new
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Start Actor Selection
  #--------------------------------------------------------------------------
  def start_actor_selection
    @command_window.active = false
    @status_window.active = true
    if $game_party.last_actor_index < @status_window.item_max
      @status_window.index = $game_party.last_actor_index
    else
      @status_window.index = 0
    end
  end
  #--------------------------------------------------------------------------
  # * End Actor Selection
  #--------------------------------------------------------------------------
  def end_actor_selection
    @command_window.active = true
    @status_window.active = false
    @status_window.index = -1
  end
  #--------------------------------------------------------------------------
  # * Update Actor Selection
  #--------------------------------------------------------------------------
  def update_actor_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_actor_selection
    elsif Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      case @command_window.index
      when 1  # skill
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        $scene = Scene_Status.new(@status_window.index)
      end
    end
  end
end







#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
  HAUTEUR = 96
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    x : window X coordinate
  #    y : window Y coordinate
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 384, 96*3+20)
    taille=$game_party.members.size
    self.contents = Bitmap.new(width - 32, 20+96*taille)
    refresh
    self.active = false
    self.index = -1
  end
 
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(width - 32, [height - 32, row_max * HAUTEUR].max)
  end

  #--------------------------------------------------------------------------
  # * Get Top Row
  #--------------------------------------------------------------------------
  def top_row
    return self.oy / HAUTEUR
  end

  #--------------------------------------------------------------------------
  # * Set Top Row
  #    row : row shown on top
  #--------------------------------------------------------------------------
  def top_row=(row)
    super(row)
    self.oy = self.oy / WLH * HAUTEUR
  end

  #--------------------------------------------------------------------------
  # * Get Number of Rows Displayable on 1 Page
  #--------------------------------------------------------------------------
  def page_row_max
    return (self.height - 32) / HAUTEUR
  end

  #--------------------------------------------------------------------------
  # * Get rectangle for displaying items
  #    index : item number
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = super(index)
    rect.height = HAUTEUR
    rect.y = index / @column_max * HAUTEUR
    return rect
  end

  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    for actor in $game_party.members
      draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
      x = 104
      y = actor.index * 96 + WLH / 2
      draw_actor_name(actor, x, y)
      draw_actor_exp(actor, x, y+48)
      draw_actor_level(actor, x, y +24)
      draw_actor_state(actor, x+120, y)
      draw_actor_hp(actor, x + 120, y + WLH * 1)
      draw_actor_mp(actor, x + 120, y + WLH * 2)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Update cursor
  #--------------------------------------------------------------------------
  def update_cursor
    if @index < 0
      self.cursor_rect.empty
    elsif @index < @item_max
      super
    elsif @index >= 100
      self.cursor_rect.set(0, (@index - 100) * HAUTEUR,contents.width, HAUTEUR)
    else
      self.cursor_rect.set(0, 0, contents.width, @item_max * HAUTEUR)
    end
  end
end


class Window_Gold < Window_Base

  def initialize(x, y)
    super(x, y, 160, 52)
    refresh
  end

  def refresh
    self.contents.clear
    draw_icon(Adurna::Icon["or"], 0,-2)
    draw_currency_value2($game_party.gold, 4, 0, 120)
  end
end





class Window_Temp < Window_Base
  def initialize(x, y)
    super(x, y, 160, 54)
    refresh
  end
  def refresh
    self.contents.clear
    @total_sec = Graphics.frame_count / Graphics.frame_rate
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    text = sprintf("%02d:%02d:%02d", hour, min, sec)
    self.contents.draw_text(0, -3, 110, 32, text, 2)
  end
  def update
    super
    if Graphics.frame_count / Graphics.frame_rate != @total_sec
      refresh
    end
  end
end





class Window_lieu< Window_Base
  def initialize(x, y)
    super(x, y, 250, WLH+28)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  def refresh
    self.contents.clear
    draw_icon(Adurna::Icon["lieu"], 0,-2)
    $maps = load_data("Data/MapInfos.rvdata")
    @map_id = $game_map.map_id
    @map_name = $maps[@map_id].name
    self.contents.draw_text(-30, -8, 360, 32, @map_name, 1)
  end
end

class Window_Step<Window_Base
    def initialize(x, y)
    super(x, y, 134, 52)
    refresh
  end
  def refresh
    self.contents.clear
      draw_icon(Adurna::Icon["pas"], 0,-4)
    self.contents.draw_text(5, -8, 100, 32, $game_party.steps, 1)
  end
  end



 class Game_Actor < Game_Battler
  def now_exp
    return @exp - @exp_list[@level]
  end
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
end

class Window_Base < Window
  def draw_currency_value2(value, x, y, width)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, width--2, WLH, value, 2)
  end
 
  def draw_actor_level_menu(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 32, WLH, Vocab::level_a)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 16, y, 24, WLH, actor.level, 2)
  end
  def draw_actor_class_menu(actor, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, 85, WLH, actor.class.name)
  end
  def exp_gauge_color1
    return text_color(30)
  end
  def exp_gauge_color2
    return text_color(31)
  end
  def draw_actor_exp(actor, x, y, width = 100)
    if actor.next_exp != 0
      exp = actor.now_exp
    else
      exp = 1
    end
    gw = width * exp / [actor.next_exp, 1].max
    gc1 = exp_gauge_color1
    gc2 = exp_gauge_color2
    self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 30, WLH, "Exp")
    self.contents.font.color = normal_color
    xr = x + width
    self.contents.draw_text(xr - 60, y, 60, WLH, actor.next_rest_exp_s, 2)
  end
end

class Window_Command2 < Window_Selectable
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader  :commands                # command
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    width      : window width
  #    commands  : command string array
  #    column_max : digit count (if 2 or more, horizontal selection)
  #    row_max    : row count (0: match command count)
  #    spacing    : blank space when items are arrange horizontally
  #--------------------------------------------------------------------------
  def initialize(width, commands, column_max = 1, row_max = 0, spacing = 25)
    if row_max == 0
      row_max = (commands.size + column_max - 1) / column_max
    end
    super(0, 0, width, row_max * WLH + 22+24, spacing)
    @commands = commands
    @item_max = commands.size
    @column_max = column_max
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #    index  : item number
  #    enabled : enabled flag. When false, draw semi-transparently.
  #--------------------------------------------------------------------------
  def draw_item(index, enabled = true)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 8
    self.contents.clear_rect(rect)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(rect, @commands[index])
  end
end

class Scene_File
  #--------------------------------------------------------------------------
  #  Initialize
  #--------------------------------------------------------------------------
 def initialize(saving, from_title, from_event,index=4)
    @saving = saving
    @from_title = from_title
    @from_event = from_event
    @index_menu = index
  end
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    if @from_title
      $scene = Scene_Title.new
    elsif @from_event
      $scene = Scene_Map.new
    else
      $scene = Scene_Menu.new(@index_menu)
    end
  end
end