Age : 28 Inscrit le : 30/12/2009 Messages : 1067
| Sujet: Menu de Côté + Refonte des script de Base Mer 28 Avr 2010 - 7:13 | |
| Je vous propose ce script de....Moi ! Merci de me mettre dans vos crédits si vous utilisez ce script. Explication :C'est en fait comme le menu de Yanfly, sur les côtés : - Spoiler:
Sauf qu'il est modifiable in game ! Il vous suffit de modifier la Variable que vous aurez choisit et hop ! Il passe de l'autre côté ! - Spoiler:
Et hop ! Le menu change de côté : Alors :Quand la variable que vous avez choisi, est égale à 0, le menu s'affiche à gauche. Mais lorsqu'elle est égale à 1 ou plus, elle est à droite. J'ai aussi rajouté un petit plus : - Spoiler:
Inventaire : Equipement : Compétences : Statuts : Sauvegarder :
Voici les touches utilisées :- F5 pour changer de héros dans la fenêtre d'Equipements et de Compétences. - Droite/Gauche pour la fenêtre de Statut - Echap pour retour au menu et a la map script :- Spoiler:
- Code:
-
module Biw #=========================== # Début de la Configuration #=========================== Var = 2 #ID de la variable qui stockera le côté choisi
# Ce qui suit concerne le choix : # Si vous rajoutez un choix, n'oubliez pas de mettre la virgule !! # N'oubliez pas non plus de mettre la Scene et l'icone Choix = { 0 =>"Inventaire", 1=>"Equipement", 2=>"Compétence", 3=>"Statut", 4=>"Quitter", 5=>"Sauvegarde", 6=>"Map" }
# Scene : # A modifier en fonction des choix plus haut ! Scene = { 0=> Scene_Item.new, #Inventaire 1=> Scene_Equip.new, #Equipements 2=> Scene_Skill.new, #Compétences 3=> Scene_Status.new, #Statut 4=> nil, # Quitter 5=> Scene_File.new(true, false, false), # Sauvegarder 6=> Scene_Map.new }
# Icone : # A modifier en fonction des choix plus haut ! Icone = { 0=> 144, 1=> 52, 2=> 130, 3=> 145, 4=> 112, 5=> 141, 6=> 150 }
Opacity = 255 # Transparence de la fenêtre du choix (0 pour invisible)
#Icone de l'argent, de la localisation et des pas : ICONE_GOLD = 147 ICONE_MAP = 153 ICONE_PAS = 137
#Texte de l'argent, de la localisation et des pas : TEXT_MAP = "Local : " TEXT_GOLD = "Argent : " TEXT_PAS = "Pas : "
# Interrupteur qui active/desactive l'affichage de : # - L'argent : Gold = 1 # - Localisation : Map = 2 # - Nombre des pas : Pas = 3
#=========================== # Fin de la Configuration #=========================== end
class Scene_Menu < Scene_Base
def start create_menu_background
@choix = [] @commands = []
@for = Biw::Choix.size - 1
for id in 0..@for @commands.push(Biw::Choix[id]) end
@choix = Window_Command.new(150, @commands)
if $game_variables[Biw::Var] == 0 @choix.x = 50 @choix.y = 0 else @choix.x = 394 @choix.y = 0 end
@choix.z = 255 @choix.opacity = 0
@win = Windoo.new @win.z = 200 @win.opacity = Biw::Opacity
@wind = Windo.new @wind.z = 0 @wind.opacity = 255 end
def terminate dispose_menu_background @choix.dispose @win.dispose end
def update update_menu_background @wind.update @choix.update if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new end @win.set_action(@choix.index) end end
class Windoo < Window_Base
def initialize if $game_variables[Biw::Var] == 0 @x = 0 @h = (Biw::Choix.size * 30) - (Biw::Choix.size * 10 / 5) else @x = 344 @h = Biw::Choix.size * 30 end
super(@x, 0, 200, @h) refresh end def set_action(num) @action = num refresh end def refresh @IY = -20 @for = Biw::Choix.size - 1 for ico in 0..@for.to_i @IX = 0 @IY = @IY.to_i + 23 @icone = Biw::Icone[ico] bitmap = Cache.system("Iconset") rect = Rect.new(@icone % 16 * 24, @icone / 16 * 24, 24, 24) self.contents.blt(0, @IY, bitmap, rect)
end
if Input.trigger?(Input::C) case @action when 0 $scene = Biw::Scene[@action] when 1 $scene = Biw::Scene[@action] when 2 $scene = Biw::Scene[@action] when 3 $scene = Biw::Scene[@action] when 4 $scene = Biw::Scene[@action] when 5 $scene = Biw::Scene[@action] when 6 $scene = Biw::Scene[@action] when 7 $scene = Biw::Scene[@action] end end end end
#============================================================================== # ** Windo #==============================================================================
class Windo < Window_Base def initialize if $game_variables[Biw::Var] == 0 @x = 295 @y = 315 else @x = 0 @y = 315 end super (@x, @y, 250, 100) @gold = $game_party.gold @pas = $game_party.steps @map = $game_map.map_id refresh end def refresh $data_mapinfo = load_data("Data/MapInfos.rvdata") @mpname = $data_mapinfo[@map].name @textgold = Biw::TEXT_GOLD.to_s + @gold.to_s @textmap= Biw::TEXT_MAP.to_s + @mpname.to_s @textpas = Biw::TEXT_PAS.to_s + @pas.to_s if $game_switches[Biw::Gold] == true self.contents.draw_text(25, -40, 100, 100, @textgold, 0) @icone = Biw::ICONE_GOLD bitmap = Cache.system("Iconset") rect = Rect.new(@icone % 16 * 24, @icone / 16 * 24, 24, 24) self.contents.blt(0, 0, bitmap, rect) end if $game_switches[Biw::Map] == true @icone = Biw::ICONE_MAP bitmap = Cache.system("Iconset") rect = Rect.new(@icone % 16 * 24, @icone / 16 * 24, 24, 24) self.contents.blt(0, 25, bitmap, rect)
self.contents.draw_text(25, -40, 200, 150, @textmap, 0) end if $game_switches[Biw::Pas] == true @icone = Biw::ICONE_PAS bitmap = Cache.system("Iconset") rect = Rect.new(@icone % 16 * 24, @icone / 16 * 24, 24, 24) self.contents.blt(0, 45, bitmap, rect)
self.contents.draw_text(25, 10, 100, 100, @textpas, 0) end end end #============================================================================== # ** Scene_Item #==============================================================================
class Scene_Item < Scene_Base
def start super create_menu_background @viewport = Viewport.new(0, 0, 544, 416) @help_window = Window_Help.new @help_window.viewport = @viewport @X = (344/2) - (150/2) @Y = (216/2) - (Biw::Choix.size * 5)/2 @item_window = Window_Item.new(@X, @Y, 344, 216) @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.active = false @target_window = Window_MenuStatus.new(0, 0) hide_target_window end
def terminate super dispose_menu_background @viewport.dispose @help_window.dispose @item_window.dispose @target_window.dispose end
def return_scene $scene = Scene_Menu.new(0) end
def update super update_menu_background @help_window.update @item_window.update @target_window.update if @item_window.active update_item_selection elsif @target_window.active update_target_selection end end
def update_item_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) @item = @item_window.item if @item != nil $game_party.last_item_id = @item.id end if $game_party.item_can_use?(@item) Sound.play_decision determine_item else Sound.play_buzzer end end end
def determine_item if @item.for_friend? show_target_window(@item_window.index % 2 == 0) if @item.for_all? @target_window.index = 99 else if $game_party.last_target_index < @target_window.item_max @target_window.index = $game_party.last_target_index else @target_window.index = 0 end end else use_item_nontarget end end
def update_target_selection if Input.trigger?(Input::B) Sound.play_cancel if $game_party.item_number(@item) == 0 # If item is used up @item_window.refresh # Recreate the window contents end hide_target_window elsif Input.trigger?(Input::C) if not $game_party.item_can_use?(@item) Sound.play_buzzer else determine_target end end end
def determine_target used = false if @item.for_all? for target in $game_party.members target.item_effect(target, @item) used = true unless target.skipped end else $game_party.last_target_index = @target_window.index target = $game_party.members[@target_window.index] target.item_effect(target, @item) used = true unless target.skipped end if used use_item_nontarget else Sound.play_buzzer end end
def show_target_window(right) @item_window.active = false width_remain = 544 - @target_window.width @target_window.x = right ? width_remain : 0 @target_window.visible = true @target_window.active = true if right @viewport.rect.set(0, 0, width_remain, 416) @viewport.ox = 0 else @viewport.rect.set(@target_window.width, 0, width_remain, 416) @viewport.ox = @target_window.width end end
def hide_target_window @item_window.active = true @target_window.visible = false @target_window.active = false @viewport.rect.set(0, 0, 544, 416) @viewport.ox = 0 end
def use_item_nontarget Sound.play_use_item $game_party.consume_item(@item) @item_window.draw_item(@item_window.index) @target_window.refresh if $game_party.all_dead? $scene = Scene_Gameover.new elsif @item.common_event_id > 0 $game_temp.common_event_id = @item.common_event_id $scene = Scene_Map.new end end end
#============================================================================== # ** Window_Help #==============================================================================
class Window_Help < Window_Base def initialize super(0, 0, 544, WLH + 32) end def set_text(text, align = 0) if text != @text or align != @align self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(10, 0, self.width - 40, WLH, text, align) @text = text @align = align end end end
#============================================================================== # ** Scene_Equip
#==============================================================================
class Scene_Equip < Scene_Base
EQUIP_TYPE_MAX = 5 # Number of equip region
def initialize(actor_index = 0, equip_index = 0) @actor_index = actor_index @equip_index = equip_index end
def start super create_menu_background @actor = $game_party.members[@actor_index] @help_window = Window_Help.new create_item_windows @equip_window = Window_Equip.new(220, 56, @actor) @equip_window.help_window = @help_window @equip_window.index = @equip_index @status_window = Window_EquipStatus.new(0, 56, @actor) end
def terminate super dispose_menu_background @help_window.dispose @equip_window.dispose @status_window.dispose dispose_item_windows end
def return_scene $scene = Scene_Menu.new(2) end
def next_actor @actor_index += 1 @actor_index %= $game_party.members.size $scene = Scene_Equip.new(@actor_index, @equip_window.index) end
def prev_actor @actor_index += $game_party.members.size - 1 @actor_index %= $game_party.members.size $scene = Scene_Equip.new(@actor_index, @equip_window.index) end
def update super update_menu_background @help_window.update update_equip_window update_status_window update_item_windows if Input.trigger?(Input::F5) next_actor end if @equip_window.active update_equip_selection elsif @item_window.active update_item_selection end end
def create_item_windows @item_windows = [] for i in 0...EQUIP_TYPE_MAX @X = (544/2) - (444/2) @Y = (216/2) - (Biw::Choix.size * 5)/2 @item_windows[i] = Window_EquipItem.new(@X, @Y, 444, 100, @actor, i) @var = 1 @item_windows[i].help_window = @help_window @item_windows[i].visible = (@equip_index == i) @item_windows[i].y = 208 @item_windows[i].height = 208 @item_windows[i].active = false @item_windows[i].index = -1 end end
def dispose_item_windows for window in @item_windows window.dispose end end
def update_item_windows for i in 0...EQUIP_TYPE_MAX @item_windows[i].visible = (@equip_window.index == i) @item_windows[i].update end @item_window = @item_windows[@equip_window.index] end
def update_equip_window @equip_window.update end
def update_status_window if @equip_window.active @status_window.set_new_parameters(nil, nil, nil, nil) elsif @item_window.active temp_actor = @actor.clone temp_actor.change_equip(@equip_window.index, @item_window.item, true) new_atk = temp_actor.atk new_def = temp_actor.def new_spi = temp_actor.spi new_agi = temp_actor.agi @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi) end @status_window.update end
def update_equip_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::R) Sound.play_cursor next_actor elsif Input.trigger?(Input::L) Sound.play_cursor prev_actor elsif Input.trigger?(Input::C) if @actor.fix_equipment Sound.play_buzzer else Sound.play_decision @equip_window.active = false @item_window.active = true @item_window.index = 0 end end end
def update_item_selection if Input.trigger?(Input::B) Sound.play_cancel @equip_window.active = true @item_window.active = false @item_window.index = -1 elsif Input.trigger?(Input::C) Sound.play_equip @actor.change_equip(@equip_window.index, @item_window.item) @equip_window.active = true @item_window.active = false @item_window.index = -1 @equip_window.refresh for item_window in @item_windows item_window.refresh end end end end
#============================================================================== # ** Window_Command #==============================================================================
class Window_Command < Window_Selectable
attr_reader :commands # command
def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32) if row_max == 0 row_max = (commands.size + column_max - 1) / column_max end super(0, 0, width, row_max * WLH + 32, spacing) @commands = commands @item_max = commands.size @column_max = column_max refresh self.index = 0 end
def refresh self.contents.clear create_contents for i in 0...@item_max draw_item(i) end end
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
#============================================================================== # ** Window_Equip #------------------------------------------------------------------------------
class Window_Equip < Window_Selectable
def initialize(x, y, actor) super(x, y, 300, 150) @actor = actor refresh self.index = 0 end
def item return @data[self.index] end
def refresh self.contents.clear @data = [] for item in @actor.equips do @data.push(item) end @item_max = @data.size self.contents.font.color = system_color if @actor.two_swords_style self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1) self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2) else self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon) self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::armor1) end self.contents.draw_text(4, WLH * 2, 92, WLH, Vocab::armor2) self.contents.draw_text(4, WLH * 3, 92, WLH, Vocab::armor3) self.contents.draw_text(4, WLH * 4, 92, WLH, Vocab::armor4) draw_item_name(@data[0], 92, WLH * 0) draw_item_name(@data[1], 92, WLH * 1) draw_item_name(@data[2], 92, WLH * 2) draw_item_name(@data[3], 92, WLH * 3) draw_item_name(@data[4], 92, WLH * 4) end
def update_help @help_window.set_text(item == nil ? "" : item.description) end end
#============================================================================== # ** Window_EquipStatus #==============================================================================
class Window_EquipStatus < Window_Base
def initialize(x, y, actor) super(15, y, 205, 150) @actor = actor refresh end
def refresh self.contents.clear draw_actor_name(@actor, 4, 0) draw_parameter(0, WLH * 1, 0) draw_parameter(0, WLH * 2, 1) draw_parameter(0, WLH * 3, 2) draw_parameter(0, WLH * 4, 3) end
def set_new_parameters(new_atk, new_def, new_spi, new_agi) if @new_atk != new_atk or @new_def != new_def or @new_spi != new_spi or @new_agi != new_agi @new_atk = new_atk @new_def = new_def @new_spi = new_spi @new_agi = new_agi refresh end end
def new_parameter_color(old_value, new_value) if new_value > old_value # Get stronger return power_up_color elsif new_value == old_value # No change return normal_color else # Get weaker return power_down_color end end
def draw_parameter(x, y, type) case type when 0 name = Vocab::atk value = @actor.atk new_value = @new_atk when 1 name = Vocab::def value = @actor.def new_value = @new_def when 2 name = Vocab::spi value = @actor.spi new_value = @new_spi when 3 name = Vocab::agi value = @actor.agi new_value = @new_agi end self.contents.font.color = system_color self.contents.draw_text(x + 4, y, 80, WLH, name) self.contents.font.color = normal_color self.contents.draw_text(x + 90, y, 30, WLH, value, 2) self.contents.font.color = system_color self.contents.draw_text(x + 122, y, 20, WLH, ">", 1) if new_value != nil self.contents.font.color = new_parameter_color(value, new_value) self.contents.draw_text(x + 142, y, 30, WLH, new_value, 2) end end end
#============================================================================== # ** Scene_Skill #==============================================================================
class Scene_Skill < Scene_Base
def initialize(actor_index = 0, equip_index = 0) @actor_index = actor_index end
def start super create_menu_background @actor = $game_party.members[@actor_index] @viewport = Viewport.new(0, 0, 544, 416) @help_window = Window_Help.new @help_window.viewport = @viewport @status_window = Window_SkillStatus.new(0, 56, @actor) @status_window.viewport = @viewport @skill_window = Window_Skill.new(0, 250, 544, 100, @actor) @skill_window.viewport = @viewport @skill_window.help_window = @help_window @target_window = Window_MenuStatus.new(0, 0) hide_target_window end
def terminate super dispose_menu_background @help_window.dispose @status_window.dispose @skill_window.dispose @target_window.dispose end
def return_scene $scene = Scene_Menu.new(1) end
def next_actor @actor_index += 1 @actor_index %= $game_party.members.size $scene = Scene_Skill.new(@actor_index) end
def prev_actor @actor_index += $game_party.members.size - 1 @actor_index %= $game_party.members.size $scene = Scene_Skill.new(@actor_index) end
def update super update_menu_background @help_window.update @status_window.update @skill_window.update @target_window.update if Input.trigger?(Input::F5) next_actor end if @skill_window.active update_skill_selection elsif @target_window.active update_target_selection end end
def update_skill_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::R) Sound.play_cursor next_actor elsif Input.trigger?(Input::L) Sound.play_cursor prev_actor elsif Input.trigger?(Input::C) @skill = @skill_window.skill if @skill != nil @actor.last_skill_id = @skill.id end if @actor.skill_can_use?(@skill) Sound.play_decision determine_skill else Sound.play_buzzer end end end
def determine_skill if @skill.for_friend? show_target_window(@skill_window.index % 2 == 0) if @skill.for_all? @target_window.index = 99 elsif @skill.for_user? @target_window.index = @actor_index + 100 else if $game_party.last_target_index < @target_window.item_max @target_window.index = $game_party.last_target_index else @target_window.index = 0 end end else use_skill_nontarget end end
def update_target_selection if Input.trigger?(Input::B) Sound.play_cancel hide_target_window elsif Input.trigger?(Input::C) if not @actor.skill_can_use?(@skill) Sound.play_buzzer else determine_target end end end
def determine_target used = false if @skill.for_all? for target in $game_party.members target.skill_effect(@actor, @skill) used = true unless target.skipped end elsif @skill.for_user? target = $game_party.members[@target_window.index - 100] target.skill_effect(@actor, @skill) used = true unless target.skipped else $game_party.last_target_index = @target_window.index target = $game_party.members[@target_window.index] target.skill_effect(@actor, @skill) used = true unless target.skipped end if used use_skill_nontarget else Sound.play_buzzer end end
def show_target_window(right) @skill_window.active = false width_remain = 544 - @target_window.width @target_window.x = right ? width_remain : 0 @target_window.visible = true @target_window.active = true if right @viewport.rect.set(0, 0, width_remain, 416) @viewport.ox = 0 else @viewport.rect.set(@target_window.width, 0, width_remain, 416) @viewport.ox = @target_window.width end end
def hide_target_window @skill_window.active = true @target_window.visible = false @target_window.active = false @viewport.rect.set(0, 0, 544, 416) @viewport.ox = 0 end
def use_skill_nontarget Sound.play_use_skill @actor.mp -= @actor.calc_mp_cost(@skill) @status_window.refresh @skill_window.refresh @target_window.refresh if $game_party.all_dead? $scene = Scene_Gameover.new elsif @skill.common_event_id > 0 $game_temp.common_event_id = @skill.common_event_id $scene = Scene_Map.new end end end
#============================================================================== # ** Window_Status #==============================================================================
class Window_Status < Window_Base
def initialize(actor) super(0, 30, 544, 360) @actor = actor refresh end
def refresh self.contents.clear draw_actor_name(@actor, 4, 0) draw_actor_class(@actor, 128, 0) draw_actor_face(@actor, 8, 32) draw_basic_info(128, 32) draw_parameters(32, 160) draw_exp_info(288, 32) draw_equipments(288, 160) end
def draw_basic_info(x, y) draw_actor_level(@actor, x, y + WLH * 0) draw_actor_state(@actor, x, y + WLH * 1) draw_actor_hp(@actor, x, y + WLH * 2) draw_actor_mp(@actor, x, y + WLH * 3) end
def draw_parameters(x, y) draw_actor_parameter(@actor, x, y + WLH * 0, 0) draw_actor_parameter(@actor, x, y + WLH * 1, 1) draw_actor_parameter(@actor, x, y + WLH * 2, 2) draw_actor_parameter(@actor, x, y + WLH * 3, 3) end
def draw_exp_info(x, y) s1 = @actor.exp_s s2 = @actor.next_rest_exp_s s_next = sprintf(Vocab::ExpNext, Vocab::level) self.contents.font.color = system_color self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal) self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next) self.contents.font.color = normal_color self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 2) self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 2) end
def draw_equipments(x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 120, WLH, Vocab::equip) for i in 0..4 draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1)) end end end
#============================================================================== # ** Scene_Status #==============================================================================
class Scene_Status < Scene_Base
def initialize(actor_index = 0) @actor_index = actor_index end
def start super create_menu_background @actor = $game_party.members[@actor_index] @status_window = Window_Status.new(@actor) end
def terminate super dispose_menu_background @status_window.dispose end
def return_scene $scene = Scene_Menu.new(3) end
def next_actor @actor_index += 1 @actor_index %= $game_party.members.size $scene = Scene_Status.new(@actor_index) end
def prev_actor @actor_index += $game_party.members.size - 1 @actor_index %= $game_party.members.size $scene = Scene_Status.new(@actor_index) end
def update if Input.trigger?(Input::RIGHT) next_actor end if Input.trigger?(Input::LEFT) prev_actor end
update_menu_background @status_window.update if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::R) Sound.play_cursor next_actor elsif Input.trigger?(Input::L) Sound.play_cursor prev_actor end super end end
#============================================================================== # ** Window_SaveFile #==============================================================================
class Window_SaveFile < Window_Base
attr_reader :filename # filename attr_reader :file_exist # file existence flag attr_reader :time_stamp # timestamp attr_reader :selected # selected
def initialize(file_index, filename) super(100, 60 + file_index % 4 * 90, 350, 80) @file_index = file_index @filename = filename load_gamedata refresh @selected = false end
def load_gamedata @time_stamp = Time.at(0) @file_exist = FileTest.exist?(@filename) if @file_exist file = File.open(@filename, "r") @time_stamp = file.mtime begin @characters = Marshal.load(file) @frame_count = Marshal.load(file) @last_bgm = Marshal.load(file) @last_bgs = Marshal.load(file) @game_system = Marshal.load(file) @game_message = Marshal.load(file) @game_switches = Marshal.load(file) @game_variables = Marshal.load(file) @total_sec = @frame_count / Graphics.frame_rate rescue @file_exist = false ensure file.close end end end
def refresh self.contents.clear self.contents.font.color = normal_color name = Vocab::File + " #{@file_index + 1}" self.contents.draw_text(4, 0, 200, WLH, name) @name_width = contents.text_size(name).width if @file_exist draw_party_characters(85, 49) draw_playtime(0, 12.5, contents.width - 4, 2) end end
def draw_party_characters(x, y) for i in 0...@characters.size name = @characters[i][0] index = @characters[i][1] draw_character(name, index, x + i * 35, y) end end
def draw_playtime(x, y, width, align) hour = @total_sec / 60 / 60 min = @total_sec / 60 % 60 sec = @total_sec % 60 time_string = sprintf("%02d:%02d:%02d", hour, min, sec) self.contents.font.color = normal_color self.contents.draw_text(x, y, width, WLH, time_string, 2) end
def selected=(selected) @selected = selected update_cursor end
def update_cursor if @selected self.cursor_rect.set(0, 0, @name_width + 8, WLH) else self.cursor_rect.empty end end end
#============================================================================== # ** Window_Skill #==============================================================================
class Window_Skill < Window_Selectable
def initialize(x, y, width, height, actor) super(x, y, width, height) @actor = actor @column_max = 1 self.index = 0 refresh end
def skill return @data[self.index] end
def refresh @data = [] for skill in @actor.skills @data.push(skill) if skill.id == @actor.last_skill_id self.index = @data.size - 1 end end @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end
def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) skill = @data[index] if skill != nil rect.width -= 4 enabled = @actor.skill_can_use?(skill) draw_item_name(skill, rect.x, rect.y, enabled) self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2) end end
def update_help @help_window.set_text(skill == nil ? "" : skill.description) end end
#============================================================================== # ** Window_Item #==============================================================================
class Window_Item < Window_Selectable
def initialize(x, y, width, height) super(x, y, width, height) @column_max = 1 self.index = 0 refresh end
def item return @data[self.index] end
def include?(item) return false if item == nil if $game_temp.in_battle return false unless item.is_a?(RPG::Item) end return true end
def enable?(item) return $game_party.item_can_use?(item) end
def refresh @data = [] for item in $game_party.items next unless include?(item) @data.push(item) if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id self.index = @data.size - 1 end end @data.push(nil) if include?(nil) @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end
def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil number = $game_party.item_number(item) enabled = enable?(item) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enabled) self.contents.draw_text(rect, sprintf(":%2d", number), 2) end end
def update_help @help_window.set_text(item == nil ? "" : item.description) end end
Voilou ^^ ! Biward |
|